dsh-github-copilot 0.4.0-alpha.109 → 0.4.0-alpha.111

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
@@ -2993,7 +2993,7 @@ function createAccountProvider(descriptors, guard, baseURL) {
2993
2993
  var package_default = {
2994
2994
  name: "dsh-github-copilot",
2995
2995
  description: "DSH companion for GitHub Copilot sign-in, account-aware model profiles, tool compatibility, and provider-hosted search.",
2996
- version: "0.4.0-alpha.109",
2996
+ version: "0.4.0-alpha.111",
2997
2997
  publishConfig: {
2998
2998
  "access": "public",
2999
2999
  "registry": "https://registry.npmjs.org/",
@@ -3062,6 +3062,7 @@ var package_default = {
3062
3062
  "docs/session-continuation.md",
3063
3063
  "docs/account-management-experience.md",
3064
3064
  "docs/mockups/copilot-account-management.html",
3065
+ "docs/mockups/copilot-account-dropdown.html",
3065
3066
  "docs/automatic-model-routing.md",
3066
3067
  "docs/auto-task-routing.md",
3067
3068
  "docs/image-input-compatibility.md",
@@ -3543,8 +3544,7 @@ var CopilotAccountsHost = class {
3543
3544
  };
3544
3545
  }
3545
3546
  cachedIdentity(accountId) {
3546
- const cached = this.identities.get(accountId);
3547
- return cached && Date.now() - cached.at < IDENTITY_TTL ? cached.identity : void 0;
3547
+ return this.identities.get(accountId)?.identity;
3548
3548
  }
3549
3549
  capture(accountId) {
3550
3550
  const selected = this.selection();
@@ -3658,7 +3658,7 @@ var CopilotAccountsHost = class {
3658
3658
  seen.add(accountId);
3659
3659
  const configured = owned.find((row) => row.key === record.key)?.kind === "grant";
3660
3660
  const cached = this.identities.get(accountId);
3661
- const identity = configured && cached && Date.now() - cached.at < IDENTITY_TTL ? cached.identity : void 0;
3661
+ const identity = configured ? cached?.identity : void 0;
3662
3662
  rows.push({
3663
3663
  id: accountId,
3664
3664
  configured,
@@ -3814,7 +3814,11 @@ var CopilotAccountsHost = class {
3814
3814
  }
3815
3815
  async ensureIdentity() {
3816
3816
  try {
3817
- return await this.ensureIdentityFor(this.selection().accountId);
3817
+ const selected = this.selection().accountId;
3818
+ const view = await this.ensureAccountNamesFor(selected);
3819
+ if (view.state === "error") return view;
3820
+ if (this.selection().accountId !== selected) fail("COPILOT_ACCOUNTS_CHANGED");
3821
+ return view;
3818
3822
  } catch (error) {
3819
3823
  return {
3820
3824
  ...await this.get(),
@@ -3833,13 +3837,24 @@ var CopilotAccountsHost = class {
3833
3837
  async ensureIdentityFor(accountId) {
3834
3838
  return this.readIdentity(accountId, false);
3835
3839
  }
3840
+ async ensureAccountNamesFor(accountId) {
3841
+ const view = await this.ensureIdentityFor(accountId);
3842
+ if (view.state === "error") return view;
3843
+ const missing = view.accounts.filter((row) => row.configured && row.id !== accountId && !this.cachedIdentity(row.id));
3844
+ await Promise.all(missing.map(async (row) => {
3845
+ const result = await this.ensureIdentityFor(row.id);
3846
+ if (result.state === "error") this.ctx.logger.warn("[github-copilot] %s", result.diagnostic ?? "COPILOT_ACCOUNTS_IDENTITY_UNAVAILABLE");
3847
+ }));
3848
+ return this.viewForAccount(accountId);
3849
+ }
3836
3850
  async readIdentity(accountId, force) {
3837
3851
  id(accountId);
3838
3852
  if (this.disposed) fail("COPILOT_ACCOUNTS_DISPOSED");
3839
3853
  let flight = this.identityFlights.get(accountId);
3840
3854
  let problem;
3841
3855
  const failed = this.identityFailures.get(accountId);
3842
- if (flight === void 0 && !force && this.cachedIdentity(accountId)) return this.viewForAccount(accountId);
3856
+ const cached = this.identities.get(accountId);
3857
+ if (flight === void 0 && !force && cached && Date.now() - cached.at < IDENTITY_TTL) return this.viewForAccount(accountId);
3843
3858
  if (flight === void 0 && !force && failed && Date.now() - failed.at < IDENTITY_FAILURE_COOLDOWN) problem = failed.diagnostic;
3844
3859
  else {
3845
3860
  if (flight === void 0) {
@@ -4838,6 +4853,7 @@ function resolveSessionAccount(sessionId, preferences, globalAccountId) {
4838
4853
  var SessionAccountTurns = class {
4839
4854
  active = /* @__PURE__ */ new Map();
4840
4855
  signals = /* @__PURE__ */ new WeakMap();
4856
+ identities = /* @__PURE__ */ new WeakMap();
4841
4857
  history = /* @__PURE__ */ new Map();
4842
4858
  admit(agent, turn, signal, selection) {
4843
4859
  if (!Number.isSafeInteger(turn) || turn < 0 || signal.aborted) throw new Error("COPILOT_SESSION_ACCOUNT_TURN_INVALID");
@@ -4870,10 +4886,12 @@ var SessionAccountTurns = class {
4870
4886
  this.history.set(agent, turns);
4871
4887
  if (this.history.size > 64) this.history.delete(this.history.keys().next().value);
4872
4888
  }
4889
+ if (identity) this.captureIdentity(admission.signal, identity);
4890
+ const captured = this.identities.get(admission);
4873
4891
  if (!turns.has(turn)) turns.set(turn, Object.freeze({
4874
4892
  accountId: admission.accountId,
4875
4893
  source: admission.source,
4876
- ...identity ? { identity: Object.freeze({ ...identity }) } : {}
4894
+ ...captured ? { identity: captured } : {}
4877
4895
  }));
4878
4896
  if (turns.size > 128) turns.delete(turns.keys().next().value);
4879
4897
  }
@@ -4908,6 +4926,18 @@ var SessionAccountTurns = class {
4908
4926
  const entry = this.signals.get(signal);
4909
4927
  if (entry && this.active.get(entry.agent) === entry.admission) this.record(entry.agent, entry.admission.turn, identity);
4910
4928
  }
4929
+ captureIdentity(signal, identity) {
4930
+ const entry = this.signals.get(signal);
4931
+ if (!entry || signal.aborted || this.active.get(entry.agent) !== entry.admission || this.identities.has(entry.admission)) return;
4932
+ const captured = Object.freeze({ ...identity });
4933
+ this.identities.set(entry.admission, captured);
4934
+ const turns = this.history.get(entry.agent);
4935
+ const evidence = turns?.get(entry.admission.turn);
4936
+ if (turns && evidence && !evidence.identity) turns.set(entry.admission.turn, Object.freeze({
4937
+ ...evidence,
4938
+ identity: captured
4939
+ }));
4940
+ }
4911
4941
  };
4912
4942
  //#endregion
4913
4943
  //#region lib/types/session-accounts-host.js
@@ -4940,6 +4970,7 @@ var SessionAccountsHost = class {
4940
4970
  try {
4941
4971
  this.turns.admit(agent.session, turn, signal, selected);
4942
4972
  this.leases.set(agent.session, lease);
4973
+ this.captureIdentity(signal, selected.accountId);
4943
4974
  return lease.binding;
4944
4975
  } catch (error) {
4945
4976
  lease.release();
@@ -4967,6 +4998,27 @@ var SessionAccountsHost = class {
4967
4998
  if (!accounts) throw new Error("COPILOT_SESSION_ACCOUNTS_UNAVAILABLE");
4968
4999
  return accounts.host.captureAccount(accountId);
4969
5000
  }
5001
+ captureIdentity(signal, accountId) {
5002
+ const accounts = this.ctx.get("githubCopilotAccounts");
5003
+ if (!accounts) throw new Error("COPILOT_SESSION_ACCOUNTS_UNAVAILABLE");
5004
+ const cached = accounts.host.cachedIdentity(accountId);
5005
+ if (cached) {
5006
+ this.turns.captureIdentity(signal, cached);
5007
+ return;
5008
+ }
5009
+ const admission = this.turns.forSignal(signal);
5010
+ accounts.host.ensureIdentityFor(accountId).then((view) => {
5011
+ if (this.turns.forSignal(signal) !== admission || signal.aborted) return;
5012
+ if (view.state === "error") {
5013
+ this.ctx.logger.warn("[github-copilot] %s", view.diagnostic ?? "COPILOT_ACCOUNTS_IDENTITY_UNAVAILABLE");
5014
+ return;
5015
+ }
5016
+ const identity = accounts.host.cachedIdentity(accountId);
5017
+ if (identity) this.turns.captureIdentity(signal, identity);
5018
+ }, () => {
5019
+ if (this.turns.forSignal(signal) === admission && !signal.aborted) this.ctx.logger.warn("[github-copilot] COPILOT_ACCOUNTS_IDENTITY_UNAVAILABLE");
5020
+ });
5021
+ }
4970
5022
  recordRequest(signal) {
4971
5023
  const admission = signal === void 0 ? void 0 : this.turns.forSignal(signal);
4972
5024
  if (admission && signal) this.turns.recordSignal(signal, this.ctx.get("githubCopilotAccounts")?.host.cachedIdentity(admission.accountId));
@@ -5192,7 +5244,7 @@ let SessionAccountController = (() => {
5192
5244
  const selected = this.owner.selected(agent);
5193
5245
  const accounts = this.ctx.get("githubCopilotAccounts");
5194
5246
  if (!accounts) throw new Error("COPILOT_SESSION_ACCOUNTS_UNAVAILABLE");
5195
- const identity = await (force ? accounts.host.refreshIdentityFor(selected.accountId) : accounts.host.ensureIdentityFor(selected.accountId));
5247
+ const identity = await (force ? accounts.host.refreshIdentityFor(selected.accountId) : accounts.host.ensureAccountNamesFor(selected.accountId));
5196
5248
  const latest = await this.get(agent);
5197
5249
  if (latest.accountId !== selected.accountId || latest.source !== selected.source) throw new Error("COPILOT_ACCOUNTS_CHANGED");
5198
5250
  return {
@@ -0,0 +1,22 @@
1
+ import type { CSSProperties, ReactElement, RefObject } from 'react';
2
+ export interface AccountDropdownOption {
3
+ id: string;
4
+ label: string;
5
+ selected: boolean;
6
+ disabled?: boolean;
7
+ }
8
+ export declare function AccountDropdown(props: {
9
+ label: string;
10
+ open: boolean;
11
+ disabled?: boolean;
12
+ busy?: boolean;
13
+ options: AccountDropdownOption[];
14
+ onOpenChange(open: boolean): void;
15
+ onSelect(id: string): void;
16
+ triggerStyle: CSSProperties;
17
+ triggerRef?: RefObject<HTMLButtonElement | null>;
18
+ footer?: ReactElement | null;
19
+ listAttribute: 'data-copilot-saved-accounts' | 'data-copilot-account-options';
20
+ maxHeight?: number;
21
+ }): ReactElement;
22
+ //# sourceMappingURL=account-dropdown.d.ts.map
@@ -56,6 +56,7 @@ export declare class CopilotAccountsHost {
56
56
  viewForAccount(accountId: string): Promise<CopilotAccountsView>;
57
57
  refreshIdentityFor(accountId: string): Promise<CopilotAccountsView>;
58
58
  ensureIdentityFor(accountId: string): Promise<CopilotAccountsView>;
59
+ ensureAccountNamesFor(accountId: string): Promise<CopilotAccountsView>;
59
60
  private readIdentity;
60
61
  private validateModels;
61
62
  private assertIdentityCurrent;
@@ -19,8 +19,8 @@ declare module '@deepseek-ai/dsh-typert-protocol' {
19
19
  export declare const CopilotAccountIdSchema: z.ZodString;
20
20
  export declare const CopilotAccountsViewSchema: z.ZodObject<{
21
21
  state: z.ZodEnum<{
22
- ready: "ready";
23
22
  error: "error";
23
+ ready: "ready";
24
24
  }>;
25
25
  activeAccountId: z.ZodString;
26
26
  revision: z.ZodOptional<z.ZodNumber>;
@@ -28,7 +28,6 @@ export interface CopilotUsageCardProps {
28
28
  accountActions?: ReactElement;
29
29
  continuation?: ReactElement;
30
30
  onManage?: () => void;
31
- navigationDiagnostic?: string;
32
31
  /** Parent-owned consent; check the request signal after awaits and dismiss on abort. */
33
32
  beforeAccountChange?: (accountId: string | null, signal: AbortSignal) => Promise<boolean>;
34
33
  sessionAccount?: {
@@ -52,9 +52,9 @@ export declare const GitHubCopilotAuthorizationViewSchema: z.ZodObject<{
52
52
  }, z.core.$strict>>;
53
53
  accountModels: z.ZodOptional<z.ZodObject<{
54
54
  state: z.ZodEnum<{
55
+ error: "error";
55
56
  ready: "ready";
56
57
  unavailable: "unavailable";
57
- error: "error";
58
58
  idle: "idle";
59
59
  loading: "loading";
60
60
  stale: "stale";
@@ -79,8 +79,8 @@ export declare const GitHubCopilotAuthorizationViewSchema: z.ZodObject<{
79
79
  }, z.core.$strict>>;
80
80
  modelPreferences: z.ZodOptional<z.ZodObject<{
81
81
  state: z.ZodEnum<{
82
- ready: "ready";
83
82
  error: "error";
83
+ ready: "ready";
84
84
  }>;
85
85
  writable: z.ZodBoolean;
86
86
  revision: z.ZodOptional<z.ZodNumber>;
@@ -99,8 +99,8 @@ export declare const GitHubCopilotAuthorizationViewSchema: z.ZodObject<{
99
99
  }, z.core.$strict>>;
100
100
  route: z.ZodOptional<z.ZodObject<{
101
101
  state: z.ZodEnum<{
102
- ready: "ready";
103
102
  error: "error";
103
+ ready: "ready";
104
104
  "needs-repair": "needs-repair";
105
105
  "not-configured": "not-configured";
106
106
  conflict: "conflict";
@@ -120,8 +120,8 @@ export declare const GitHubCopilotAuthorizationViewSchema: z.ZodObject<{
120
120
  }, z.core.$strict>;
121
121
  export declare const GitHubCopilotModelPreferencesViewSchema: z.ZodObject<{
122
122
  state: z.ZodEnum<{
123
- ready: "ready";
124
123
  error: "error";
124
+ ready: "ready";
125
125
  }>;
126
126
  writable: z.ZodBoolean;
127
127
  revision: z.ZodOptional<z.ZodNumber>;
@@ -168,8 +168,8 @@ export declare const GitHubCopilotMigrationStatusSchema: z.ZodObject<{
168
168
  sessions: z.ZodArray<z.ZodObject<{
169
169
  id: z.ZodString;
170
170
  status: z.ZodEnum<{
171
- idle: "idle";
172
171
  running: "running";
172
+ idle: "idle";
173
173
  }>;
174
174
  effectiveSelection: z.ZodNullable<z.ZodObject<{
175
175
  provider: z.ZodString;
@@ -177,8 +177,8 @@ export declare const GitHubCopilotMigrationStatusSchema: z.ZodObject<{
177
177
  reasoningEffort: z.ZodOptional<z.ZodString>;
178
178
  }, z.core.$strict>>;
179
179
  selectionSource: z.ZodEnum<{
180
- unknown: "unknown";
181
180
  default: "default";
181
+ unknown: "unknown";
182
182
  pending: "pending";
183
183
  "request-header": "request-header";
184
184
  }>;
@@ -24,6 +24,7 @@ export declare class SessionAccountsHost {
24
24
  remove(session: object): void;
25
25
  dispose(): void;
26
26
  bindingForAccount(accountId: string): CopilotAccountBinding;
27
+ private captureIdentity;
27
28
  recordRequest(signal?: AbortSignal): void;
28
29
  requestBinding(signal?: AbortSignal): CopilotAccountBinding;
29
30
  set(agent: SessionOwner, accountId: string | null, revision: number): Promise<void>;
@@ -12,8 +12,8 @@ export declare const SessionAccountViewSchema: z.ZodObject<{
12
12
  runningAccountId: z.ZodOptional<z.ZodString>;
13
13
  accounts: z.ZodObject<{
14
14
  state: z.ZodEnum<{
15
- ready: "ready";
16
15
  error: "error";
16
+ ready: "ready";
17
17
  }>;
18
18
  activeAccountId: z.ZodString;
19
19
  revision: z.ZodOptional<z.ZodNumber>;
@@ -21,6 +21,7 @@ export declare function resolveSessionAccount(sessionId: string, preferences: re
21
21
  export declare class SessionAccountTurns {
22
22
  private readonly active;
23
23
  private readonly signals;
24
+ private readonly identities;
24
25
  private readonly history;
25
26
  admit(agent: object, turn: number, signal: AbortSignal, selection: SessionAccountSelection): Admission;
26
27
  record(agent: object, turn: number, identity?: CopilotAccountIdentity): void;
@@ -31,6 +32,7 @@ export declare class SessionAccountTurns {
31
32
  remove(agent: object): void;
32
33
  clear(): void;
33
34
  recordSignal(signal: AbortSignal, identity?: CopilotAccountIdentity): void;
35
+ captureIdentity(signal: AbortSignal, identity: CopilotAccountIdentity): void;
34
36
  }
35
37
  export {};
36
38
  //# sourceMappingURL=session-accounts.d.ts.map
@@ -21,12 +21,14 @@ export interface SessionContinuationRemote {
21
21
  value?: unknown;
22
22
  }>;
23
23
  }
24
- export declare function SessionContinuationCard({ sessionId, remote, locale, running, onEnabledChange, expanded }: {
24
+ export declare function SessionContinuationCard({ sessionId, remote, locale, running, onEnabledChange, expanded, recovery, onCancel }: {
25
25
  sessionId: string;
26
26
  remote: SessionContinuationRemote | undefined;
27
27
  locale?: string;
28
28
  running?: boolean;
29
29
  expanded?: boolean;
30
+ recovery?: boolean;
31
+ onCancel?(): void;
30
32
  onEnabledChange?(enabled: boolean): void;
31
33
  }): ReactElement;
32
34
  export declare function ContinuationDefaultCard({ remote, locale, onSaved }: {
@@ -8,8 +8,8 @@ export declare const TurnSelectionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
8
8
  }, z.core.$strict>, z.ZodObject<{
9
9
  mode: z.ZodLiteral<"auto">;
10
10
  preference: z.ZodEnum<{
11
- efficiency: "efficiency";
12
11
  balance: "balance";
12
+ efficiency: "efficiency";
13
13
  intelligence: "intelligence";
14
14
  }>;
15
15
  reason: z.ZodEnum<{
@@ -42,10 +42,10 @@ export declare const TurnSelectionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
42
42
  semantic: "semantic";
43
43
  }>;
44
44
  diagnostic: z.ZodOptional<z.ZodEnum<{
45
+ disabled: "disabled";
45
46
  unavailable: "unavailable";
46
47
  failed: "failed";
47
48
  "context-omitted": "context-omitted";
48
- disabled: "disabled";
49
49
  "invalid-result": "invalid-result";
50
50
  timeout: "timeout";
51
51
  }>>;
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.109",
4
+ "version": "0.4.0-alpha.111",
5
5
  "publishConfig": {
6
6
  "access": "public",
7
7
  "registry": "https://registry.npmjs.org/",
@@ -69,6 +69,7 @@
69
69
  "docs/session-continuation.md",
70
70
  "docs/account-management-experience.md",
71
71
  "docs/mockups/copilot-account-management.html",
72
+ "docs/mockups/copilot-account-dropdown.html",
72
73
  "docs/automatic-model-routing.md",
73
74
  "docs/auto-task-routing.md",
74
75
  "docs/image-input-compatibility.md",