dsh-github-copilot 0.4.0-alpha.103 → 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/lib/remote.js CHANGED
@@ -43,7 +43,7 @@ const DualModelCreateSchema = z.object({
43
43
  expectedRevision: revision$1
44
44
  }).strict();
45
45
  const DualModelCreateResultSchema = z.object({ sessionId: id }).strict();
46
- const contribution$6 = {
46
+ const contribution$7 = {
47
47
  package: "dsh-github-copilot",
48
48
  descriptors: [
49
49
  {
@@ -85,7 +85,7 @@ const contribution$6 = {
85
85
  }
86
86
  ]
87
87
  };
88
- const contribution$5 = {
88
+ const contribution$6 = {
89
89
  package: "dsh-github-copilot",
90
90
  descriptors: [{
91
91
  id: "dsh-github-copilot:githubCopilotSearchRouting.providers",
@@ -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",
@@ -210,7 +216,7 @@ const CopilotUsageViewSchema = z.object({
210
216
  if (view.remaining !== void 0 && view.percentUsed !== void 0 && Math.abs((1 - view.remaining / view.limit) * 100 - view.percentUsed) > 1) invalid();
211
217
  }
212
218
  });
213
- const contribution$4 = {
219
+ const contribution$5 = {
214
220
  package: "dsh-github-copilot",
215
221
  descriptors: ["get", "refresh"].map((method) => ({
216
222
  id: `dsh-github-copilot:githubCopilotUsage.${method}`,
@@ -337,7 +343,7 @@ const TurnSelectionSchema = z.discriminatedUnion("mode", [
337
343
  ]);
338
344
  //#endregion
339
345
  //#region lib/types/turn-selection-remote.js
340
- const contribution$3 = {
346
+ const contribution$4 = {
341
347
  package: "dsh-github-copilot",
342
348
  descriptors: [{
343
349
  id: "dsh-github-copilot:githubCopilotTurnSelection.get",
@@ -373,14 +379,14 @@ const ReplayRecoveryViewSchema = z.discriminatedUnion("state", [z.object({ state
373
379
  }).strict()]);
374
380
  //#endregion
375
381
  //#region lib/types/replay-recovery-remote.js
376
- const agent = {
382
+ const agent$1 = {
377
383
  name: "agent",
378
384
  wire: "agentId",
379
385
  source: "lookup",
380
386
  lookup: "agent",
381
387
  codec: strictRemoteCodec("@deepseek-ai/dsh-session/types#SessionId", z.string().min(1).max(256))
382
388
  };
383
- const contribution$2 = {
389
+ const contribution$3 = {
384
390
  package: "dsh-github-copilot",
385
391
  descriptors: [
386
392
  {
@@ -389,7 +395,7 @@ const contribution$2 = {
389
395
  service: "githubCopilotReplayRecovery",
390
396
  method: "get",
391
397
  invocation: { kind: "direct" },
392
- parameters: [agent],
398
+ parameters: [agent$1],
393
399
  result: strictRemoteCodec("dsh-github-copilot#ReplayRecoveryView", ReplayRecoveryViewSchema)
394
400
  },
395
401
  {
@@ -399,7 +405,7 @@ const contribution$2 = {
399
405
  method: "authorize",
400
406
  invocation: { kind: "direct" },
401
407
  parameters: [
402
- agent,
408
+ agent$1,
403
409
  {
404
410
  name: "revision",
405
411
  wire: "revision",
@@ -422,7 +428,7 @@ const contribution$2 = {
422
428
  method: "setEnabled",
423
429
  invocation: { kind: "direct" },
424
430
  parameters: [
425
- agent,
431
+ agent$1,
426
432
  {
427
433
  name: "revision",
428
434
  wire: "revision",
@@ -484,11 +490,12 @@ const CopilotAccountsViewSchema = z.object({
484
490
  if (row.identity !== void 0 && !row.configured) invalid();
485
491
  }
486
492
  });
487
- const contribution$1 = {
493
+ const contribution$2 = {
488
494
  package: "dsh-github-copilot",
489
495
  descriptors: [
490
496
  "get",
491
497
  "refreshIdentity",
498
+ "ensureIdentity",
492
499
  "add",
493
500
  "cancel",
494
501
  "switchAccount",
@@ -515,6 +522,63 @@ const contribution$1 = {
515
522
  }))
516
523
  };
517
524
  //#endregion
525
+ //#region lib/types/session-accounts-remote.js
526
+ const SessionAccountViewSchema = z.object({
527
+ source: z.enum(["global", "session"]),
528
+ accountId: CopilotAccountIdSchema,
529
+ globalAccountId: CopilotAccountIdSchema,
530
+ runningAccountId: CopilotAccountIdSchema.optional(),
531
+ accounts: CopilotAccountsViewSchema
532
+ }).strict().refine((view) => view.accountId === view.accounts.activeAccountId, { message: "Session account identity mismatch" });
533
+ const TurnAccountViewSchema = z.discriminatedUnion("state", [z.object({ state: z.literal("unknown") }).strict(), z.object({
534
+ state: z.literal("recorded"),
535
+ accountId: CopilotAccountIdSchema,
536
+ source: z.enum(["global", "session"]),
537
+ identity: CopilotAccountsViewSchema.shape.accounts.element.shape.identity
538
+ }).strict()]);
539
+ const agent = {
540
+ name: "agent",
541
+ wire: "agentId",
542
+ source: "lookup",
543
+ lookup: "agent",
544
+ codec: strictRemoteCodec("@deepseek-ai/dsh-session/types#SessionId", z.string().min(1).max(256))
545
+ };
546
+ const contribution$1 = {
547
+ package: "dsh-github-copilot",
548
+ descriptors: [
549
+ "get",
550
+ "set",
551
+ "refreshIdentity",
552
+ "ensureIdentity",
553
+ "usage",
554
+ "refreshUsage",
555
+ "turn"
556
+ ].map((method) => ({
557
+ id: `dsh-github-copilot:githubCopilotSessionAccount.${method}`,
558
+ namespace: "githubCopilotSessionAccount",
559
+ service: "githubCopilotSessionAccount",
560
+ method,
561
+ invocation: { kind: "direct" },
562
+ parameters: [agent, ...method === "set" ? [{
563
+ name: "accountId",
564
+ wire: "accountId",
565
+ source: "json",
566
+ codec: strictRemoteCodec("dsh-github-copilot#SessionAccountChoice", CopilotAccountIdSchema.nullable())
567
+ }, {
568
+ name: "revision",
569
+ wire: "revision",
570
+ source: "json",
571
+ codec: strictRemoteCodec("dsh-github-copilot#SessionAccountRevision", z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER))
572
+ }] : method === "turn" ? [{
573
+ name: "turn",
574
+ wire: "turn",
575
+ source: "json",
576
+ codec: strictRemoteCodec("dsh-github-copilot#SessionAccountTurn", z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER))
577
+ }] : []],
578
+ result: method === "usage" || method === "refreshUsage" ? strictRemoteCodec("dsh-github-copilot#CopilotUsageView", CopilotUsageViewSchema) : method === "turn" ? strictRemoteCodec("dsh-github-copilot#TurnAccountView", TurnAccountViewSchema) : strictRemoteCodec("dsh-github-copilot#SessionAccountView", SessionAccountViewSchema)
579
+ }))
580
+ };
581
+ //#endregion
518
582
  //#region lib/types/remote.js
519
583
  /**
520
584
  * Client-safe Remote contribution for the plugin-owned authorization bridge.
@@ -723,6 +787,7 @@ const contribution = {
723
787
  parameters: [],
724
788
  result: strictRemoteCodec(GITHUB_COPILOT_MIGRATION_STATUS_TYPE_SYMBOL, GitHubCopilotMigrationStatusSchema)
725
789
  },
790
+ ...contribution$7.descriptors,
726
791
  ...contribution$6.descriptors,
727
792
  ...contribution$5.descriptors,
728
793
  ...contribution$4.descriptors,
package/lib/routed-web.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import "./copilot-identity-DRZY_d2X.js";
2
- import { D as isPluginPreviewProvider, t as isCopilotSearchSelection, v as currentSearchInitiator, y as currentSearchSelection } from "./search-routing-CqysPLve.js";
2
+ import { O as isPluginPreviewProvider, b as currentSearchSelection, t as isCopilotSearchSelection, y as currentSearchInitiator } from "./search-routing-CHyF6TbO.js";
3
3
  import { WebError, WebRuntime } from "@deepseek-ai/dsh-web";
4
4
  //#region lib/types/routed-web.js
5
5
  /**
@@ -789,4 +789,4 @@ async function routeSessionSearch(request, signal, deps) {
789
789
  };
790
790
  }
791
791
  //#endregion
792
- export { readBounded as C, isPluginPreviewProvider as D, readSettingsNamespace as E, readCopilotCatalog as O, providerErrorMessage as S, readConfigValue as T, currentChatRoute as _, COPILOT_HOSTED_SEARCH_PROVIDER_ID as a, abortable as b, applyRequestAuth as c, ANTHROPIC_WEB_SEARCH_TOOL_TYPE as d, RESPONSES_WEB_SEARCH_TOOL_TYPE as f, sameCandidates as g, candidatesForRoute as h, describeSearchBackend as i, normalizeRequestAuth as l, WEB_SEARCH_TOOL_TYPE as m, routeSessionSearch as n, GITHUB_COPILOT_HOSTED_SEARCH_PROVIDER_ID as o, SearchPlan as p, DescribedSearchFallbackError as r, createTraditionalSearchProvider as s, isCopilotSearchSelection as t, providerRequestHeaders as u, currentSearchInitiator as v, onSettingsNamespaceUpdated as w, isAbortError as x, currentSearchSelection as y };
792
+ export { providerErrorMessage as C, readSettingsNamespace as D, readConfigValue as E, isPluginPreviewProvider as O, isAbortError as S, onSettingsNamespaceUpdated as T, sameCandidates as _, COPILOT_HOSTED_SEARCH_PROVIDER_ID as a, currentSearchSelection as b, applyRequestAuth as c, ANTHROPIC_WEB_SEARCH_TOOL_TYPE as d, GITHUB_COPILOT_CREDENTIAL_KEY as f, candidatesForRoute as g, WEB_SEARCH_TOOL_TYPE as h, describeSearchBackend as i, readCopilotCatalog as k, normalizeRequestAuth as l, SearchPlan as m, routeSessionSearch as n, GITHUB_COPILOT_HOSTED_SEARCH_PROVIDER_ID as o, RESPONSES_WEB_SEARCH_TOOL_TYPE as p, DescribedSearchFallbackError as r, createTraditionalSearchProvider as s, isCopilotSearchSelection as t, providerRequestHeaders as u, currentChatRoute as v, readBounded as w, abortable as x, currentSearchInitiator as y };
@@ -8,6 +8,7 @@ import type { RequestBudgetPolicy } from './request-budget.ts';
8
8
  import type { WebSearchRoutingConfig } from './web-search-routing-config.ts';
9
9
  import type { LiveSetting } from './settings-reader.ts';
10
10
  import type { ParentModelBinding } from './parent-model-follow.ts';
11
+ import type { SessionAccountPreference } from './session-accounts.ts';
11
12
  /** Plugin configuration. Defaults make the current chat route decide. */
12
13
  export interface InlineConfig {
13
14
  /** Hosted-search switch; managed chat requests remain enabled. */
@@ -41,6 +42,8 @@ export interface InlineConfig {
41
42
  excludedModelIds?: string[];
42
43
  /** Opaque profile-wide account selector; absence retains canonical compatibility. */
43
44
  activeAccountId?: string;
45
+ /** Explicit Session overrides; absence means follow the profile default. */
46
+ sessionAccounts?: SessionAccountPreference[];
44
47
  /** Explicit native child/direct-parent enrollments; empty preserves native routing. */
45
48
  parentModelFollow?: ParentModelBinding[];
46
49
  /** Profile-wide next-turn policy for supported native children. */
@@ -64,7 +67,8 @@ export interface InlineConfig {
64
67
  /** Internal JSON backup of route leaves temporarily owned by the GPT-6 overlay. */
65
68
  temporaryRouteBackup?: string;
66
69
  }
67
- export type LiveInlineConfig = Omit<InlineConfig, 'searchModel' | 'searchRouting' | 'temporaryRouteBackup' | 'excludedModelIds' | 'parentModelFollow' | 'followParentModel' | 'activeAccountId'> & {
70
+ export type LiveInlineConfig = Omit<InlineConfig, 'searchModel' | 'searchRouting' | 'temporaryRouteBackup' | 'excludedModelIds' | 'parentModelFollow' | 'followParentModel' | 'activeAccountId' | 'sessionAccounts'> & {
71
+ sessionAccounts?: SessionAccountPreference[] | LiveSetting<ArrayLike<SessionAccountPreference>>;
68
72
  activeAccountId?: string | LiveSetting<string | undefined>;
69
73
  followParentModel?: boolean | LiveSetting<boolean>;
70
74
  parentModelFollow?: ParentModelBinding[] | LiveSetting<ArrayLike<ParentModelBinding>>;
@@ -73,7 +77,8 @@ export type LiveInlineConfig = Omit<InlineConfig, 'searchModel' | 'searchRouting
73
77
  searchRouting?: WebSearchRoutingConfig | LiveSetting<WebSearchRoutingConfig | undefined>;
74
78
  temporaryRouteBackup?: string | LiveSetting<string | undefined>;
75
79
  };
76
- export type ResolvedInlineConfig = Omit<InlineConfig, 'searchModel' | 'searchRouting' | 'temporaryRouteBackup' | 'excludedModelIds' | 'parentModelFollow' | 'followParentModel' | 'activeAccountId'> & {
80
+ export type ResolvedInlineConfig = Omit<InlineConfig, 'searchModel' | 'searchRouting' | 'temporaryRouteBackup' | 'excludedModelIds' | 'parentModelFollow' | 'followParentModel' | 'activeAccountId' | 'sessionAccounts'> & {
81
+ sessionAccounts: LiveSetting<ArrayLike<SessionAccountPreference>>;
77
82
  activeAccountId: LiveSetting<string | undefined>;
78
83
  followParentModel: LiveSetting<boolean>;
79
84
  parentModelFollow: LiveSetting<ArrayLike<ParentModelBinding>>;
@@ -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>;
@@ -1,6 +1,6 @@
1
1
  import { Context } from '@deepseek-ai/cordis';
2
2
  import { TypertRemoteService } from '@deepseek-ai/dsh-typert-protocol';
3
- import type { CopilotAccountBinding, CopilotAccountLease, CopilotAccountsDiagnostic, CopilotAccountsView } from './copilot-accounts-types.ts';
3
+ import type { CopilotAccountBinding, CopilotAccountIdentity, CopilotAccountLease, CopilotAccountsDiagnostic, CopilotAccountsView } from './copilot-accounts-types.ts';
4
4
  interface Dependencies {
5
5
  fetch?: typeof globalThis.fetch;
6
6
  validateModels?: (binding: CopilotAccountBinding, signal: AbortSignal) => Promise<void>;
@@ -15,8 +15,11 @@ export declare class CopilotAccountsHost {
15
15
  private selectionSignature;
16
16
  private disposed;
17
17
  private readonly leases;
18
+ private readonly accountLeases;
18
19
  private readonly identities;
19
20
  private readonly unavailableIdentities;
21
+ private readonly identityFlights;
22
+ private readonly identityFailures;
20
23
  private readonly listeners;
21
24
  private readonly abort;
22
25
  private operation;
@@ -31,17 +34,29 @@ export declare class CopilotAccountsHost {
31
34
  selectionChanged(): void;
32
35
  isActiveRecord(key: string): boolean;
33
36
  credentialChanged(key: string): void;
37
+ private invalidateIdentity;
34
38
  onChanged(listener: () => void): () => void;
39
+ cachedIdentity(accountId: string): CopilotAccountIdentity | undefined;
35
40
  capture(accountId?: string): CopilotAccountBinding;
36
- acquire(signal?: AbortSignal, requireManaged?: boolean): CopilotAccountLease;
41
+ /** A frozen turn owns a record, not the mutable profile default. */
42
+ captureAccount(accountId: string): CopilotAccountBinding;
43
+ validateAccount(binding: CopilotAccountBinding): Promise<void>;
44
+ acquire(signal?: AbortSignal, requireManaged?: boolean, accountId?: string): CopilotAccountLease;
37
45
  acquireCanonicalAuthorization(): CopilotAccountLease;
38
46
  private routeDiagnostic;
39
47
  private busy;
40
48
  private membership;
41
49
  get(): Promise<CopilotAccountsView>;
50
+ private accountView;
42
51
  private identity;
43
52
  private fetchIdentity;
53
+ private fetchIdentityResponse;
44
54
  refreshIdentity(): Promise<CopilotAccountsView>;
55
+ ensureIdentity(): Promise<CopilotAccountsView>;
56
+ viewForAccount(accountId: string): Promise<CopilotAccountsView>;
57
+ refreshIdentityFor(accountId: string): Promise<CopilotAccountsView>;
58
+ ensureIdentityFor(accountId: string): Promise<CopilotAccountsView>;
59
+ private readIdentity;
45
60
  private validateModels;
46
61
  private assertIdentityCurrent;
47
62
  switchAccount(accountId: string, expectedRevision: number): Promise<CopilotAccountsView>;
@@ -65,6 +80,7 @@ export default class GitHubCopilotAccountsController extends TypertRemoteService
65
80
  constructor(ctx: Context);
66
81
  get(): Promise<CopilotAccountsView>;
67
82
  refreshIdentity(): Promise<CopilotAccountsView>;
83
+ ensureIdentity(): Promise<CopilotAccountsView>;
68
84
  add(): Promise<CopilotAccountsView>;
69
85
  cancel(): Promise<CopilotAccountsView>;
70
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;
@@ -1,6 +1,7 @@
1
1
  import type { ReactElement } from 'react';
2
2
  import type { CopilotUsageView } from './copilot-usage-types.ts';
3
3
  import type { CopilotAccountsRemote } from './copilot-accounts-card.ts';
4
+ import type { SessionAccountView } from './session-accounts-remote.ts';
4
5
  /** Client-only face: no credentials, provider transport or billing arithmetic. */
5
6
  export interface CopilotUsageRemote {
6
7
  get(): Promise<{
@@ -20,10 +21,26 @@ export interface CopilotUsageRemote {
20
21
  }
21
22
  export interface CopilotUsageCardProps {
22
23
  remote?: CopilotUsageRemote;
23
- accountsRemote?: Pick<CopilotAccountsRemote, 'get' | 'refreshIdentity'>;
24
+ accountsRemote?: Pick<CopilotAccountsRemote, 'get' | 'refreshIdentity' | 'ensureIdentity'>;
24
25
  /** Changes revoke every in-flight read, including switches between Copilot routes. */
25
26
  contextKey: string;
26
27
  locale?: string;
28
+ sessionAccount?: {
29
+ get(): Promise<{
30
+ ok: true;
31
+ value: SessionAccountView;
32
+ } | {
33
+ ok: false;
34
+ error: unknown;
35
+ }>;
36
+ set(accountId: string | null, revision: number): Promise<{
37
+ ok: true;
38
+ value: SessionAccountView;
39
+ } | {
40
+ ok: false;
41
+ error: unknown;
42
+ }>;
43
+ };
27
44
  }
28
45
  /** Mounted only for a proven effective Copilot selection in the owning Session. */
29
46
  export declare function CopilotUsageCard(props: CopilotUsageCardProps): ReactElement;
@@ -2,6 +2,7 @@ import { Context } from '@deepseek-ai/cordis';
2
2
  import { TypertRemoteService } from '@deepseek-ai/dsh-typert-protocol';
3
3
  import { Agent } from 'undici';
4
4
  import type { CopilotUsageView } from './copilot-usage-types.ts';
5
+ import type { CopilotAccountBinding } from './copilot-accounts-types.ts';
5
6
  export declare const COPILOT_USAGE_ENDPOINT = "https://api.github.com/copilot_internal/user";
6
7
  interface Dependencies {
7
8
  readonly accountId?: string;
@@ -45,10 +46,12 @@ declare module '@deepseek-ai/cordis' {
45
46
  }
46
47
  }
47
48
  export default class GitHubCopilotUsageController extends TypertRemoteService {
49
+ private readonly accountSources;
48
50
  private source;
49
51
  private accountSignature;
50
52
  private sourceInitialized;
51
53
  constructor(ctx: Context);
54
+ forAccount(binding: CopilotAccountBinding, force?: boolean): Promise<CopilotUsageView>;
52
55
  private createSource;
53
56
  private current;
54
57
  get(): Promise<CopilotUsageView>;
@@ -63,7 +63,7 @@ declare module '@deepseek-ai/cordis' {
63
63
  githubCopilotPreview: GitHubCopilotPreview;
64
64
  }
65
65
  }
66
- /** Register one stable account route; attach/status remain network-free. */
66
+ /** Register services once; account switches affect the directory, not admitted turns. */
67
67
  export declare function apply(ctx: Context, config?: PreviewRouteConfig): void;
68
68
  declare const _default: {
69
69
  name: string;
@@ -13,12 +13,12 @@ export declare class ReplayRecoveryController extends TypertRemoteService {
13
13
  private readonly store;
14
14
  private readonly proof;
15
15
  private readonly busy;
16
- constructor(ctx: Context, store: ReplayRecoveryStore, proof: () => string | undefined, busy: WeakSet<object>);
16
+ constructor(ctx: Context, store: ReplayRecoveryStore, proof: (agent?: Agent, request?: GenerateOptions) => string | undefined, busy: WeakSet<object>);
17
17
  get(agent: Agent): ReplayRecoveryView;
18
18
  setEnabled(agent: Agent, revision: string, enabled: boolean): ReplayRecoveryView;
19
19
  authorize(agent: Agent, revision: string, duration: ReplayRecoveryDuration): ReplayRecoveryView;
20
20
  }
21
- export declare function installReplayRecovery(ctx: Context, proof: () => string | undefined): {
21
+ export declare function installReplayRecovery(ctx: Context, proof: (agent?: Agent, request?: GenerateOptions) => string | undefined): {
22
22
  prepare(request: GenerateOptions): {
23
23
  transform(payload: unknown): unknown;
24
24
  rejected(body: string | undefined): void;
@@ -0,0 +1,20 @@
1
+ import { TypertRemoteService } from '@deepseek-ai/dsh-typert-protocol';
2
+ import type { Context } from '@deepseek-ai/cordis';
3
+ import type { Agent } from '@deepseek-ai/dsh-agent';
4
+ import type { SessionAccountsHost } from './session-accounts-host.ts';
5
+ import type { SessionAccountView, TurnAccountView } from './session-accounts-remote.ts';
6
+ import type { CopilotUsageView } from './copilot-usage-types.ts';
7
+ export declare class SessionAccountController extends TypertRemoteService {
8
+ private readonly owner;
9
+ constructor(ctx: Context, owner: SessionAccountsHost);
10
+ get(agent: Agent): Promise<SessionAccountView>;
11
+ set(agent: Agent, accountId: string | null, revision: number): Promise<SessionAccountView>;
12
+ refreshIdentity(agent: Agent): Promise<SessionAccountView>;
13
+ ensureIdentity(agent: Agent): Promise<SessionAccountView>;
14
+ private readIdentity;
15
+ private readUsage;
16
+ usage(agent: Agent): Promise<CopilotUsageView>;
17
+ refreshUsage(agent: Agent): Promise<CopilotUsageView>;
18
+ turn(agent: Agent, turn: number): TurnAccountView;
19
+ }
20
+ //# sourceMappingURL=session-accounts-controller.d.ts.map
@@ -0,0 +1,32 @@
1
+ import type { Context } from '@deepseek-ai/cordis';
2
+ import { SessionAccountTurns } from './session-accounts.ts';
3
+ import type { SessionAccountSelection } from './session-accounts.ts';
4
+ import type { CopilotAccountBinding } from './copilot-accounts-types.ts';
5
+ declare module '@deepseek-ai/cordis' {
6
+ interface Context {
7
+ githubCopilotSessionAccounts: SessionAccountsHost;
8
+ }
9
+ }
10
+ interface SessionOwner {
11
+ readonly session: {
12
+ readonly id: string;
13
+ };
14
+ }
15
+ /** Host-only routing owner; credentials remain in the existing account service. */
16
+ export declare class SessionAccountsHost {
17
+ private readonly ctx;
18
+ readonly turns: SessionAccountTurns;
19
+ private readonly leases;
20
+ constructor(ctx: Context);
21
+ selected(agent: SessionOwner): SessionAccountSelection;
22
+ admit(agent: SessionOwner, turn: number, signal: AbortSignal): CopilotAccountBinding;
23
+ end(session: object, turn: number): void;
24
+ remove(session: object): void;
25
+ dispose(): void;
26
+ bindingForAccount(accountId: string): CopilotAccountBinding;
27
+ recordRequest(signal?: AbortSignal): void;
28
+ requestBinding(signal?: AbortSignal): CopilotAccountBinding;
29
+ set(agent: SessionOwner, accountId: string | null, revision: number): Promise<void>;
30
+ }
31
+ export {};
32
+ //# sourceMappingURL=session-accounts-host.d.ts.map
@@ -0,0 +1,113 @@
1
+ import { z } from 'zod';
2
+ import type { RemoteResult, TypertRemoteContribution } from '@deepseek-ai/dsh-typert-protocol';
3
+ import type { CopilotUsageView } from './copilot-usage-types.ts';
4
+ import type { CopilotAccountsView } from './copilot-accounts-types.ts';
5
+ export declare const SessionAccountViewSchema: z.ZodObject<{
6
+ source: z.ZodEnum<{
7
+ session: "session";
8
+ global: "global";
9
+ }>;
10
+ accountId: z.ZodString;
11
+ globalAccountId: z.ZodString;
12
+ runningAccountId: z.ZodOptional<z.ZodString>;
13
+ accounts: z.ZodObject<{
14
+ state: z.ZodEnum<{
15
+ ready: "ready";
16
+ error: "error";
17
+ }>;
18
+ activeAccountId: z.ZodString;
19
+ revision: z.ZodOptional<z.ZodNumber>;
20
+ writable: z.ZodBoolean;
21
+ switchable: z.ZodBoolean;
22
+ accounts: z.ZodArray<z.ZodObject<{
23
+ id: z.ZodString;
24
+ configured: z.ZodBoolean;
25
+ identityState: z.ZodEnum<{
26
+ ready: "ready";
27
+ unavailable: "unavailable";
28
+ unknown: "unknown";
29
+ }>;
30
+ identity: z.ZodOptional<z.ZodObject<{
31
+ login: z.ZodString;
32
+ userId: z.ZodNumber;
33
+ }, z.core.$strict>>;
34
+ }, z.core.$strict>>;
35
+ operation: z.ZodOptional<z.ZodEnum<{
36
+ authorizing: "authorizing";
37
+ switching: "switching";
38
+ }>>;
39
+ notices: z.ZodArray<z.ZodObject<{
40
+ message: z.ZodString;
41
+ url: z.ZodOptional<z.ZodLiteral<"https://github.com/login/device">>;
42
+ code: z.ZodOptional<z.ZodString>;
43
+ }, z.core.$strict>>;
44
+ diagnostic: z.ZodOptional<z.ZodEnum<{
45
+ COPILOT_ACCOUNTS_SELECTOR_INVALID: "COPILOT_ACCOUNTS_SELECTOR_INVALID";
46
+ COPILOT_ACCOUNTS_SETTINGS_UNAVAILABLE: "COPILOT_ACCOUNTS_SETTINGS_UNAVAILABLE";
47
+ COPILOT_ACCOUNTS_SELECTED_MISSING: "COPILOT_ACCOUNTS_SELECTED_MISSING";
48
+ COPILOT_ACCOUNTS_CREDENTIALS_UNAVAILABLE: "COPILOT_ACCOUNTS_CREDENTIALS_UNAVAILABLE";
49
+ COPILOT_ACCOUNTS_CHANGED: "COPILOT_ACCOUNTS_CHANGED";
50
+ COPILOT_ACCOUNTS_BUSY: "COPILOT_ACCOUNTS_BUSY";
51
+ COPILOT_ACCOUNTS_CONFLICT: "COPILOT_ACCOUNTS_CONFLICT";
52
+ COPILOT_ACCOUNTS_COMMIT_UNCERTAIN: "COPILOT_ACCOUNTS_COMMIT_UNCERTAIN";
53
+ COPILOT_ACCOUNTS_MODELS_FAILED: "COPILOT_ACCOUNTS_MODELS_FAILED";
54
+ COPILOT_ACCOUNTS_IDENTITY_UNAVAILABLE: "COPILOT_ACCOUNTS_IDENTITY_UNAVAILABLE";
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";
62
+ COPILOT_ACCOUNTS_IDENTITY_CHANGED: "COPILOT_ACCOUNTS_IDENTITY_CHANGED";
63
+ COPILOT_ACCOUNTS_DUPLICATE: "COPILOT_ACCOUNTS_DUPLICATE";
64
+ COPILOT_ACCOUNTS_ENTERPRISE_UNSUPPORTED: "COPILOT_ACCOUNTS_ENTERPRISE_UNSUPPORTED";
65
+ COPILOT_ACCOUNTS_ROUTE_BLOCKED: "COPILOT_ACCOUNTS_ROUTE_BLOCKED";
66
+ COPILOT_ACCOUNTS_EVIDENCE_INCOMPLETE: "COPILOT_ACCOUNTS_EVIDENCE_INCOMPLETE";
67
+ COPILOT_ACCOUNTS_LIMIT: "COPILOT_ACCOUNTS_LIMIT";
68
+ COPILOT_ACCOUNTS_AUTH_FAILED: "COPILOT_ACCOUNTS_AUTH_FAILED";
69
+ COPILOT_ACCOUNTS_AUTH_UNAVAILABLE: "COPILOT_ACCOUNTS_AUTH_UNAVAILABLE";
70
+ COPILOT_ACCOUNTS_ACTIVE_REMOVE_BLOCKED: "COPILOT_ACCOUNTS_ACTIVE_REMOVE_BLOCKED";
71
+ COPILOT_ACCOUNTS_REMOVE_FAILED: "COPILOT_ACCOUNTS_REMOVE_FAILED";
72
+ COPILOT_ACCOUNTS_DISPOSED: "COPILOT_ACCOUNTS_DISPOSED";
73
+ }>>;
74
+ }, z.core.$strict>;
75
+ }, z.core.$strict>;
76
+ export interface SessionAccountView {
77
+ readonly source: 'global' | 'session';
78
+ readonly accountId: string;
79
+ readonly globalAccountId: string;
80
+ readonly runningAccountId?: string;
81
+ readonly accounts: CopilotAccountsView;
82
+ }
83
+ export declare const TurnAccountViewSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
84
+ state: z.ZodLiteral<"unknown">;
85
+ }, z.core.$strict>, z.ZodObject<{
86
+ state: z.ZodLiteral<"recorded">;
87
+ accountId: z.ZodString;
88
+ source: z.ZodEnum<{
89
+ session: "session";
90
+ global: "global";
91
+ }>;
92
+ identity: z.ZodOptional<z.ZodObject<{
93
+ login: z.ZodString;
94
+ userId: z.ZodNumber;
95
+ }, z.core.$strict>>;
96
+ }, z.core.$strict>], "state">;
97
+ export type TurnAccountView = z.infer<typeof TurnAccountViewSchema>;
98
+ declare module '@deepseek-ai/dsh-typert-protocol' {
99
+ interface TypertRemoteNamespaceMap {
100
+ githubCopilotSessionAccount: {
101
+ get(agentId: string): Promise<RemoteResult<SessionAccountView>>;
102
+ set(agentId: string, accountId: string | null, revision: number): Promise<RemoteResult<SessionAccountView>>;
103
+ refreshIdentity(agentId: string): Promise<RemoteResult<SessionAccountView>>;
104
+ ensureIdentity(agentId: string): Promise<RemoteResult<SessionAccountView>>;
105
+ usage(agentId: string): Promise<RemoteResult<CopilotUsageView>>;
106
+ refreshUsage(agentId: string): Promise<RemoteResult<CopilotUsageView>>;
107
+ turn(agentId: string, turn: number): Promise<RemoteResult<TurnAccountView>>;
108
+ };
109
+ }
110
+ }
111
+ declare const contribution: TypertRemoteContribution;
112
+ export default contribution;
113
+ //# sourceMappingURL=session-accounts-remote.d.ts.map
@@ -0,0 +1,36 @@
1
+ import type { CopilotAccountIdentity } from './copilot-accounts-types.ts';
2
+ export declare const SESSION_ACCOUNTS_MAX = 2048;
3
+ export interface SessionAccountPreference {
4
+ readonly sessionId: string;
5
+ readonly accountId: string;
6
+ }
7
+ export interface SessionAccountSelection {
8
+ readonly accountId: string;
9
+ readonly source: 'global' | 'session';
10
+ }
11
+ export interface TurnAccountEvidence extends SessionAccountSelection {
12
+ readonly identity?: CopilotAccountIdentity;
13
+ }
14
+ interface Admission extends SessionAccountSelection {
15
+ readonly turn: number;
16
+ readonly signal: AbortSignal;
17
+ }
18
+ export declare function parseSessionAccounts(value: unknown): readonly SessionAccountPreference[];
19
+ export declare function resolveSessionAccount(sessionId: string, preferences: readonly SessionAccountPreference[], globalAccountId: string): SessionAccountSelection;
20
+ /** Active turns are never evicted; bounded historical evidence may become unknown. */
21
+ export declare class SessionAccountTurns {
22
+ private readonly active;
23
+ private readonly signals;
24
+ private readonly history;
25
+ admit(agent: object, turn: number, signal: AbortSignal, selection: SessionAccountSelection): Admission;
26
+ record(agent: object, turn: number, identity?: CopilotAccountIdentity): void;
27
+ current(agent: object): Admission | undefined;
28
+ forSignal(signal: AbortSignal): Admission | undefined;
29
+ evidence(agent: object, turn: number): TurnAccountEvidence | undefined;
30
+ end(agent: object, turn: number): void;
31
+ remove(agent: object): void;
32
+ clear(): void;
33
+ recordSignal(signal: AbortSignal, identity?: CopilotAccountIdentity): void;
34
+ }
35
+ export {};
36
+ //# sourceMappingURL=session-accounts.d.ts.map
@@ -1,10 +1,14 @@
1
1
  import type { ReactElement } from 'react';
2
2
  import type { TurnSelection } from './turn-selection.ts';
3
- export declare function TurnSelectionCard({ selection, locale, incomplete, readState, retry }: {
3
+ import type { TurnAccountView } from './session-accounts-remote.ts';
4
+ export declare function TurnSelectionCard({ selection, locale, incomplete, readState, retry, account, accountFailed, retryAccount }: {
4
5
  selection: TurnSelection;
5
6
  locale?: string;
6
7
  incomplete?: boolean;
7
8
  readState?: 'loading' | 'ready' | 'failed';
8
9
  retry?: () => void;
10
+ account?: TurnAccountView;
11
+ accountFailed?: boolean;
12
+ retryAccount?: () => void;
9
13
  }): ReactElement;
10
14
  //# sourceMappingURL=turn-selection-card.d.ts.map
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.103",
4
+ "version": "0.4.0-alpha.105",
5
5
  "publishConfig": {
6
6
  "access": "public",
7
7
  "registry": "https://registry.npmjs.org/",