dsh-github-copilot 0.4.0-alpha.57 → 0.4.0-alpha.59

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { A as GITHUB_COPILOT_AUTO_INTELLIGENCE_MODEL_ID, C as currentSearchInitiator, D as isPluginPreviewProvider, E as readSettingsNamespace, F as autoModelPreference, M as GITHUB_COPILOT_CREDENTIAL_KEY, N as GITHUB_COPILOT_PREVIEW_PROVIDER_ID, O as readCopilotCatalog, P as GITHUB_COPILOT_PROVIDER_ID, S as currentChatRoute, T as onSettingsNamespaceUpdated, _ as RESPONSES_WEB_SEARCH_TOOL_TYPE, a as COPILOT_HOSTED_SEARCH_PROVIDER_ID, b as candidatesForRoute, c as abortable$1, d as readBounded, f as applyRequestAuth, h as ANTHROPIC_WEB_SEARCH_TOOL_TYPE, i as describeSearchBackend, j as GITHUB_COPILOT_AUTO_MODEL_ID, k as GITHUB_COPILOT_AUTO_EFFICIENCY_MODEL_ID, l as isAbortError, m as providerRequestHeaders, n as routeSessionSearch, o as GITHUB_COPILOT_HOSTED_SEARCH_PROVIDER_ID, p as normalizeRequestAuth, r as DescribedSearchFallbackError, s as createTraditionalSearchProvider, t as isCopilotSearchSelection, u as providerErrorMessage, v as SearchPlan, w as currentSearchSelection, x as sameCandidates, y as WEB_SEARCH_TOOL_TYPE } from "./search-routing-CncYAO8_.js";
1
+ import { A as GITHUB_COPILOT_AUTO_EFFICIENCY_MODEL_ID, C as currentSearchInitiator, D as readSettingsNamespace, E as readConfigValue, F as GITHUB_COPILOT_PROVIDER_ID, I as autoModelPreference, M as GITHUB_COPILOT_AUTO_MODEL_ID, N as GITHUB_COPILOT_CREDENTIAL_KEY, O as isPluginPreviewProvider, P as GITHUB_COPILOT_PREVIEW_PROVIDER_ID, S as currentChatRoute, T as onSettingsNamespaceUpdated, _ as RESPONSES_WEB_SEARCH_TOOL_TYPE, a as COPILOT_HOSTED_SEARCH_PROVIDER_ID, b as candidatesForRoute, c as abortable$1, d as readBounded, f as applyRequestAuth, h as ANTHROPIC_WEB_SEARCH_TOOL_TYPE, i as describeSearchBackend, j as GITHUB_COPILOT_AUTO_INTELLIGENCE_MODEL_ID, k as readCopilotCatalog, l as isAbortError, m as providerRequestHeaders, n as routeSessionSearch, o as GITHUB_COPILOT_HOSTED_SEARCH_PROVIDER_ID, p as normalizeRequestAuth, r as DescribedSearchFallbackError, s as createTraditionalSearchProvider, t as isCopilotSearchSelection, u as providerErrorMessage, v as SearchPlan, w as currentSearchSelection, x as sameCandidates, y as WEB_SEARCH_TOOL_TYPE } from "./search-routing-BhrTbF-V.js";
2
2
  import AuthorizationService from "@deepseek-ai/dsh-authorization";
3
3
  import { createHash, randomUUID } from "node:crypto";
4
4
  import * as dshScope from "@deepseek-ai/dsh-scope";
@@ -13,7 +13,6 @@ import { getBuiltinModels } from "@earendil-works/pi-ai/providers/all";
13
13
  import * as dshLlm from "@deepseek-ai/dsh-llm";
14
14
  import { CONTEXT_WINDOW_EXCEEDED_CODE, LlmError, ReasoningEffortId, attributionHeaders, boundContextSummary, callConfigEquals, contentHasImage, createUserMessage, isAgentLoopRequest, resolveImageAttachmentAccess, resolveRetryPolicy } from "@deepseek-ai/dsh-llm";
15
15
  import { WebError } from "@deepseek-ai/dsh-web";
16
- import * as dshSettings from "@deepseek-ai/dsh-settings";
17
16
  import { credentialRef } from "@deepseek-ai/dsh-credentials";
18
17
  import { Config as Config$1, PiAiAdapter } from "@deepseek-ai/dsh-llm-pi-ai";
19
18
  import { estimateContextTokens, estimateMessageTokens } from "@earendil-works/pi-ai/utils/estimate";
@@ -1647,7 +1646,7 @@ let GitHubCopilotUsageController = (() => {
1647
1646
  //#endregion
1648
1647
  //#region package.json
1649
1648
  var name$1 = "dsh-github-copilot";
1650
- var version = "0.4.0-alpha.57";
1649
+ var version = "0.4.0-alpha.59";
1651
1650
  //#endregion
1652
1651
  //#region lib/types/probe.js
1653
1652
  /**
@@ -2066,6 +2065,15 @@ const WebSearchRoutingConfigSchema = z.object({
2066
2065
  * configurable through the settings seam; defaults follow the chat route.
2067
2066
  * @module dsh-github-copilot/config
2068
2067
  */
2068
+ /** Keep native live references at the boundary; request code consumes plain snapshots. */
2069
+ function readInlineConfig(config) {
2070
+ return {
2071
+ ...config,
2072
+ searchModel: readConfigValue(config.searchModel),
2073
+ searchRouting: readConfigValue(config.searchRouting),
2074
+ temporaryRouteBackup: readConfigValue(config.temporaryRouteBackup)
2075
+ };
2076
+ }
2069
2077
  /** Longest timer either bound may take; `setTimeout`/`AbortSignal.timeout` refuse more. */
2070
2078
  const MAX_TIMEOUT_MS = 2147483647;
2071
2079
  /** Schema of the plugin's settings section. */
@@ -2084,9 +2092,9 @@ const Config = z.object({
2084
2092
  compactionReasoning: z.union(["prefer-low", "preserve"]).default(DEFAULT_REQUEST_BUDGET_POLICY.compactionReasoning),
2085
2093
  routeWebSearch: z.boolean().default(true),
2086
2094
  searchFallback: z.union(["none", "deepseek"]).default("deepseek"),
2087
- searchModel: z.string().hidden(),
2088
- searchRouting: WebSearchRoutingConfigSchema.default({}),
2089
- temporaryRouteBackup: z.string().hidden()
2095
+ searchModel: z.string().hidden().volatile(),
2096
+ searchRouting: WebSearchRoutingConfigSchema.default({}).volatile(),
2097
+ temporaryRouteBackup: z.string().hidden().volatile()
2090
2098
  });
2091
2099
  //#endregion
2092
2100
  //#region lib/types/search-tool-routing.js
@@ -3680,12 +3688,6 @@ async function* inlineStream(request, candidate, hooks, cfg) {
3680
3688
  }
3681
3689
  //#endregion
3682
3690
  //#region lib/types/deepseek-search-fallback.js
3683
- function isVolatileSetting(value) {
3684
- return typeof value === "object" && value !== null && typeof Reflect.get(value, "get") === "function";
3685
- }
3686
- function readConfigValue(value) {
3687
- return isVolatileSetting(value) ? value.get() : value;
3688
- }
3689
3691
  var InvalidFallbackBase = class extends WebError {
3690
3692
  constructor() {
3691
3693
  super("DeepSeek fallback requires an HTTP(S) API base URL without userinfo, query or fragment", "WEB_PROVIDER_UNAVAILABLE");
@@ -5109,6 +5111,15 @@ async function isCopilotInputItemScopeError(response, signal) {
5109
5111
  }
5110
5112
  //#endregion
5111
5113
  //#region lib/types/preview-provider.js
5114
+ /** Identity, not upstream error text, proves that the plugin revoked this wire. */
5115
+ var ManagedWireAbortError = class extends Error {
5116
+ code;
5117
+ constructor(code) {
5118
+ super(code);
5119
+ this.code = code;
5120
+ this.name = "ManagedWireAbortError";
5121
+ }
5122
+ };
5112
5123
  const enabledLevels = [
5113
5124
  "minimal",
5114
5125
  "low",
@@ -5332,7 +5343,10 @@ function createAccountProvider(descriptors, guard, baseURL) {
5332
5343
  }
5333
5344
  return (async function* () {
5334
5345
  try {
5335
- yield* native.streamSimple(model, context, wireOptions);
5346
+ for await (const event of native.streamSimple(model, context, wireOptions)) {
5347
+ if (event.type === "error" && event.reason === "aborted" && lease.signal.reason instanceof ManagedWireAbortError) guard.onWireAbort?.(lease.signal.reason.code);
5348
+ yield event;
5349
+ }
5336
5350
  } finally {
5337
5351
  lease.release();
5338
5352
  if (unauthorized && !guard.signal.aborted && !options.signal?.aborted) try {
@@ -6368,6 +6382,51 @@ function selectAutoModel(models, messages, preference = "balance", context) {
6368
6382
  function autoModelInputModalities(models) {
6369
6383
  return models.filter((model) => autoModelPreference(model.id) === void 0 && model.input.includes("text")).some((model) => model.input.includes("image")) ? ["text", "image"] : ["text"];
6370
6384
  }
6385
+ z$1.discriminatedUnion("mode", [
6386
+ z$1.object({ mode: z$1.literal("unknown") }).strict(),
6387
+ z$1.object({ mode: z$1.literal("manual") }).strict(),
6388
+ z$1.object({
6389
+ mode: z$1.literal("auto"),
6390
+ preference: z$1.enum([
6391
+ "efficiency",
6392
+ "balance",
6393
+ "intelligence"
6394
+ ]),
6395
+ reason: z$1.enum([
6396
+ "short-text-turn",
6397
+ "standard-turn",
6398
+ "large-structured-turn",
6399
+ "image-capability"
6400
+ ]),
6401
+ candidateCount: z$1.number().int().positive(),
6402
+ fittingCandidateCount: z$1.number().int().nonnegative().optional()
6403
+ }).strict()
6404
+ ]);
6405
+ /** Ephemeral decision evidence only; never session content, model usage or credentials. */
6406
+ var TurnSelectionStore = class {
6407
+ agents = /* @__PURE__ */ new Map();
6408
+ record(agent, turn, selection) {
6409
+ if (!Number.isSafeInteger(turn) || turn < 0) throw new Error("COPILOT_TURN_SELECTION_INVALID_TURN");
6410
+ let turns = this.agents.get(agent);
6411
+ if (!turns) {
6412
+ turns = /* @__PURE__ */ new Map();
6413
+ this.agents.set(agent, turns);
6414
+ if (this.agents.size > 64) this.agents.delete(this.agents.keys().next().value);
6415
+ }
6416
+ if (!turns.has(turn)) turns.set(turn, Object.freeze({ ...selection }));
6417
+ if (turns.size > 128) turns.delete(turns.keys().next().value);
6418
+ }
6419
+ get(agent, turn) {
6420
+ if (!Number.isSafeInteger(turn) || turn < 0) throw new Error("COPILOT_TURN_SELECTION_INVALID_TURN");
6421
+ return this.agents.get(agent)?.get(turn) ?? { mode: "unknown" };
6422
+ }
6423
+ remove(agent) {
6424
+ this.agents.delete(agent);
6425
+ }
6426
+ clear() {
6427
+ this.agents.clear();
6428
+ }
6429
+ };
6371
6430
  //#endregion
6372
6431
  //#region lib/types/auto-model-host.js
6373
6432
  function failure$1(code) {
@@ -6431,6 +6490,8 @@ function actualNotice(agent, model) {
6431
6490
  }
6432
6491
  /** Resolve virtual Auto once per Core turn before request/header persistence. */
6433
6492
  function installAutoModelRouting(ctx, dependencies) {
6493
+ const selections = new TurnSelectionStore();
6494
+ ctx.provide("githubCopilotTurnSelection", { get: (agent, turn) => selections.get(agent, turn) });
6434
6495
  const captured = /* @__PURE__ */ new WeakMap();
6435
6496
  const routed = /* @__PURE__ */ new WeakMap();
6436
6497
  const agentDisposers = /* @__PURE__ */ new WeakMap();
@@ -6496,6 +6557,7 @@ function installAutoModelRouting(ctx, dependencies) {
6496
6557
  agentDisposers.delete(agent);
6497
6558
  captured.delete(agent);
6498
6559
  routed.delete(agent);
6560
+ selections.remove(agent);
6499
6561
  });
6500
6562
  const removeRequest = ctx.on("agent/request", async ({ agent, turn, signal }, next) => {
6501
6563
  const resolved = await next();
@@ -6504,6 +6566,10 @@ function installAutoModelRouting(ctx, dependencies) {
6504
6566
  const virtual = virtualPreference !== void 0;
6505
6567
  if (!virtual && pending === void 0) {
6506
6568
  routed.delete(agent);
6569
+ const projections = ctx.get("sessionProjections");
6570
+ const selection = record(projections) && typeof projections.stateOf === "function" ? projections.stateOf(agent.session, "modelSelection") : void 0;
6571
+ const fixed = record(selection) && record(selection.pending) && selection.pending.provider === resolved.provider && selection.pending.model === resolved.model;
6572
+ if (!signal.aborted && (resolved.provider === "github-copilot-preview" || resolved.provider === "github-copilot")) selections.record(agent, turn, { mode: fixed ? "manual" : "unknown" });
6507
6573
  return resolved;
6508
6574
  }
6509
6575
  if (resolved.provider !== "github-copilot-preview") {
@@ -6535,6 +6601,13 @@ function installAutoModelRouting(ctx, dependencies) {
6535
6601
  }
6536
6602
  state.recorded = true;
6537
6603
  }
6604
+ if (!signal.aborted) selections.record(agent, turn, {
6605
+ mode: "auto",
6606
+ preference: state.decision.preference,
6607
+ reason: state.decision.reason,
6608
+ candidateCount: state.decision.candidateCount,
6609
+ fittingCandidateCount: state.decision.fittingCandidateCount
6610
+ });
6538
6611
  return {
6539
6612
  ...resolved,
6540
6613
  model: state.decision.model.id
@@ -6546,6 +6619,7 @@ function installAutoModelRouting(ctx, dependencies) {
6546
6619
  removeRequest();
6547
6620
  for (const dispose of activeDisposers) dispose();
6548
6621
  activeDisposers.clear();
6622
+ selections.clear();
6549
6623
  };
6550
6624
  }
6551
6625
  //#endregion
@@ -6553,6 +6627,9 @@ function installAutoModelRouting(ctx, dependencies) {
6553
6627
  function failure(code, category = "AUTH") {
6554
6628
  return new LlmError(code, category);
6555
6629
  }
6630
+ function abortFailure(signal) {
6631
+ return failure(signal.reason instanceof ManagedWireAbortError ? signal.reason.code : "COPILOT_PREVIEW_ABORTED", "ABORTED");
6632
+ }
6556
6633
  function tokenFingerprint(value) {
6557
6634
  return createHash("sha256").update(value).digest("hex");
6558
6635
  }
@@ -6595,13 +6672,13 @@ var PreviewLifetime = class {
6595
6672
  this.assertActive();
6596
6673
  this.revision++;
6597
6674
  this.source.invalidate();
6598
- for (const wire of this.wires) wire.abort(failure("COPILOT_PREVIEW_CREDENTIAL_CHANGED", "ABORTED"));
6675
+ for (const wire of this.wires) wire.abort(new ManagedWireAbortError("COPILOT_PREVIEW_CREDENTIAL_CHANGED"));
6599
6676
  }
6600
6677
  dispose() {
6601
6678
  if (!this.active) return;
6602
6679
  this.active = false;
6603
6680
  this.source.dispose();
6604
- this.controller.abort(failure("COPILOT_PREVIEW_DISPOSED", "ABORTED"));
6681
+ this.controller.abort(new ManagedWireAbortError("COPILOT_PREVIEW_DISPOSED"));
6605
6682
  for (const wire of this.wires) wire.abort();
6606
6683
  this.wires.clear();
6607
6684
  }
@@ -6618,7 +6695,7 @@ var PreviewLifetime = class {
6618
6695
  credential = await abortable$1(this.credentials.read(GITHUB_COPILOT_PREVIEW_PROVIDER_ID), signal);
6619
6696
  } catch {
6620
6697
  this.assertActive();
6621
- if (signal.aborted) throw failure("COPILOT_PREVIEW_ABORTED", "ABORTED");
6698
+ if (signal.aborted) throw abortFailure(signal);
6622
6699
  if (revision === this.revision) invalidateRead();
6623
6700
  throw failure("COPILOT_PREVIEW_CREDENTIAL_READ_FAILED");
6624
6701
  }
@@ -6875,7 +6952,7 @@ var PreviewAdapter = class extends PiAiAdapter {
6875
6952
  owned(options.provider);
6876
6953
  if (options.model !== lease.descriptor.id) throw failure("COPILOT_PREVIEW_MODEL_MISMATCH");
6877
6954
  const signal = AbortSignal.any([lease.signal, ...options.signal === void 0 ? [] : [options.signal]]);
6878
- if (signal.aborted) throw failure("COPILOT_PREVIEW_ABORTED", "ABORTED");
6955
+ if (signal.aborted) throw abortFailure(signal);
6879
6956
  const policy = resolveRequestBudgetPolicy(owner.requestBudgetSettings());
6880
6957
  const model = accountModelFromDescriptor(lease.descriptor, lease.proof.baseURL);
6881
6958
  if (options.reasoningEffort !== void 0) {
@@ -6883,8 +6960,9 @@ var PreviewAdapter = class extends PiAiAdapter {
6883
6960
  if (typeof mapping !== "string" || mapping.length === 0) throw failure("COPILOT_PREVIEW_REASONING_UNSUPPORTED", "INVALID_REQUEST");
6884
6961
  }
6885
6962
  let requestFailure;
6963
+ let wireAbort;
6886
6964
  const inspectRequest = (_model, context, nativeOptions) => {
6887
- if (signal.aborted) throw failure("COPILOT_PREVIEW_ABORTED", "ABORTED");
6965
+ if (signal.aborted) throw abortFailure(signal);
6888
6966
  const calculated = calculateRequestBudget(lease.descriptor, nativeOptions?.maxTokens, policy);
6889
6967
  if (!calculated.ok) {
6890
6968
  requestFailure = budgetFailure(calculated);
@@ -6900,6 +6978,9 @@ var PreviewAdapter = class extends PiAiAdapter {
6900
6978
  try {
6901
6979
  const native = new PiAiAdapter(owner.optionsFor(lease, {
6902
6980
  inspectRequest,
6981
+ onWireAbort(code) {
6982
+ wireAbort = code;
6983
+ },
6903
6984
  onReplayFailure(error) {
6904
6985
  if (!signal.aborted) requestFailure = new LlmError(error.message, "INVALID_REQUEST");
6905
6986
  }
@@ -6914,15 +6995,19 @@ var PreviewAdapter = class extends PiAiAdapter {
6914
6995
  };
6915
6996
  for await (const chunk of native.stream(request)) {
6916
6997
  if (requestFailure !== void 0) {
6917
- if (signal.aborted) throw failure("COPILOT_PREVIEW_ABORTED", "ABORTED");
6998
+ if (signal.aborted) throw abortFailure(signal);
6918
6999
  throw requestFailure;
6919
7000
  }
7001
+ if (chunk.type === "finish" && wireAbort !== void 0) {
7002
+ if (signal.aborted) throw abortFailure(signal);
7003
+ throw failure(wireAbort, "ABORTED");
7004
+ }
6920
7005
  if (chunk.type === "finish" && chunk.reason.kind === "error" && chunk.reason.failure.code === "UNKNOWN_MODEL") await owner.refreshRejected(lease.snapshot, signal);
6921
7006
  yield chunk;
6922
7007
  }
6923
7008
  if (requestFailure !== void 0) throw requestFailure;
6924
7009
  } catch (cause) {
6925
- if (signal.aborted) throw failure("COPILOT_PREVIEW_ABORTED", "ABORTED");
7010
+ if (signal.aborted) throw abortFailure(signal);
6926
7011
  if (cause instanceof LlmError && cause.code === "UNKNOWN_MODEL") await owner.refreshRejected(lease.snapshot, signal);
6927
7012
  throw requestFailure ?? cause;
6928
7013
  }
@@ -7304,31 +7389,21 @@ var ConfiguredSearchProofInvalidated = class extends WebError {
7304
7389
  super("configured Copilot search owner or account proof invalidated", "WEB_PROVIDER_UNAVAILABLE");
7305
7390
  }
7306
7391
  };
7307
- function installSettingsNamespace(ctx, namespace, schema, config, hooks) {
7308
- const legacyInstaller = dshSettings.installSettingsSection;
7309
- if (legacyInstaller !== void 0) {
7310
- legacyInstaller(ctx, namespace, schema, config, hooks);
7311
- return;
7312
- }
7313
- ctx.inject(["settings"], () => {
7392
+ function observeSettingsNamespace(ctx, namespace, config, hooks) {
7393
+ ctx.inject(["settings"], (scope) => {
7314
7394
  hooks.setSource(() => {
7315
- const value = readSettingsNamespace(ctx, namespace);
7316
- if (typeof value !== "object" || value === null) return config;
7317
- const merged = {
7318
- ...typeof config === "object" && config !== null ? config : {},
7395
+ const value = readSettingsNamespace(scope, namespace);
7396
+ const base = readInlineConfig(config);
7397
+ if (typeof value !== "object" || value === null) return base;
7398
+ return {
7399
+ ...base,
7319
7400
  ...value
7320
7401
  };
7321
- if (typeof schema === "function") try {
7322
- return schema(merged);
7323
- } catch {
7324
- return merged;
7325
- }
7326
- return merged;
7327
7402
  });
7328
- const dispose = onSettingsNamespaceUpdated(ctx, (changed) => {
7403
+ const dispose = onSettingsNamespaceUpdated(scope, (changed) => {
7329
7404
  if (changed === namespace || namespace === "github-copilot" && changed === "github-copilot-search-routing") hooks.onChange();
7330
7405
  });
7331
- ctx.effect(() => dispose);
7406
+ scope.effect(() => dispose);
7332
7407
  });
7333
7408
  }
7334
7409
  /**
@@ -7375,7 +7450,7 @@ function ensureAuthorization(ctx) {
7375
7450
  /** Activate the integration only after the complete DSH service contract is available. */
7376
7451
  function activate(ctx, config) {
7377
7452
  assertDshCompatibility(ctx);
7378
- let current = () => config;
7453
+ let current = () => readInlineConfig(config);
7379
7454
  const readRouting = () => {
7380
7455
  const rawRouting = readSettingsNamespace(ctx, GITHUB_COPILOT_SETTINGS_NAMESPACE)?.searchRouting;
7381
7456
  if (rawRouting && (rawRouting.searchProvider !== void 0 || rawRouting.defaultSearchProvider !== void 0 || rawRouting.searchMode !== void 0)) return rawRouting;
@@ -7769,7 +7844,7 @@ function activate(ctx, config) {
7769
7844
  canContinue
7770
7845
  })).result;
7771
7846
  } });
7772
- installSettingsNamespace(ctx, GITHUB_COPILOT_SETTINGS_NAMESPACE, Config, config, {
7847
+ observeSettingsNamespace(ctx, GITHUB_COPILOT_SETTINGS_NAMESPACE, config, {
7773
7848
  setSource: (source) => {
7774
7849
  current = source;
7775
7850
  },
package/lib/remote.js CHANGED
@@ -43,7 +43,7 @@ const DualModelCreateSchema = z.object({
43
43
  expectedRevision: revision
44
44
  }).strict();
45
45
  const DualModelCreateResultSchema = z.object({ sessionId: id }).strict();
46
- const contribution$3 = {
46
+ const contribution$4 = {
47
47
  package: "dsh-github-copilot",
48
48
  descriptors: [
49
49
  {
@@ -85,7 +85,7 @@ const contribution$3 = {
85
85
  }
86
86
  ]
87
87
  };
88
- const contribution$2 = {
88
+ const contribution$3 = {
89
89
  package: "dsh-github-copilot",
90
90
  descriptors: [{
91
91
  id: "dsh-github-copilot:githubCopilotSearchRouting.providers",
@@ -181,7 +181,7 @@ const CopilotUsageViewSchema = z.object({
181
181
  if (view.remaining !== void 0 && view.percentUsed !== void 0 && Math.abs((1 - view.remaining / view.limit) * 100 - view.percentUsed) > 1) invalid();
182
182
  }
183
183
  });
184
- const contribution$1 = {
184
+ const contribution$2 = {
185
185
  package: "dsh-github-copilot",
186
186
  descriptors: ["get", "refresh"].map((method) => ({
187
187
  id: `dsh-github-copilot:githubCopilotUsage.${method}`,
@@ -194,6 +194,57 @@ const contribution$1 = {
194
194
  }))
195
195
  };
196
196
  //#endregion
197
+ //#region lib/types/turn-selection.js
198
+ const TurnSelectionSchema = z.discriminatedUnion("mode", [
199
+ z.object({ mode: z.literal("unknown") }).strict(),
200
+ z.object({ mode: z.literal("manual") }).strict(),
201
+ z.object({
202
+ mode: z.literal("auto"),
203
+ preference: z.enum([
204
+ "efficiency",
205
+ "balance",
206
+ "intelligence"
207
+ ]),
208
+ reason: z.enum([
209
+ "short-text-turn",
210
+ "standard-turn",
211
+ "large-structured-turn",
212
+ "image-capability"
213
+ ]),
214
+ candidateCount: z.number().int().positive(),
215
+ fittingCandidateCount: z.number().int().nonnegative().optional()
216
+ }).strict()
217
+ ]);
218
+ //#endregion
219
+ //#region lib/types/turn-selection-remote.js
220
+ const contribution$1 = {
221
+ package: "dsh-github-copilot",
222
+ descriptors: [{
223
+ id: "dsh-github-copilot:githubCopilotTurnSelection.get",
224
+ namespace: "githubCopilotTurnSelection",
225
+ service: "githubCopilotTurnSelection",
226
+ method: "get",
227
+ invocation: { kind: "direct" },
228
+ scope: {
229
+ context: "agent",
230
+ wire: "agentId"
231
+ },
232
+ parameters: [{
233
+ name: "agent",
234
+ wire: "agentId",
235
+ source: "lookup",
236
+ lookup: "agent",
237
+ codec: strictRemoteCodec("@deepseek-ai/dsh-session/types#SessionId", z.string().min(1).max(256))
238
+ }, {
239
+ name: "turn",
240
+ wire: "turn",
241
+ source: "json",
242
+ codec: strictRemoteCodec("dsh-github-copilot#TurnSelectionTurn", z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER))
243
+ }],
244
+ result: strictRemoteCodec("dsh-github-copilot#TurnSelection", TurnSelectionSchema)
245
+ }]
246
+ };
247
+ //#endregion
197
248
  //#region lib/types/remote.js
198
249
  /**
199
250
  * Client-safe Remote contribution for the plugin-owned authorization bridge.
@@ -351,6 +402,7 @@ const contribution = {
351
402
  parameters: [],
352
403
  result: strictRemoteCodec(GITHUB_COPILOT_MIGRATION_STATUS_TYPE_SYMBOL, GitHubCopilotMigrationStatusSchema)
353
404
  },
405
+ ...contribution$4.descriptors,
354
406
  ...contribution$3.descriptors,
355
407
  ...contribution$2.descriptors,
356
408
  ...contribution$1.descriptors
package/lib/routed-web.js CHANGED
@@ -1,4 +1,4 @@
1
- import { C as currentSearchInitiator, D as isPluginPreviewProvider, t as isCopilotSearchSelection, w as currentSearchSelection } from "./search-routing-CncYAO8_.js";
1
+ import { C as currentSearchInitiator, O as isPluginPreviewProvider, t as isCopilotSearchSelection, w as currentSearchSelection } from "./search-routing-BhrTbF-V.js";
2
2
  import { WebError, WebRuntime } from "@deepseek-ai/dsh-web";
3
3
  //#region lib/types/routed-web.js
4
4
  /**
@@ -54,6 +54,13 @@ function isPluginPreviewProvider(ctx, provider) {
54
54
  }
55
55
  //#endregion
56
56
  //#region lib/types/settings-reader.js
57
+ function isLiveSetting(value) {
58
+ return typeof value === "object" && value !== null && typeof Reflect.get(value, "get") === "function";
59
+ }
60
+ /** Capture a native volatile field for one operation, or retain a plain fixture value. */
61
+ function readConfigValue(value) {
62
+ return isLiveSetting(value) ? value.get() : value;
63
+ }
57
64
  function isRecord(value) {
58
65
  return typeof value === "object" && value !== null;
59
66
  }
@@ -795,4 +802,4 @@ async function routeSessionSearch(request, signal, deps) {
795
802
  };
796
803
  }
797
804
  //#endregion
798
- export { GITHUB_COPILOT_AUTO_INTELLIGENCE_MODEL_ID as A, currentSearchInitiator as C, isPluginPreviewProvider as D, readSettingsNamespace as E, autoModelPreference as F, GITHUB_COPILOT_CREDENTIAL_KEY$1 as M, GITHUB_COPILOT_PREVIEW_PROVIDER_ID as N, readCopilotCatalog as O, GITHUB_COPILOT_PROVIDER_ID as P, currentChatRoute as S, onSettingsNamespaceUpdated as T, RESPONSES_WEB_SEARCH_TOOL_TYPE as _, COPILOT_HOSTED_SEARCH_PROVIDER_ID as a, candidatesForRoute as b, abortable as c, readBounded as d, applyRequestAuth as f, GITHUB_COPILOT_CREDENTIAL_KEY as g, ANTHROPIC_WEB_SEARCH_TOOL_TYPE as h, describeSearchBackend as i, GITHUB_COPILOT_AUTO_MODEL_ID as j, GITHUB_COPILOT_AUTO_EFFICIENCY_MODEL_ID as k, isAbortError as l, providerRequestHeaders as m, routeSessionSearch as n, GITHUB_COPILOT_HOSTED_SEARCH_PROVIDER_ID as o, normalizeRequestAuth as p, DescribedSearchFallbackError as r, createTraditionalSearchProvider as s, isCopilotSearchSelection as t, providerErrorMessage as u, SearchPlan as v, currentSearchSelection as w, sameCandidates as x, WEB_SEARCH_TOOL_TYPE as y };
805
+ export { GITHUB_COPILOT_AUTO_EFFICIENCY_MODEL_ID as A, currentSearchInitiator as C, readSettingsNamespace as D, readConfigValue as E, GITHUB_COPILOT_PROVIDER_ID as F, autoModelPreference as I, GITHUB_COPILOT_AUTO_MODEL_ID as M, GITHUB_COPILOT_CREDENTIAL_KEY$1 as N, isPluginPreviewProvider as O, GITHUB_COPILOT_PREVIEW_PROVIDER_ID as P, currentChatRoute as S, onSettingsNamespaceUpdated as T, RESPONSES_WEB_SEARCH_TOOL_TYPE as _, COPILOT_HOSTED_SEARCH_PROVIDER_ID as a, candidatesForRoute as b, abortable as c, readBounded as d, applyRequestAuth as f, GITHUB_COPILOT_CREDENTIAL_KEY as g, ANTHROPIC_WEB_SEARCH_TOOL_TYPE as h, describeSearchBackend as i, GITHUB_COPILOT_AUTO_INTELLIGENCE_MODEL_ID as j, readCopilotCatalog as k, isAbortError as l, providerRequestHeaders as m, routeSessionSearch as n, GITHUB_COPILOT_HOSTED_SEARCH_PROVIDER_ID as o, normalizeRequestAuth as p, DescribedSearchFallbackError as r, createTraditionalSearchProvider as s, isCopilotSearchSelection as t, providerErrorMessage as u, SearchPlan as v, currentSearchSelection as w, sameCandidates as x, WEB_SEARCH_TOOL_TYPE as y };
@@ -1,6 +1,15 @@
1
1
  import type { Context } from '@deepseek-ai/cordis';
2
+ import type { Agent } from '@deepseek-ai/dsh-agent';
2
3
  import type { AccountModelDescriptor } from './account-model-catalog.ts';
3
4
  import type { RequestBudgetPolicy } from './request-budget.ts';
5
+ import { TurnSelectionStore } from './turn-selection.ts';
6
+ declare module '@deepseek-ai/cordis' {
7
+ interface Context {
8
+ githubCopilotTurnSelection: {
9
+ get(agent: Agent, turn: number): ReturnType<TurnSelectionStore['get']>;
10
+ };
11
+ }
12
+ }
4
13
  export interface AutoModelHostDependencies {
5
14
  loadModels(signal: AbortSignal): Promise<readonly AccountModelDescriptor[]>;
6
15
  budgetPolicy?: () => Partial<RequestBudgetPolicy>;
@@ -42,12 +42,12 @@ export declare const autoModelAttributionDefinition: {
42
42
  }): AttributionState;
43
43
  buildLocationData(context: Context, scope: string, previous: LocationData | null): LocationData | null;
44
44
  };
45
- /** Inline footer chrome: after the settled clock, hidden until the message is hovered. */
46
- export declare const AUTO_ATTRIBUTION_STYLE: string;
47
45
  export declare function installAutoModelPresentation(capabilities: {
48
46
  readonly slots: unknown;
49
47
  readonly uiConversation: unknown;
50
48
  readonly diagnostic: (code: string) => void;
49
+ readonly remote?: unknown;
50
+ readonly locale?: unknown;
51
51
  }): Dispose;
52
52
  export {};
53
53
  //# sourceMappingURL=auto-model-presentation.d.ts.map
@@ -7,6 +7,7 @@
7
7
  import z from '@deepseek-ai/schemastery';
8
8
  import type { RequestBudgetPolicy } from './request-budget.ts';
9
9
  import type { WebSearchRoutingConfig } from './web-search-routing-config.ts';
10
+ import type { LiveSetting } from './settings-reader.ts';
10
11
  /** Plugin configuration. Defaults make the current chat route decide. */
11
12
  export interface InlineConfig {
12
13
  /** Master switch; false sends every request down the normal adapter path. */
@@ -47,6 +48,18 @@ export interface InlineConfig {
47
48
  /** Internal JSON backup of route leaves temporarily owned by the GPT-6 overlay. */
48
49
  temporaryRouteBackup?: string;
49
50
  }
51
+ export type LiveInlineConfig = Omit<InlineConfig, 'searchModel' | 'searchRouting' | 'temporaryRouteBackup'> & {
52
+ searchModel?: string | LiveSetting<string | undefined>;
53
+ searchRouting?: WebSearchRoutingConfig | LiveSetting<WebSearchRoutingConfig | undefined>;
54
+ temporaryRouteBackup?: string | LiveSetting<string | undefined>;
55
+ };
56
+ export type ResolvedInlineConfig = Omit<InlineConfig, 'searchModel' | 'searchRouting' | 'temporaryRouteBackup'> & {
57
+ searchModel: LiveSetting<string | undefined>;
58
+ searchRouting: LiveSetting<WebSearchRoutingConfig>;
59
+ temporaryRouteBackup: LiveSetting<string | undefined>;
60
+ };
61
+ /** Keep native live references at the boundary; request code consumes plain snapshots. */
62
+ export declare function readInlineConfig(config: LiveInlineConfig): InlineConfig;
50
63
  /** Schema of the plugin's settings section. */
51
- export declare const Config: z<InlineConfig>;
64
+ export declare const Config: z<Partial<InlineConfig>, ResolvedInlineConfig>;
52
65
  //# sourceMappingURL=config.d.ts.map
@@ -7,7 +7,7 @@
7
7
  */
8
8
  import type { Context } from '@deepseek-ai/cordis';
9
9
  import type { SettingsNamespace } from '@deepseek-ai/dsh-settings';
10
- import type { InlineConfig } from './config.ts';
10
+ import type { LiveInlineConfig } from './config.ts';
11
11
  export { COPILOT_HOSTED_SEARCH_PROVIDER_ID, GITHUB_COPILOT_HOSTED_SEARCH_PROVIDER_ID, } from './traditional-search.ts';
12
12
  /** Cordis plugin name used by loader diagnostics. */
13
13
  export declare const name = "github-copilot";
@@ -35,5 +35,5 @@ export type { AuthorizationNoticeView, GitHubCopilotAuthorizationPhase, GitHubCo
35
35
  * registrations; both are effect-scoped and unregister on dispose.
36
36
  * @param config - the composition entry config, used as the settings base layer.
37
37
  */
38
- export declare function apply(ctx: Context, config: InlineConfig): void;
38
+ export declare function apply(ctx: Context, config: LiveInlineConfig): void;
39
39
  //# sourceMappingURL=index.d.ts.map
@@ -3,6 +3,12 @@ import type { AccountModelApi, AccountModelDescriptor } from './account-model-ca
3
3
  import type { CoreCompatibleProvider } from './pi-provider-bridge.ts';
4
4
  import type { GitHubCopilotOAuthCredential } from './copilot-grant.ts';
5
5
  import { CopilotResponsesReplayError } from './responses-replay-compat.ts';
6
+ export type ManagedWireAbortCode = 'COPILOT_PREVIEW_CREDENTIAL_CHANGED' | 'COPILOT_PREVIEW_DISPOSED';
7
+ /** Identity, not upstream error text, proves that the plugin revoked this wire. */
8
+ export declare class ManagedWireAbortError extends Error {
9
+ readonly code: ManagedWireAbortCode;
10
+ constructor(code: ManagedWireAbortCode);
11
+ }
6
12
  /** Per-call authorization/lifetime checks supplied by the owning route. */
7
13
  export interface PreviewProviderGuard {
8
14
  readonly signal: AbortSignal;
@@ -16,6 +22,8 @@ export interface PreviewProviderGuard {
16
22
  onUnauthorized?(): void;
17
23
  /** Dispatch-local, verified replay failure; never inferred from SDK error text. */
18
24
  onReplayFailure?(error: CopilotResponsesReplayError): void;
25
+ /** Preserve an owned abort cause before SDK terminal delivery and lease cleanup. */
26
+ onWireAbort?(code: ManagedWireAbortCode): void;
19
27
  }
20
28
  /** Guard for one selected model in an account-bound descriptor snapshot. */
21
29
  export interface AccountProviderGuard extends PreviewProviderGuard {
@@ -1,4 +1,9 @@
1
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;
2
7
  /** Read non-secret configuration through the API available on the running Core. */
3
8
  export declare function readSettingsNamespace(ctx: Context, namespace: string): unknown;
4
9
  declare module '@deepseek-ai/cordis' {
@@ -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,8 @@
1
+ import type { ReactElement } from 'react';
2
+ import type { TurnSelection } from './turn-selection.ts';
3
+ export declare function TurnSelectionCard({ selection, locale, incomplete }: {
4
+ selection: TurnSelection;
5
+ locale?: string;
6
+ incomplete?: boolean;
7
+ }): ReactElement;
8
+ //# sourceMappingURL=turn-selection-card.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