dsh-github-copilot 0.4.0-alpha.102 → 0.4.0-alpha.104
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 +3 -1
- package/CHANGELOG.md +12 -0
- package/README.md +23 -11
- package/README.zh.md +21 -10
- package/deployment-baseline.json +22 -1
- package/docs/copilot-accounts.md +53 -23
- package/docs/copilot-usage.md +5 -3
- package/lib/client.js +322 -30
- package/lib/client.js.map +1 -1
- package/lib/index.js +912 -224
- package/lib/remote.js +67 -10
- package/lib/routed-web.js +1 -1
- package/lib/{search-routing-CqysPLve.js → search-routing-CHyF6TbO.js} +1 -1
- package/lib/types/config.d.ts +7 -2
- package/lib/types/copilot-accounts-host.d.ts +10 -2
- package/lib/types/copilot-usage-card.d.ts +17 -0
- package/lib/types/copilot-usage-host.d.ts +3 -0
- package/lib/types/preview-route.d.ts +1 -1
- package/lib/types/replay-recovery-host.d.ts +2 -2
- package/lib/types/session-accounts-controller.d.ts +18 -0
- package/lib/types/session-accounts-host.d.ts +32 -0
- package/lib/types/session-accounts-remote.d.ts +106 -0
- package/lib/types/session-accounts.d.ts +36 -0
- package/lib/types/turn-selection-card.d.ts +5 -1
- package/package.json +1 -1
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$
|
|
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$
|
|
88
|
+
const contribution$6 = {
|
|
89
89
|
package: "dsh-github-copilot",
|
|
90
90
|
descriptors: [{
|
|
91
91
|
id: "dsh-github-copilot:githubCopilotSearchRouting.providers",
|
|
@@ -210,7 +210,7 @@ const CopilotUsageViewSchema = z.object({
|
|
|
210
210
|
if (view.remaining !== void 0 && view.percentUsed !== void 0 && Math.abs((1 - view.remaining / view.limit) * 100 - view.percentUsed) > 1) invalid();
|
|
211
211
|
}
|
|
212
212
|
});
|
|
213
|
-
const contribution$
|
|
213
|
+
const contribution$5 = {
|
|
214
214
|
package: "dsh-github-copilot",
|
|
215
215
|
descriptors: ["get", "refresh"].map((method) => ({
|
|
216
216
|
id: `dsh-github-copilot:githubCopilotUsage.${method}`,
|
|
@@ -337,7 +337,7 @@ const TurnSelectionSchema = z.discriminatedUnion("mode", [
|
|
|
337
337
|
]);
|
|
338
338
|
//#endregion
|
|
339
339
|
//#region lib/types/turn-selection-remote.js
|
|
340
|
-
const contribution$
|
|
340
|
+
const contribution$4 = {
|
|
341
341
|
package: "dsh-github-copilot",
|
|
342
342
|
descriptors: [{
|
|
343
343
|
id: "dsh-github-copilot:githubCopilotTurnSelection.get",
|
|
@@ -373,14 +373,14 @@ const ReplayRecoveryViewSchema = z.discriminatedUnion("state", [z.object({ state
|
|
|
373
373
|
}).strict()]);
|
|
374
374
|
//#endregion
|
|
375
375
|
//#region lib/types/replay-recovery-remote.js
|
|
376
|
-
const agent = {
|
|
376
|
+
const agent$1 = {
|
|
377
377
|
name: "agent",
|
|
378
378
|
wire: "agentId",
|
|
379
379
|
source: "lookup",
|
|
380
380
|
lookup: "agent",
|
|
381
381
|
codec: strictRemoteCodec("@deepseek-ai/dsh-session/types#SessionId", z.string().min(1).max(256))
|
|
382
382
|
};
|
|
383
|
-
const contribution$
|
|
383
|
+
const contribution$3 = {
|
|
384
384
|
package: "dsh-github-copilot",
|
|
385
385
|
descriptors: [
|
|
386
386
|
{
|
|
@@ -389,7 +389,7 @@ const contribution$2 = {
|
|
|
389
389
|
service: "githubCopilotReplayRecovery",
|
|
390
390
|
method: "get",
|
|
391
391
|
invocation: { kind: "direct" },
|
|
392
|
-
parameters: [agent],
|
|
392
|
+
parameters: [agent$1],
|
|
393
393
|
result: strictRemoteCodec("dsh-github-copilot#ReplayRecoveryView", ReplayRecoveryViewSchema)
|
|
394
394
|
},
|
|
395
395
|
{
|
|
@@ -399,7 +399,7 @@ const contribution$2 = {
|
|
|
399
399
|
method: "authorize",
|
|
400
400
|
invocation: { kind: "direct" },
|
|
401
401
|
parameters: [
|
|
402
|
-
agent,
|
|
402
|
+
agent$1,
|
|
403
403
|
{
|
|
404
404
|
name: "revision",
|
|
405
405
|
wire: "revision",
|
|
@@ -422,7 +422,7 @@ const contribution$2 = {
|
|
|
422
422
|
method: "setEnabled",
|
|
423
423
|
invocation: { kind: "direct" },
|
|
424
424
|
parameters: [
|
|
425
|
-
agent,
|
|
425
|
+
agent$1,
|
|
426
426
|
{
|
|
427
427
|
name: "revision",
|
|
428
428
|
wire: "revision",
|
|
@@ -484,7 +484,7 @@ const CopilotAccountsViewSchema = z.object({
|
|
|
484
484
|
if (row.identity !== void 0 && !row.configured) invalid();
|
|
485
485
|
}
|
|
486
486
|
});
|
|
487
|
-
const contribution$
|
|
487
|
+
const contribution$2 = {
|
|
488
488
|
package: "dsh-github-copilot",
|
|
489
489
|
descriptors: [
|
|
490
490
|
"get",
|
|
@@ -515,6 +515,62 @@ const contribution$1 = {
|
|
|
515
515
|
}))
|
|
516
516
|
};
|
|
517
517
|
//#endregion
|
|
518
|
+
//#region lib/types/session-accounts-remote.js
|
|
519
|
+
const SessionAccountViewSchema = z.object({
|
|
520
|
+
source: z.enum(["global", "session"]),
|
|
521
|
+
accountId: CopilotAccountIdSchema,
|
|
522
|
+
globalAccountId: CopilotAccountIdSchema,
|
|
523
|
+
runningAccountId: CopilotAccountIdSchema.optional(),
|
|
524
|
+
accounts: CopilotAccountsViewSchema
|
|
525
|
+
}).strict().refine((view) => view.accountId === view.accounts.activeAccountId, { message: "Session account identity mismatch" });
|
|
526
|
+
const TurnAccountViewSchema = z.discriminatedUnion("state", [z.object({ state: z.literal("unknown") }).strict(), z.object({
|
|
527
|
+
state: z.literal("recorded"),
|
|
528
|
+
accountId: CopilotAccountIdSchema,
|
|
529
|
+
source: z.enum(["global", "session"]),
|
|
530
|
+
identity: CopilotAccountsViewSchema.shape.accounts.element.shape.identity
|
|
531
|
+
}).strict()]);
|
|
532
|
+
const agent = {
|
|
533
|
+
name: "agent",
|
|
534
|
+
wire: "agentId",
|
|
535
|
+
source: "lookup",
|
|
536
|
+
lookup: "agent",
|
|
537
|
+
codec: strictRemoteCodec("@deepseek-ai/dsh-session/types#SessionId", z.string().min(1).max(256))
|
|
538
|
+
};
|
|
539
|
+
const contribution$1 = {
|
|
540
|
+
package: "dsh-github-copilot",
|
|
541
|
+
descriptors: [
|
|
542
|
+
"get",
|
|
543
|
+
"set",
|
|
544
|
+
"refreshIdentity",
|
|
545
|
+
"usage",
|
|
546
|
+
"refreshUsage",
|
|
547
|
+
"turn"
|
|
548
|
+
].map((method) => ({
|
|
549
|
+
id: `dsh-github-copilot:githubCopilotSessionAccount.${method}`,
|
|
550
|
+
namespace: "githubCopilotSessionAccount",
|
|
551
|
+
service: "githubCopilotSessionAccount",
|
|
552
|
+
method,
|
|
553
|
+
invocation: { kind: "direct" },
|
|
554
|
+
parameters: [agent, ...method === "set" ? [{
|
|
555
|
+
name: "accountId",
|
|
556
|
+
wire: "accountId",
|
|
557
|
+
source: "json",
|
|
558
|
+
codec: strictRemoteCodec("dsh-github-copilot#SessionAccountChoice", CopilotAccountIdSchema.nullable())
|
|
559
|
+
}, {
|
|
560
|
+
name: "revision",
|
|
561
|
+
wire: "revision",
|
|
562
|
+
source: "json",
|
|
563
|
+
codec: strictRemoteCodec("dsh-github-copilot#SessionAccountRevision", z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER))
|
|
564
|
+
}] : method === "turn" ? [{
|
|
565
|
+
name: "turn",
|
|
566
|
+
wire: "turn",
|
|
567
|
+
source: "json",
|
|
568
|
+
codec: strictRemoteCodec("dsh-github-copilot#SessionAccountTurn", z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER))
|
|
569
|
+
}] : []],
|
|
570
|
+
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)
|
|
571
|
+
}))
|
|
572
|
+
};
|
|
573
|
+
//#endregion
|
|
518
574
|
//#region lib/types/remote.js
|
|
519
575
|
/**
|
|
520
576
|
* Client-safe Remote contribution for the plugin-owned authorization bridge.
|
|
@@ -723,6 +779,7 @@ const contribution = {
|
|
|
723
779
|
parameters: [],
|
|
724
780
|
result: strictRemoteCodec(GITHUB_COPILOT_MIGRATION_STATUS_TYPE_SYMBOL, GitHubCopilotMigrationStatusSchema)
|
|
725
781
|
},
|
|
782
|
+
...contribution$7.descriptors,
|
|
726
783
|
...contribution$6.descriptors,
|
|
727
784
|
...contribution$5.descriptors,
|
|
728
785
|
...contribution$4.descriptors,
|
package/lib/routed-web.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "./copilot-identity-DRZY_d2X.js";
|
|
2
|
-
import {
|
|
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 {
|
|
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 };
|
package/lib/types/config.d.ts
CHANGED
|
@@ -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>>;
|
|
@@ -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,6 +15,7 @@ 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;
|
|
20
21
|
private readonly listeners;
|
|
@@ -32,16 +33,23 @@ export declare class CopilotAccountsHost {
|
|
|
32
33
|
isActiveRecord(key: string): boolean;
|
|
33
34
|
credentialChanged(key: string): void;
|
|
34
35
|
onChanged(listener: () => void): () => void;
|
|
36
|
+
cachedIdentity(accountId: string): CopilotAccountIdentity | undefined;
|
|
35
37
|
capture(accountId?: string): CopilotAccountBinding;
|
|
36
|
-
|
|
38
|
+
/** A frozen turn owns a record, not the mutable profile default. */
|
|
39
|
+
captureAccount(accountId: string): CopilotAccountBinding;
|
|
40
|
+
validateAccount(binding: CopilotAccountBinding): Promise<void>;
|
|
41
|
+
acquire(signal?: AbortSignal, requireManaged?: boolean, accountId?: string): CopilotAccountLease;
|
|
37
42
|
acquireCanonicalAuthorization(): CopilotAccountLease;
|
|
38
43
|
private routeDiagnostic;
|
|
39
44
|
private busy;
|
|
40
45
|
private membership;
|
|
41
46
|
get(): Promise<CopilotAccountsView>;
|
|
47
|
+
private accountView;
|
|
42
48
|
private identity;
|
|
43
49
|
private fetchIdentity;
|
|
44
50
|
refreshIdentity(): Promise<CopilotAccountsView>;
|
|
51
|
+
viewForAccount(accountId: string): Promise<CopilotAccountsView>;
|
|
52
|
+
refreshIdentityFor(accountId: string): Promise<CopilotAccountsView>;
|
|
45
53
|
private validateModels;
|
|
46
54
|
private assertIdentityCurrent;
|
|
47
55
|
switchAccount(accountId: string, expectedRevision: number): Promise<CopilotAccountsView>;
|
|
@@ -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<{
|
|
@@ -24,6 +25,22 @@ export interface CopilotUsageCardProps {
|
|
|
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
|
|
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,18 @@
|
|
|
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
|
+
private readUsage;
|
|
14
|
+
usage(agent: Agent): Promise<CopilotUsageView>;
|
|
15
|
+
refreshUsage(agent: Agent): Promise<CopilotUsageView>;
|
|
16
|
+
turn(agent: Agent, turn: number): TurnAccountView;
|
|
17
|
+
}
|
|
18
|
+
//# 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,106 @@
|
|
|
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_CHANGED: "COPILOT_ACCOUNTS_IDENTITY_CHANGED";
|
|
57
|
+
COPILOT_ACCOUNTS_DUPLICATE: "COPILOT_ACCOUNTS_DUPLICATE";
|
|
58
|
+
COPILOT_ACCOUNTS_ENTERPRISE_UNSUPPORTED: "COPILOT_ACCOUNTS_ENTERPRISE_UNSUPPORTED";
|
|
59
|
+
COPILOT_ACCOUNTS_ROUTE_BLOCKED: "COPILOT_ACCOUNTS_ROUTE_BLOCKED";
|
|
60
|
+
COPILOT_ACCOUNTS_EVIDENCE_INCOMPLETE: "COPILOT_ACCOUNTS_EVIDENCE_INCOMPLETE";
|
|
61
|
+
COPILOT_ACCOUNTS_LIMIT: "COPILOT_ACCOUNTS_LIMIT";
|
|
62
|
+
COPILOT_ACCOUNTS_AUTH_FAILED: "COPILOT_ACCOUNTS_AUTH_FAILED";
|
|
63
|
+
COPILOT_ACCOUNTS_AUTH_UNAVAILABLE: "COPILOT_ACCOUNTS_AUTH_UNAVAILABLE";
|
|
64
|
+
COPILOT_ACCOUNTS_ACTIVE_REMOVE_BLOCKED: "COPILOT_ACCOUNTS_ACTIVE_REMOVE_BLOCKED";
|
|
65
|
+
COPILOT_ACCOUNTS_REMOVE_FAILED: "COPILOT_ACCOUNTS_REMOVE_FAILED";
|
|
66
|
+
COPILOT_ACCOUNTS_DISPOSED: "COPILOT_ACCOUNTS_DISPOSED";
|
|
67
|
+
}>>;
|
|
68
|
+
}, z.core.$strict>;
|
|
69
|
+
}, z.core.$strict>;
|
|
70
|
+
export interface SessionAccountView {
|
|
71
|
+
readonly source: 'global' | 'session';
|
|
72
|
+
readonly accountId: string;
|
|
73
|
+
readonly globalAccountId: string;
|
|
74
|
+
readonly runningAccountId?: string;
|
|
75
|
+
readonly accounts: CopilotAccountsView;
|
|
76
|
+
}
|
|
77
|
+
export declare const TurnAccountViewSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
78
|
+
state: z.ZodLiteral<"unknown">;
|
|
79
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
80
|
+
state: z.ZodLiteral<"recorded">;
|
|
81
|
+
accountId: z.ZodString;
|
|
82
|
+
source: z.ZodEnum<{
|
|
83
|
+
session: "session";
|
|
84
|
+
global: "global";
|
|
85
|
+
}>;
|
|
86
|
+
identity: z.ZodOptional<z.ZodObject<{
|
|
87
|
+
login: z.ZodString;
|
|
88
|
+
userId: z.ZodNumber;
|
|
89
|
+
}, z.core.$strict>>;
|
|
90
|
+
}, z.core.$strict>], "state">;
|
|
91
|
+
export type TurnAccountView = z.infer<typeof TurnAccountViewSchema>;
|
|
92
|
+
declare module '@deepseek-ai/dsh-typert-protocol' {
|
|
93
|
+
interface TypertRemoteNamespaceMap {
|
|
94
|
+
githubCopilotSessionAccount: {
|
|
95
|
+
get(agentId: string): Promise<RemoteResult<SessionAccountView>>;
|
|
96
|
+
set(agentId: string, accountId: string | null, revision: number): Promise<RemoteResult<SessionAccountView>>;
|
|
97
|
+
refreshIdentity(agentId: string): Promise<RemoteResult<SessionAccountView>>;
|
|
98
|
+
usage(agentId: string): Promise<RemoteResult<CopilotUsageView>>;
|
|
99
|
+
refreshUsage(agentId: string): Promise<RemoteResult<CopilotUsageView>>;
|
|
100
|
+
turn(agentId: string, turn: number): Promise<RemoteResult<TurnAccountView>>;
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
declare const contribution: TypertRemoteContribution;
|
|
105
|
+
export default contribution;
|
|
106
|
+
//# 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
|
-
|
|
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.
|
|
4
|
+
"version": "0.4.0-alpha.104",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
7
7
|
"registry": "https://registry.npmjs.org/",
|