dsh-github-copilot 0.4.0-alpha.50 → 0.4.0-alpha.51
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 +2 -2
- package/CHANGELOG.md +6 -0
- package/README.md +8 -8
- package/README.zh.md +10 -10
- package/deployment-baseline.json +4 -3
- package/docs/session-search-routing.md +2 -2
- package/lib/client.js +31 -14
- package/lib/client.js.map +1 -1
- package/lib/index.js +25 -26
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -1622,7 +1622,7 @@ let GitHubCopilotUsageController = (() => {
|
|
|
1622
1622
|
//#endregion
|
|
1623
1623
|
//#region package.json
|
|
1624
1624
|
var name$1 = "dsh-github-copilot";
|
|
1625
|
-
var version = "0.4.0-alpha.
|
|
1625
|
+
var version = "0.4.0-alpha.51";
|
|
1626
1626
|
//#endregion
|
|
1627
1627
|
//#region lib/types/probe.js
|
|
1628
1628
|
/**
|
|
@@ -7115,27 +7115,29 @@ var ConfiguredSearchProofInvalidated = class extends WebError {
|
|
|
7115
7115
|
super("configured Copilot search owner or account proof invalidated", "WEB_PROVIDER_UNAVAILABLE");
|
|
7116
7116
|
}
|
|
7117
7117
|
};
|
|
7118
|
-
function isInstanceSettingsInstaller(value) {
|
|
7119
|
-
return typeof value === "object" && value !== null && "installSection" in value && typeof value.installSection === "function";
|
|
7120
|
-
}
|
|
7121
7118
|
function installSettingsNamespace(ctx, namespace, schema, config, hooks) {
|
|
7122
7119
|
const legacyInstaller = dshSettings.installSettingsSection;
|
|
7123
7120
|
if (legacyInstaller !== void 0) {
|
|
7124
7121
|
legacyInstaller(ctx, namespace, schema, config, hooks);
|
|
7125
7122
|
return;
|
|
7126
7123
|
}
|
|
7127
|
-
ctx.inject(["settings"], (
|
|
7128
|
-
if (isInstanceSettingsInstaller(settingsCtx.settings)) {
|
|
7129
|
-
settingsCtx.settings.installSection(ctx, namespace, schema, config, hooks);
|
|
7130
|
-
return;
|
|
7131
|
-
}
|
|
7132
|
-
const fallback = namespace === "github-copilot-search-routing" ? (typeof config === "object" && config !== null ? config : void 0)?.searchRouting ?? {} : config;
|
|
7124
|
+
ctx.inject(["settings"], () => {
|
|
7133
7125
|
hooks.setSource(() => {
|
|
7134
|
-
|
|
7126
|
+
const value = readSettingsNamespace(ctx, namespace);
|
|
7127
|
+
if (typeof value !== "object" || value === null) return config;
|
|
7128
|
+
const merged = {
|
|
7129
|
+
...typeof config === "object" && config !== null ? config : {},
|
|
7130
|
+
...value
|
|
7131
|
+
};
|
|
7132
|
+
if (typeof schema === "function") try {
|
|
7133
|
+
return schema(merged);
|
|
7134
|
+
} catch {
|
|
7135
|
+
return merged;
|
|
7136
|
+
}
|
|
7137
|
+
return merged;
|
|
7135
7138
|
});
|
|
7136
|
-
const watched = namespace === "github-copilot-search-routing" ? /* @__PURE__ */ new Set([namespace, GITHUB_COPILOT_SETTINGS_NAMESPACE]) : /* @__PURE__ */ new Set([namespace]);
|
|
7137
7139
|
const dispose = onSettingsNamespaceUpdated(ctx, (changed) => {
|
|
7138
|
-
if (
|
|
7140
|
+
if (changed === namespace || namespace === "github-copilot" && changed === "github-copilot-search-routing") hooks.onChange();
|
|
7139
7141
|
});
|
|
7140
7142
|
ctx.effect(() => dispose);
|
|
7141
7143
|
});
|
|
@@ -7185,10 +7187,13 @@ function ensureAuthorization(ctx) {
|
|
|
7185
7187
|
function activate(ctx, config) {
|
|
7186
7188
|
assertDshCompatibility(ctx);
|
|
7187
7189
|
let current = () => config;
|
|
7188
|
-
|
|
7189
|
-
|
|
7190
|
-
defaultSearchProvider
|
|
7191
|
-
|
|
7190
|
+
const readRouting = () => {
|
|
7191
|
+
const rawRouting = readSettingsNamespace(ctx, GITHUB_COPILOT_SETTINGS_NAMESPACE)?.searchRouting;
|
|
7192
|
+
if (rawRouting && (rawRouting.searchProvider !== void 0 || rawRouting.defaultSearchProvider !== void 0 || rawRouting.searchMode !== void 0)) return rawRouting;
|
|
7193
|
+
const legacy = readSettingsNamespace(ctx, WEB_SEARCH_ROUTING_SETTINGS_NAMESPACE);
|
|
7194
|
+
if (legacy && (legacy.searchProvider !== void 0 || legacy.defaultSearchProvider !== void 0 || legacy.searchMode !== void 0)) return legacy;
|
|
7195
|
+
return current().searchRouting ?? {};
|
|
7196
|
+
};
|
|
7192
7197
|
ctx.plugin(preview_route_default, {
|
|
7193
7198
|
accountModelSettings: () => current(),
|
|
7194
7199
|
requestBudgetSettings: () => {
|
|
@@ -7475,7 +7480,7 @@ function activate(ctx, config) {
|
|
|
7475
7480
|
ctx.web.registerSearchProvider(traditionalProvider);
|
|
7476
7481
|
ctx.provide("githubCopilotSearchRouter", { search: async (request, signal, delegate, selectProvider, captureSearchProvider) => {
|
|
7477
7482
|
const cfg = current();
|
|
7478
|
-
const routing =
|
|
7483
|
+
const routing = readRouting();
|
|
7479
7484
|
const policy = normalizeWebSearchRouting(routing);
|
|
7480
7485
|
const owner = currentSearchInitiator(ctx);
|
|
7481
7486
|
const selection = currentSearchSelection(owner);
|
|
@@ -7581,19 +7586,13 @@ function activate(ctx, config) {
|
|
|
7581
7586
|
},
|
|
7582
7587
|
onChange: invalidatePlans
|
|
7583
7588
|
});
|
|
7584
|
-
installSettingsNamespace(ctx, WEB_SEARCH_ROUTING_SETTINGS_NAMESPACE, WebSearchRoutingConfigSchema, {}, {
|
|
7585
|
-
setSource: (source) => {
|
|
7586
|
-
routingCurrent = source;
|
|
7587
|
-
},
|
|
7588
|
-
onChange: invalidatePlans
|
|
7589
|
-
});
|
|
7590
7589
|
ensureGitHubCopilotProviderProfile(ctx).catch((error) => {
|
|
7591
7590
|
ctx.logger.error("github-copilot: failed to repair the GitHub Copilot provider route during startup");
|
|
7592
7591
|
ctx.logger.error(error);
|
|
7593
7592
|
});
|
|
7594
7593
|
ctx.on("llm/stream", (request, next) => {
|
|
7595
7594
|
const cfg = current();
|
|
7596
|
-
if (!active || normalizeWebSearchRouting(
|
|
7595
|
+
if (!active || normalizeWebSearchRouting(readRouting()).primaryProvider !== "auto") return next();
|
|
7597
7596
|
const owner = currentSearchInitiator(ctx);
|
|
7598
7597
|
if (owner !== void 0 && disposedOwners.has(owner)) return next();
|
|
7599
7598
|
const route = currentChatRoute(ctx, request);
|
|
@@ -7612,7 +7611,7 @@ function activate(ctx, config) {
|
|
|
7612
7611
|
text: () => ""
|
|
7613
7612
|
});
|
|
7614
7613
|
return (owner, selection) => {
|
|
7615
|
-
const policy = normalizeWebSearchRouting(
|
|
7614
|
+
const policy = normalizeWebSearchRouting(readRouting());
|
|
7616
7615
|
if (!active || owner === void 0 || disposedOwners.has(owner) || policy.primaryProvider !== "auto") return "";
|
|
7617
7616
|
const route = currentChatRoute(ctx, selection);
|
|
7618
7617
|
const cfg = current();
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-github-copilot",
|
|
3
3
|
"description": "DSH companion for GitHub Copilot sign-in, account-aware model profiles, tool compatibility, and provider-hosted search.",
|
|
4
|
-
"version": "0.4.0-alpha.
|
|
4
|
+
"version": "0.4.0-alpha.51",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
7
7
|
"registry": "https://registry.npmjs.org/",
|