dsh-github-copilot 0.1.0-alpha.1.dsh.0.2.1.alpha.5 → 0.1.0-alpha.2.dsh.0.2.1.alpha.5
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/AGENTS.md +8 -0
- package/CHANGELOG.md +6 -0
- package/README.md +9 -7
- package/README.zh.md +9 -7
- package/deployment-baseline.json +8 -2
- package/docs/account-management-experience.md +12 -0
- package/docs/copilot-accounts.md +46 -0
- package/lib/client.js +130 -22
- package/lib/client.js.map +1 -1
- package/lib/index.js +104 -22
- package/lib/remote.js +39 -5
- package/lib/types/context-evidence.d.ts +4 -4
- package/lib/types/copilot-accounts-card.d.ts +3 -1
- package/lib/types/copilot-accounts-host.d.ts +5 -1
- package/lib/types/copilot-accounts-remote.d.ts +4 -1
- package/lib/types/copilot-accounts-types.d.ts +1 -0
- package/lib/types/copilot-login-environment.d.ts +12 -0
- package/lib/types/session-accounts-remote.d.ts +3 -1
- package/package.json +1 -1
package/AGENTS.md
CHANGED
|
@@ -91,6 +91,14 @@ codes, never raw errors. Installation alone neither selects nor invokes recovery
|
|
|
91
91
|
See `src/compaction-replay.ts` and `docs/manual-compaction-recovery.md` (#349).
|
|
92
92
|
|
|
93
93
|
## Approved multi-account ownership extension (#297)
|
|
94
|
+
|
|
95
|
+
Login environments (#424) use only pinned native pi-ai OAuth for GitHub.com and
|
|
96
|
+
validated single-label `tenant.ghe.com` Enterprise Cloud hosts. Preserve host
|
|
97
|
+
binding through identity, duplicate checks, reauthorization and native refresh/
|
|
98
|
+
discovery/request auth. Plugin identity rejects redirects; native OAuth redirect
|
|
99
|
+
control is unavailable in pi-ai 1.1.0 and must not be claimed or emulated with a
|
|
100
|
+
global Fetch patch/second flow. GHES and Enterprise quota remain unsupported.
|
|
101
|
+
See `src/copilot-login-environment.ts` and `docs/copilot-accounts.md`.
|
|
94
102
|
|
|
95
103
|
Identity presentation uses additive `ensureIdentity` Remotes, including explicit-Agent Session lookup. Keep `get` metadata-only; visible surfaces may ensure on their sixty-second cadence. Fresh ten-minute cache avoids requests, same-account consumers join a bounded flight, and failures cool down thirty seconds unless explicitly refreshed. Credential notifications revoke pending work even when token bytes are unchanged; no late cache publication. Quota may settle independently only with account-coherent metadata. Presentation cache never replaces fresh identity validation for switch, reauthorization or duplicate checks. Preserve strict sanitized diagnostics and Session/turn ownership (#309).
|
|
96
104
|
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.0-alpha.2.dsh.0.2.1.alpha.5 (prepared)
|
|
4
|
+
|
|
5
|
+
- Add a login-environment choice for independently authorized GitHub.com and GitHub Enterprise Cloud data-residency (`tenant.ghe.com`) Copilot accounts through pinned pi-ai 1.1.0 (#424). Validate the tenant before login; bind device links, identity, duplicate checks and reauthorization to its host.
|
|
6
|
+
- Retain account-local native refresh, model discovery and the existing published adapter with OAuth-derived trusted endpoints. Show tenant hosts beside verified account names in Models, Credits and historical Account evidence. Preserve existing GitHub.com Remote methods and add strict environment-aware methods.
|
|
7
|
+
- GitHub Enterprise Server and Enterprise quota remain unsupported. Plugin identity rejects redirects; native OAuth exposes no redirect-control seam, so OAuth redirect rejection is not claimed. No second OAuth/model wire, Core changes, live sign-in, settings migration, installation or restart.
|
|
8
|
+
|
|
3
9
|
## 0.1.0-alpha.1.dsh.0.2.1.alpha.5 (prepared)
|
|
4
10
|
|
|
5
11
|
- Start an independent plugin sequence for each exact DSH Core at `0.1.0-alpha.1.dsh.<Core>`; same-Core fixes increment `alpha.N`. Validate the explicit mapping, suffix, engines and baseline together. Retain published alpha.15/alpha.16 anchors; no code/history reset, new npm channel or automatic updater integration.
|
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
GitHub Copilot account discovery, contextual Auto routing and hosted search for DSH. The plugin reuses DSH's published native adapter, retaining a profile-wide account default with independent Session next-turn choices; it does not patch Core or maintain a second model catalog.
|
|
10
10
|
|
|
11
|
-
**Historical stable release: [`0.4.1`](https://github.com/cloga/dsh-github-copilot/releases/tag/v0.4.1); pending DSH alpha.5
|
|
11
|
+
**Historical stable release: [`0.4.1`](https://github.com/cloga/dsh-github-copilot/releases/tag/v0.4.1); pending DSH alpha.5 iteration: `0.1.0-alpha.2.dsh.0.2.1.alpha.5`.** Each exact DSH Core version starts an independent plugin sequence at `0.1.0-alpha.1.dsh.<Core>`; same-Core fixes increment `alpha.N`. The suffix normalizes Core `0.2.1-alpha.5` to `dsh.0.2.1.alpha.5`, but compatibility is validated against explicit metadata, not guessed from the name. This resets numbering, not code, history or qualification requirements. Existing versions/tags remain unchanged. Candidate Desktop artifacts/signatures are unverified; this is not a Desktop-upgrade recommendation. Published, installed and loaded states remain separate.
|
|
12
12
|
|
|
13
13
|
Select by **exact Core**, never global SemVer maximum or npm `latest`/`alpha`.
|
|
14
14
|
The read-only `node scripts/select-core-release.mjs 0.2.0-rc.2` command checks
|
|
@@ -155,10 +155,10 @@ Supply any launcher patches with repeated `--patch /absolute/file`. Require `sup
|
|
|
155
155
|
For a **standalone named profile**:
|
|
156
156
|
|
|
157
157
|
```sh
|
|
158
|
-
dsh plugin --profile web add https://github.com/cloga/dsh-github-copilot/releases/download/v0.1.0-alpha.
|
|
158
|
+
dsh plugin --profile web add https://github.com/cloga/dsh-github-copilot/releases/download/v0.1.0-alpha.2.dsh.0.2.1.alpha.5/dsh-github-copilot-0.1.0-alpha.2.dsh.0.2.1.alpha.5.tgz
|
|
159
159
|
```
|
|
160
160
|
|
|
161
|
-
The command above is a prepared-release example, usable only after publication, and requires official DSH `0.2.1-alpha.5`. **Desktop rc.2 must not install alpha.16 or `0.1.0-alpha.
|
|
161
|
+
The command above is a prepared-release example, usable only after publication, and requires official DSH `0.2.1-alpha.5`. **Desktop rc.2 must not install alpha.16 or `0.1.0-alpha.2.dsh.0.2.1.alpha.5`**; retain `dsh-github-copilot@0.4.2-alpha.15` there. Candidate Desktop package/signature and profile peer composition remain unverified. The [historical rc.2 bundled-CLI qualification](./docs/npm-distribution.md#desktop-bundled-cli-on-official-rc2) is not alpha.5 acceptance; a generic/global `dsh` shim is not equivalent. No install, restart, registry-policy bypass, peer patch or configuration deletion is authorized by this release.
|
|
162
162
|
|
|
163
163
|
Desktop's native package manager and qualified bundled CLI are profile-specific.
|
|
164
164
|
[Standalone offline maintenance](./docs/npm-distribution.md#controlled-offline-cli-maintenance-for-standalone-profiles)
|
|
@@ -172,7 +172,9 @@ After an approved reload/restart:
|
|
|
172
172
|
|
|
173
173
|
Sign-out requires an explicit action and removes only the active account's authorization, not other saved grants or route settings. Upgrades preserve existing native Copilot profiles; two groups can remain until [explicit single-route migration](./docs/single-route-migration.md). Installation never migrates conversations or defaults.
|
|
174
174
|
|
|
175
|
-
In **Manage → Account management**,
|
|
175
|
+
In **Manage → Account management**, choose **Login environment** before Add/Reauthorize: **GitHub.com** or **GitHub Enterprise Cloud (GHE.com)** with your data-residency tenant, such as `company.ghe.com`. Arbitrary hosts, ports and URL paths are rejected. Reauthorization must retain the saved host; use Add for another environment. Verified tenant names appear beside account logins. **GitHub Enterprise Server and Enterprise quota are unsupported.** Plugin identity requests reject redirects; native pi-ai OAuth has no redirect-control seam, so OAuth redirect rejection is not claimed. See [login environment boundaries](./docs/copilot-accounts.md#github-login-environments-424).
|
|
176
|
+
|
|
177
|
+
The **Switch** dropdown lists saved accounts and **Add GitHub account** at the bottom. Adding never replaces the global default. During device authorization, the card keeps the verification URL, one-time code, **Copy authorization code** and **Cancel adding account** together; identity/model verification follows separately. A confirmed switch changes future inherited turns, not running turns or explicit Session overrides. **Manage saved authorizations** contains **Reauthorize** and **Remove**; removal affects only a nondefault saved authorization, never a running turn's pinned account or GitHub-side access. **Refresh account information** updates identity, not authorization. Native-route or incomplete evidence blocks switching; missing/revoked accounts never fall back. A new account may lack your selected model, and encrypted replay may be account-bound: no automatic model substitution or history removal occurs. See [account requirements](./docs/copilot-accounts.md).
|
|
176
178
|
|
|
177
179
|
Completed managed turns show **Account** beside native Usage. It records the request account, not billing or subagent totals. A verified name is frozen at admission; if missing, an existing bounded non-forcing lookup for that exact account runs without delaying model delivery and can fill identity only while the same turn remains active. No account evidence exists before native delivery. Missing identity remains unavailable; completed history is never backfilled from current settings. Evidence is bounded to the Host lifetime; restart, cold history or missing delivery displays unknown. Credits labels an unidentified original or saved authorization without displaying opaque account IDs.
|
|
178
180
|
|
|
@@ -352,14 +354,14 @@ Commit attribution uses `Assisted-by` with the actual tool, never the model prov
|
|
|
352
354
|
GitHub Releases and npm distribute the same original verified tarball. Pin a version; verify Release SHA-256 or npm `dist.integrity`. Never repack an immutable release or move/reuse its tag.
|
|
353
355
|
|
|
354
356
|
```sh
|
|
355
|
-
curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.1.0-alpha.
|
|
356
|
-
curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.1.0-alpha.
|
|
357
|
+
curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.1.0-alpha.2.dsh.0.2.1.alpha.5/dsh-github-copilot-0.1.0-alpha.2.dsh.0.2.1.alpha.5.tgz
|
|
358
|
+
curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.1.0-alpha.2.dsh.0.2.1.alpha.5/SHA256SUMS
|
|
357
359
|
sha256sum --check SHA256SUMS
|
|
358
360
|
```
|
|
359
361
|
|
|
360
362
|
```powershell
|
|
361
363
|
$expected = (Get-Content .\SHA256SUMS).Split()[0]
|
|
362
|
-
$actual = (Get-FileHash .\dsh-github-copilot-0.1.0-alpha.
|
|
364
|
+
$actual = (Get-FileHash .\dsh-github-copilot-0.1.0-alpha.2.dsh.0.2.1.alpha.5.tgz -Algorithm SHA256).Hash.ToLowerInvariant()
|
|
363
365
|
if ($actual -cne $expected) { throw 'Release checksum mismatch' }
|
|
364
366
|
```
|
|
365
367
|
|
package/README.zh.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
为 DSH 提供 GitHub Copilot 账号模型发现、上下文 Auto 选模和 hosted search。插件复用 DSH 公开的原生适配器,保留 profile 全局默认账号,并支持 Session 后续 turn 指定独立账号;不修改 Core,也不维护第二套模型目录。
|
|
10
10
|
|
|
11
|
-
**历史稳定版:[`0.4.1`](https://github.com/cloga/dsh-github-copilot/releases/tag/v0.4.1);DSH alpha.5
|
|
11
|
+
**历史稳定版:[`0.4.1`](https://github.com/cloga/dsh-github-copilot/releases/tag/v0.4.1);DSH alpha.5 待发布迭代:`0.1.0-alpha.2.dsh.0.2.1.alpha.5`。** 每个精确 DSH Core 版本都从独立插件序列 `0.1.0-alpha.1.dsh.<Core>` 开始;同一 Core 内修复递增 `alpha.N`。后缀将 Core `0.2.1-alpha.5` 规范化为 `dsh.0.2.1.alpha.5`,但兼容性仍须核对明确元数据,不能只猜版本名。重置的是编号,不是代码、历史或资格验证要求;既有版本和 tag 不变。候选 Desktop 制品/签名未核验,这不是 Desktop 升级建议。已发布、已安装、已加载仍是不同状态。
|
|
12
12
|
|
|
13
13
|
按**精确 Core**选版本,不按全局 SemVer 最大值或 npm `latest`/`alpha`。
|
|
14
14
|
只读命令 `node scripts/select-core-release.mjs 0.2.0-rc.2` 先读取
|
|
@@ -133,10 +133,10 @@ node package/scripts/check-search-composition.mjs --profile-dir /absolute/profil
|
|
|
133
133
|
**独立具名 profile**:
|
|
134
134
|
|
|
135
135
|
```sh
|
|
136
|
-
dsh plugin --profile web add https://github.com/cloga/dsh-github-copilot/releases/download/v0.1.0-alpha.
|
|
136
|
+
dsh plugin --profile web add https://github.com/cloga/dsh-github-copilot/releases/download/v0.1.0-alpha.2.dsh.0.2.1.alpha.5/dsh-github-copilot-0.1.0-alpha.2.dsh.0.2.1.alpha.5.tgz
|
|
137
137
|
```
|
|
138
138
|
|
|
139
|
-
上面的命令是准备发布的示例,仅在发布后可用,并要求官方 DSH `0.2.1-alpha.5`。**Desktop rc.2 不得安装 alpha.16 或 `0.1.0-alpha.
|
|
139
|
+
上面的命令是准备发布的示例,仅在发布后可用,并要求官方 DSH `0.2.1-alpha.5`。**Desktop rc.2 不得安装 alpha.16 或 `0.1.0-alpha.2.dsh.0.2.1.alpha.5`**,应保留 `dsh-github-copilot@0.4.2-alpha.15`。候选 Desktop 包/签名及 profile peer 组合仍未核验。[历史 rc.2 随附 CLI 核验](./docs/npm-distribution.md#desktop-bundled-cli-on-official-rc2)不代表 alpha.5 验收;全局/普通 `dsh` shim 不等价。此版本不授权安装、重启、绕过包源政策、修改 peer 或删除配置。
|
|
140
140
|
|
|
141
141
|
Desktop 原生包管理器和已核验的随附 CLI 都有 profile 边界。
|
|
142
142
|
[独立 profile 离线维护](./docs/npm-distribution.md#controlled-offline-cli-maintenance-for-standalone-profiles)
|
|
@@ -150,7 +150,9 @@ Desktop 原生包管理器和已核验的随附 CLI 都有 profile 边界。
|
|
|
150
150
|
|
|
151
151
|
退出须显式操作,只删除活动账号的授权,保留其它授权与路由设置。升级保留已有原生 Copilot profile;在[显式单路由迁移](./docs/single-route-migration.md)前,仍可能存在两个分组。安装不迁移会话或默认模型。
|
|
152
152
|
|
|
153
|
-
在 **Manage →
|
|
153
|
+
在 **Manage → 账号管理**内,添加或重新授权前先选择**登录环境**:**GitHub.com**,或 **GitHub Enterprise Cloud(GHE.com)**并填写数据驻留租户,例如 `company.ghe.com`。不接受任意域名、端口或 URL 路径。重新授权必须保留已保存主机;其他环境请添加新账号。已验证的租户主机名会显示在账号名旁。**不支持 GitHub Enterprise Server 和 Enterprise 额度查询。** 插件身份请求拒绝重定向;原生 pi-ai OAuth 没有重定向控制接口,因此不宣称 OAuth 拒绝重定向。参见[登录环境边界](./docs/copilot-accounts.md#github-login-environments-424)。
|
|
154
|
+
|
|
155
|
+
**切换**下拉菜单列出已保存账号,底部为**添加 GitHub 账号**。添加不会替换全局默认。设备授权期间显示验证网址、一次性授权码、**复制授权码**和**取消添加账号**;随后单独验证身份和模型。确认切换只影响后续继承默认的新 turn,不改变运行中 turn 或 Session 已指定账号。**管理已保存授权**包含**重新授权**和**移除**;移除仅影响非默认的本地已保存授权,不改变运行中 turn 锁定的账号或 GitHub 端访问。**刷新账号信息**只更新身份,不操作授权。原生路由或不完整证据阻止切换;账号缺失/失效不会自动回退。新账号可能缺少已选模型,旧加密 replay 也可能绑定原账号;不自动替换模型或删除历史。参见[账号需求](./docs/copilot-accounts.md)。
|
|
154
156
|
|
|
155
157
|
已完成的托管 turn 在原生 Usage 旁显示 **Account**,记录实际请求账号,不是计费归因或子 Agent 汇总。准入时冻结已验证名称;缺失时针对本轮固定账号执行现有的有界、非强制查询,不阻塞模型输出,只能在同一 turn 仍运行时补齐身份。没有原生流返回就没有账号执行证据。未查到的身份仍显示不可用;不会根据当前设置补写已完成历史。证据仅在 Host 生命周期内有界保留,重启及冷历史显示未知。Credits 对身份未知的原始/已保存授权显示可读标签,不显示不透明账号 ID。
|
|
156
158
|
|
|
@@ -327,14 +329,14 @@ Agent 从 `node scripts/agent.mjs describe --json`、`doctor --json`及`plan <ta
|
|
|
327
329
|
GitHub Releases 和 npm 分发同一原始已校验 tarball。固定版本并核验 Release SHA-256 或 npm `dist.integrity`;不重打包不可变 Release、不移动/复用 tag。
|
|
328
330
|
|
|
329
331
|
```sh
|
|
330
|
-
curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.1.0-alpha.
|
|
331
|
-
curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.1.0-alpha.
|
|
332
|
+
curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.1.0-alpha.2.dsh.0.2.1.alpha.5/dsh-github-copilot-0.1.0-alpha.2.dsh.0.2.1.alpha.5.tgz
|
|
333
|
+
curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.1.0-alpha.2.dsh.0.2.1.alpha.5/SHA256SUMS
|
|
332
334
|
sha256sum --check SHA256SUMS
|
|
333
335
|
```
|
|
334
336
|
|
|
335
337
|
```powershell
|
|
336
338
|
$expected = (Get-Content .\SHA256SUMS).Split()[0]
|
|
337
|
-
$actual = (Get-FileHash .\dsh-github-copilot-0.1.0-alpha.
|
|
339
|
+
$actual = (Get-FileHash .\dsh-github-copilot-0.1.0-alpha.2.dsh.0.2.1.alpha.5.tgz -Algorithm SHA256).Hash.ToLowerInvariant()
|
|
338
340
|
if ($actual -cne $expected) { throw 'Release checksum mismatch' }
|
|
339
341
|
```
|
|
340
342
|
|
package/deployment-baseline.json
CHANGED
|
@@ -8,12 +8,12 @@
|
|
|
8
8
|
},
|
|
9
9
|
"package": {
|
|
10
10
|
"name": "dsh-github-copilot",
|
|
11
|
-
"version": "0.1.0-alpha.
|
|
11
|
+
"version": "0.1.0-alpha.2.dsh.0.2.1.alpha.5"
|
|
12
12
|
},
|
|
13
13
|
"releaseLines": [
|
|
14
14
|
{ "core": "0.2.0-rc.2", "version": "0.4.2-alpha.15", "status": "published" },
|
|
15
15
|
{ "core": "0.2.1-alpha.4", "version": "0.4.2-alpha.16", "status": "published" },
|
|
16
|
-
{ "core": "0.2.1-alpha.5", "version": "0.1.0-alpha.
|
|
16
|
+
{ "core": "0.2.1-alpha.5", "version": "0.1.0-alpha.2.dsh.0.2.1.alpha.5", "status": "pending" }
|
|
17
17
|
],
|
|
18
18
|
"evidence": {
|
|
19
19
|
"kind": "source-and-synthetic-test-inventory",
|
|
@@ -413,6 +413,9 @@
|
|
|
413
413
|
"activation": "managed-only-explicit-account-selector",
|
|
414
414
|
"sourceMarkers": [
|
|
415
415
|
{"file": "src/copilot-accounts-host.ts", "marker": "async ensureIdentityFor(accountId: string)"},
|
|
416
|
+
{"file": "src/copilot-login-environment.ts", "marker": "COPILOT_LOGIN_HOST_PATTERN"},
|
|
417
|
+
{"file": "src/copilot-accounts-host.ts", "marker": "event.verificationUri !== copilotVerificationUri(host)"},
|
|
418
|
+
{"file": "docs/copilot-accounts.md", "marker": "Native OAuth redirect control is unavailable"},
|
|
416
419
|
{"file": "AGENTS.md", "marker": "Approved multi-account ownership extension (#297)"},
|
|
417
420
|
{"file": "src/remote.ts", "marker": "...copilotAccountsRemote.descriptors"},
|
|
418
421
|
{"file": "src/copilot-accounts-card.ts", "marker": "removeAccount(accountId: string, expectedRevision: number)"},
|
|
@@ -420,6 +423,9 @@
|
|
|
420
423
|
{"file": "docs/copilot-accounts.md", "marker": "A mutable active-account lookup inside each store method is forbidden"}
|
|
421
424
|
],
|
|
422
425
|
"tests": [
|
|
426
|
+
{"file": "tests/scripts/copilot-login-environment.test.mjs", "name": "compares numeric identities within their host without relabeling legacy GitHub.com evidence"},
|
|
427
|
+
{"file": "tests/fixtures/copilot-accounts-host-core.fixture.ts", "name": "authorizes native GHE environments with host-scoped duplicates and immutable reauthorization hosts"},
|
|
428
|
+
{"file": "tests/copilot-accounts-card.spec.ts", "name": "chooses a validated GHE environment without selecting an account or changing GitHub.com login"},
|
|
423
429
|
{"file": "tests/copilot-identity-refresh.spec.ts", "name": "renews expired identity once for account %s without changing metadata-only reads"},
|
|
424
430
|
{"file": "tests/copilot-account-identity-cache.spec.ts", "name": "hydrates saved inactive names without activating them, then reuses them"},
|
|
425
431
|
{"file": "tests/account-dropdown.spec.ts", "name": "backs translucent native menu tokens with opaque Canvas and uses a dark elevation shadow"},
|
|
@@ -11,6 +11,18 @@ disabled and an account switch awaiting confirmation. All accounts, quota,
|
|
|
11
11
|
authorization, messages and model availability in this mock are synthetic.
|
|
12
12
|
It performs no network requests and persists no credentials or settings.
|
|
13
13
|
|
|
14
|
+
## Login environment
|
|
15
|
+
|
|
16
|
+
Models adds a native **Login environment** select before the existing account
|
|
17
|
+
actions. GitHub.com remains the initial choice. GitHub Enterprise Cloud reveals
|
|
18
|
+
a labeled tenant field with local validation and an explicit GHES limitation;
|
|
19
|
+
invalid drafts disable only Add/Reauthorize, not saved-account switching.
|
|
20
|
+
The draft never changes the default or an admitted turn. Reauthorization must
|
|
21
|
+
match the saved host; use Add for another environment. Verified GHE logins retain
|
|
22
|
+
their tenant label in both Models and Credits, including same-name accounts.
|
|
23
|
+
The historical synthetic mock predates this addition and is not environment
|
|
24
|
+
support evidence. See [the exact native boundary](./copilot-accounts.md#github-login-environments-424).
|
|
25
|
+
|
|
14
26
|
## Chat: quick selection, not a second settings page
|
|
15
27
|
|
|
16
28
|
The Credits control opens a compact current-account summary and Switch button.
|
package/docs/copilot-accounts.md
CHANGED
|
@@ -10,6 +10,52 @@ separate evidence.
|
|
|
10
10
|
|
|
11
11
|
## Requirements
|
|
12
12
|
|
|
13
|
+
### GitHub login environments (#424)
|
|
14
|
+
|
|
15
|
+
For DSH `0.2.1-alpha.5`, prepared plugin iteration
|
|
16
|
+
`0.1.0-alpha.2.dsh.0.2.1.alpha.5` adds **Login environment** to the existing
|
|
17
|
+
Models account controls (and the shared add-only surface). Choose **GitHub.com**
|
|
18
|
+
or **GitHub Enterprise Cloud (GHE.com)** before Add/Reauthorize. Enter a
|
|
19
|
+
single-label data-residency tenant such as `company.ghe.com`; an HTTPS origin
|
|
20
|
+
with an optional trailing slash is also accepted and normalized locally.
|
|
21
|
+
Ports, credentials, paths, queries, fragments, nested subdomains, IP addresses,
|
|
22
|
+
Unicode host spellings and arbitrary domains are rejected before login.
|
|
23
|
+
The environment choice is an unsaved login draft, not the global account selector.
|
|
24
|
+
For reauthorization, choose the saved account's original host; changing hosts
|
|
25
|
+
requires Add, never overwriting the existing record.
|
|
26
|
+
|
|
27
|
+
The exact published pi-ai `1.1.0` flow owns the device code exchange,
|
|
28
|
+
`https://api.<tenant>.ghe.com/copilot_internal/v2/token`, native model permissions
|
|
29
|
+
and refresh. The plugin answers only its known Enterprise-domain prompt.
|
|
30
|
+
Device verification must be exactly `https://<selected-host>/login/device`
|
|
31
|
+
before a link is shown or token polling continues. Identity uses
|
|
32
|
+
`https://api.<selected-host>/user` with `redirect: 'error'`, bounded response
|
|
33
|
+
parsing and existing cancellation/credential fences. Numeric GitHub user IDs
|
|
34
|
+
are unique only within a host. Reauthorization preserves both host and ID;
|
|
35
|
+
duplicate checks compare both. Verified GHE names display their tenant in
|
|
36
|
+
Models, Credits and bounded historical Account evidence. Legacy evidence with
|
|
37
|
+
no host remains GitHub.com; no historical or credential migration is performed.
|
|
38
|
+
|
|
39
|
+
Managed discovery and requests still resolve the captured account through native
|
|
40
|
+
`Models.getAuth()` and the existing published adapter. Endpoint validation uses
|
|
41
|
+
the native OAuth-derived endpoint, never a hand-built model transport or a
|
|
42
|
+
model-name routing rule. Unsupported stored hosts are rejected before native
|
|
43
|
+
refresh; changing account/host invalidates the existing proof as before.
|
|
44
|
+
|
|
45
|
+
**Native OAuth redirect control is unavailable** in pi-ai `1.1.0`: its OAuth
|
|
46
|
+
implementation uses global Fetch and exposes no request-Fetch/redirect option in
|
|
47
|
+
the published login/refresh contracts. This plugin does not patch global Fetch,
|
|
48
|
+
replace the flow, or claim OAuth redirect rejection. Its own identity request
|
|
49
|
+
rejects redirects and network errors fail closed without account fallback or
|
|
50
|
+
an added retry. Synthetic flow/endpoint tests are not live tenant acceptance.
|
|
51
|
+
|
|
52
|
+
**GitHub Enterprise Server (GHES) is unsupported.** The pinned flow constructs
|
|
53
|
+
`api.<domain>` token URLs and does not establish GHES REST/OAuth/Copilot parity;
|
|
54
|
+
arbitrary server hosts retain `COPILOT_ACCOUNTS_ENTERPRISE_UNSUPPORTED`.
|
|
55
|
+
Enterprise billing quota retains `COPILOT_USAGE_ENTERPRISE_UNSUPPORTED`; account
|
|
56
|
+
login/model availability is not quota support. Publication, profile installation,
|
|
57
|
+
loaded Host state and live enterprise permissions remain separate.
|
|
58
|
+
|
|
13
59
|
### Native OAuth refresh and dispatched requests (#385)
|
|
14
60
|
|
|
15
61
|
In 0.4.0, every matching credential notification aborts managed wires, including
|
package/lib/client.js
CHANGED
|
@@ -5377,9 +5377,32 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5377
5377
|
]
|
|
5378
5378
|
};
|
|
5379
5379
|
//#endregion
|
|
5380
|
+
//#region lib/types/copilot-login-environment.js
|
|
5381
|
+
const COPILOT_LOGIN_HOST_PATTERN = /^(?:github\.com|[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.ghe\.com)$/u;
|
|
5382
|
+
var CopilotLoginEnvironmentError = class extends Error {
|
|
5383
|
+
constructor() {
|
|
5384
|
+
super("COPILOT_ACCOUNTS_ENTERPRISE_UNSUPPORTED");
|
|
5385
|
+
}
|
|
5386
|
+
};
|
|
5387
|
+
/** Validate the original spelling before URL parsing can discard ports or paths. */
|
|
5388
|
+
function copilotLoginHost(value = void 0) {
|
|
5389
|
+
if (value === void 0) return "github.com";
|
|
5390
|
+
if (typeof value !== "string") throw new CopilotLoginEnvironmentError();
|
|
5391
|
+
const host = value.trim().toLowerCase().replace(/^https:\/\//u, "").replace(/\/$/u, "");
|
|
5392
|
+
if (!COPILOT_LOGIN_HOST_PATTERN.test(host)) throw new CopilotLoginEnvironmentError();
|
|
5393
|
+
return host;
|
|
5394
|
+
}
|
|
5395
|
+
function copilotVerificationUri(host) {
|
|
5396
|
+
return `https://${copilotLoginHost(host)}/login/device`;
|
|
5397
|
+
}
|
|
5398
|
+
function copilotIdentityLabel(identity) {
|
|
5399
|
+
return `@${identity.login}${identity.host && identity.host !== "github.com" ? ` · ${identity.host}` : ""}`;
|
|
5400
|
+
}
|
|
5401
|
+
//#endregion
|
|
5380
5402
|
//#region lib/types/copilot-accounts-remote.js
|
|
5381
5403
|
const CopilotAccountIdSchema = string().max(36).regex(COPILOT_ACCOUNT_ID_PATTERN);
|
|
5382
5404
|
const revision = number().int().nonnegative().max(Number.MAX_SAFE_INTEGER);
|
|
5405
|
+
const host = string().max(71).regex(COPILOT_LOGIN_HOST_PATTERN);
|
|
5383
5406
|
const CopilotAccountsViewSchema = object({
|
|
5384
5407
|
state: _enum(["ready", "error"]),
|
|
5385
5408
|
activeAccountId: CopilotAccountIdSchema,
|
|
@@ -5396,7 +5419,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5396
5419
|
]),
|
|
5397
5420
|
identity: object({
|
|
5398
5421
|
login: string().min(1).max(39).regex(GITHUB_ACCOUNT_LOGIN_PATTERN),
|
|
5399
|
-
userId: number().int().positive().max(Number.MAX_SAFE_INTEGER)
|
|
5422
|
+
userId: number().int().positive().max(Number.MAX_SAFE_INTEGER),
|
|
5423
|
+
host: host.optional()
|
|
5400
5424
|
}).strict().optional()
|
|
5401
5425
|
}).strict()).max(32),
|
|
5402
5426
|
operation: _enum([
|
|
@@ -5406,7 +5430,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5406
5430
|
]).optional(),
|
|
5407
5431
|
notices: array(object({
|
|
5408
5432
|
message: string().min(1).max(512),
|
|
5409
|
-
url:
|
|
5433
|
+
url: string().max(100).refine((value) => {
|
|
5434
|
+
try {
|
|
5435
|
+
return value === copilotVerificationUri(copilotLoginHost(new URL(value).hostname));
|
|
5436
|
+
} catch {
|
|
5437
|
+
return false;
|
|
5438
|
+
}
|
|
5439
|
+
}).optional(),
|
|
5410
5440
|
code: string().min(1).max(32).regex(/^[A-Z0-9-]+$/u).optional()
|
|
5411
5441
|
}).strict()).max(8),
|
|
5412
5442
|
diagnostic: _enum(COPILOT_ACCOUNTS_DIAGNOSTICS).optional()
|
|
@@ -5434,14 +5464,16 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5434
5464
|
"cancel",
|
|
5435
5465
|
"switchAccount",
|
|
5436
5466
|
"removeAccount",
|
|
5437
|
-
"reauthorize"
|
|
5467
|
+
"reauthorize",
|
|
5468
|
+
"addForEnvironment",
|
|
5469
|
+
"reauthorizeForEnvironment"
|
|
5438
5470
|
].map((method) => ({
|
|
5439
5471
|
id: `dsh-github-copilot:githubCopilotAccounts.${method}`,
|
|
5440
5472
|
namespace: "githubCopilotAccounts",
|
|
5441
5473
|
service: "githubCopilotAccounts",
|
|
5442
5474
|
method,
|
|
5443
5475
|
invocation: { kind: "direct" },
|
|
5444
|
-
parameters: method === "switchAccount" || method === "removeAccount" || method === "reauthorize" ? [{
|
|
5476
|
+
parameters: [...method === "switchAccount" || method === "removeAccount" || method === "reauthorize" || method === "reauthorizeForEnvironment" ? [{
|
|
5445
5477
|
name: "accountId",
|
|
5446
5478
|
wire: "accountId",
|
|
5447
5479
|
source: "json",
|
|
@@ -5451,7 +5483,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5451
5483
|
wire: "expectedRevision",
|
|
5452
5484
|
source: "json",
|
|
5453
5485
|
codec: strictRemoteCodec("dsh-github-copilot#CopilotAccountsRevision", revision)
|
|
5454
|
-
}] : [],
|
|
5486
|
+
}] : [], ...method === "addForEnvironment" || method === "reauthorizeForEnvironment" ? [{
|
|
5487
|
+
name: "host",
|
|
5488
|
+
wire: "host",
|
|
5489
|
+
source: "json",
|
|
5490
|
+
codec: strictRemoteCodec("dsh-github-copilot#CopilotLoginHost", host)
|
|
5491
|
+
}] : []],
|
|
5455
5492
|
result: strictRemoteCodec("dsh-github-copilot#CopilotAccountsView", CopilotAccountsViewSchema)
|
|
5456
5493
|
}))
|
|
5457
5494
|
};
|
|
@@ -6292,7 +6329,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6292
6329
|
};
|
|
6293
6330
|
//#endregion
|
|
6294
6331
|
//#region package.json
|
|
6295
|
-
var version = "0.1.0-alpha.
|
|
6332
|
+
var version = "0.1.0-alpha.2.dsh.0.2.1.alpha.5";
|
|
6296
6333
|
//#endregion
|
|
6297
6334
|
//#region lib/types/diagnostics-client.js
|
|
6298
6335
|
let owner;
|
|
@@ -7012,7 +7049,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
7012
7049
|
//#region lib/types/turn-selection-card.js
|
|
7013
7050
|
function turnAccountLabel(account, zh) {
|
|
7014
7051
|
if (account.state !== "recorded" || account.identity === void 0) return zh ? "身份暂不可用" : "identity unavailable";
|
|
7015
|
-
return
|
|
7052
|
+
return copilotIdentityLabel(account.identity);
|
|
7016
7053
|
}
|
|
7017
7054
|
function TurnSelectionCard({ selection, locale = "en", incomplete = false, readState = "ready", retry, account, accountFailed = false, retryAccount, models, modelsFailed = false, retryModels, allocationEvidence }) {
|
|
7018
7055
|
const zh = locale.startsWith("zh");
|
|
@@ -9046,7 +9083,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
9046
9083
|
"identityState"
|
|
9047
9084
|
]);
|
|
9048
9085
|
const identity = record(item).identity;
|
|
9049
|
-
if (identity !== void 0) account.identity = fields(identity, [
|
|
9086
|
+
if (identity !== void 0) account.identity = fields(identity, [
|
|
9087
|
+
"login",
|
|
9088
|
+
"userId",
|
|
9089
|
+
"host"
|
|
9090
|
+
]);
|
|
9050
9091
|
return account;
|
|
9051
9092
|
});
|
|
9052
9093
|
owned.notices = source.notices.map((item) => fields(item, [
|
|
@@ -9062,7 +9103,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
9062
9103
|
}
|
|
9063
9104
|
function accountIdentityLabel(view) {
|
|
9064
9105
|
const account = view?.accounts.find((item) => item.id === view.activeAccountId);
|
|
9065
|
-
return account?.configured === true && account.identityState === "ready" && account.identity !== void 0 ?
|
|
9106
|
+
return account?.configured === true && account.identityState === "ready" && account.identity !== void 0 ? copilotIdentityLabel(account.identity) : void 0;
|
|
9066
9107
|
}
|
|
9067
9108
|
const border$1 = "1px solid var(--dsw-alias-border-main, color-mix(in srgb, currentColor 20%, transparent))";
|
|
9068
9109
|
const button$1 = nativeCompactButtonStyle;
|
|
@@ -9130,7 +9171,14 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
9130
9171
|
add: "Add GitHub account",
|
|
9131
9172
|
refresh: "Refresh account information",
|
|
9132
9173
|
refreshing: "Checking…",
|
|
9133
|
-
retry: "Retry"
|
|
9174
|
+
retry: "Retry",
|
|
9175
|
+
environment: "Login environment",
|
|
9176
|
+
enterprise: "GitHub Enterprise Cloud (GHE.com)",
|
|
9177
|
+
tenant: "Tenant hostname",
|
|
9178
|
+
environmentHelp: "For Add or Reauthorize only. Use your data-residency tenant, such as company.ghe.com. GitHub Enterprise Server is not supported.",
|
|
9179
|
+
environmentInvalid: "Enter a tenant hostname such as company.ghe.com, without a path, port or credentials.",
|
|
9180
|
+
environmentUnavailable: "This deployment does not support every GHE.com authorization action. Update both Host and Client.",
|
|
9181
|
+
environmentUnsupported: "This login environment is not supported. Use GitHub.com or a tenant.ghe.com hostname."
|
|
9134
9182
|
},
|
|
9135
9183
|
zh: {
|
|
9136
9184
|
identityChecking: "正在检查 GitHub 身份…",
|
|
@@ -9191,7 +9239,14 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
9191
9239
|
add: "添加 GitHub 账号",
|
|
9192
9240
|
refresh: "刷新账号信息",
|
|
9193
9241
|
refreshing: "正在检查…",
|
|
9194
|
-
retry: "重试"
|
|
9242
|
+
retry: "重试",
|
|
9243
|
+
environment: "登录环境",
|
|
9244
|
+
enterprise: "GitHub Enterprise Cloud(GHE.com)",
|
|
9245
|
+
tenant: "租户主机名",
|
|
9246
|
+
environmentHelp: "仅用于添加或重新授权。请输入数据驻留租户,例如 company.ghe.com。不支持 GitHub Enterprise Server。",
|
|
9247
|
+
environmentInvalid: "请输入 company.ghe.com 形式的租户主机名,不含路径、端口或凭据。",
|
|
9248
|
+
environmentUnavailable: "当前部署不支持部分 GHE.com 授权操作,请同时更新 Host 和 Client。",
|
|
9249
|
+
environmentUnsupported: "不支持此登录环境。请使用 GitHub.com 或 tenant.ghe.com 租户主机名。"
|
|
9195
9250
|
}
|
|
9196
9251
|
};
|
|
9197
9252
|
function accountProblemMessage(code, text) {
|
|
@@ -9201,6 +9256,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
9201
9256
|
case "COPILOT_ACCOUNTS_BUSY": return text.switchUnavailable;
|
|
9202
9257
|
case "COPILOT_ACCOUNTS_AUTH_FAILED": return text.authorizationFailed;
|
|
9203
9258
|
case "COPILOT_ACCOUNTS_AUTH_UNAVAILABLE": return text.authorizationUnavailableError;
|
|
9259
|
+
case "COPILOT_ACCOUNTS_ENTERPRISE_UNSUPPORTED": return text.environmentUnsupported;
|
|
9204
9260
|
case "COPILOT_ACCOUNTS_MODELS_FAILED": return text.modelsFailed;
|
|
9205
9261
|
case "COPILOT_ACCOUNTS_IDENTITY_UNAVAILABLE":
|
|
9206
9262
|
case "COPILOT_ACCOUNTS_IDENTITY_INVALID":
|
|
@@ -9230,6 +9286,14 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
9230
9286
|
const [authorizationIntent, setAuthorizationIntent] = (0, react.useState)();
|
|
9231
9287
|
const [confirmation, setConfirmation] = (0, react.useState)();
|
|
9232
9288
|
const [accountsOpen, setAccountsOpen] = (0, react.useState)(false);
|
|
9289
|
+
const [enterprise, setEnterprise] = (0, react.useState)(false);
|
|
9290
|
+
const [tenant, setTenant] = (0, react.useState)("");
|
|
9291
|
+
const environmentId = (0, react.useId)();
|
|
9292
|
+
let environmentHost;
|
|
9293
|
+
try {
|
|
9294
|
+
const host = copilotLoginHost(enterprise ? tenant : void 0);
|
|
9295
|
+
if (!enterprise || host !== "github.com") environmentHost = host;
|
|
9296
|
+
} catch {}
|
|
9233
9297
|
const lifetime = (0, react.useRef)({
|
|
9234
9298
|
active: false,
|
|
9235
9299
|
generation: 0,
|
|
@@ -9444,22 +9508,31 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
9444
9508
|
run(() => props.remote.cancel(), true);
|
|
9445
9509
|
};
|
|
9446
9510
|
const startAdd = () => {
|
|
9511
|
+
const host = environmentHost;
|
|
9512
|
+
if (host === void 0 || enterprise && typeof props.remote?.addForEnvironment !== "function") return;
|
|
9447
9513
|
setAuthorizationIntent("add");
|
|
9448
9514
|
setCancelRequested(false);
|
|
9449
|
-
run(() => props.remote.add(), true);
|
|
9515
|
+
run(() => enterprise ? props.remote.addForEnvironment(host) : props.remote.add(), true);
|
|
9450
9516
|
};
|
|
9451
9517
|
const startReauthorization = (accountId, revision) => {
|
|
9452
9518
|
if (managementRemote === void 0) return;
|
|
9519
|
+
const host = environmentHost;
|
|
9520
|
+
if (host === void 0 || enterprise && typeof managementRemote.reauthorizeForEnvironment !== "function") return;
|
|
9453
9521
|
setAuthorizationIntent("reauthorize");
|
|
9454
9522
|
setCancelRequested(false);
|
|
9455
|
-
run(() => managementRemote.reauthorize(accountId, revision), true);
|
|
9523
|
+
run(() => managementRemote.reauthorizeForEnvironment ? managementRemote.reauthorizeForEnvironment(accountId, revision, host) : managementRemote.reauthorize(accountId, revision), true);
|
|
9456
9524
|
};
|
|
9457
9525
|
const identity = accountIdentityLabel(view);
|
|
9458
9526
|
const activeAccount = view?.accounts.find((account) => account.id === view.activeAccountId);
|
|
9459
9527
|
const selected = confirmation === void 0 ? void 0 : view?.accounts.find((item) => item.id === confirmation.id);
|
|
9460
|
-
const selectedLabel = selected?.identityState === "ready" && selected.identity !== void 0 ?
|
|
9528
|
+
const selectedLabel = selected?.identityState === "ready" && selected.identity !== void 0 ? copilotIdentityLabel(selected.identity) : text.savedAuthorization;
|
|
9461
9529
|
const savedAccounts = view?.accounts ?? [];
|
|
9462
9530
|
const pending = busy || props.authorizationBusy === true || view?.operation !== void 0;
|
|
9531
|
+
const addEnvironmentUnavailable = enterprise && typeof props.remote?.addForEnvironment !== "function";
|
|
9532
|
+
const reauthorizeEnvironmentUnavailable = enterprise && !props.addOnly && typeof managementRemote?.reauthorizeForEnvironment !== "function";
|
|
9533
|
+
const environmentUnavailable = addEnvironmentUnavailable || reauthorizeEnvironmentUnavailable;
|
|
9534
|
+
const addBlocked = environmentHost === void 0 || addEnvironmentUnavailable;
|
|
9535
|
+
const reauthorizeBlocked = environmentHost === void 0 || reauthorizeEnvironmentUnavailable;
|
|
9463
9536
|
const authorizationOperation = view?.operation === "authorizing" || view?.operation === "verifying";
|
|
9464
9537
|
const authorizationStatus = cancelRequested ? text.cancelling : view?.operation === "authorizing" ? authorizationIntent === "add" ? noticeCode === void 0 ? text.addingStarting : text.addingWaiting : authorizationIntent === "reauthorize" ? noticeCode === void 0 ? text.reauthorizingStarting : text.reauthorizingWaiting : noticeCode === void 0 ? text.authorizationStarting : text.authorizationWaiting : view?.operation === "verifying" ? authorizationIntent === "add" ? text.verifyingAdding : authorizationIntent === "reauthorize" ? text.verifyingReauthorizing : text.verifying : view?.operation === "switching" ? text.switchingBusy : void 0;
|
|
9465
9538
|
const switchBlocker = view !== void 0 && view.switchable === false ? view.operation === "authorizing" ? text.authorizationBusy : view.operation === "verifying" ? text.verifyingBusy : view.operation === "switching" ? text.switchingBusy : view.diagnostic === "COPILOT_ACCOUNTS_ROUTE_BLOCKED" ? text.routeBlocked : view.diagnostic === "COPILOT_ACCOUNTS_EVIDENCE_INCOMPLETE" ? text.evidenceIncomplete : view.state === "error" ? void 0 : text.switchUnavailable : void 0;
|
|
@@ -9474,7 +9547,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
9474
9547
|
disabled
|
|
9475
9548
|
}, label);
|
|
9476
9549
|
const savedAccountItems = savedAccounts.map((account) => {
|
|
9477
|
-
const accountName = account.identityState === "ready" && account.identity !== void 0 ?
|
|
9550
|
+
const accountName = account.identityState === "ready" && account.identity !== void 0 ? copilotIdentityLabel(account.identity) : text.savedAuthorization;
|
|
9478
9551
|
return (0, react.createElement)("li", {
|
|
9479
9552
|
key: account.id,
|
|
9480
9553
|
style: {
|
|
@@ -9490,7 +9563,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
9490
9563
|
flex: "1 1 140px"
|
|
9491
9564
|
} }, (0, react.createElement)("strong", null, account.identityState === "ready" && account.identity !== void 0 ? accountName : account.configured ? text.identityUnavailableLabel : text.authorizationUnavailable), (0, react.createElement)("p", { style: muted$1 }, account.id === view?.activeAccountId ? text.currentDefault : account.configured ? text.savedAuthorization : text.authorizationUnavailable)), account.id === "canonical" || account.id === view?.activeAccountId ? null : control(text.reauthorize, () => {
|
|
9492
9565
|
if (props.remote !== void 0 && view?.revision !== void 0) startReauthorization(account.id, view.revision);
|
|
9493
|
-
}, pending || view?.writable !== true || view?.switchable !== true || view?.revision === void 0), account.id === "canonical" || account.id === view?.activeAccountId ? null : control(text.remove, () => {
|
|
9566
|
+
}, pending || reauthorizeBlocked || view?.writable !== true || view?.switchable !== true || view?.revision === void 0), account.id === "canonical" || account.id === view?.activeAccountId ? null : control(text.remove, () => {
|
|
9494
9567
|
if (view?.revision !== void 0) setConfirmation({
|
|
9495
9568
|
id: account.id,
|
|
9496
9569
|
revision: view.revision,
|
|
@@ -9587,9 +9660,44 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
9587
9660
|
} }, control(cancelRequested ? text.cancelling : authorizationIntent === "reauthorize" ? text.cancelReauthorize : text.cancelAdd, cancelAuthorization, busy || cancelRequested)) : null), view?.diagnostic === void 0 ? null : (0, react.createElement)("details", {
|
|
9588
9661
|
"data-copilot-account-diagnostic": "",
|
|
9589
9662
|
style: nativeCaptionStyle
|
|
9590
|
-
}, (0, react.createElement)("summary", { style: { cursor: "pointer" } }, text.technicalDetails), (0, react.createElement)("code", { style: { overflowWrap: "anywhere" } }, view.diagnostic)),
|
|
9663
|
+
}, (0, react.createElement)("summary", { style: { cursor: "pointer" } }, text.technicalDetails), (0, react.createElement)("code", { style: { overflowWrap: "anywhere" } }, view.diagnostic)), (0, react.createElement)("div", {
|
|
9664
|
+
"data-copilot-login-environment": "",
|
|
9665
|
+
style: {
|
|
9666
|
+
display: "grid",
|
|
9667
|
+
gap: 6
|
|
9668
|
+
}
|
|
9669
|
+
}, (0, react.createElement)("label", { htmlFor: environmentId }, text.environment), (0, react.createElement)("select", {
|
|
9670
|
+
id: environmentId,
|
|
9671
|
+
value: enterprise ? "enterprise" : "github.com",
|
|
9672
|
+
disabled: pending,
|
|
9673
|
+
style: {
|
|
9674
|
+
...nativeInputStyle,
|
|
9675
|
+
width: "100%"
|
|
9676
|
+
},
|
|
9677
|
+
onChange: (event) => setEnterprise(event.target.value === "enterprise"),
|
|
9678
|
+
"aria-describedby": `${environmentId}-help`
|
|
9679
|
+
}, (0, react.createElement)("option", { value: "github.com" }, "GitHub.com"), (0, react.createElement)("option", { value: "enterprise" }, text.enterprise)), enterprise ? (0, react.createElement)("label", { htmlFor: `${environmentId}-tenant` }, text.tenant) : null, enterprise ? (0, react.createElement)("input", {
|
|
9680
|
+
id: `${environmentId}-tenant`,
|
|
9681
|
+
type: "text",
|
|
9682
|
+
value: tenant,
|
|
9683
|
+
disabled: pending,
|
|
9684
|
+
autoCapitalize: "none",
|
|
9685
|
+
autoComplete: "off",
|
|
9686
|
+
spellCheck: false,
|
|
9687
|
+
placeholder: "company.ghe.com",
|
|
9688
|
+
style: {
|
|
9689
|
+
...nativeInputStyle,
|
|
9690
|
+
width: "100%"
|
|
9691
|
+
},
|
|
9692
|
+
"aria-invalid": environmentHost === void 0,
|
|
9693
|
+
"aria-describedby": `${environmentId}-help`,
|
|
9694
|
+
onChange: (event) => setTenant(event.target.value)
|
|
9695
|
+
}) : null, (0, react.createElement)("p", {
|
|
9696
|
+
id: `${environmentId}-help`,
|
|
9697
|
+
style: muted$1
|
|
9698
|
+
}, text.environmentHelp, environmentUnavailable ? ` ${text.environmentUnavailable}` : enterprise && environmentHost === void 0 ? ` ${text.environmentInvalid}` : null)), props.addOnly && !authorizationOperation ? control(text.add, () => {
|
|
9591
9699
|
if (props.remote !== void 0) startAdd();
|
|
9592
|
-
}, pending || view?.writable !== true || view?.switchable !== true) : null, props.addOnly && (failed || !pending && view?.switchable === false) ? control(text.retry, () => {
|
|
9700
|
+
}, pending || addBlocked || view?.writable !== true || view?.switchable !== true) : null, props.addOnly && (failed || !pending && view?.switchable === false) ? control(text.retry, () => {
|
|
9593
9701
|
if (props.remote !== void 0) run(() => props.remote.get());
|
|
9594
9702
|
}, pending || props.remote === void 0) : null, props.addOnly ? null : (0, react.createElement)("div", {
|
|
9595
9703
|
"data-copilot-current-account-row": true,
|
|
@@ -9620,7 +9728,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
9620
9728
|
},
|
|
9621
9729
|
options: savedAccounts.map((account) => ({
|
|
9622
9730
|
id: account.id,
|
|
9623
|
-
label: account.identityState === "ready" && account.identity ?
|
|
9731
|
+
label: account.identityState === "ready" && account.identity ? copilotIdentityLabel(account.identity) : `${text.savedAuthorization}${account.id === "canonical" ? "" : ` ${savedAccounts.indexOf(account) + 1}`} · ${text.identityUnavailableLabel}`,
|
|
9624
9732
|
selected: account.id === view?.activeAccountId,
|
|
9625
9733
|
disabled: !account.configured
|
|
9626
9734
|
})),
|
|
@@ -9636,7 +9744,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
9636
9744
|
footer: authorizationOperation ? null : control(text.add, () => {
|
|
9637
9745
|
setAccountsOpen(false);
|
|
9638
9746
|
if (props.remote !== void 0) startAdd();
|
|
9639
|
-
}, pending || view?.writable !== true || view?.switchable !== true)
|
|
9747
|
+
}, pending || addBlocked || view?.writable !== true || view?.switchable !== true)
|
|
9640
9748
|
})), props.addOnly || confirmation === void 0 ? null : (0, react.createElement)("div", {
|
|
9641
9749
|
role: "group",
|
|
9642
9750
|
"aria-label": confirmation.remove ? text.confirmRemoveTitle : text.confirmSwitchTitle,
|
|
@@ -9665,7 +9773,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
9665
9773
|
if (managementRemote !== void 0) run(() => managementRemote.refreshIdentity());
|
|
9666
9774
|
}, pending || props.remote === void 0), activeAccount === void 0 || activeAccount.id === "canonical" ? null : control(text.reauthorize, () => {
|
|
9667
9775
|
if (props.remote !== void 0 && view?.revision !== void 0) startReauthorization(activeAccount.id, view.revision);
|
|
9668
|
-
}, pending || view?.writable !== true || view?.switchable !== true || view?.revision === void 0)), props.addOnly || savedAccounts.every((account) => account.id === "canonical" || account.id === view?.activeAccountId) ? null : (0, react.createElement)("details", null, (0, react.createElement)("summary", { style: { cursor: "pointer" } }, text.savedAccounts), (0, react.createElement)("ul", { style: {
|
|
9776
|
+
}, pending || reauthorizeBlocked || view?.writable !== true || view?.switchable !== true || view?.revision === void 0)), props.addOnly || savedAccounts.every((account) => account.id === "canonical" || account.id === view?.activeAccountId) ? null : (0, react.createElement)("details", null, (0, react.createElement)("summary", { style: { cursor: "pointer" } }, text.savedAccounts), (0, react.createElement)("ul", { style: {
|
|
9669
9777
|
listStyle: "none",
|
|
9670
9778
|
padding: 0,
|
|
9671
9779
|
maxHeight: 240,
|
|
@@ -10182,7 +10290,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
10182
10290
|
});
|
|
10183
10291
|
const accountOptions = open && choosingAccount && sessionAccount ? [...sessionAccount.accounts.accounts.filter((account) => account.configured).map((account) => ({
|
|
10184
10292
|
id: account.id,
|
|
10185
|
-
label: account.identity ?
|
|
10293
|
+
label: account.identity ? copilotIdentityLabel(account.identity) : account.id === "canonical" ? `${t.originalAuthorization} · ${t.identityUnknown}` : `${t.savedAuthorization}${numberedUnknownAccounts.has(account.id) ? ` ${numberedUnknownAccounts.get(account.id)}` : ""} · ${t.identityUnknown}`,
|
|
10186
10294
|
selected: sessionAccount.accountId === account.id
|
|
10187
10295
|
}))] : [];
|
|
10188
10296
|
return (0, react.createElement)("span", { style: {
|