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.
Files changed (156) hide show
  1. package/AGENTS.md +312 -0
  2. package/CHANGELOG.md +479 -0
  3. package/CONTRIBUTING.md +46 -0
  4. package/LICENSE +21 -0
  5. package/README.md +203 -0
  6. package/README.zh.md +202 -0
  7. package/SECURITY.md +29 -0
  8. package/cordis.patch.yml +16 -0
  9. package/deployment-baseline.json +1299 -0
  10. package/docs/agent-readiness.md +110 -0
  11. package/docs/auto-task-routing.md +234 -0
  12. package/docs/automatic-model-routing.md +205 -0
  13. package/docs/copilot-accounts.md +236 -0
  14. package/docs/copilot-compaction.md +120 -0
  15. package/docs/copilot-usage.md +125 -0
  16. package/docs/dual-model.md +66 -0
  17. package/docs/image-input-compatibility.md +64 -0
  18. package/docs/images/copilot-accounts-credits.png +0 -0
  19. package/docs/images/copilot-accounts.png +0 -0
  20. package/docs/images/copilot-model-preferences.png +0 -0
  21. package/docs/images/copilot-search-routing.png +0 -0
  22. package/docs/images/dual-model-desktop.png +0 -0
  23. package/docs/images/dual-model-mobile.png +0 -0
  24. package/docs/images/dual-model-provenance.json +35 -0
  25. package/docs/images/parent-model-follow.png +0 -0
  26. package/docs/manual-compaction-recovery.md +64 -0
  27. package/docs/model-compatibility-acceptance.md +164 -0
  28. package/docs/npm-distribution.md +149 -0
  29. package/docs/official-first-016-alpha2.md +66 -0
  30. package/docs/official-first-020-rc1.md +32 -0
  31. package/docs/official-first-020-rc2.md +16 -0
  32. package/docs/session-search-routing.md +133 -0
  33. package/docs/single-route-migration.md +130 -0
  34. package/docs/web-lifecycle-rc2.md +55 -0
  35. package/lib/client.js +10822 -0
  36. package/lib/client.js.map +1 -0
  37. package/lib/copilot-identity-DRZY_d2X.js +15 -0
  38. package/lib/index.js +11689 -0
  39. package/lib/manual-compaction-recovery.js +315 -0
  40. package/lib/remote.js +734 -0
  41. package/lib/request-budget-DLY_aRq0.js +87 -0
  42. package/lib/routed-web.js +120 -0
  43. package/lib/search-routing-CqysPLve.js +792 -0
  44. package/lib/types/account-model-auth.d.ts +15 -0
  45. package/lib/types/account-model-catalog.d.ts +70 -0
  46. package/lib/types/account-model-source.d.ts +85 -0
  47. package/lib/types/agent-compaction.d.ts +4 -0
  48. package/lib/types/authorization-controller.d.ts +119 -0
  49. package/lib/types/auto-assessment-evidence.d.ts +46 -0
  50. package/lib/types/auto-model-host.d.ts +27 -0
  51. package/lib/types/auto-model-intent.d.ts +36 -0
  52. package/lib/types/auto-model-presentation.d.ts +57 -0
  53. package/lib/types/auto-model-routing.d.ts +59 -0
  54. package/lib/types/auto-selection-explanation.d.ts +9 -0
  55. package/lib/types/auto-task-assessment.d.ts +47 -0
  56. package/lib/types/auto-task-classifier.d.ts +9 -0
  57. package/lib/types/background-compaction.d.ts +30 -0
  58. package/lib/types/client.d.ts +115 -0
  59. package/lib/types/compact-account.d.ts +42 -0
  60. package/lib/types/compaction-pressure.d.ts +23 -0
  61. package/lib/types/compatibility.d.ts +17 -0
  62. package/lib/types/config.d.ts +89 -0
  63. package/lib/types/content-file.d.ts +10 -0
  64. package/lib/types/context-evidence-ui.d.ts +11 -0
  65. package/lib/types/context-evidence.d.ts +108 -0
  66. package/lib/types/context-usage.d.ts +4 -0
  67. package/lib/types/copilot-account-presentation.d.ts +7 -0
  68. package/lib/types/copilot-accounts-card.d.ts +30 -0
  69. package/lib/types/copilot-accounts-host.d.ts +75 -0
  70. package/lib/types/copilot-accounts-remote.d.ts +77 -0
  71. package/lib/types/copilot-accounts-types.d.ts +42 -0
  72. package/lib/types/copilot-auth.d.ts +25 -0
  73. package/lib/types/copilot-grant.d.ts +11 -0
  74. package/lib/types/copilot-identity.d.ts +11 -0
  75. package/lib/types/copilot-request.d.ts +11 -0
  76. package/lib/types/copilot-stream-liveness.d.ts +23 -0
  77. package/lib/types/copilot-usage-card.d.ts +30 -0
  78. package/lib/types/copilot-usage-host.d.ts +58 -0
  79. package/lib/types/copilot-usage-normalize.d.ts +9 -0
  80. package/lib/types/copilot-usage-remote.d.ts +63 -0
  81. package/lib/types/copilot-usage-types.d.ts +20 -0
  82. package/lib/types/copilot-usage-ui.d.ts +4 -0
  83. package/lib/types/current-provider.d.ts +59 -0
  84. package/lib/types/deepseek-search-fallback.d.ts +11 -0
  85. package/lib/types/dual-model-host.d.ts +119 -0
  86. package/lib/types/dual-model-remote.d.ts +63 -0
  87. package/lib/types/dual-model-types.d.ts +34 -0
  88. package/lib/types/external-link.d.ts +3 -0
  89. package/lib/types/failure.d.ts +38 -0
  90. package/lib/types/http.d.ts +48 -0
  91. package/lib/types/image-input-admission.d.ts +5 -0
  92. package/lib/types/index.d.ts +39 -0
  93. package/lib/types/manual-compaction-recovery.d.ts +52 -0
  94. package/lib/types/migration-status.d.ts +50 -0
  95. package/lib/types/model-exclusions.d.ts +15 -0
  96. package/lib/types/model-preferences-card.d.ts +9 -0
  97. package/lib/types/model-protocol.d.ts +31 -0
  98. package/lib/types/native-select-style.d.ts +4 -0
  99. package/lib/types/parent-model-follow-card.d.ts +41 -0
  100. package/lib/types/parent-model-follow.d.ts +44 -0
  101. package/lib/types/pi-provider-bridge.d.ts +22 -0
  102. package/lib/types/plan.d.ts +148 -0
  103. package/lib/types/pre-step-pressure.d.ts +8 -0
  104. package/lib/types/preview-provider.d.ts +66 -0
  105. package/lib/types/preview-route.d.ts +74 -0
  106. package/lib/types/probe.d.ts +39 -0
  107. package/lib/types/reasoning-presentation.d.ts +55 -0
  108. package/lib/types/remote-codec.d.ts +10 -0
  109. package/lib/types/remote.d.ts +199 -0
  110. package/lib/types/replay-recovery-host.d.ts +28 -0
  111. package/lib/types/replay-recovery-remote.d.ts +14 -0
  112. package/lib/types/replay-recovery-types.d.ts +24 -0
  113. package/lib/types/replay-recovery-ui.d.ts +26 -0
  114. package/lib/types/replay-recovery.d.ts +17 -0
  115. package/lib/types/request-body-evidence.d.ts +34 -0
  116. package/lib/types/request-body-timeout-marker.d.ts +2 -0
  117. package/lib/types/request-body-timeout.d.ts +4 -0
  118. package/lib/types/request-budget.d.ts +58 -0
  119. package/lib/types/request-upload-evidence.d.ts +23 -0
  120. package/lib/types/response-error-body.d.ts +3 -0
  121. package/lib/types/responses-reasoning-text.d.ts +24 -0
  122. package/lib/types/responses-reasoning.d.ts +7 -0
  123. package/lib/types/responses-replay-compat.d.ts +30 -0
  124. package/lib/types/route-ownership.d.ts +70 -0
  125. package/lib/types/routed-web.d.ts +50 -0
  126. package/lib/types/search-backend.d.ts +16 -0
  127. package/lib/types/search-routing-host.d.ts +19 -0
  128. package/lib/types/search-routing-policy.d.ts +18 -0
  129. package/lib/types/search-routing-remote.d.ts +20 -0
  130. package/lib/types/search-routing.d.ts +43 -0
  131. package/lib/types/search-tool-routing.d.ts +22 -0
  132. package/lib/types/serialize.d.ts +106 -0
  133. package/lib/types/settings-reader.d.ts +16 -0
  134. package/lib/types/sse.d.ts +28 -0
  135. package/lib/types/temporary-models.d.ts +25 -0
  136. package/lib/types/tool-schema-compat.d.ts +17 -0
  137. package/lib/types/traditional-search.d.ts +17 -0
  138. package/lib/types/turn-model-provenance.d.ts +45 -0
  139. package/lib/types/turn-selection-card.d.ts +10 -0
  140. package/lib/types/turn-selection-host.d.ts +11 -0
  141. package/lib/types/turn-selection-remote.d.ts +13 -0
  142. package/lib/types/turn-selection.d.ts +119 -0
  143. package/lib/types/turn-usage-evidence.d.ts +66 -0
  144. package/lib/types/turn-usage-notice.d.ts +7 -0
  145. package/lib/types/types.d.ts +69 -0
  146. package/lib/types/usage.d.ts +26 -0
  147. package/lib/types/watchdog.d.ts +22 -0
  148. package/lib/types/web-delegate.d.ts +12 -0
  149. package/lib/types/web-search-routing-card.d.ts +16 -0
  150. package/lib/types/web-search-routing-config.d.ts +12 -0
  151. package/lib/types/wire-anthropic.d.ts +37 -0
  152. package/lib/types/wire.d.ts +56 -0
  153. package/lib/web-delegate.js +9 -0
  154. package/output/auto-model-mockup/index.html +207 -0
  155. package/package.json +236 -0
  156. package/scripts/check-search-composition.mjs +191 -0
@@ -0,0 +1,7 @@
1
+ import type { Context } from '@deepseek-ai/cordis';
2
+ import type { GenerateOptions } from '@deepseek-ai/dsh-llm';
3
+ import type { SearchPlanCandidate } from './plan.ts';
4
+ import type { ResponsesReasoningOptions } from './serialize.ts';
5
+ /** Resolve only the selected model's declared/native efforts, with the same precedence as Core. */
6
+ export declare function resolveCopilotResponsesReasoning(ctx: Context, request: GenerateOptions, candidate: Pick<SearchPlanCandidate, 'protocol' | 'model'>): ResponsesReasoningOptions | undefined;
7
+ //# sourceMappingURL=responses-reasoning.d.ts.map
@@ -0,0 +1,30 @@
1
+ type ReplayFailure = 'scope-mismatch' | 'unsupported' | 'invalid-payload';
2
+ interface ReplayDispatch {
3
+ readonly body?: string;
4
+ readonly sessionHeader?: boolean;
5
+ readonly clientRequestHeader?: boolean;
6
+ }
7
+ /** Fixed diagnostics and bounded counts only; never retain request or replay content. */
8
+ export declare class CopilotResponsesReplayError extends Error {
9
+ constructor(reason?: ReplayFailure, dispatch?: ReplayDispatch);
10
+ }
11
+ /** Normalize only the outgoing managed Responses payload, never stored history/context. */
12
+ export declare function normalizeCopilotResponsesPayload(payload: unknown): unknown;
13
+ /** A single lease can admit one HTTP-verified retry at a time; it never reads durable history. */
14
+ export declare class ResponsesRetryReplay {
15
+ private snapshot;
16
+ private active;
17
+ private disposed;
18
+ dispose(): void;
19
+ belongsTo(sessionId: string): boolean;
20
+ begin(context: unknown, signal?: AbortSignal, sessionId?: string, modelId?: string): ResponsesRetryAttempt;
21
+ }
22
+ export interface ResponsesRetryAttempt {
23
+ normalize(payload: unknown): unknown;
24
+ observe(body: string | undefined, status: number): void;
25
+ finish(): void;
26
+ }
27
+ /** Observe a cloned, bounded 401 body; every unknown result retains native auth behavior. */
28
+ export declare function isCopilotInputItemScopeError(response: Response, signal?: AbortSignal): Promise<boolean>;
29
+ export {};
30
+ //# sourceMappingURL=responses-replay-compat.d.ts.map
@@ -0,0 +1,70 @@
1
+ /** Journal provenance only; process identity is not namespace lifetime evidence. */
2
+ export declare const ROUTE_OWNERSHIP_EPOCH: `${string}-${string}-${string}-${string}-${string}`;
3
+ export type RouteMutation = {
4
+ readonly op: 'set';
5
+ readonly path: string[];
6
+ readonly value: unknown;
7
+ } | {
8
+ readonly op: 'unset';
9
+ readonly path: string[];
10
+ };
11
+ export interface RouteSettings {
12
+ describe(options?: {
13
+ redactSecrets?: boolean;
14
+ }): Array<{
15
+ ns: string;
16
+ value: unknown;
17
+ revision: number;
18
+ user?: unknown;
19
+ base?: unknown;
20
+ secrets?: readonly {
21
+ path: readonly string[];
22
+ set: boolean;
23
+ }[];
24
+ }>;
25
+ mutate(namespace: string, operations: readonly RouteMutation[], expectedRevision?: number): Promise<void>;
26
+ }
27
+ export declare class TemporaryRouteConflictError extends Error {
28
+ readonly code: 'TEMPORARY_ROUTE_OWNERSHIP_CONFLICT' | 'TEMPORARY_ROUTE_LEGACY_CONFLICT' | 'TEMPORARY_ROUTE_INVALID_BACKUP';
29
+ constructor(code?: 'TEMPORARY_ROUTE_OWNERSHIP_CONFLICT' | 'TEMPORARY_ROUTE_LEGACY_CONFLICT' | 'TEMPORARY_ROUTE_INVALID_BACKUP');
30
+ }
31
+ export declare function object(value: unknown): Record<string, unknown> | undefined;
32
+ export declare function profileAt(value: unknown): Record<string, unknown> | undefined;
33
+ /** Bounded comparison; never stringify or copy unknown model extras or headers. */
34
+ export declare function equalJson(a: unknown, b: unknown, depth?: number): boolean;
35
+ interface Leaves {
36
+ readonly api?: string;
37
+ readonly models?: readonly Record<string, unknown>[];
38
+ }
39
+ export interface RouteBackup {
40
+ readonly version: 2;
41
+ readonly providerExisted: boolean;
42
+ readonly preimage: Leaves;
43
+ readonly postimage: Leaves;
44
+ readonly ownedHeaders: Readonly<Record<string, string>>;
45
+ readonly phase: 'overlay' | 'restoring';
46
+ readonly sourceRevision: number;
47
+ readonly sourceEpoch: string;
48
+ readonly target?: Leaves;
49
+ readonly removeProfile?: boolean;
50
+ }
51
+ export declare function leavesOf(profile: Record<string, unknown> | undefined): Leaves;
52
+ export declare function encodeBackup(backup: RouteBackup): string;
53
+ export declare function readBackup(value: unknown): RouteBackup | undefined;
54
+ export declare function settingsSnapshot(settings: RouteSettings): {
55
+ current: Record<string, unknown> | undefined;
56
+ raw: Record<string, unknown> | undefined;
57
+ base: Record<string, unknown> | undefined;
58
+ hasSecrets: boolean;
59
+ hasOwnedSecrets: boolean;
60
+ routeRevision: number;
61
+ markerRevision: number;
62
+ backup: RouteBackup | undefined;
63
+ };
64
+ export declare function assertOwned(current: Record<string, unknown> | undefined, backup: RouteBackup): 'preimage' | 'postimage' | 'target';
65
+ export declare function leafOperations(current: Record<string, unknown> | undefined, target: Leaves): RouteMutation[];
66
+ export declare function ownedHeaderRemoval(current: Record<string, unknown> | undefined, backup: RouteBackup): RouteMutation[];
67
+ /** Raw shape, not schema-resolved defaults, proves whole-profile ownership. */
68
+ export declare function wholeProfileOwned(snapshot: ReturnType<typeof settingsSnapshot>, backup: RouteBackup): boolean;
69
+ export {};
70
+ //# sourceMappingURL=route-ownership.d.ts.map
@@ -0,0 +1,50 @@
1
+ import type { Context } from '@deepseek-ai/cordis';
2
+ import { WebRuntime } from '@deepseek-ai/dsh-web';
3
+ import type { WebRuntimeConfig, WebSearchRequest, WebSearchResult, WebSearchProvider, WebFetchProvider, WebFetchRequest, WebFetchResult } from '@deepseek-ai/dsh-web';
4
+ /** Parent dispatch captured from the exact WebRuntime instance serving this call. */
5
+ export type NativeSearch = (request: WebSearchRequest, signal?: AbortSignal) => Promise<WebSearchResult>;
6
+ /** Exact-id dispatch over providers registered through the routed facade. */
7
+ export type ProviderSearch = (providerId: string, request: WebSearchRequest, signal?: AbortSignal) => Promise<WebSearchResult>;
8
+ /** Captured facade registration; no provider implementation object crosses the Client boundary. */
9
+ export interface CapturedSearchProvider {
10
+ readonly id: string;
11
+ readonly signal: AbortSignal;
12
+ current(): boolean;
13
+ /** Identity proof for a router-owned provider, never an inference from its id. */
14
+ owns(provider: WebSearchProvider): boolean;
15
+ search(request: WebSearchRequest, signal?: AbortSignal): Promise<WebSearchResult>;
16
+ }
17
+ /** Resolve one registered id synchronously before the routing operation starts awaiting. */
18
+ export type CaptureSearchProvider = (providerId: string) => CapturedSearchProvider | undefined;
19
+ /** Host-owned router; credentials and provider implementation objects stay inside the facade. */
20
+ export interface GitHubCopilotSearchRouter {
21
+ search(request: WebSearchRequest, signal: AbortSignal | undefined, delegate: NativeSearch, selectProvider?: ProviderSearch, captureSearchProvider?: CaptureSearchProvider): Promise<WebSearchResult>;
22
+ }
23
+ declare module '@deepseek-ai/cordis' {
24
+ interface Context {
25
+ githubCopilotSearchRouter: GitHubCopilotSearchRouter;
26
+ }
27
+ }
28
+ /**
29
+ * Plugin-owned WebRuntime facade. The bundle isolates, but does not reconfigure,
30
+ * the original official service. Normal search, fetch and registrations delegate
31
+ * through its public APIs. A second private official WebRuntime supplies the same
32
+ * validation/source cap for the Copilot branch. No Core prototypes or private
33
+ * registries are read or changed.
34
+ */
35
+ export default class CopilotRoutedWeb extends WebRuntime {
36
+ static inject: string[];
37
+ private readonly bounded;
38
+ private readonly lifetime;
39
+ private readonly pending;
40
+ private readonly mirroredSearchProviders;
41
+ constructor(ctx: Context, config?: WebRuntimeConfig);
42
+ private disposedError;
43
+ private searchWithProvider;
44
+ private captureSearchProvider;
45
+ registerSearchProvider(provider: WebSearchProvider): () => void;
46
+ registerFetchProvider(provider: WebFetchProvider): () => void;
47
+ fetch(request: WebFetchRequest, signal?: AbortSignal): Promise<WebFetchResult>;
48
+ search(request: WebSearchRequest, signal?: AbortSignal): Promise<WebSearchResult>;
49
+ }
50
+ //# sourceMappingURL=routed-web.d.ts.map
@@ -0,0 +1,16 @@
1
+ import { WebError } from '@deepseek-ai/dsh-web';
2
+ /** Safe request-option leaves; never includes auth, URL path/query or opaque provider state. */
3
+ export interface SearchBackend {
4
+ readonly provider: 'deepseek-official';
5
+ readonly origin: string;
6
+ readonly model: string;
7
+ readonly customEndpoint: boolean;
8
+ }
9
+ /** Bounded metadata included in the same query's successful or failed fallback notice. */
10
+ export declare function describeSearchBackend(backend: SearchBackend): string;
11
+ /** Known sanitized failure, distinct from arbitrary native provider exception messages. */
12
+ export declare class DescribedSearchFallbackError extends WebError {
13
+ readonly backend: SearchBackend | undefined;
14
+ constructor(backend: SearchBackend | undefined, code?: WebError['code']);
15
+ }
16
+ //# sourceMappingURL=search-backend.d.ts.map
@@ -0,0 +1,19 @@
1
+ /** Read-only search catalog bridge; no credentials, availability probes or writes. */
2
+ import { Context } from '@deepseek-ai/cordis';
3
+ import { TypertRemoteService } from '@deepseek-ai/dsh-typert-protocol';
4
+ import type { SearchProviderCatalog } from './search-routing-remote.ts';
5
+ export interface SearchProviderDirectory {
6
+ /** Fresh IDs from facade-owned registrations, not a process-wide registry. */
7
+ list(): readonly string[];
8
+ }
9
+ declare module '@deepseek-ai/cordis' {
10
+ interface Context {
11
+ githubCopilotSearchCatalog: SearchProviderDirectory;
12
+ githubCopilotSearchRouting: SearchRoutingController;
13
+ }
14
+ }
15
+ export default class SearchRoutingController extends TypertRemoteService {
16
+ constructor(ctx: Context);
17
+ providers(): SearchProviderCatalog;
18
+ }
19
+ //# sourceMappingURL=search-routing-host.d.ts.map
@@ -0,0 +1,18 @@
1
+ /** Shared Client-safe settings shape; provider credentials and models remain provider-owned. */
2
+ export interface WebSearchRoutingConfig {
3
+ /** Auto follows the initiating Chat provider; a concrete id pins the primary, and none disables search. */
4
+ searchProvider?: string;
5
+ /** Legacy primary selection; used only when searchProvider has not been explicitly saved. */
6
+ searchMode?: 'auto' | 'fixed';
7
+ /** Final fallback provider id, or none; legacy fixed mode also uses this id as its primary. */
8
+ defaultSearchProvider?: string;
9
+ }
10
+ /** Operation-local normalized policy; reading legacy settings never migrates them on disk. */
11
+ export interface NormalizedWebSearchRouting {
12
+ readonly primaryProvider: string;
13
+ readonly defaultProvider: string;
14
+ readonly legacy: boolean;
15
+ }
16
+ /** Resolve old and new settings without guessing registered providers or dropping unknown ids. */
17
+ export declare function normalizeWebSearchRouting(config: WebSearchRoutingConfig): NormalizedWebSearchRouting;
18
+ //# sourceMappingURL=search-routing-policy.d.ts.map
@@ -0,0 +1,20 @@
1
+ /** Client-safe catalog of search registrations observed by the routed facade. */
2
+ import type { RemoteResult, TypertRemoteContribution } from '@deepseek-ai/dsh-typert-protocol';
3
+ import { z } from 'zod';
4
+ export declare const SearchProviderCatalogSchema: z.ZodObject<{
5
+ supported: z.ZodBoolean;
6
+ providers: z.ZodArray<z.ZodObject<{
7
+ id: z.ZodString;
8
+ }, z.core.$strict>>;
9
+ }, z.core.$strict>;
10
+ export type SearchProviderCatalog = z.infer<typeof SearchProviderCatalogSchema>;
11
+ declare module '@deepseek-ai/dsh-typert-protocol' {
12
+ interface TypertRemoteNamespaceMap {
13
+ githubCopilotSearchRouting: {
14
+ providers(): Promise<RemoteResult<SearchProviderCatalog>>;
15
+ };
16
+ }
17
+ }
18
+ declare const contribution: TypertRemoteContribution;
19
+ export default contribution;
20
+ //# sourceMappingURL=search-routing-remote.d.ts.map
@@ -0,0 +1,43 @@
1
+ import type { WebSearchProvider, WebSearchRequest, WebSearchResult } from '@deepseek-ai/dsh-web';
2
+ /** Explicit cross-provider spending policy; disabled unless the operator selects DeepSeek. */
3
+ export type SearchFallback = 'none' | 'deepseek';
4
+ /** Selection captured from the initiating request, never from a global default. */
5
+ export interface SearchSelection {
6
+ readonly provider: string;
7
+ readonly model: string;
8
+ }
9
+ /** Public, non-secret provenance retained outside the canonical WebSearchResult. */
10
+ export interface SearchRouting {
11
+ readonly requestedProvider: 'github-copilot-hosted';
12
+ readonly actualProvider: 'github-copilot-hosted' | 'deepseek-official';
13
+ readonly model: string;
14
+ readonly fallback: boolean;
15
+ readonly reason?: string;
16
+ }
17
+ /** Delegated results have no plugin provenance and retain their original object identity. */
18
+ export interface RoutedSearchResult {
19
+ readonly result: WebSearchResult;
20
+ readonly routing?: SearchRouting;
21
+ }
22
+ /** Operation-local dependencies; providers must be owned instances, not private-registry lookups. */
23
+ export interface SessionSearchDependencies {
24
+ readonly selection: SearchSelection | undefined;
25
+ readonly managedOwned: boolean;
26
+ readonly fallback: SearchFallback;
27
+ readonly copilot: WebSearchProvider;
28
+ readonly delegate: (request: WebSearchRequest, signal?: AbortSignal) => Promise<WebSearchResult>;
29
+ readonly resolveDeepSeek: () => Promise<WebSearchProvider>;
30
+ /** Recheck captured owner/account generation after every asynchronous boundary. */
31
+ readonly canContinue: () => boolean;
32
+ }
33
+ /** Match only the canonical route or a verified plugin-owned managed route. */
34
+ export declare function isCopilotSearchSelection(selection: SearchSelection | undefined, managedOwned: boolean): boolean;
35
+ /**
36
+ * Route one already-validated search using captured request identity.
37
+ * Non-Copilot calls delegate untouched. Copilot failures reach a known DeepSeek
38
+ * provider only under the explicit spending policy; cancellation and invalidated
39
+ * ownership never trigger fallback. Consumer validation, batching and deadlines
40
+ * remain the caller's responsibility, not this provider-selection function.
41
+ */
42
+ export declare function routeSessionSearch(request: WebSearchRequest, signal: AbortSignal | undefined, deps: SessionSearchDependencies): Promise<RoutedSearchResult>;
43
+ //# sourceMappingURL=search-routing.d.ts.map
@@ -0,0 +1,22 @@
1
+ import type { WebSearchRequest, WebSearchResult } from '@deepseek-ai/dsh-web';
2
+ /** An already selected, operation-owned search entry; availability remains its owner's responsibility. */
3
+ export interface SearchToolProvider {
4
+ readonly id: string;
5
+ search(request: WebSearchRequest, signal?: AbortSignal): Promise<WebSearchResult>;
6
+ }
7
+ /** Captured policy for one primary attempt and at most one distinct final fallback. */
8
+ export interface SearchToolRoutingDependencies {
9
+ readonly primary?: SearchToolProvider | undefined;
10
+ readonly fallback?: SearchToolProvider | undefined;
11
+ /** False, or a thrown error, revokes this operation without permitting fallback. */
12
+ readonly canContinue: () => boolean;
13
+ /** Legacy failure-spending control; does not prevent fallback when no primary was resolved. */
14
+ readonly allowFailureFallback?: boolean;
15
+ }
16
+ /**
17
+ * Execute a captured primary and optional final fallback without registry or credential access.
18
+ * The caller resolves Auto, handles disabled policy, proves registrations and supplies lifetime guards.
19
+ * Generic providers must honor the signal; this helper cannot inspect their internal auth/HTTP boundary.
20
+ */
21
+ export declare function routeSearchTools(request: WebSearchRequest, signal: AbortSignal | undefined, deps: SearchToolRoutingDependencies): Promise<WebSearchResult>;
22
+ //# sourceMappingURL=search-tool-routing.d.ts.map
@@ -0,0 +1,106 @@
1
+ /**
2
+ * Text/tool serialization for the inline wire path, plus server-side web
3
+ * search injection. Reasoning and opaque replay histories remain Core-owned;
4
+ * this limited serializer refuses them instead of inventing Responses items.
5
+ * @module dsh-github-copilot/serialize
6
+ */
7
+ import type { GenerateOptions, RequestMessage, ToolSchema } from '@deepseek-ai/dsh-llm';
8
+ import type { ResponsesWebSearchToolType } from './plan.ts';
9
+ import type { InlineConfig } from './config.ts';
10
+ /** Mapped only after the selected model's native capability checks succeed. */
11
+ export interface ResponsesReasoningOptions {
12
+ readonly effort: string;
13
+ readonly summary: 'auto';
14
+ }
15
+ /** Keep Core-owned reasoning provenance and opaque replay state out of this serializer. */
16
+ export declare function hasResponsesReplayContext(messages: readonly RequestMessage[]): boolean;
17
+ /** Thrown for content whose projection must remain with Core. */
18
+ export declare class UnsupportedContentError extends Error {
19
+ constructor(detail: string);
20
+ }
21
+ /**
22
+ * Stable short hash (FNV-1a variant) for synthesizing item ids.
23
+ * @param input - any string.
24
+ * @returns an 8-character base36 string.
25
+ */
26
+ export declare function shortHash(input: string): string;
27
+ /**
28
+ * Split a harness call id into the Responses `call_id`/`id` pair. Harness
29
+ * ids produced by the pi-ai adapter carry the `call_id|item_id` shape; ids
30
+ * from other origins get a synthesized item id.
31
+ * @param id - the harness tool-call id.
32
+ * @returns the call id and item id.
33
+ */
34
+ export declare function splitCallId(id: string): {
35
+ callId: string;
36
+ itemId: string;
37
+ };
38
+ export declare function flattenText(content: readonly unknown[]): string;
39
+ /** Detect a grounded sandbox denial in either current tool-role or retained legacy message layout. */
40
+ export declare function hasToolResultText(message: RequestMessage, needle: string): boolean;
41
+ /**
42
+ * Serialize one dsh message into Responses input items.
43
+ * @param message - the harness message.
44
+ * @returns the wire input items; may be empty for content-free messages.
45
+ * @throws UnsupportedContentError for image or Core-owned reasoning/replay content.
46
+ */
47
+ export declare function serializeMessage(message: RequestMessage, pairedCallIds?: ReadonlySet<string>): unknown[];
48
+ /**
49
+ * Return call ids that have both an assistant function call and a user tool
50
+ * result. Responses rejects either half when replayed alone, which can happen
51
+ * when a prior provider/tool failure ended the step before persistence wrote
52
+ * the matching result.
53
+ */
54
+ export declare function pairedToolCallIds(messages: readonly RequestMessage[]): ReadonlySet<string>;
55
+ /**
56
+ * Build the wire tools array: function tools (optionally stripped of the
57
+ * variants shadowed by server-side web tools) plus the server-side web
58
+ * search tool in the candidate's verified spelling.
59
+ * @param tools - the harness tool schemas.
60
+ * @param stripServerTools - whether to drop the shadowed function variants.
61
+ * @param webSearchToolType - the Responses spelling the probe verified.
62
+ * @returns the wire tools array.
63
+ */
64
+ export declare function wireTools(tools: readonly ToolSchema[] | undefined, stripServerTools: boolean, webSearchToolType: ResponsesWebSearchToolType): unknown[];
65
+ /**
66
+ * Build the complete Responses request body for one inline call.
67
+ * @param request - the harness request.
68
+ * @param cfg - the wire controls.
69
+ * @param model - the model the plan resolved (config override or the loop's
70
+ * route model); the same model the capability probe verified.
71
+ * @param webSearchToolType - the Responses spelling the probe verified; the
72
+ * wire must send exactly the spelling that passed.
73
+ * @returns the JSON body to POST.
74
+ */
75
+ export declare function buildWireBody(request: GenerateOptions, cfg: Pick<InlineConfig, 'includeSources' | 'stripServerTools'>, model: string, webSearchToolType: ResponsesWebSearchToolType, reasoning?: ResponsesReasoningOptions): unknown;
76
+ /**
77
+ * Build the Anthropic Messages wire tools array: function tools (optionally
78
+ * stripped of the `web_search` variant, which shadows the server-side tool)
79
+ * plus the server-side web search tool. Function tools carry no `type`.
80
+ * @param tools - the harness tool schemas.
81
+ * @param stripServerTools - whether to drop the shadowed function variants.
82
+ * @returns the wire tools array.
83
+ */
84
+ export declare function anthropicWireTools(tools: readonly ToolSchema[] | undefined, stripServerTools: boolean): unknown[];
85
+ /**
86
+ * Serialize one dsh message into Anthropic Messages content items.
87
+ * Assistant messages aggregate their blocks into one content array
88
+ * (reasoning without a usable signature becomes plain text).
89
+ * @param message - the harness message.
90
+ * @returns the Anthropic content items for this message.
91
+ * @throws UnsupportedContentError for image content.
92
+ */
93
+ export declare function serializeAnthropicMessage(message: RequestMessage): unknown[];
94
+ /**
95
+ * Build the complete Anthropic Messages request body for one inline call.
96
+ * The system prompt goes to the top-level `system` field (unlike the
97
+ * Responses wire, the Anthropic gateway keeps server-side web_search native
98
+ * with a top-level system).
99
+ * @param request - the harness request.
100
+ * @param cfg - the wire controls.
101
+ * @param model - the model the plan resolved (config override or the loop's
102
+ * route model); the same model the capability probe verified.
103
+ * @returns the JSON body to POST.
104
+ */
105
+ export declare function buildAnthropicWireBody(request: GenerateOptions, cfg: Pick<InlineConfig, 'stripServerTools'>, model: string): unknown;
106
+ //# sourceMappingURL=serialize.d.ts.map
@@ -0,0 +1,16 @@
1
+ import type { Context } from '@deepseek-ai/cordis';
2
+ export interface LiveSetting<T> {
3
+ get(): T;
4
+ }
5
+ /** Capture a native volatile field for one operation, or retain a plain fixture value. */
6
+ export declare function readConfigValue<T>(value: T | LiveSetting<T>): T;
7
+ /** Read non-secret configuration through the API available on the running Core. */
8
+ export declare function readSettingsNamespace(ctx: Context, namespace: string): unknown;
9
+ declare module '@deepseek-ai/cordis' {
10
+ interface Events {
11
+ 'settings/updated'(namespace: string): void;
12
+ }
13
+ }
14
+ /** Subscribe to namespace changes across the legacy settings provider and current form service. */
15
+ export declare function onSettingsNamespaceUpdated(ctx: Context, listener: (namespace: string) => void): () => void;
16
+ //# sourceMappingURL=settings-reader.d.ts.map
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Bounded SSE line parser for the inline wire path. Handles `event:` and
3
+ * `data:` fields, multi-line data, CRLF, comments, and trailing events
4
+ * without a final blank line; unknown fields are ignored and oversized
5
+ * individual events are rejected.
6
+ * @module dsh-github-copilot/sse
7
+ */
8
+ /** Upper bound on one incomplete SSE event, in bytes. */
9
+ export declare const MAX_SSE_EVENT_BYTES: number;
10
+ /** Stable error raised when one incomplete SSE event exceeds its byte bound. */
11
+ export declare class SseEventSizeError extends Error {
12
+ readonly limit: number;
13
+ constructor();
14
+ }
15
+ /** One parsed SSE event; `type` falls back to `message`. */
16
+ export interface SseEvent {
17
+ readonly type: string;
18
+ readonly data: unknown;
19
+ }
20
+ /**
21
+ * Parse an SSE byte stream into typed events.
22
+ * @param body - the response body stream.
23
+ * @returns an async generator of parsed events.
24
+ * @throws on invalid JSON or when one event exceeds
25
+ * {@link MAX_SSE_EVENT_BYTES}.
26
+ */
27
+ export declare function parseSse(body: ReadableStream<Uint8Array>): AsyncGenerator<SseEvent>;
28
+ //# sourceMappingURL=sse.d.ts.map
@@ -0,0 +1,25 @@
1
+ import type { Api } from '@earendil-works/pi-ai';
2
+ import type { CopilotModelFacts } from './model-protocol.ts';
3
+ /**
4
+ * Narrow compatibility metadata for account models that GitHub releases before
5
+ * the published pi-ai Copilot catalog catches up. Correct native protocol and
6
+ * capability metadata retire the correction; a matching ID alone does not.
7
+ */
8
+ export interface TemporaryGitHubCopilotModel {
9
+ readonly id: string;
10
+ readonly name: string;
11
+ readonly api: Api;
12
+ readonly baseUrl: string;
13
+ readonly contextWindow: number;
14
+ readonly maxTokens: number;
15
+ readonly input: readonly ('text' | 'image')[];
16
+ readonly reasoningEfforts: Readonly<Record<string, string | null>>;
17
+ readonly headers: Readonly<Record<string, string>>;
18
+ }
19
+ /** Return a narrow correction until the native entry supplies the verified capabilities. */
20
+ export declare function temporaryGitHubCopilotModel(modelId: string, installedModels: ReadonlyMap<string, CopilotModelFacts>, nativeAuthoritative?: boolean): TemporaryGitHubCopilotModel | undefined;
21
+ /** Minimal llm-pi-ai settings entry for one temporary model. */
22
+ export declare function temporaryGitHubCopilotModelProfile(model: TemporaryGitHubCopilotModel): Record<string, unknown>;
23
+ /** Recognize metadata written by this overlay without matching user-owned extras. */
24
+ export declare function temporaryGitHubCopilotModelFromProfile(value: Readonly<Record<string, unknown>>): TemporaryGitHubCopilotModel | undefined;
25
+ //# sourceMappingURL=temporary-models.d.ts.map
@@ -0,0 +1,17 @@
1
+ import type { Context } from '@deepseek-ai/cordis';
2
+ import type { ToolSchema } from '@deepseek-ai/dsh-llm';
3
+ interface PromptAssemblyView {
4
+ readonly variables: Readonly<Record<string, string | undefined>>;
5
+ readonly tools: readonly ToolSchema[];
6
+ }
7
+ /**
8
+ * Copilot models repeatedly emit optional arguments even when runtime state
9
+ * makes them invalid. Remove unusable sandbox escalation fields and expose the
10
+ * multi-action Goal update as a discriminated union, so each action advertises
11
+ * only its legal fields. Other model providers retain the original schemas.
12
+ */
13
+ export declare function filterCopilotToolAssembly<T extends PromptAssemblyView>(assembly: T, ownedPreview?: boolean): T;
14
+ /** Install the provider-scoped filter after Agent model selection has run. */
15
+ export declare function installCopilotToolSchemaCompatibility(ctx: Context): void;
16
+ export {};
17
+ //# sourceMappingURL=tool-schema-compat.d.ts.map
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Traditional `ctx.web` search provider backed by a verified OpenAI Responses
3
+ * candidate. This is intentionally search-only: URL fetching remains owned by
4
+ * dedicated anonymous fetch providers.
5
+ * @module dsh-github-copilot/traditional-search
6
+ */
7
+ import type { WebSearchProvider } from '@deepseek-ai/dsh-web';
8
+ import type { InlineConfig } from './config.ts';
9
+ import type { SearchPlan } from './plan.ts';
10
+ import type { InlineHooks } from './wire.ts';
11
+ /** Stable provider id selected through `web.searchProvider`. */
12
+ export declare const GITHUB_COPILOT_HOSTED_SEARCH_PROVIDER_ID = "github-copilot-hosted";
13
+ /** @deprecated Use {@link GITHUB_COPILOT_HOSTED_SEARCH_PROVIDER_ID}. */
14
+ export declare const COPILOT_HOSTED_SEARCH_PROVIDER_ID = "github-copilot-hosted";
15
+ /** Build the search-only provider registered with `ctx.web`. */
16
+ export declare function createTraditionalSearchProvider(available: () => boolean, plan: (signal?: AbortSignal) => SearchPlan | Promise<SearchPlan>, hooks: InlineHooks, config: () => InlineConfig, unavailableMessage?: string): WebSearchProvider;
17
+ //# sourceMappingURL=traditional-search.d.ts.map
@@ -0,0 +1,45 @@
1
+ export declare const TURN_MODEL_PROVENANCE_KEY = "github-copilot-turn-model-provenance";
2
+ export interface RecordedModel {
3
+ readonly provider: string;
4
+ readonly model: string;
5
+ }
6
+ export interface TurnModelProvenance {
7
+ readonly routes: readonly RecordedModel[];
8
+ readonly incomplete: boolean;
9
+ readonly ended: boolean;
10
+ }
11
+ interface State {
12
+ readonly turn: number;
13
+ readonly hasStart: boolean;
14
+ readonly openSteps: readonly number[];
15
+ readonly value: TurnModelProvenance;
16
+ }
17
+ interface Match {
18
+ readonly event: unknown;
19
+ }
20
+ interface Context {
21
+ readonly state?: State;
22
+ readonly matches: readonly Match[];
23
+ }
24
+ interface LocationData {
25
+ readonly kind: 'turn';
26
+ readonly turn: number;
27
+ readonly key: typeof TURN_MODEL_PROVENANCE_KEY;
28
+ readonly value: TurnModelProvenance;
29
+ }
30
+ export declare function isTurnModelProvenance(value: unknown): value is TurnModelProvenance;
31
+ /** Read provenance only; native Core retains attempt accounting and token totals. */
32
+ export declare const turnModelProvenanceDefinition: {
33
+ kind: string;
34
+ match(event: unknown): {
35
+ id: string;
36
+ role: "start" | "update";
37
+ } | null;
38
+ start(_context: Context, match: Match): State;
39
+ update(context: Context & {
40
+ readonly state: State;
41
+ }, match: Match): State;
42
+ buildLocationData(context: Context, scope: string, previous: LocationData | null): LocationData | null;
43
+ };
44
+ export {};
45
+ //# sourceMappingURL=turn-model-provenance.d.ts.map
@@ -0,0 +1,10 @@
1
+ import type { ReactElement } from 'react';
2
+ import type { TurnSelection } from './turn-selection.ts';
3
+ export declare function TurnSelectionCard({ selection, locale, incomplete, readState, retry }: {
4
+ selection: TurnSelection;
5
+ locale?: string;
6
+ incomplete?: boolean;
7
+ readState?: 'loading' | 'ready' | 'failed';
8
+ retry?: () => void;
9
+ }): ReactElement;
10
+ //# sourceMappingURL=turn-selection-card.d.ts.map
@@ -0,0 +1,11 @@
1
+ import type { Context } from '@deepseek-ai/cordis';
2
+ import type { Agent } from '@deepseek-ai/dsh-agent';
3
+ import { TypertRemoteService } from '@deepseek-ai/dsh-typert-protocol';
4
+ import type { TurnSelection, TurnSelectionStore } from './turn-selection.ts';
5
+ /** Public Host binding for the existing bounded, runtime-only decision store. */
6
+ export declare class TurnSelectionController extends TypertRemoteService {
7
+ private readonly selections;
8
+ constructor(ctx: Context, selections: TurnSelectionStore);
9
+ get(agent: Agent, turn: number): TurnSelection;
10
+ }
11
+ //# sourceMappingURL=turn-selection-host.d.ts.map
@@ -0,0 +1,13 @@
1
+ import type { RemoteResult, TypertRemoteContribution } from '@deepseek-ai/dsh-typert-protocol';
2
+ import type { TurnSelection } from './turn-selection.ts';
3
+ export { TurnSelectionSchema } from './turn-selection.ts';
4
+ declare module '@deepseek-ai/dsh-typert-protocol' {
5
+ interface TypertRemoteNamespaceMap {
6
+ githubCopilotTurnSelection: {
7
+ get(agentId: string, turn: number): Promise<RemoteResult<TurnSelection>>;
8
+ };
9
+ }
10
+ }
11
+ declare const contribution: TypertRemoteContribution;
12
+ export default contribution;
13
+ //# sourceMappingURL=turn-selection-remote.d.ts.map