dsh-github-copilot 0.4.0-alpha.100
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 +312 -0
- package/CHANGELOG.md +479 -0
- package/CONTRIBUTING.md +46 -0
- package/LICENSE +21 -0
- package/README.md +203 -0
- package/README.zh.md +202 -0
- package/SECURITY.md +29 -0
- package/cordis.patch.yml +16 -0
- package/deployment-baseline.json +1299 -0
- package/docs/agent-readiness.md +110 -0
- package/docs/auto-task-routing.md +234 -0
- package/docs/automatic-model-routing.md +205 -0
- package/docs/copilot-accounts.md +236 -0
- package/docs/copilot-compaction.md +120 -0
- package/docs/copilot-usage.md +125 -0
- package/docs/dual-model.md +66 -0
- package/docs/image-input-compatibility.md +64 -0
- package/docs/images/copilot-accounts-credits.png +0 -0
- package/docs/images/copilot-accounts.png +0 -0
- package/docs/images/copilot-model-preferences.png +0 -0
- package/docs/images/copilot-search-routing.png +0 -0
- package/docs/images/dual-model-desktop.png +0 -0
- package/docs/images/dual-model-mobile.png +0 -0
- package/docs/images/dual-model-provenance.json +35 -0
- package/docs/images/parent-model-follow.png +0 -0
- package/docs/manual-compaction-recovery.md +64 -0
- package/docs/model-compatibility-acceptance.md +164 -0
- package/docs/npm-distribution.md +149 -0
- package/docs/official-first-016-alpha2.md +66 -0
- package/docs/official-first-020-rc1.md +32 -0
- package/docs/official-first-020-rc2.md +16 -0
- package/docs/session-search-routing.md +133 -0
- package/docs/single-route-migration.md +130 -0
- package/docs/web-lifecycle-rc2.md +55 -0
- package/lib/client.js +10822 -0
- package/lib/client.js.map +1 -0
- package/lib/copilot-identity-DRZY_d2X.js +15 -0
- package/lib/index.js +11689 -0
- package/lib/manual-compaction-recovery.js +315 -0
- package/lib/remote.js +734 -0
- package/lib/request-budget-DLY_aRq0.js +87 -0
- package/lib/routed-web.js +120 -0
- package/lib/search-routing-CqysPLve.js +792 -0
- package/lib/types/account-model-auth.d.ts +15 -0
- package/lib/types/account-model-catalog.d.ts +70 -0
- package/lib/types/account-model-source.d.ts +85 -0
- package/lib/types/agent-compaction.d.ts +4 -0
- package/lib/types/authorization-controller.d.ts +119 -0
- package/lib/types/auto-assessment-evidence.d.ts +46 -0
- package/lib/types/auto-model-host.d.ts +27 -0
- package/lib/types/auto-model-intent.d.ts +36 -0
- package/lib/types/auto-model-presentation.d.ts +57 -0
- package/lib/types/auto-model-routing.d.ts +59 -0
- package/lib/types/auto-selection-explanation.d.ts +9 -0
- package/lib/types/auto-task-assessment.d.ts +47 -0
- package/lib/types/auto-task-classifier.d.ts +9 -0
- package/lib/types/background-compaction.d.ts +30 -0
- package/lib/types/client.d.ts +115 -0
- package/lib/types/compact-account.d.ts +42 -0
- package/lib/types/compaction-pressure.d.ts +23 -0
- package/lib/types/compatibility.d.ts +17 -0
- package/lib/types/config.d.ts +89 -0
- package/lib/types/content-file.d.ts +10 -0
- package/lib/types/context-evidence-ui.d.ts +11 -0
- package/lib/types/context-evidence.d.ts +108 -0
- package/lib/types/context-usage.d.ts +4 -0
- package/lib/types/copilot-account-presentation.d.ts +7 -0
- package/lib/types/copilot-accounts-card.d.ts +30 -0
- package/lib/types/copilot-accounts-host.d.ts +75 -0
- package/lib/types/copilot-accounts-remote.d.ts +77 -0
- package/lib/types/copilot-accounts-types.d.ts +42 -0
- package/lib/types/copilot-auth.d.ts +25 -0
- package/lib/types/copilot-grant.d.ts +11 -0
- package/lib/types/copilot-identity.d.ts +11 -0
- package/lib/types/copilot-request.d.ts +11 -0
- package/lib/types/copilot-stream-liveness.d.ts +23 -0
- package/lib/types/copilot-usage-card.d.ts +30 -0
- package/lib/types/copilot-usage-host.d.ts +58 -0
- package/lib/types/copilot-usage-normalize.d.ts +9 -0
- package/lib/types/copilot-usage-remote.d.ts +63 -0
- package/lib/types/copilot-usage-types.d.ts +20 -0
- package/lib/types/copilot-usage-ui.d.ts +4 -0
- package/lib/types/current-provider.d.ts +59 -0
- package/lib/types/deepseek-search-fallback.d.ts +11 -0
- package/lib/types/dual-model-host.d.ts +119 -0
- package/lib/types/dual-model-remote.d.ts +63 -0
- package/lib/types/dual-model-types.d.ts +34 -0
- package/lib/types/external-link.d.ts +3 -0
- package/lib/types/failure.d.ts +38 -0
- package/lib/types/http.d.ts +48 -0
- package/lib/types/image-input-admission.d.ts +5 -0
- package/lib/types/index.d.ts +39 -0
- package/lib/types/manual-compaction-recovery.d.ts +52 -0
- package/lib/types/migration-status.d.ts +50 -0
- package/lib/types/model-exclusions.d.ts +15 -0
- package/lib/types/model-preferences-card.d.ts +9 -0
- package/lib/types/model-protocol.d.ts +31 -0
- package/lib/types/native-select-style.d.ts +4 -0
- package/lib/types/parent-model-follow-card.d.ts +41 -0
- package/lib/types/parent-model-follow.d.ts +44 -0
- package/lib/types/pi-provider-bridge.d.ts +22 -0
- package/lib/types/plan.d.ts +148 -0
- package/lib/types/pre-step-pressure.d.ts +8 -0
- package/lib/types/preview-provider.d.ts +66 -0
- package/lib/types/preview-route.d.ts +74 -0
- package/lib/types/probe.d.ts +39 -0
- package/lib/types/reasoning-presentation.d.ts +55 -0
- package/lib/types/remote-codec.d.ts +10 -0
- package/lib/types/remote.d.ts +199 -0
- package/lib/types/replay-recovery-host.d.ts +28 -0
- package/lib/types/replay-recovery-remote.d.ts +14 -0
- package/lib/types/replay-recovery-types.d.ts +24 -0
- package/lib/types/replay-recovery-ui.d.ts +26 -0
- package/lib/types/replay-recovery.d.ts +17 -0
- package/lib/types/request-body-evidence.d.ts +34 -0
- package/lib/types/request-body-timeout-marker.d.ts +2 -0
- package/lib/types/request-body-timeout.d.ts +4 -0
- package/lib/types/request-budget.d.ts +58 -0
- package/lib/types/request-upload-evidence.d.ts +23 -0
- package/lib/types/response-error-body.d.ts +3 -0
- package/lib/types/responses-reasoning-text.d.ts +24 -0
- package/lib/types/responses-reasoning.d.ts +7 -0
- package/lib/types/responses-replay-compat.d.ts +30 -0
- package/lib/types/route-ownership.d.ts +70 -0
- package/lib/types/routed-web.d.ts +50 -0
- package/lib/types/search-backend.d.ts +16 -0
- package/lib/types/search-routing-host.d.ts +19 -0
- package/lib/types/search-routing-policy.d.ts +18 -0
- package/lib/types/search-routing-remote.d.ts +20 -0
- package/lib/types/search-routing.d.ts +43 -0
- package/lib/types/search-tool-routing.d.ts +22 -0
- package/lib/types/serialize.d.ts +106 -0
- package/lib/types/settings-reader.d.ts +16 -0
- package/lib/types/sse.d.ts +28 -0
- package/lib/types/temporary-models.d.ts +25 -0
- package/lib/types/tool-schema-compat.d.ts +17 -0
- package/lib/types/traditional-search.d.ts +17 -0
- package/lib/types/turn-model-provenance.d.ts +45 -0
- package/lib/types/turn-selection-card.d.ts +10 -0
- package/lib/types/turn-selection-host.d.ts +11 -0
- package/lib/types/turn-selection-remote.d.ts +13 -0
- package/lib/types/turn-selection.d.ts +119 -0
- package/lib/types/turn-usage-evidence.d.ts +66 -0
- package/lib/types/turn-usage-notice.d.ts +7 -0
- package/lib/types/types.d.ts +69 -0
- package/lib/types/usage.d.ts +26 -0
- package/lib/types/watchdog.d.ts +22 -0
- package/lib/types/web-delegate.d.ts +12 -0
- package/lib/types/web-search-routing-card.d.ts +16 -0
- package/lib/types/web-search-routing-config.d.ts +12 -0
- package/lib/types/wire-anthropic.d.ts +37 -0
- package/lib/types/wire.d.ts +56 -0
- package/lib/web-delegate.js +9 -0
- package/output/auto-model-mockup/index.html +207 -0
- package/package.json +236 -0
- package/scripts/check-search-composition.mjs +191 -0
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import type { AutoModelPreference } from './copilot-identity.ts';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import type { AutoSelectionExplanation } from './auto-model-routing.ts';
|
|
4
|
+
export declare const TurnSelectionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
5
|
+
mode: z.ZodLiteral<"unknown">;
|
|
6
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
7
|
+
mode: z.ZodLiteral<"manual">;
|
|
8
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
9
|
+
mode: z.ZodLiteral<"auto">;
|
|
10
|
+
preference: z.ZodEnum<{
|
|
11
|
+
efficiency: "efficiency";
|
|
12
|
+
balance: "balance";
|
|
13
|
+
intelligence: "intelligence";
|
|
14
|
+
}>;
|
|
15
|
+
reason: z.ZodEnum<{
|
|
16
|
+
"short-text-turn": "short-text-turn";
|
|
17
|
+
"standard-turn": "standard-turn";
|
|
18
|
+
"large-structured-turn": "large-structured-turn";
|
|
19
|
+
"image-capability": "image-capability";
|
|
20
|
+
}>;
|
|
21
|
+
candidateCount: z.ZodNumber;
|
|
22
|
+
fittingCandidateCount: z.ZodOptional<z.ZodNumber>;
|
|
23
|
+
explanation: z.ZodOptional<z.ZodObject<{
|
|
24
|
+
assessment: z.ZodObject<{
|
|
25
|
+
demand: z.ZodEnum<{
|
|
26
|
+
unknown: "unknown";
|
|
27
|
+
simple: "simple";
|
|
28
|
+
routine: "routine";
|
|
29
|
+
complex: "complex";
|
|
30
|
+
}>;
|
|
31
|
+
signals: z.ZodArray<z.ZodEnum<{
|
|
32
|
+
reasoning: "reasoning";
|
|
33
|
+
"context-omitted": "context-omitted";
|
|
34
|
+
"isolated-greeting": "isolated-greeting";
|
|
35
|
+
"bounded-transformation": "bounded-transformation";
|
|
36
|
+
investigation: "investigation";
|
|
37
|
+
continuation: "continuation";
|
|
38
|
+
"insufficient-evidence": "insufficient-evidence";
|
|
39
|
+
}>>;
|
|
40
|
+
source: z.ZodEnum<{
|
|
41
|
+
local: "local";
|
|
42
|
+
semantic: "semantic";
|
|
43
|
+
}>;
|
|
44
|
+
diagnostic: z.ZodOptional<z.ZodEnum<{
|
|
45
|
+
unavailable: "unavailable";
|
|
46
|
+
failed: "failed";
|
|
47
|
+
"context-omitted": "context-omitted";
|
|
48
|
+
disabled: "disabled";
|
|
49
|
+
"invalid-result": "invalid-result";
|
|
50
|
+
timeout: "timeout";
|
|
51
|
+
}>>;
|
|
52
|
+
semantic: z.ZodOptional<z.ZodObject<{
|
|
53
|
+
modelId: z.ZodOptional<z.ZodString>;
|
|
54
|
+
budgetMs: z.ZodNumber;
|
|
55
|
+
elapsedMs: z.ZodNumber;
|
|
56
|
+
stage: z.ZodEnum<{
|
|
57
|
+
preparing: "preparing";
|
|
58
|
+
"model-selected": "model-selected";
|
|
59
|
+
"adapter-started": "adapter-started";
|
|
60
|
+
"text-received": "text-received";
|
|
61
|
+
finished: "finished";
|
|
62
|
+
}>;
|
|
63
|
+
adapterStartedMs: z.ZodOptional<z.ZodNumber>;
|
|
64
|
+
firstTextMs: z.ZodOptional<z.ZodNumber>;
|
|
65
|
+
nativeFinish: z.ZodOptional<z.ZodEnum<{
|
|
66
|
+
stop: "stop";
|
|
67
|
+
"non-stop": "non-stop";
|
|
68
|
+
}>>;
|
|
69
|
+
outputCharacters: z.ZodNumber;
|
|
70
|
+
validation: z.ZodEnum<{
|
|
71
|
+
invalid: "invalid";
|
|
72
|
+
"not-validated": "not-validated";
|
|
73
|
+
valid: "valid";
|
|
74
|
+
"context-omitted": "context-omitted";
|
|
75
|
+
}>;
|
|
76
|
+
}, z.core.$strict>>;
|
|
77
|
+
}, z.core.$strict>;
|
|
78
|
+
targetCategory: z.ZodEnum<{
|
|
79
|
+
powerful: "powerful";
|
|
80
|
+
versatile: "versatile";
|
|
81
|
+
lightweight: "lightweight";
|
|
82
|
+
}>;
|
|
83
|
+
selectedCategory: z.ZodEnum<{
|
|
84
|
+
unknown: "unknown";
|
|
85
|
+
powerful: "powerful";
|
|
86
|
+
versatile: "versatile";
|
|
87
|
+
lightweight: "lightweight";
|
|
88
|
+
}>;
|
|
89
|
+
categoryCandidateCount: z.ZodNumber;
|
|
90
|
+
method: z.ZodEnum<{
|
|
91
|
+
continuity: "continuity";
|
|
92
|
+
"equal-distribution": "equal-distribution";
|
|
93
|
+
"only-candidate": "only-candidate";
|
|
94
|
+
"no-fit": "no-fit";
|
|
95
|
+
}>;
|
|
96
|
+
fallback: z.ZodBoolean;
|
|
97
|
+
}, z.core.$strict>>;
|
|
98
|
+
}, z.core.$strict>], "mode">;
|
|
99
|
+
export type TurnSelection = {
|
|
100
|
+
readonly mode: 'unknown';
|
|
101
|
+
} | {
|
|
102
|
+
readonly mode: 'manual';
|
|
103
|
+
} | {
|
|
104
|
+
readonly mode: 'auto';
|
|
105
|
+
readonly preference: AutoModelPreference;
|
|
106
|
+
readonly reason: 'short-text-turn' | 'standard-turn' | 'large-structured-turn' | 'image-capability';
|
|
107
|
+
readonly candidateCount: number;
|
|
108
|
+
readonly fittingCandidateCount?: number;
|
|
109
|
+
readonly explanation?: AutoSelectionExplanation;
|
|
110
|
+
};
|
|
111
|
+
/** Ephemeral decision evidence only; never session content, model usage or credentials. */
|
|
112
|
+
export declare class TurnSelectionStore {
|
|
113
|
+
private readonly agents;
|
|
114
|
+
record(agent: object, turn: number, selection: TurnSelection): void;
|
|
115
|
+
get(agent: object, turn: number): TurnSelection;
|
|
116
|
+
remove(agent: object): void;
|
|
117
|
+
clear(): void;
|
|
118
|
+
}
|
|
119
|
+
//# sourceMappingURL=turn-selection.d.ts.map
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
export declare const TURN_USAGE_EVIDENCE_KEY = "github-copilot-turn-usage-evidence";
|
|
2
|
+
export interface TimeoutUsageDetail {
|
|
3
|
+
readonly step?: number;
|
|
4
|
+
readonly seq?: number;
|
|
5
|
+
readonly recovered: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface TurnUsageEvidence {
|
|
8
|
+
readonly ended: boolean;
|
|
9
|
+
readonly hasStart: boolean;
|
|
10
|
+
readonly localPreDispatchBlocks: number;
|
|
11
|
+
readonly unreportedAttempts: number;
|
|
12
|
+
readonly requestBodyTimeouts?: number;
|
|
13
|
+
readonly timeoutDetails?: readonly TimeoutUsageDetail[];
|
|
14
|
+
}
|
|
15
|
+
interface PendingRetry {
|
|
16
|
+
readonly index: number;
|
|
17
|
+
readonly step: number;
|
|
18
|
+
readonly seq: number;
|
|
19
|
+
readonly phase: 'failed' | 'scheduled' | 'started';
|
|
20
|
+
readonly retryId?: string;
|
|
21
|
+
readonly retry?: number;
|
|
22
|
+
}
|
|
23
|
+
interface State {
|
|
24
|
+
readonly turn: number;
|
|
25
|
+
readonly value: TurnUsageEvidence;
|
|
26
|
+
readonly pending?: PendingRetry;
|
|
27
|
+
}
|
|
28
|
+
interface Match {
|
|
29
|
+
readonly event: unknown;
|
|
30
|
+
}
|
|
31
|
+
interface Context {
|
|
32
|
+
readonly state?: State;
|
|
33
|
+
readonly matches: readonly Match[];
|
|
34
|
+
}
|
|
35
|
+
interface LocationData {
|
|
36
|
+
readonly kind: 'turn';
|
|
37
|
+
readonly turn: number;
|
|
38
|
+
readonly key: typeof TURN_USAGE_EVIDENCE_KEY;
|
|
39
|
+
readonly value: TurnUsageEvidence;
|
|
40
|
+
}
|
|
41
|
+
export declare function isTurnUsageEvidence(value: unknown): value is TurnUsageEvidence;
|
|
42
|
+
export interface TurnUsageDiagnostic {
|
|
43
|
+
readonly localPreDispatchBlocks: number;
|
|
44
|
+
readonly unreportedAttempts: number;
|
|
45
|
+
readonly incompleteHistory: boolean;
|
|
46
|
+
readonly requestBodyTimeouts?: number;
|
|
47
|
+
readonly timeoutDetails?: readonly TimeoutUsageDetail[];
|
|
48
|
+
}
|
|
49
|
+
/** Native completed-tail evidence gates the notice; native totals are never replaced. */
|
|
50
|
+
export declare function turnUsageDiagnostic(turn: number, tail: unknown, evidence: unknown, copilot: boolean): TurnUsageDiagnostic | undefined;
|
|
51
|
+
/** Bounded diagnostic evidence, not a competing usage total or billing projection. */
|
|
52
|
+
export declare const turnUsageEvidenceDefinition: {
|
|
53
|
+
kind: string;
|
|
54
|
+
stateVersion: number;
|
|
55
|
+
match(event: unknown): {
|
|
56
|
+
id: string;
|
|
57
|
+
role: "start" | "update";
|
|
58
|
+
} | null;
|
|
59
|
+
start(_context: Context, match: Match): State;
|
|
60
|
+
update(context: Context & {
|
|
61
|
+
readonly state: State;
|
|
62
|
+
}, match: Match): State;
|
|
63
|
+
buildLocationData(context: Context, scope: string, previous: LocationData | null): LocationData | null;
|
|
64
|
+
};
|
|
65
|
+
export {};
|
|
66
|
+
//# sourceMappingURL=turn-usage-evidence.d.ts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
import type { TurnUsageDiagnostic } from './turn-usage-evidence.ts';
|
|
3
|
+
export declare function TurnUsageNotice({ diagnostic, locale }: {
|
|
4
|
+
readonly diagnostic: TurnUsageDiagnostic;
|
|
5
|
+
readonly locale?: string;
|
|
6
|
+
}): ReactElement;
|
|
7
|
+
//# sourceMappingURL=turn-usage-notice.d.ts.map
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Provider-private wire types for the two search-capable protocols this
|
|
3
|
+
* package speaks, restricted to the shapes the capability probe consumes:
|
|
4
|
+
* the OpenAI Responses API `web_search_call` evidence item and the
|
|
5
|
+
* Anthropic-compatible Messages API `web_search_tool_result` block. The
|
|
6
|
+
* probe's verdict is structural — a reply containing the evidence item means
|
|
7
|
+
* the endpoint executed native search inside the request.
|
|
8
|
+
* @module dsh-github-copilot/types
|
|
9
|
+
*/
|
|
10
|
+
/** A `web_search_call` output item: evidence that the server ran the tool. */
|
|
11
|
+
export interface WebSearchCallItem {
|
|
12
|
+
readonly type: 'web_search_call';
|
|
13
|
+
readonly id?: string;
|
|
14
|
+
readonly status?: string;
|
|
15
|
+
readonly action?: {
|
|
16
|
+
readonly sources?: readonly ResponsesWebSearchSource[];
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
/** One Responses citation or search source. */
|
|
20
|
+
export interface ResponsesWebSearchSource {
|
|
21
|
+
readonly url?: string;
|
|
22
|
+
readonly title?: string;
|
|
23
|
+
readonly snippet?: string;
|
|
24
|
+
readonly published_at?: string;
|
|
25
|
+
}
|
|
26
|
+
/** One annotation on generated output text. */
|
|
27
|
+
export interface ResponsesAnnotation extends ResponsesWebSearchSource {
|
|
28
|
+
readonly type?: string;
|
|
29
|
+
}
|
|
30
|
+
/** Generated output text carrying optional URL citations. */
|
|
31
|
+
export interface ResponsesOutputText {
|
|
32
|
+
readonly type: 'output_text';
|
|
33
|
+
readonly text?: string;
|
|
34
|
+
readonly annotations?: readonly ResponsesAnnotation[];
|
|
35
|
+
}
|
|
36
|
+
/** A generated message in a non-streamed Responses envelope. */
|
|
37
|
+
export interface ResponsesMessageItem {
|
|
38
|
+
readonly type: 'message';
|
|
39
|
+
readonly content?: readonly ResponsesOutputText[];
|
|
40
|
+
}
|
|
41
|
+
/** Any output item consumed by the probe or traditional-search bridge. */
|
|
42
|
+
export type ResponseOutputItem = WebSearchCallItem | ResponsesMessageItem | {
|
|
43
|
+
readonly type: string;
|
|
44
|
+
};
|
|
45
|
+
/** The non-streamed Responses envelope the probe parses. */
|
|
46
|
+
export interface ResponsesResponse {
|
|
47
|
+
readonly id?: string;
|
|
48
|
+
readonly status?: string;
|
|
49
|
+
readonly output?: readonly ResponseOutputItem[];
|
|
50
|
+
}
|
|
51
|
+
/** A `web_search_result` item inside a `web_search_tool_result` block. */
|
|
52
|
+
export interface WebSearchResultItem {
|
|
53
|
+
readonly type: string;
|
|
54
|
+
readonly url: string;
|
|
55
|
+
}
|
|
56
|
+
/** A `web_search_tool_result` content block: the citeable result shape. */
|
|
57
|
+
export interface WebSearchToolResultBlock {
|
|
58
|
+
readonly type: 'web_search_tool_result';
|
|
59
|
+
readonly content?: readonly WebSearchResultItem[];
|
|
60
|
+
}
|
|
61
|
+
/** Any content block; only `web_search_tool_result` is consumed by the probe. */
|
|
62
|
+
export type ContentBlock = WebSearchToolResultBlock | {
|
|
63
|
+
readonly type: string;
|
|
64
|
+
};
|
|
65
|
+
/** The Messages response envelope the probe parses. */
|
|
66
|
+
export interface AnthropicResponse {
|
|
67
|
+
readonly content?: readonly ContentBlock[];
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Usage mapping for the inline wire path: Responses-API usage objects
|
|
3
|
+
* project onto the harness TokenUsage shape exactly like the pi-ai adapter
|
|
4
|
+
* (input minus cached, cache and reasoning split out as separate fields).
|
|
5
|
+
* @module dsh-github-copilot/usage
|
|
6
|
+
*/
|
|
7
|
+
import type { TokenUsage } from '@deepseek-ai/dsh-llm';
|
|
8
|
+
/** The usage object carried by `response.completed` / `response.incomplete` (snake_case wire fields). */
|
|
9
|
+
export interface WireUsage {
|
|
10
|
+
readonly input_tokens: number;
|
|
11
|
+
readonly output_tokens: number;
|
|
12
|
+
readonly total_tokens: number;
|
|
13
|
+
readonly input_tokens_details?: {
|
|
14
|
+
readonly cached_tokens?: number;
|
|
15
|
+
};
|
|
16
|
+
readonly output_tokens_details?: {
|
|
17
|
+
readonly reasoning_tokens?: number;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Map a wire usage object to the harness TokenUsage shape.
|
|
22
|
+
* @param usage - the provider usage object (snake_case wire fields).
|
|
23
|
+
* @returns the harness usage; cache and reasoning fields are omitted when absent.
|
|
24
|
+
*/
|
|
25
|
+
export declare function mapUsage(usage: WireUsage): TokenUsage;
|
|
26
|
+
//# sourceMappingURL=usage.d.ts.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Idle watchdog for the inline wire path: aborts when no data arrives for a
|
|
3
|
+
* configurable interval. The timeout resets on every `reset()` call, so a
|
|
4
|
+
* slow but alive stream never trips it.
|
|
5
|
+
* @module dsh-github-copilot/watchdog
|
|
6
|
+
*/
|
|
7
|
+
/** Abort-triggering idle timer. */
|
|
8
|
+
export declare class IdleWatchdog {
|
|
9
|
+
private readonly ms;
|
|
10
|
+
readonly signal: AbortSignal;
|
|
11
|
+
private readonly controller;
|
|
12
|
+
private timer;
|
|
13
|
+
/**
|
|
14
|
+
* @param ms - the idle bound in milliseconds.
|
|
15
|
+
*/
|
|
16
|
+
constructor(ms: number);
|
|
17
|
+
/** Restart the idle window. Call after every received event. */
|
|
18
|
+
reset(): void;
|
|
19
|
+
/** Stop the timer and release the signal. */
|
|
20
|
+
dispose(): void;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=watchdog.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
2
|
+
import type { WebRuntime } from '@deepseek-ai/dsh-web';
|
|
3
|
+
declare module '@deepseek-ai/cordis' {
|
|
4
|
+
interface Context {
|
|
5
|
+
githubCopilotOriginalWeb: WebRuntime;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
/** Expose the unchanged official service from the bundle's named web isolate. */
|
|
9
|
+
export declare const name = "github-copilot-web-delegate";
|
|
10
|
+
export declare const inject: string[];
|
|
11
|
+
export declare function apply(ctx: Context): void;
|
|
12
|
+
//# sourceMappingURL=web-delegate.d.ts.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Context as ClientContext } from '@deepseek-ai/cordis';
|
|
2
|
+
import type { ReactElement } from 'react';
|
|
3
|
+
interface SearchRoutingCardProps {
|
|
4
|
+
readonly settings: ClientContext['remote']['settings'];
|
|
5
|
+
readonly routing: ClientContext['remote']['githubCopilotSearchRouting'];
|
|
6
|
+
readonly settingsRevision?: {
|
|
7
|
+
previous: number;
|
|
8
|
+
next: number;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
/** Edit only explicit Copilot hosted-search leaves; provider routing remains a separate CAS. */
|
|
12
|
+
export declare function HostedSearchSettingsCard({ settings }: Pick<SearchRoutingCardProps, 'settings'>): ReactElement;
|
|
13
|
+
/** Save provider routing independently of account discovery and provider-specific model settings. */
|
|
14
|
+
export declare function WebSearchRoutingCard(props: SearchRoutingCardProps): ReactElement;
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=web-search-routing-card.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import z from '@deepseek-ai/schemastery';
|
|
2
|
+
import type { SettingsNamespace } from '@deepseek-ai/dsh-settings';
|
|
3
|
+
import type { WebSearchRoutingConfig } from './search-routing-policy.ts';
|
|
4
|
+
export { normalizeWebSearchRouting } from './search-routing-policy.ts';
|
|
5
|
+
export type { WebSearchRoutingConfig, NormalizedWebSearchRouting } from './search-routing-policy.ts';
|
|
6
|
+
/** Plugin-owned settings namespace for cross-provider web-search routing. */
|
|
7
|
+
export declare const WEB_SEARCH_ROUTING_SETTINGS_NAMESPACE: SettingsNamespace;
|
|
8
|
+
/** Sentinel that disables the default/fixed search backend. */
|
|
9
|
+
export declare const NO_DEFAULT_SEARCH_PROVIDER = "none";
|
|
10
|
+
/** User-facing routing settings; provider-specific credentials and models remain provider-owned. */
|
|
11
|
+
export declare const WebSearchRoutingConfigSchema: z<WebSearchRoutingConfig>;
|
|
12
|
+
//# sourceMappingURL=web-search-routing-config.d.ts.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Anthropic Messages wire for the inline web search plugin: intercepts an
|
|
3
|
+
* agent-loop model call, builds a Messages streaming request carrying the
|
|
4
|
+
* server-side `web_search_20250305` tool, and maps the Anthropic event
|
|
5
|
+
* stream onto the harness StreamChunk contract. Server-side search blocks
|
|
6
|
+
* (`server_tool_use` / `web_search_tool_result`) are skipped — the gateway
|
|
7
|
+
* executes the search inside the same request and the model answers from
|
|
8
|
+
* its results in the same turn. The generator NEVER throws; every failure
|
|
9
|
+
* becomes a finish chunk.
|
|
10
|
+
* @module dsh-github-copilot/wire-anthropic
|
|
11
|
+
*/
|
|
12
|
+
import type { GenerateOptions, StreamChunk, TokenUsage } from '@deepseek-ai/dsh-llm';
|
|
13
|
+
import type { SearchPlanCandidate } from './plan.ts';
|
|
14
|
+
import type { InlineConfig } from './config.ts';
|
|
15
|
+
import type { InlineHooks } from './wire.ts';
|
|
16
|
+
/** Map an Anthropic usage object onto the harness TokenUsage shape. */
|
|
17
|
+
export declare function mapAnthropicUsage(usage: {
|
|
18
|
+
readonly input_tokens?: number;
|
|
19
|
+
readonly output_tokens?: number;
|
|
20
|
+
readonly cache_read_input_tokens?: number;
|
|
21
|
+
readonly cache_creation_input_tokens?: number;
|
|
22
|
+
readonly output_tokens_details?: {
|
|
23
|
+
readonly thinking_tokens?: number;
|
|
24
|
+
};
|
|
25
|
+
}): TokenUsage;
|
|
26
|
+
/**
|
|
27
|
+
* Run one inline model call through the Anthropic Messages API with the
|
|
28
|
+
* server-side web search tool injected. Never throws; always ends with a
|
|
29
|
+
* finish chunk.
|
|
30
|
+
* @param request - the frozen agent-loop request.
|
|
31
|
+
* @param candidate - the settled endpoint facts (probe-verified).
|
|
32
|
+
* @param hooks - credential hooks.
|
|
33
|
+
* @param cfg - the current plugin configuration.
|
|
34
|
+
* @returns the StreamChunk stream for the loop's assembler.
|
|
35
|
+
*/
|
|
36
|
+
export declare function inlineAnthropicStream(request: GenerateOptions, candidate: SearchPlanCandidate, hooks: InlineHooks, cfg: InlineConfig): AsyncGenerator<StreamChunk>;
|
|
37
|
+
//# sourceMappingURL=wire-anthropic.d.ts.map
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The short-circuit wire: intercepts an agent-loop model call, builds a
|
|
3
|
+
* streaming request carrying the server-side `web_search` tool, and maps the
|
|
4
|
+
* SSE events onto the harness StreamChunk contract. The generator NEVER
|
|
5
|
+
* throws — every failure becomes a finish chunk, exactly what the loop's
|
|
6
|
+
* catch-less `for await` requires. {@link inlineWireStream} settles the plan
|
|
7
|
+
* first and then dispatches to the protocol the VERIFIED candidate speaks, so
|
|
8
|
+
* the wire always matches the probe verdict (never the chat route snapshot).
|
|
9
|
+
*
|
|
10
|
+
* Server-side `web_search_call` items are skipped: the gateway executes the
|
|
11
|
+
* search inside the same request and the model answers from its results in
|
|
12
|
+
* the same turn, so the harness never sees a tool call. (UI search cards
|
|
13
|
+
* were removed — the added latency outweighed the visual value.)
|
|
14
|
+
* @module dsh-github-copilot/wire
|
|
15
|
+
*/
|
|
16
|
+
import type { GenerateOptions, StreamChunk } from '@deepseek-ai/dsh-llm';
|
|
17
|
+
import type { SearchPlan, SearchPlanCandidate } from './plan.ts';
|
|
18
|
+
import type { ResponsesReasoningOptions } from './serialize.ts';
|
|
19
|
+
import type { ResolvedRequestAuth } from './copilot-request.ts';
|
|
20
|
+
import type { InlineConfig } from './config.ts';
|
|
21
|
+
/** Credential and cancellation hooks the stream resolves per operation. */
|
|
22
|
+
export interface InlineHooks {
|
|
23
|
+
/** Resolve one credential reference through the credentials seam. */
|
|
24
|
+
resolveApiKey: (candidate: SearchPlanCandidate) => Promise<string | ResolvedRequestAuth | undefined>;
|
|
25
|
+
/** Validate effective model/profile reasoning and return its mapped wire value. */
|
|
26
|
+
resolveResponsesReasoning?: (request: GenerateOptions, candidate: SearchPlanCandidate) => ResponsesReasoningOptions | undefined;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Whether the request carries an image attachment. Image blocks retain the
|
|
30
|
+
* harness attachment object that the official vision channel must consume.
|
|
31
|
+
*/
|
|
32
|
+
export declare function contentHasImageAttachments(request: GenerateOptions): boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Run one inline model call through whichever wire the settled candidate
|
|
35
|
+
* speaks. The plan is settled HERE — once — so the protocol choice follows
|
|
36
|
+
* the probe verdict instead of the chat route snapshot taken before the
|
|
37
|
+
* probe ran.
|
|
38
|
+
* @param request - the frozen agent-loop request.
|
|
39
|
+
* @param plan - the search plan owning endpoint facts.
|
|
40
|
+
* @param hooks - credential hooks.
|
|
41
|
+
* @param cfg - the current plugin configuration.
|
|
42
|
+
* @returns the StreamChunk stream for the loop's assembler.
|
|
43
|
+
*/
|
|
44
|
+
export declare function inlineWireStream(request: GenerateOptions, plan: SearchPlan, hooks: InlineHooks, cfg: InlineConfig): AsyncGenerator<StreamChunk>;
|
|
45
|
+
/**
|
|
46
|
+
* Run one inline model call: fetch the Responses endpoint with the
|
|
47
|
+
* server-side web tool injected and translate the SSE stream into harness
|
|
48
|
+
* chunks. Never throws; always ends with a finish chunk.
|
|
49
|
+
* @param request - the frozen agent-loop request.
|
|
50
|
+
* @param candidate - the settled endpoint facts (probe-verified).
|
|
51
|
+
* @param hooks - credential hooks.
|
|
52
|
+
* @param cfg - the current plugin configuration.
|
|
53
|
+
* @returns the StreamChunk stream for the loop's assembler.
|
|
54
|
+
*/
|
|
55
|
+
export declare function inlineStream(request: GenerateOptions, candidate: SearchPlanCandidate, hooks: InlineHooks, cfg: InlineConfig): AsyncGenerator<StreamChunk>;
|
|
56
|
+
//# sourceMappingURL=wire.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
//#region lib/types/web-delegate.js
|
|
2
|
+
/** Expose the unchanged official service from the bundle's named web isolate. */
|
|
3
|
+
const name = "github-copilot-web-delegate";
|
|
4
|
+
const inject = ["web"];
|
|
5
|
+
function apply(ctx) {
|
|
6
|
+
ctx.provide("githubCopilotOriginalWeb", ctx.web);
|
|
7
|
+
}
|
|
8
|
+
//#endregion
|
|
9
|
+
export { apply, inject, name };
|