dsh-github-copilot 0.4.0-alpha.104 → 0.4.0-alpha.105
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 +2 -0
- package/CHANGELOG.md +7 -0
- package/README.md +8 -6
- package/README.zh.md +8 -6
- package/deployment-baseline.json +4 -1
- package/docs/copilot-accounts.md +21 -3
- package/lib/client.js +54 -11
- package/lib/client.js.map +1 -1
- package/lib/index.js +141 -27
- package/lib/remote.js +8 -0
- package/lib/types/copilot-accounts-card.d.ts +1 -0
- package/lib/types/copilot-accounts-host.d.ts +8 -0
- package/lib/types/copilot-accounts-remote.d.ts +7 -0
- package/lib/types/copilot-accounts-types.d.ts +1 -1
- package/lib/types/copilot-usage-card.d.ts +1 -1
- package/lib/types/session-accounts-controller.d.ts +2 -0
- package/lib/types/session-accounts-remote.d.ts +7 -0
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -2989,7 +2989,7 @@ function createAccountProvider(descriptors, guard, baseURL) {
|
|
|
2989
2989
|
var package_default = {
|
|
2990
2990
|
name: "dsh-github-copilot",
|
|
2991
2991
|
description: "DSH companion for GitHub Copilot sign-in, account-aware model profiles, tool compatibility, and provider-hosted search.",
|
|
2992
|
-
version: "0.4.0-alpha.
|
|
2992
|
+
version: "0.4.0-alpha.105",
|
|
2993
2993
|
publishConfig: {
|
|
2994
2994
|
"access": "public",
|
|
2995
2995
|
"registry": "https://registry.npmjs.org/",
|
|
@@ -3414,6 +3414,7 @@ var __esDecorate$5 = function(ctor, descriptorIn, decorators, contextIn, initial
|
|
|
3414
3414
|
done = true;
|
|
3415
3415
|
};
|
|
3416
3416
|
const IDENTITY_TTL = 6e5;
|
|
3417
|
+
const IDENTITY_FAILURE_COOLDOWN = 3e4;
|
|
3417
3418
|
const TIMEOUT = 1e4;
|
|
3418
3419
|
const MAX_BODY = 65536;
|
|
3419
3420
|
var AccountsFailure = class extends Error {
|
|
@@ -3457,6 +3458,8 @@ var CopilotAccountsHost = class {
|
|
|
3457
3458
|
accountLeases = /* @__PURE__ */ new Map();
|
|
3458
3459
|
identities = /* @__PURE__ */ new Map();
|
|
3459
3460
|
unavailableIdentities = /* @__PURE__ */ new Set();
|
|
3461
|
+
identityFlights = /* @__PURE__ */ new Map();
|
|
3462
|
+
identityFailures = /* @__PURE__ */ new Map();
|
|
3460
3463
|
listeners = /* @__PURE__ */ new Set();
|
|
3461
3464
|
abort = new AbortController();
|
|
3462
3465
|
operation;
|
|
@@ -3496,6 +3499,7 @@ var CopilotAccountsHost = class {
|
|
|
3496
3499
|
}
|
|
3497
3500
|
revoke(clearIdentity = true) {
|
|
3498
3501
|
this.generation++;
|
|
3502
|
+
for (const accountId of this.identityFlights.keys()) this.invalidateIdentity(accountId);
|
|
3499
3503
|
if (clearIdentity) {
|
|
3500
3504
|
this.identities.clear();
|
|
3501
3505
|
this.unavailableIdentities.clear();
|
|
@@ -3516,9 +3520,15 @@ var CopilotAccountsHost = class {
|
|
|
3516
3520
|
credentialChanged(key) {
|
|
3517
3521
|
if (!isCopilotAccountRecord(key)) return;
|
|
3518
3522
|
const accountId = key === "llm-pi-ai/github-copilot" ? "canonical" : key.slice(23);
|
|
3523
|
+
this.invalidateIdentity(accountId);
|
|
3519
3524
|
this.identities.delete(accountId);
|
|
3520
3525
|
this.unavailableIdentities.delete(accountId);
|
|
3521
3526
|
}
|
|
3527
|
+
invalidateIdentity(accountId) {
|
|
3528
|
+
this.identityFlights.get(accountId)?.abort.abort(new AccountsFailure("COPILOT_ACCOUNTS_CHANGED"));
|
|
3529
|
+
this.identityFlights.delete(accountId);
|
|
3530
|
+
this.identityFailures.delete(accountId);
|
|
3531
|
+
}
|
|
3522
3532
|
onChanged(listener) {
|
|
3523
3533
|
this.listeners.add(listener);
|
|
3524
3534
|
return () => {
|
|
@@ -3696,6 +3706,7 @@ var CopilotAccountsHost = class {
|
|
|
3696
3706
|
const latest = await store.read(GITHUB_COPILOT_PROVIDER_ID);
|
|
3697
3707
|
if (!latest || copilotAccountKey(normalizeGitHubCopilotOAuthCredential(latest)) !== before) fail("COPILOT_ACCOUNTS_CHANGED");
|
|
3698
3708
|
binding.assertCurrent();
|
|
3709
|
+
signal.throwIfAborted();
|
|
3699
3710
|
const previous = this.identities.get(binding.accountId);
|
|
3700
3711
|
if (previous && previous.identity.userId !== identity.userId) fail("COPILOT_ACCOUNTS_IDENTITY_CHANGED");
|
|
3701
3712
|
if (!this.identities.has(binding.accountId) && this.identities.size >= 32) this.identities.delete(this.identities.keys().next().value);
|
|
@@ -3708,6 +3719,23 @@ var CopilotAccountsHost = class {
|
|
|
3708
3719
|
return identity;
|
|
3709
3720
|
}
|
|
3710
3721
|
async fetchIdentity(grant, signal) {
|
|
3722
|
+
try {
|
|
3723
|
+
return await this.fetchIdentityResponse(grant, signal);
|
|
3724
|
+
} catch (error) {
|
|
3725
|
+
if (error instanceof AccountsFailure) throw error;
|
|
3726
|
+
if (signal.aborted) fail(signal.reason instanceof DOMException && signal.reason.name === "TimeoutError" ? "COPILOT_ACCOUNTS_IDENTITY_TIMEOUT" : "COPILOT_ACCOUNTS_CHANGED");
|
|
3727
|
+
const cause = object$4(error) ? error.cause : void 0;
|
|
3728
|
+
fail(object$4(cause) && typeof cause.code === "string" && [
|
|
3729
|
+
"UNABLE_TO_VERIFY_LEAF_SIGNATURE",
|
|
3730
|
+
"UNABLE_TO_GET_ISSUER_CERT_LOCALLY",
|
|
3731
|
+
"SELF_SIGNED_CERT_IN_CHAIN",
|
|
3732
|
+
"DEPTH_ZERO_SELF_SIGNED_CERT",
|
|
3733
|
+
"CERT_HAS_EXPIRED",
|
|
3734
|
+
"ERR_TLS_CERT_ALTNAME_INVALID"
|
|
3735
|
+
].includes(cause.code) ? "COPILOT_ACCOUNTS_IDENTITY_TLS" : "COPILOT_ACCOUNTS_IDENTITY_NETWORK");
|
|
3736
|
+
}
|
|
3737
|
+
}
|
|
3738
|
+
async fetchIdentityResponse(grant, signal) {
|
|
3711
3739
|
if (grant.enterpriseUrl !== void 0) fail("COPILOT_ACCOUNTS_ENTERPRISE_UNSUPPORTED");
|
|
3712
3740
|
signal.throwIfAborted();
|
|
3713
3741
|
const response = await abortable$1((this.dependencies.fetch ?? globalThis.fetch)("https://api.github.com/user", {
|
|
@@ -3723,7 +3751,7 @@ var CopilotAccountsHost = class {
|
|
|
3723
3751
|
}), signal);
|
|
3724
3752
|
if (!response.ok || response.redirected || !response.body) {
|
|
3725
3753
|
response.body?.cancel().catch(() => void 0);
|
|
3726
|
-
fail("
|
|
3754
|
+
fail(response.status === 429 || response.status === 403 && (response.headers.get("x-ratelimit-remaining") === "0" || response.headers.has("retry-after")) ? "COPILOT_ACCOUNTS_IDENTITY_RATE_LIMITED" : response.status === 401 || response.status === 403 ? "COPILOT_ACCOUNTS_IDENTITY_AUTH_REJECTED" : "COPILOT_ACCOUNTS_IDENTITY_HTTP_ERROR");
|
|
3727
3755
|
}
|
|
3728
3756
|
const reader = response.body.getReader();
|
|
3729
3757
|
const chunks = [];
|
|
@@ -3734,7 +3762,7 @@ var CopilotAccountsHost = class {
|
|
|
3734
3762
|
signal.addEventListener("abort", cancel, { once: true });
|
|
3735
3763
|
try {
|
|
3736
3764
|
while (true) {
|
|
3737
|
-
|
|
3765
|
+
signal.throwIfAborted();
|
|
3738
3766
|
const chunk = await abortable$1(reader.read(), signal);
|
|
3739
3767
|
if (chunk.done) break;
|
|
3740
3768
|
bytes += chunk.value.byteLength;
|
|
@@ -3748,7 +3776,7 @@ var CopilotAccountsHost = class {
|
|
|
3748
3776
|
signal.removeEventListener("abort", cancel);
|
|
3749
3777
|
reader.releaseLock();
|
|
3750
3778
|
}
|
|
3751
|
-
|
|
3779
|
+
signal.throwIfAborted();
|
|
3752
3780
|
const buffer = new Uint8Array(bytes);
|
|
3753
3781
|
let offset = 0;
|
|
3754
3782
|
for (const chunk of chunks) {
|
|
@@ -3768,42 +3796,92 @@ var CopilotAccountsHost = class {
|
|
|
3768
3796
|
});
|
|
3769
3797
|
}
|
|
3770
3798
|
async refreshIdentity() {
|
|
3771
|
-
let lease;
|
|
3772
3799
|
try {
|
|
3773
|
-
|
|
3774
|
-
|
|
3775
|
-
|
|
3800
|
+
const view = await this.refreshIdentityFor(this.selection().accountId);
|
|
3801
|
+
if (view.state === "ready") this.lastFailure = void 0;
|
|
3802
|
+
return view;
|
|
3776
3803
|
} catch (error) {
|
|
3777
|
-
if (lease) {
|
|
3778
|
-
this.identities.delete(lease.binding.accountId);
|
|
3779
|
-
this.unavailableIdentities.add(lease.binding.accountId);
|
|
3780
|
-
}
|
|
3781
3804
|
this.lastFailure = diagnostic(error, "COPILOT_ACCOUNTS_IDENTITY_UNAVAILABLE");
|
|
3782
|
-
} finally {
|
|
3783
|
-
lease?.release();
|
|
3784
3805
|
}
|
|
3785
3806
|
return this.get();
|
|
3786
3807
|
}
|
|
3787
|
-
async
|
|
3788
|
-
return this.accountView(accountId);
|
|
3789
|
-
}
|
|
3790
|
-
async refreshIdentityFor(accountId) {
|
|
3791
|
-
const lease = this.acquire(void 0, false, accountId);
|
|
3808
|
+
async ensureIdentity() {
|
|
3792
3809
|
try {
|
|
3793
|
-
await this.
|
|
3810
|
+
return await this.ensureIdentityFor(this.selection().accountId);
|
|
3794
3811
|
} catch (error) {
|
|
3795
|
-
this.identities.delete(accountId);
|
|
3796
|
-
this.unavailableIdentities.add(accountId);
|
|
3797
3812
|
return {
|
|
3798
|
-
...await this.
|
|
3813
|
+
...await this.get(),
|
|
3799
3814
|
state: "error",
|
|
3800
3815
|
switchable: false,
|
|
3801
3816
|
diagnostic: diagnostic(error, "COPILOT_ACCOUNTS_IDENTITY_UNAVAILABLE")
|
|
3802
3817
|
};
|
|
3803
|
-
} finally {
|
|
3804
|
-
lease.release();
|
|
3805
3818
|
}
|
|
3806
|
-
|
|
3819
|
+
}
|
|
3820
|
+
async viewForAccount(accountId) {
|
|
3821
|
+
return this.accountView(accountId);
|
|
3822
|
+
}
|
|
3823
|
+
async refreshIdentityFor(accountId) {
|
|
3824
|
+
return this.readIdentity(accountId, true);
|
|
3825
|
+
}
|
|
3826
|
+
async ensureIdentityFor(accountId) {
|
|
3827
|
+
return this.readIdentity(accountId, false);
|
|
3828
|
+
}
|
|
3829
|
+
async readIdentity(accountId, force) {
|
|
3830
|
+
id(accountId);
|
|
3831
|
+
if (this.disposed) fail("COPILOT_ACCOUNTS_DISPOSED");
|
|
3832
|
+
let flight = this.identityFlights.get(accountId);
|
|
3833
|
+
let problem;
|
|
3834
|
+
const failed = this.identityFailures.get(accountId);
|
|
3835
|
+
if (flight === void 0 && !force && this.cachedIdentity(accountId)) return this.viewForAccount(accountId);
|
|
3836
|
+
if (flight === void 0 && !force && failed && Date.now() - failed.at < IDENTITY_FAILURE_COOLDOWN) problem = failed.diagnostic;
|
|
3837
|
+
else {
|
|
3838
|
+
if (flight === void 0) {
|
|
3839
|
+
if (this.identityFlights.size >= 32) fail("COPILOT_ACCOUNTS_LIMIT");
|
|
3840
|
+
const abort = new AbortController();
|
|
3841
|
+
const signal = AbortSignal.any([
|
|
3842
|
+
abort.signal,
|
|
3843
|
+
this.abort.signal,
|
|
3844
|
+
AbortSignal.timeout(TIMEOUT)
|
|
3845
|
+
]);
|
|
3846
|
+
flight = {
|
|
3847
|
+
abort,
|
|
3848
|
+
promise: Promise.resolve().then(async () => {
|
|
3849
|
+
let lease;
|
|
3850
|
+
try {
|
|
3851
|
+
signal.throwIfAborted();
|
|
3852
|
+
lease = this.acquire(void 0, false, accountId);
|
|
3853
|
+
await abortable$1(this.identity(lease.binding, signal), signal);
|
|
3854
|
+
this.identityFailures.delete(accountId);
|
|
3855
|
+
return;
|
|
3856
|
+
} catch (error) {
|
|
3857
|
+
const problem = signal.aborted ? signal.reason instanceof DOMException && signal.reason.name === "TimeoutError" ? "COPILOT_ACCOUNTS_IDENTITY_TIMEOUT" : "COPILOT_ACCOUNTS_CHANGED" : diagnostic(error, "COPILOT_ACCOUNTS_IDENTITY_UNAVAILABLE");
|
|
3858
|
+
if (!abort.signal.aborted && !this.disposed) {
|
|
3859
|
+
this.identities.delete(accountId);
|
|
3860
|
+
this.unavailableIdentities.add(accountId);
|
|
3861
|
+
if (!this.identityFailures.has(accountId) && this.identityFailures.size >= 32) this.identityFailures.delete(this.identityFailures.keys().next().value);
|
|
3862
|
+
this.identityFailures.set(accountId, {
|
|
3863
|
+
at: Date.now(),
|
|
3864
|
+
diagnostic: problem
|
|
3865
|
+
});
|
|
3866
|
+
}
|
|
3867
|
+
return problem;
|
|
3868
|
+
} finally {
|
|
3869
|
+
lease?.release();
|
|
3870
|
+
if (this.identityFlights.get(accountId)?.abort === abort) this.identityFlights.delete(accountId);
|
|
3871
|
+
}
|
|
3872
|
+
})
|
|
3873
|
+
};
|
|
3874
|
+
this.identityFlights.set(accountId, flight);
|
|
3875
|
+
}
|
|
3876
|
+
problem = await flight.promise;
|
|
3877
|
+
}
|
|
3878
|
+
const view = await this.viewForAccount(accountId);
|
|
3879
|
+
return problem === void 0 ? view : {
|
|
3880
|
+
...view,
|
|
3881
|
+
state: "error",
|
|
3882
|
+
switchable: false,
|
|
3883
|
+
diagnostic: problem
|
|
3884
|
+
};
|
|
3807
3885
|
}
|
|
3808
3886
|
async validateModels(binding, signal) {
|
|
3809
3887
|
try {
|
|
@@ -4105,6 +4183,7 @@ var CopilotAccountsHost = class {
|
|
|
4105
4183
|
this.authorizationAbort?.abort();
|
|
4106
4184
|
this.abort.abort();
|
|
4107
4185
|
this.revoke();
|
|
4186
|
+
this.identityFailures.clear();
|
|
4108
4187
|
for (const release of this.leases) release();
|
|
4109
4188
|
for (const leases of this.accountLeases.values()) for (const release of leases) release();
|
|
4110
4189
|
this.listeners.clear();
|
|
@@ -4123,6 +4202,7 @@ let GitHubCopilotAccountsController = (() => {
|
|
|
4123
4202
|
let _instanceExtraInitializers = [];
|
|
4124
4203
|
let _get_decorators;
|
|
4125
4204
|
let _refreshIdentity_decorators;
|
|
4205
|
+
let _ensureIdentity_decorators;
|
|
4126
4206
|
let _add_decorators;
|
|
4127
4207
|
let _cancel_decorators;
|
|
4128
4208
|
let _reauthorize_decorators;
|
|
@@ -4133,6 +4213,7 @@ let GitHubCopilotAccountsController = (() => {
|
|
|
4133
4213
|
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
4134
4214
|
_get_decorators = [Remote];
|
|
4135
4215
|
_refreshIdentity_decorators = [Remote];
|
|
4216
|
+
_ensureIdentity_decorators = [Remote];
|
|
4136
4217
|
_add_decorators = [Remote];
|
|
4137
4218
|
_cancel_decorators = [Remote];
|
|
4138
4219
|
_reauthorize_decorators = [Remote];
|
|
@@ -4160,6 +4241,17 @@ let GitHubCopilotAccountsController = (() => {
|
|
|
4160
4241
|
},
|
|
4161
4242
|
metadata: _metadata
|
|
4162
4243
|
}, null, _instanceExtraInitializers);
|
|
4244
|
+
__esDecorate$5(this, null, _ensureIdentity_decorators, {
|
|
4245
|
+
kind: "method",
|
|
4246
|
+
name: "ensureIdentity",
|
|
4247
|
+
static: false,
|
|
4248
|
+
private: false,
|
|
4249
|
+
access: {
|
|
4250
|
+
has: (obj) => "ensureIdentity" in obj,
|
|
4251
|
+
get: (obj) => obj.ensureIdentity
|
|
4252
|
+
},
|
|
4253
|
+
metadata: _metadata
|
|
4254
|
+
}, null, _instanceExtraInitializers);
|
|
4163
4255
|
__esDecorate$5(this, null, _add_decorators, {
|
|
4164
4256
|
kind: "method",
|
|
4165
4257
|
name: "add",
|
|
@@ -4238,6 +4330,9 @@ let GitHubCopilotAccountsController = (() => {
|
|
|
4238
4330
|
refreshIdentity() {
|
|
4239
4331
|
return this.host.refreshIdentity();
|
|
4240
4332
|
}
|
|
4333
|
+
ensureIdentity() {
|
|
4334
|
+
return this.host.ensureIdentity();
|
|
4335
|
+
}
|
|
4241
4336
|
add() {
|
|
4242
4337
|
return this.host.add();
|
|
4243
4338
|
}
|
|
@@ -4956,6 +5051,7 @@ let SessionAccountController = (() => {
|
|
|
4956
5051
|
let _get_decorators;
|
|
4957
5052
|
let _set_decorators;
|
|
4958
5053
|
let _refreshIdentity_decorators;
|
|
5054
|
+
let _ensureIdentity_decorators;
|
|
4959
5055
|
let _usage_decorators;
|
|
4960
5056
|
let _refreshUsage_decorators;
|
|
4961
5057
|
let _turn_decorators;
|
|
@@ -4965,6 +5061,7 @@ let SessionAccountController = (() => {
|
|
|
4965
5061
|
_get_decorators = [Remote];
|
|
4966
5062
|
_set_decorators = [Remote];
|
|
4967
5063
|
_refreshIdentity_decorators = [Remote];
|
|
5064
|
+
_ensureIdentity_decorators = [Remote];
|
|
4968
5065
|
_usage_decorators = [Remote];
|
|
4969
5066
|
_refreshUsage_decorators = [Remote];
|
|
4970
5067
|
_turn_decorators = [Remote];
|
|
@@ -5001,6 +5098,17 @@ let SessionAccountController = (() => {
|
|
|
5001
5098
|
},
|
|
5002
5099
|
metadata: _metadata
|
|
5003
5100
|
}, null, _instanceExtraInitializers);
|
|
5101
|
+
__esDecorate$3(this, null, _ensureIdentity_decorators, {
|
|
5102
|
+
kind: "method",
|
|
5103
|
+
name: "ensureIdentity",
|
|
5104
|
+
static: false,
|
|
5105
|
+
private: false,
|
|
5106
|
+
access: {
|
|
5107
|
+
has: (obj) => "ensureIdentity" in obj,
|
|
5108
|
+
get: (obj) => obj.ensureIdentity
|
|
5109
|
+
},
|
|
5110
|
+
metadata: _metadata
|
|
5111
|
+
}, null, _instanceExtraInitializers);
|
|
5004
5112
|
__esDecorate$3(this, null, _usage_decorators, {
|
|
5005
5113
|
kind: "method",
|
|
5006
5114
|
name: "usage",
|
|
@@ -5066,10 +5174,16 @@ let SessionAccountController = (() => {
|
|
|
5066
5174
|
return this.get(agent);
|
|
5067
5175
|
}
|
|
5068
5176
|
async refreshIdentity(agent) {
|
|
5177
|
+
return this.readIdentity(agent, true);
|
|
5178
|
+
}
|
|
5179
|
+
async ensureIdentity(agent) {
|
|
5180
|
+
return this.readIdentity(agent, false);
|
|
5181
|
+
}
|
|
5182
|
+
async readIdentity(agent, force) {
|
|
5069
5183
|
const selected = this.owner.selected(agent);
|
|
5070
5184
|
const accounts = this.ctx.get("githubCopilotAccounts");
|
|
5071
5185
|
if (!accounts) throw new Error("COPILOT_SESSION_ACCOUNTS_UNAVAILABLE");
|
|
5072
|
-
const identity = await accounts.host.refreshIdentityFor(selected.accountId);
|
|
5186
|
+
const identity = await (force ? accounts.host.refreshIdentityFor(selected.accountId) : accounts.host.ensureIdentityFor(selected.accountId));
|
|
5073
5187
|
const latest = await this.get(agent);
|
|
5074
5188
|
if (latest.accountId !== selected.accountId || latest.source !== selected.source) throw new Error("COPILOT_ACCOUNTS_CHANGED");
|
|
5075
5189
|
return {
|
package/lib/remote.js
CHANGED
|
@@ -143,6 +143,12 @@ const COPILOT_ACCOUNTS_DIAGNOSTICS = [
|
|
|
143
143
|
"COPILOT_ACCOUNTS_MODELS_FAILED",
|
|
144
144
|
"COPILOT_ACCOUNTS_IDENTITY_UNAVAILABLE",
|
|
145
145
|
"COPILOT_ACCOUNTS_IDENTITY_INVALID",
|
|
146
|
+
"COPILOT_ACCOUNTS_IDENTITY_TIMEOUT",
|
|
147
|
+
"COPILOT_ACCOUNTS_IDENTITY_TLS",
|
|
148
|
+
"COPILOT_ACCOUNTS_IDENTITY_NETWORK",
|
|
149
|
+
"COPILOT_ACCOUNTS_IDENTITY_AUTH_REJECTED",
|
|
150
|
+
"COPILOT_ACCOUNTS_IDENTITY_RATE_LIMITED",
|
|
151
|
+
"COPILOT_ACCOUNTS_IDENTITY_HTTP_ERROR",
|
|
146
152
|
"COPILOT_ACCOUNTS_IDENTITY_CHANGED",
|
|
147
153
|
"COPILOT_ACCOUNTS_DUPLICATE",
|
|
148
154
|
"COPILOT_ACCOUNTS_ENTERPRISE_UNSUPPORTED",
|
|
@@ -489,6 +495,7 @@ const contribution$2 = {
|
|
|
489
495
|
descriptors: [
|
|
490
496
|
"get",
|
|
491
497
|
"refreshIdentity",
|
|
498
|
+
"ensureIdentity",
|
|
492
499
|
"add",
|
|
493
500
|
"cancel",
|
|
494
501
|
"switchAccount",
|
|
@@ -542,6 +549,7 @@ const contribution$1 = {
|
|
|
542
549
|
"get",
|
|
543
550
|
"set",
|
|
544
551
|
"refreshIdentity",
|
|
552
|
+
"ensureIdentity",
|
|
545
553
|
"usage",
|
|
546
554
|
"refreshUsage",
|
|
547
555
|
"turn"
|
|
@@ -10,6 +10,7 @@ type AccountResult = {
|
|
|
10
10
|
export interface CopilotAccountsRemote {
|
|
11
11
|
get(): Promise<AccountResult>;
|
|
12
12
|
refreshIdentity(): Promise<AccountResult>;
|
|
13
|
+
ensureIdentity(): Promise<AccountResult>;
|
|
13
14
|
add(): Promise<AccountResult>;
|
|
14
15
|
cancel(): Promise<AccountResult>;
|
|
15
16
|
switchAccount(accountId: string, expectedRevision: number): Promise<AccountResult>;
|
|
@@ -18,6 +18,8 @@ export declare class CopilotAccountsHost {
|
|
|
18
18
|
private readonly accountLeases;
|
|
19
19
|
private readonly identities;
|
|
20
20
|
private readonly unavailableIdentities;
|
|
21
|
+
private readonly identityFlights;
|
|
22
|
+
private readonly identityFailures;
|
|
21
23
|
private readonly listeners;
|
|
22
24
|
private readonly abort;
|
|
23
25
|
private operation;
|
|
@@ -32,6 +34,7 @@ export declare class CopilotAccountsHost {
|
|
|
32
34
|
selectionChanged(): void;
|
|
33
35
|
isActiveRecord(key: string): boolean;
|
|
34
36
|
credentialChanged(key: string): void;
|
|
37
|
+
private invalidateIdentity;
|
|
35
38
|
onChanged(listener: () => void): () => void;
|
|
36
39
|
cachedIdentity(accountId: string): CopilotAccountIdentity | undefined;
|
|
37
40
|
capture(accountId?: string): CopilotAccountBinding;
|
|
@@ -47,9 +50,13 @@ export declare class CopilotAccountsHost {
|
|
|
47
50
|
private accountView;
|
|
48
51
|
private identity;
|
|
49
52
|
private fetchIdentity;
|
|
53
|
+
private fetchIdentityResponse;
|
|
50
54
|
refreshIdentity(): Promise<CopilotAccountsView>;
|
|
55
|
+
ensureIdentity(): Promise<CopilotAccountsView>;
|
|
51
56
|
viewForAccount(accountId: string): Promise<CopilotAccountsView>;
|
|
52
57
|
refreshIdentityFor(accountId: string): Promise<CopilotAccountsView>;
|
|
58
|
+
ensureIdentityFor(accountId: string): Promise<CopilotAccountsView>;
|
|
59
|
+
private readIdentity;
|
|
53
60
|
private validateModels;
|
|
54
61
|
private assertIdentityCurrent;
|
|
55
62
|
switchAccount(accountId: string, expectedRevision: number): Promise<CopilotAccountsView>;
|
|
@@ -73,6 +80,7 @@ export default class GitHubCopilotAccountsController extends TypertRemoteService
|
|
|
73
80
|
constructor(ctx: Context);
|
|
74
81
|
get(): Promise<CopilotAccountsView>;
|
|
75
82
|
refreshIdentity(): Promise<CopilotAccountsView>;
|
|
83
|
+
ensureIdentity(): Promise<CopilotAccountsView>;
|
|
76
84
|
add(): Promise<CopilotAccountsView>;
|
|
77
85
|
cancel(): Promise<CopilotAccountsView>;
|
|
78
86
|
reauthorize(accountId: string, expectedRevision: number): Promise<CopilotAccountsView>;
|
|
@@ -7,6 +7,7 @@ declare module '@deepseek-ai/dsh-typert-protocol' {
|
|
|
7
7
|
githubCopilotAccounts: {
|
|
8
8
|
get(): Promise<RemoteResult<CopilotAccountsView>>;
|
|
9
9
|
refreshIdentity(): Promise<RemoteResult<CopilotAccountsView>>;
|
|
10
|
+
ensureIdentity(): Promise<RemoteResult<CopilotAccountsView>>;
|
|
10
11
|
add(): Promise<RemoteResult<CopilotAccountsView>>;
|
|
11
12
|
cancel(): Promise<RemoteResult<CopilotAccountsView>>;
|
|
12
13
|
reauthorize(accountId: string, expectedRevision: number): Promise<RemoteResult<CopilotAccountsView>>;
|
|
@@ -59,6 +60,12 @@ export declare const CopilotAccountsViewSchema: z.ZodObject<{
|
|
|
59
60
|
COPILOT_ACCOUNTS_MODELS_FAILED: "COPILOT_ACCOUNTS_MODELS_FAILED";
|
|
60
61
|
COPILOT_ACCOUNTS_IDENTITY_UNAVAILABLE: "COPILOT_ACCOUNTS_IDENTITY_UNAVAILABLE";
|
|
61
62
|
COPILOT_ACCOUNTS_IDENTITY_INVALID: "COPILOT_ACCOUNTS_IDENTITY_INVALID";
|
|
63
|
+
COPILOT_ACCOUNTS_IDENTITY_TIMEOUT: "COPILOT_ACCOUNTS_IDENTITY_TIMEOUT";
|
|
64
|
+
COPILOT_ACCOUNTS_IDENTITY_TLS: "COPILOT_ACCOUNTS_IDENTITY_TLS";
|
|
65
|
+
COPILOT_ACCOUNTS_IDENTITY_NETWORK: "COPILOT_ACCOUNTS_IDENTITY_NETWORK";
|
|
66
|
+
COPILOT_ACCOUNTS_IDENTITY_AUTH_REJECTED: "COPILOT_ACCOUNTS_IDENTITY_AUTH_REJECTED";
|
|
67
|
+
COPILOT_ACCOUNTS_IDENTITY_RATE_LIMITED: "COPILOT_ACCOUNTS_IDENTITY_RATE_LIMITED";
|
|
68
|
+
COPILOT_ACCOUNTS_IDENTITY_HTTP_ERROR: "COPILOT_ACCOUNTS_IDENTITY_HTTP_ERROR";
|
|
62
69
|
COPILOT_ACCOUNTS_IDENTITY_CHANGED: "COPILOT_ACCOUNTS_IDENTITY_CHANGED";
|
|
63
70
|
COPILOT_ACCOUNTS_DUPLICATE: "COPILOT_ACCOUNTS_DUPLICATE";
|
|
64
71
|
COPILOT_ACCOUNTS_ENTERPRISE_UNSUPPORTED: "COPILOT_ACCOUNTS_ENTERPRISE_UNSUPPORTED";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare const COPILOT_ACCOUNT_ID_PATTERN: RegExp;
|
|
2
2
|
export declare const COPILOT_ACCOUNTS_MAX = 32;
|
|
3
3
|
export declare const GITHUB_ACCOUNT_LOGIN_PATTERN: RegExp;
|
|
4
|
-
export declare const COPILOT_ACCOUNTS_DIAGNOSTICS: readonly ["COPILOT_ACCOUNTS_SELECTOR_INVALID", "COPILOT_ACCOUNTS_SETTINGS_UNAVAILABLE", "COPILOT_ACCOUNTS_SELECTED_MISSING", "COPILOT_ACCOUNTS_CREDENTIALS_UNAVAILABLE", "COPILOT_ACCOUNTS_CHANGED", "COPILOT_ACCOUNTS_BUSY", "COPILOT_ACCOUNTS_CONFLICT", "COPILOT_ACCOUNTS_COMMIT_UNCERTAIN", "COPILOT_ACCOUNTS_MODELS_FAILED", "COPILOT_ACCOUNTS_IDENTITY_UNAVAILABLE", "COPILOT_ACCOUNTS_IDENTITY_INVALID", "COPILOT_ACCOUNTS_IDENTITY_CHANGED", "COPILOT_ACCOUNTS_DUPLICATE", "COPILOT_ACCOUNTS_ENTERPRISE_UNSUPPORTED", "COPILOT_ACCOUNTS_ROUTE_BLOCKED", "COPILOT_ACCOUNTS_EVIDENCE_INCOMPLETE", "COPILOT_ACCOUNTS_LIMIT", "COPILOT_ACCOUNTS_AUTH_FAILED", "COPILOT_ACCOUNTS_AUTH_UNAVAILABLE", "COPILOT_ACCOUNTS_ACTIVE_REMOVE_BLOCKED", "COPILOT_ACCOUNTS_REMOVE_FAILED", "COPILOT_ACCOUNTS_DISPOSED"];
|
|
4
|
+
export declare const COPILOT_ACCOUNTS_DIAGNOSTICS: readonly ["COPILOT_ACCOUNTS_SELECTOR_INVALID", "COPILOT_ACCOUNTS_SETTINGS_UNAVAILABLE", "COPILOT_ACCOUNTS_SELECTED_MISSING", "COPILOT_ACCOUNTS_CREDENTIALS_UNAVAILABLE", "COPILOT_ACCOUNTS_CHANGED", "COPILOT_ACCOUNTS_BUSY", "COPILOT_ACCOUNTS_CONFLICT", "COPILOT_ACCOUNTS_COMMIT_UNCERTAIN", "COPILOT_ACCOUNTS_MODELS_FAILED", "COPILOT_ACCOUNTS_IDENTITY_UNAVAILABLE", "COPILOT_ACCOUNTS_IDENTITY_INVALID", "COPILOT_ACCOUNTS_IDENTITY_TIMEOUT", "COPILOT_ACCOUNTS_IDENTITY_TLS", "COPILOT_ACCOUNTS_IDENTITY_NETWORK", "COPILOT_ACCOUNTS_IDENTITY_AUTH_REJECTED", "COPILOT_ACCOUNTS_IDENTITY_RATE_LIMITED", "COPILOT_ACCOUNTS_IDENTITY_HTTP_ERROR", "COPILOT_ACCOUNTS_IDENTITY_CHANGED", "COPILOT_ACCOUNTS_DUPLICATE", "COPILOT_ACCOUNTS_ENTERPRISE_UNSUPPORTED", "COPILOT_ACCOUNTS_ROUTE_BLOCKED", "COPILOT_ACCOUNTS_EVIDENCE_INCOMPLETE", "COPILOT_ACCOUNTS_LIMIT", "COPILOT_ACCOUNTS_AUTH_FAILED", "COPILOT_ACCOUNTS_AUTH_UNAVAILABLE", "COPILOT_ACCOUNTS_ACTIVE_REMOVE_BLOCKED", "COPILOT_ACCOUNTS_REMOVE_FAILED", "COPILOT_ACCOUNTS_DISPOSED"];
|
|
5
5
|
export type CopilotAccountsDiagnostic = typeof COPILOT_ACCOUNTS_DIAGNOSTICS[number];
|
|
6
6
|
export interface CopilotAccountIdentity {
|
|
7
7
|
readonly login: string;
|
|
@@ -21,7 +21,7 @@ export interface CopilotUsageRemote {
|
|
|
21
21
|
}
|
|
22
22
|
export interface CopilotUsageCardProps {
|
|
23
23
|
remote?: CopilotUsageRemote;
|
|
24
|
-
accountsRemote?: Pick<CopilotAccountsRemote, 'get' | 'refreshIdentity'>;
|
|
24
|
+
accountsRemote?: Pick<CopilotAccountsRemote, 'get' | 'refreshIdentity' | 'ensureIdentity'>;
|
|
25
25
|
/** Changes revoke every in-flight read, including switches between Copilot routes. */
|
|
26
26
|
contextKey: string;
|
|
27
27
|
locale?: string;
|
|
@@ -10,6 +10,8 @@ export declare class SessionAccountController extends TypertRemoteService {
|
|
|
10
10
|
get(agent: Agent): Promise<SessionAccountView>;
|
|
11
11
|
set(agent: Agent, accountId: string | null, revision: number): Promise<SessionAccountView>;
|
|
12
12
|
refreshIdentity(agent: Agent): Promise<SessionAccountView>;
|
|
13
|
+
ensureIdentity(agent: Agent): Promise<SessionAccountView>;
|
|
14
|
+
private readIdentity;
|
|
13
15
|
private readUsage;
|
|
14
16
|
usage(agent: Agent): Promise<CopilotUsageView>;
|
|
15
17
|
refreshUsage(agent: Agent): Promise<CopilotUsageView>;
|
|
@@ -53,6 +53,12 @@ export declare const SessionAccountViewSchema: z.ZodObject<{
|
|
|
53
53
|
COPILOT_ACCOUNTS_MODELS_FAILED: "COPILOT_ACCOUNTS_MODELS_FAILED";
|
|
54
54
|
COPILOT_ACCOUNTS_IDENTITY_UNAVAILABLE: "COPILOT_ACCOUNTS_IDENTITY_UNAVAILABLE";
|
|
55
55
|
COPILOT_ACCOUNTS_IDENTITY_INVALID: "COPILOT_ACCOUNTS_IDENTITY_INVALID";
|
|
56
|
+
COPILOT_ACCOUNTS_IDENTITY_TIMEOUT: "COPILOT_ACCOUNTS_IDENTITY_TIMEOUT";
|
|
57
|
+
COPILOT_ACCOUNTS_IDENTITY_TLS: "COPILOT_ACCOUNTS_IDENTITY_TLS";
|
|
58
|
+
COPILOT_ACCOUNTS_IDENTITY_NETWORK: "COPILOT_ACCOUNTS_IDENTITY_NETWORK";
|
|
59
|
+
COPILOT_ACCOUNTS_IDENTITY_AUTH_REJECTED: "COPILOT_ACCOUNTS_IDENTITY_AUTH_REJECTED";
|
|
60
|
+
COPILOT_ACCOUNTS_IDENTITY_RATE_LIMITED: "COPILOT_ACCOUNTS_IDENTITY_RATE_LIMITED";
|
|
61
|
+
COPILOT_ACCOUNTS_IDENTITY_HTTP_ERROR: "COPILOT_ACCOUNTS_IDENTITY_HTTP_ERROR";
|
|
56
62
|
COPILOT_ACCOUNTS_IDENTITY_CHANGED: "COPILOT_ACCOUNTS_IDENTITY_CHANGED";
|
|
57
63
|
COPILOT_ACCOUNTS_DUPLICATE: "COPILOT_ACCOUNTS_DUPLICATE";
|
|
58
64
|
COPILOT_ACCOUNTS_ENTERPRISE_UNSUPPORTED: "COPILOT_ACCOUNTS_ENTERPRISE_UNSUPPORTED";
|
|
@@ -95,6 +101,7 @@ declare module '@deepseek-ai/dsh-typert-protocol' {
|
|
|
95
101
|
get(agentId: string): Promise<RemoteResult<SessionAccountView>>;
|
|
96
102
|
set(agentId: string, accountId: string | null, revision: number): Promise<RemoteResult<SessionAccountView>>;
|
|
97
103
|
refreshIdentity(agentId: string): Promise<RemoteResult<SessionAccountView>>;
|
|
104
|
+
ensureIdentity(agentId: string): Promise<RemoteResult<SessionAccountView>>;
|
|
98
105
|
usage(agentId: string): Promise<RemoteResult<CopilotUsageView>>;
|
|
99
106
|
refreshUsage(agentId: string): Promise<RemoteResult<CopilotUsageView>>;
|
|
100
107
|
turn(agentId: string, turn: number): Promise<RemoteResult<TurnAccountView>>;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-github-copilot",
|
|
3
3
|
"description": "DSH companion for GitHub Copilot sign-in, account-aware model profiles, tool compatibility, and provider-hosted search.",
|
|
4
|
-
"version": "0.4.0-alpha.
|
|
4
|
+
"version": "0.4.0-alpha.105",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
7
7
|
"registry": "https://registry.npmjs.org/",
|