dsh-github-copilot 0.4.0-alpha.39 → 0.4.0-alpha.40

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/lib/index.js CHANGED
@@ -1602,7 +1602,7 @@ let GitHubCopilotUsageController = (() => {
1602
1602
  //#endregion
1603
1603
  //#region package.json
1604
1604
  var name$1 = "dsh-github-copilot";
1605
- var version = "0.4.0-alpha.39";
1605
+ var version = "0.4.0-alpha.40";
1606
1606
  //#endregion
1607
1607
  //#region lib/types/probe.js
1608
1608
  /**
@@ -4323,9 +4323,6 @@ function service(ctx, name, methods) {
4323
4323
  for (const method of methods) if (typeof Reflect.get(candidate, method) !== "function") throw new Error(`github-copilot: required DSH API "${name}.${method}" is unavailable`);
4324
4324
  return candidate;
4325
4325
  }
4326
- function messageOf(error) {
4327
- return error instanceof Error ? error.message : String(error);
4328
- }
4329
4326
  function providerModels(value) {
4330
4327
  if (!Array.isArray(value)) return void 0;
4331
4328
  const models = [];
@@ -4691,30 +4688,36 @@ let GitHubCopilotAuthorizationController = (() => {
4691
4688
  this.notices = [];
4692
4689
  this.failure = void 0;
4693
4690
  this.reconciliationFailed = false;
4694
- const running = authorization.begin({
4695
- key: GITHUB_COPILOT_CREDENTIAL_KEY,
4696
- method: oauth.id,
4697
- interaction: {
4698
- notify: (notice) => {
4699
- this.notices = [...this.notices, { ...notice }];
4700
- },
4701
- prompt: (prompt) => {
4702
- if (prompt.kind === "text" && /GitHub Enterprise URL\/domain/i.test(prompt.message)) return Promise.resolve("");
4703
- return Promise.reject(/* @__PURE__ */ new Error(`github-copilot: this browser bridge cannot answer authorization prompt "${prompt.message}"`));
4691
+ let begun;
4692
+ try {
4693
+ begun = authorization.begin({
4694
+ key: GITHUB_COPILOT_CREDENTIAL_KEY,
4695
+ method: oauth.id,
4696
+ interaction: {
4697
+ notify: (notice) => {
4698
+ this.notices = [...this.notices, { ...notice }];
4699
+ },
4700
+ prompt: (prompt) => {
4701
+ if (prompt.kind === "text" && /GitHub Enterprise URL\/domain/i.test(prompt.message)) return Promise.resolve("");
4702
+ return Promise.reject(/* @__PURE__ */ new Error("github-copilot: this browser bridge cannot answer the authorization prompt"));
4703
+ }
4704
4704
  }
4705
- }
4706
- }).then(async (outcome) => {
4705
+ });
4706
+ } catch {
4707
+ begun = Promise.reject(/* @__PURE__ */ new Error("github-copilot: authorization.begin failed"));
4708
+ }
4709
+ const running = begun.then(async (outcome) => {
4707
4710
  if (outcome.status === "authorized") {
4708
4711
  this.notices = [];
4709
4712
  await this.ensureProviderProfile();
4713
+ if (this.reconciliationFailed) this.failure = "COPILOT_ROUTE_REPAIR_FAILED";
4710
4714
  return;
4711
4715
  }
4712
4716
  this.notices = [];
4713
- }).catch((error) => {
4717
+ }).catch(() => {
4714
4718
  this.notices = [];
4715
- this.failure = messageOf(error);
4716
- this.ctx.logger.error("github-copilot: GitHub Copilot authorization failed");
4717
- this.ctx.logger.error(error);
4719
+ this.failure = "COPILOT_AUTHORIZATION_BEGIN_FAILED";
4720
+ this.ctx.logger.error("github-copilot: authorization.begin failed (COPILOT_AUTHORIZATION_BEGIN_FAILED)");
4718
4721
  }).finally(() => {
4719
4722
  this.attempt = void 0;
4720
4723
  });
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.39",
4
+ "version": "0.4.0-alpha.40",
5
5
  "publishConfig": {
6
6
  "access": "public",
7
7
  "registry": "https://registry.npmjs.org/",