dsh-github-copilot 0.4.0-alpha.65 → 0.4.0-alpha.68
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 -0
- package/CHANGELOG.md +12 -0
- package/README.md +10 -8
- package/README.zh.md +10 -8
- package/deployment-baseline.json +7 -1
- package/docs/automatic-model-routing.md +127 -4
- package/docs/images/parent-model-follow.png +0 -0
- package/lib/client.js +229 -1
- package/lib/client.js.map +1 -1
- package/lib/index.js +305 -57
- package/lib/types/auto-model-host.d.ts +3 -0
- package/lib/types/client.d.ts +5 -0
- package/lib/types/config.d.ts +11 -2
- package/lib/types/parent-model-follow-card.d.ts +41 -0
- package/lib/types/parent-model-follow.d.ts +44 -0
- package/lib/types/preview-route.d.ts +1 -1
- package/lib/types/web-search-routing-card.d.ts +4 -0
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -191,12 +191,12 @@ function fail$1(reason, creation) {
|
|
|
191
191
|
function creationOf(error) {
|
|
192
192
|
return ownRemoteFailure(error)?.creation ?? "uncertain";
|
|
193
193
|
}
|
|
194
|
-
function object$
|
|
194
|
+
function object$5(value) {
|
|
195
195
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
196
196
|
}
|
|
197
197
|
function api$1(ctx, key, methods) {
|
|
198
198
|
const value = ctx.get(key);
|
|
199
|
-
return object$
|
|
199
|
+
return object$5(value) && methods.every((method) => typeof value[method] === "function") ? value : void 0;
|
|
200
200
|
}
|
|
201
201
|
function revision(value) {
|
|
202
202
|
return typeof value === "number" && Number.isSafeInteger(value) && value >= 0;
|
|
@@ -221,7 +221,7 @@ const ERROR_REASONS = /* @__PURE__ */ new Set([
|
|
|
221
221
|
/** Remote errors cross bundle/realm boundaries; constructor identity is not a protocol. */
|
|
222
222
|
function ownRemoteFailure(error) {
|
|
223
223
|
try {
|
|
224
|
-
if (!object$
|
|
224
|
+
if (!object$5(error) || error.isDSHRemoteError !== true || error.code !== "copilot/dual-model" || !object$5(error.details)) return void 0;
|
|
225
225
|
const reason = error.details.reason;
|
|
226
226
|
if (typeof reason !== "string" || !ERROR_REASONS.has(reason)) return void 0;
|
|
227
227
|
const creation = error.details.creation;
|
|
@@ -237,7 +237,7 @@ function reasonOf(error, fallback) {
|
|
|
237
237
|
const own = ownRemoteFailure(error);
|
|
238
238
|
if (own) return own.reason;
|
|
239
239
|
try {
|
|
240
|
-
if (object$
|
|
240
|
+
if (object$5(error) && error.code === "SETTINGS_CONFLICT") return "DUAL_MODEL_REVISION_CONFLICT";
|
|
241
241
|
} catch {}
|
|
242
242
|
return fallback;
|
|
243
243
|
}
|
|
@@ -365,7 +365,7 @@ let GitHubCopilotDualModel = (() => {
|
|
|
365
365
|
}, { prepend: true });
|
|
366
366
|
ctx.on("system-prompt/assemble", async (_assembly, context, next) => {
|
|
367
367
|
const candidate = context.scope;
|
|
368
|
-
if (!candidate || !object$
|
|
368
|
+
if (!candidate || !object$5(candidate.session) || !object$5(candidate.session.header) || !dedicatedAddress(candidate)) return next();
|
|
369
369
|
const rehydrating = !this.overlays.has(candidate);
|
|
370
370
|
if (rehydrating) this.restore(candidate);
|
|
371
371
|
const installed = this.overlays.get(candidate);
|
|
@@ -1646,7 +1646,7 @@ let GitHubCopilotUsageController = (() => {
|
|
|
1646
1646
|
//#endregion
|
|
1647
1647
|
//#region package.json
|
|
1648
1648
|
var name$1 = "dsh-github-copilot";
|
|
1649
|
-
var version = "0.4.0-alpha.
|
|
1649
|
+
var version = "0.4.0-alpha.68";
|
|
1650
1650
|
//#endregion
|
|
1651
1651
|
//#region lib/types/probe.js
|
|
1652
1652
|
/**
|
|
@@ -2068,9 +2068,15 @@ const WebSearchRoutingConfigSchema = z.object({
|
|
|
2068
2068
|
/** Keep native live references at the boundary; request code consumes plain snapshots. */
|
|
2069
2069
|
function readInlineConfig(config) {
|
|
2070
2070
|
const exclusions = readConfigValue(config.excludedModelIds);
|
|
2071
|
+
const bindings = readConfigValue(config.parentModelFollow);
|
|
2071
2072
|
return {
|
|
2072
2073
|
...config,
|
|
2073
2074
|
excludedModelIds: exclusions === void 0 ? void 0 : Array.from(exclusions),
|
|
2075
|
+
parentModelFollow: bindings === void 0 ? void 0 : Array.from(bindings, (binding) => ({
|
|
2076
|
+
childSessionId: binding.childSessionId,
|
|
2077
|
+
parentSessionId: binding.parentSessionId
|
|
2078
|
+
})),
|
|
2079
|
+
followParentModel: readConfigValue(config.followParentModel),
|
|
2074
2080
|
searchModel: readConfigValue(config.searchModel),
|
|
2075
2081
|
searchRouting: readConfigValue(config.searchRouting),
|
|
2076
2082
|
temporaryRouteBackup: readConfigValue(config.temporaryRouteBackup)
|
|
@@ -2090,6 +2096,11 @@ const Config = z.object({
|
|
|
2090
2096
|
accountModelTtlMs: z.number().step(1).min(0).max(MAX_TIMEOUT_MS).default(864e5),
|
|
2091
2097
|
accountModelFailureCooldownMs: z.number().step(1).min(0).max(MAX_TIMEOUT_MS).default(3e5),
|
|
2092
2098
|
excludedModelIds: z.array(z.string()).default([]).hidden().volatile(),
|
|
2099
|
+
followParentModel: z.boolean().default(false).volatile(),
|
|
2100
|
+
parentModelFollow: z.array(z.object({
|
|
2101
|
+
childSessionId: z.string().min(1),
|
|
2102
|
+
parentSessionId: z.string().min(1)
|
|
2103
|
+
})).default([]).hidden().volatile(),
|
|
2093
2104
|
requestBudgetSafetyTokens: z.number().step(1).min(0).max(Number.MAX_SAFE_INTEGER).default(DEFAULT_REQUEST_BUDGET_POLICY.safetyTokens),
|
|
2094
2105
|
requestBudgetPressureRatio: z.number().step(.01).min(.01).max(1).default(DEFAULT_REQUEST_BUDGET_POLICY.pressureRatio),
|
|
2095
2106
|
compactionReasoning: z.union(["prefer-low", "preserve"]).default(DEFAULT_REQUEST_BUDGET_POLICY.compactionReasoning),
|
|
@@ -3914,19 +3925,19 @@ var TemporaryRouteConflictError = class extends Error {
|
|
|
3914
3925
|
this.name = "TemporaryRouteConflictError";
|
|
3915
3926
|
}
|
|
3916
3927
|
};
|
|
3917
|
-
function object$
|
|
3928
|
+
function object$4(value) {
|
|
3918
3929
|
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
|
|
3919
3930
|
}
|
|
3920
3931
|
function profileAt(value) {
|
|
3921
|
-
return object$
|
|
3932
|
+
return object$4(object$4(object$4(value)?.providers)?.["github-copilot"]);
|
|
3922
3933
|
}
|
|
3923
3934
|
/** Bounded comparison; never stringify or copy unknown model extras or headers. */
|
|
3924
3935
|
function equalJson(a, b, depth = 0) {
|
|
3925
3936
|
if (a === b) return true;
|
|
3926
3937
|
if (depth > 12) return false;
|
|
3927
3938
|
if (Array.isArray(a) || Array.isArray(b)) return Array.isArray(a) && Array.isArray(b) && a.length <= 512 && a.length === b.length && a.every((value, i) => equalJson(value, b[i], depth + 1));
|
|
3928
|
-
const left = object$
|
|
3929
|
-
const right = object$
|
|
3939
|
+
const left = object$4(a);
|
|
3940
|
+
const right = object$4(b);
|
|
3930
3941
|
if (!left || !right) return false;
|
|
3931
3942
|
const keys = Object.keys(left);
|
|
3932
3943
|
return keys.length <= 512 && keys.length === Object.keys(right).length && keys.every((key) => Object.hasOwn(right, key) && equalJson(left[key], right[key], depth + 1));
|
|
@@ -3935,7 +3946,7 @@ const MAX_BACKUP = 131072;
|
|
|
3935
3946
|
function safeModels(value) {
|
|
3936
3947
|
if (!Array.isArray(value) || value.length > 512) throw new TemporaryRouteConflictError();
|
|
3937
3948
|
return value.map((entry) => {
|
|
3938
|
-
const model = object$
|
|
3949
|
+
const model = object$4(entry);
|
|
3939
3950
|
if (!model || typeof model.id !== "string" || !/^[a-zA-Z0-9._:/-]{1,200}$/.test(model.id)) throw new TemporaryRouteConflictError();
|
|
3940
3951
|
const overlay = temporaryGitHubCopilotModel(model.id, /* @__PURE__ */ new Map());
|
|
3941
3952
|
if (overlay && Object.keys(model).some((key) => key !== "id" && key !== "api")) {
|
|
@@ -3966,10 +3977,10 @@ function readBackup(value) {
|
|
|
3966
3977
|
if (value === void 0) return void 0;
|
|
3967
3978
|
if (typeof value !== "string" || value.length > MAX_BACKUP) throw new TemporaryRouteConflictError("TEMPORARY_ROUTE_INVALID_BACKUP");
|
|
3968
3979
|
try {
|
|
3969
|
-
const decoded = object$
|
|
3980
|
+
const decoded = object$4(JSON.parse(value));
|
|
3970
3981
|
if (!decoded) throw new Error();
|
|
3971
3982
|
if (decoded.version === void 0 || decoded.version === 2 && decoded.sourceEpoch === void 0) throw new TemporaryRouteConflictError("TEMPORARY_ROUTE_LEGACY_CONFLICT");
|
|
3972
|
-
if (decoded.version !== 2 || typeof decoded.providerExisted !== "boolean" || typeof decoded.sourceEpoch !== "string" || !/^[a-f0-9-]{36}$/.test(decoded.sourceEpoch) || !Number.isSafeInteger(decoded.sourceRevision) || Number(decoded.sourceRevision) < 0 || !["overlay", "restoring"].includes(String(decoded.phase)) || !object$
|
|
3983
|
+
if (decoded.version !== 2 || typeof decoded.providerExisted !== "boolean" || typeof decoded.sourceEpoch !== "string" || !/^[a-f0-9-]{36}$/.test(decoded.sourceEpoch) || !Number.isSafeInteger(decoded.sourceRevision) || Number(decoded.sourceRevision) < 0 || !["overlay", "restoring"].includes(String(decoded.phase)) || !object$4(decoded.preimage) || !object$4(decoded.postimage) || !object$4(decoded.ownedHeaders) || Object.keys(decoded).some((key) => ![
|
|
3973
3984
|
"version",
|
|
3974
3985
|
"providerExisted",
|
|
3975
3986
|
"preimage",
|
|
@@ -3986,15 +3997,15 @@ function readBackup(value) {
|
|
|
3986
3997
|
decoded.postimage,
|
|
3987
3998
|
...decoded.phase === "restoring" ? [decoded.target] : []
|
|
3988
3999
|
]) {
|
|
3989
|
-
const record = object$
|
|
4000
|
+
const record = object$4(leaf);
|
|
3990
4001
|
if (!record || !equalJson(record, leavesOf(record))) throw new Error();
|
|
3991
4002
|
}
|
|
3992
|
-
const models = object$
|
|
4003
|
+
const models = object$4(decoded.postimage)?.models ?? [];
|
|
3993
4004
|
const knownHeaders = Object.assign({}, ...models.flatMap((model) => {
|
|
3994
4005
|
const overlay = temporaryGitHubCopilotModelFromProfile(model);
|
|
3995
4006
|
return overlay ? [overlay.headers] : [];
|
|
3996
4007
|
}));
|
|
3997
|
-
if (!Object.entries(object$
|
|
4008
|
+
if (!Object.entries(object$4(decoded.ownedHeaders)).every(([name, header]) => knownHeaders[name] === header)) throw new Error();
|
|
3998
4009
|
if (decoded.removeProfile !== void 0 && typeof decoded.removeProfile !== "boolean") throw new Error();
|
|
3999
4010
|
return decoded;
|
|
4000
4011
|
} catch (error) {
|
|
@@ -4020,7 +4031,7 @@ function settingsSnapshot(settings) {
|
|
|
4020
4031
|
hasOwnedSecrets,
|
|
4021
4032
|
routeRevision: route.revision,
|
|
4022
4033
|
markerRevision: marker.revision,
|
|
4023
|
-
backup: readBackup(object$
|
|
4034
|
+
backup: readBackup(object$4(marker.value)?.temporaryRouteBackup)
|
|
4024
4035
|
};
|
|
4025
4036
|
}
|
|
4026
4037
|
function assertOwned(current, backup) {
|
|
@@ -4053,7 +4064,7 @@ function leafOperations(current, target) {
|
|
|
4053
4064
|
}]);
|
|
4054
4065
|
}
|
|
4055
4066
|
function ownedHeaderRemoval(current, backup) {
|
|
4056
|
-
return Object.entries(object$
|
|
4067
|
+
return Object.entries(object$4(current?.headers) ?? {}).flatMap(([name, value]) => Object.entries(backup.ownedHeaders).some(([ownedName, ownedValue]) => name.toLowerCase() === ownedName.toLowerCase() && value === ownedValue) ? [{
|
|
4057
4068
|
op: "unset",
|
|
4058
4069
|
path: [
|
|
4059
4070
|
"providers",
|
|
@@ -4075,7 +4086,7 @@ function wholeProfileOwned(snapshot, backup) {
|
|
|
4075
4086
|
//#endregion
|
|
4076
4087
|
//#region lib/types/migration-status.js
|
|
4077
4088
|
const LIMIT = 1024;
|
|
4078
|
-
function object$
|
|
4089
|
+
function object$3(value) {
|
|
4079
4090
|
if (typeof value !== "object" || value === null || Array.isArray(value)) throw new Error("Invalid evidence");
|
|
4080
4091
|
return value;
|
|
4081
4092
|
}
|
|
@@ -4084,7 +4095,7 @@ function text$1(value) {
|
|
|
4084
4095
|
return value;
|
|
4085
4096
|
}
|
|
4086
4097
|
function selection(value, omitDefaultEffort = false) {
|
|
4087
|
-
const item = object$
|
|
4098
|
+
const item = object$3(value);
|
|
4088
4099
|
const provider = text$1(item.provider), model = text$1(item.model), effort = item.reasoningEffort;
|
|
4089
4100
|
if (effort !== void 0) text$1(effort);
|
|
4090
4101
|
return {
|
|
@@ -4099,7 +4110,7 @@ function array(value) {
|
|
|
4099
4110
|
}
|
|
4100
4111
|
function api(ctx, name, methods) {
|
|
4101
4112
|
try {
|
|
4102
|
-
const candidate = object$
|
|
4113
|
+
const candidate = object$3(ctx.get(name));
|
|
4103
4114
|
return methods.every((key) => typeof candidate[key] === "function") ? candidate : void 0;
|
|
4104
4115
|
} catch {
|
|
4105
4116
|
return;
|
|
@@ -4169,26 +4180,26 @@ function migrationStatus(ctx) {
|
|
|
4169
4180
|
const rows = [], ids = /* @__PURE__ */ new Set();
|
|
4170
4181
|
let complete = projections !== void 0;
|
|
4171
4182
|
for (const candidate of array(call(agents, "list"))) {
|
|
4172
|
-
const agent = object$
|
|
4183
|
+
const agent = object$3(candidate), id = text$1(agent.id), status = agent.status;
|
|
4173
4184
|
if (ids.has(id) || status !== "idle" && status !== "running") throw new Error("Invalid agent inventory");
|
|
4174
4185
|
ids.add(id);
|
|
4175
|
-
const session = object$
|
|
4186
|
+
const session = object$3(agent.session);
|
|
4176
4187
|
if (text$1(session.id) !== id) throw new Error("Invalid agent identity");
|
|
4177
4188
|
const header = call(session, "requestHeader");
|
|
4178
|
-
const request = header === void 0 ? null : selection(object$
|
|
4189
|
+
const request = header === void 0 ? null : selection(object$3(header).config);
|
|
4179
4190
|
let effective = null, source = "unknown";
|
|
4180
4191
|
if (projections) {
|
|
4181
4192
|
const state = call(projections, "stateOf", session, "modelSelection");
|
|
4182
4193
|
if (state !== void 0) {
|
|
4183
|
-
const pending = object$
|
|
4194
|
+
const pending = object$3(state).pending;
|
|
4184
4195
|
if (pending !== null) {
|
|
4185
4196
|
effective = selection(pending);
|
|
4186
4197
|
source = "pending";
|
|
4187
4198
|
} else if (header !== void 0) {
|
|
4188
|
-
const defaults = object$
|
|
4189
|
-
const defaultEffort = defaults === void 0 ? false : object$
|
|
4199
|
+
const defaults = object$3(header).adapterDefaults;
|
|
4200
|
+
const defaultEffort = defaults === void 0 ? false : object$3(defaults).reasoningEffort;
|
|
4190
4201
|
if (defaultEffort !== void 0 && typeof defaultEffort !== "boolean") throw new Error("Invalid adapter defaults");
|
|
4191
|
-
effective = selection(object$
|
|
4202
|
+
effective = selection(object$3(header).config, defaultEffort === true);
|
|
4192
4203
|
source = "request-header";
|
|
4193
4204
|
} else if (result.complete.defaultSelection) {
|
|
4194
4205
|
effective = result.defaultSelection;
|
|
@@ -4212,23 +4223,23 @@ function migrationStatus(ctx) {
|
|
|
4212
4223
|
const descriptors = array(call(settings, "describe", { redactSecrets: true }));
|
|
4213
4224
|
const found = /* @__PURE__ */ new Set();
|
|
4214
4225
|
for (const value of descriptors) {
|
|
4215
|
-
const descriptor = object$
|
|
4226
|
+
const descriptor = object$3(value);
|
|
4216
4227
|
const ns = text$1(descriptor.ns);
|
|
4217
4228
|
if (ns !== "llm-pi-ai" && ns !== "github-copilot") continue;
|
|
4218
4229
|
if (found.has(ns) || !Number.isSafeInteger(descriptor.revision) || descriptor.revision < 0) throw new Error("Invalid settings evidence");
|
|
4219
4230
|
found.add(ns);
|
|
4220
4231
|
}
|
|
4221
4232
|
if (found.size !== 2) throw new Error("Unregistered settings");
|
|
4222
|
-
const config = object$
|
|
4223
|
-
const profile = (config.providers === void 0 ? void 0 : object$
|
|
4224
|
-
if (profile !== void 0) object$
|
|
4233
|
+
const config = object$3(call(settings, "get", "llm-pi-ai"));
|
|
4234
|
+
const profile = (config.providers === void 0 ? void 0 : object$3(config.providers))?.[GITHUB_COPILOT_PROVIDER_ID];
|
|
4235
|
+
if (profile !== void 0) object$3(profile);
|
|
4225
4236
|
result.capabilities.settingsCas = true;
|
|
4226
4237
|
result.routes.nativeConfigured = profile !== void 0;
|
|
4227
4238
|
} catch {}
|
|
4228
4239
|
if (llm) try {
|
|
4229
4240
|
const ids = /* @__PURE__ */ new Set();
|
|
4230
4241
|
for (const value of array(call(llm, "listProviders"))) {
|
|
4231
|
-
const id = text$1(object$
|
|
4242
|
+
const id = text$1(object$3(value).id);
|
|
4232
4243
|
if (ids.has(id)) throw new Error("Invalid registry evidence");
|
|
4233
4244
|
ids.add(id);
|
|
4234
4245
|
}
|
|
@@ -4378,7 +4389,7 @@ function accountModelsView(ctx) {
|
|
|
4378
4389
|
}
|
|
4379
4390
|
}
|
|
4380
4391
|
function modelSelection(value) {
|
|
4381
|
-
const selection = object$
|
|
4392
|
+
const selection = object$4(value);
|
|
4382
4393
|
const provider = selection?.provider;
|
|
4383
4394
|
const model = selection?.model;
|
|
4384
4395
|
return typeof provider === "string" && provider.length > 0 && typeof model === "string" && model.length > 0 ? {
|
|
@@ -4407,16 +4418,16 @@ function selectedFixedModelIds(ctx) {
|
|
|
4407
4418
|
const stateOf = Reflect.get(projections, "stateOf");
|
|
4408
4419
|
if (typeof stateOf !== "function") return void 0;
|
|
4409
4420
|
for (const candidate of rows) {
|
|
4410
|
-
const session = object$
|
|
4421
|
+
const session = object$4(object$4(candidate)?.session);
|
|
4411
4422
|
if (session === void 0) return void 0;
|
|
4412
|
-
const state = object$
|
|
4423
|
+
const state = object$4(Reflect.apply(stateOf, projections, [session, "modelSelection"]));
|
|
4413
4424
|
if (state === void 0 || !("pending" in state)) return void 0;
|
|
4414
4425
|
const pending = state.pending;
|
|
4415
4426
|
if (pending !== null && modelSelection(pending) === void 0) return void 0;
|
|
4416
4427
|
let selected = pending === null ? void 0 : fixedPreviewModel(pending);
|
|
4417
4428
|
if (pending === null) {
|
|
4418
4429
|
const requestHeader = session.requestHeader;
|
|
4419
|
-
const header = typeof requestHeader === "function" ? object$
|
|
4430
|
+
const header = typeof requestHeader === "function" ? object$4(Reflect.apply(requestHeader, session, [])) : void 0;
|
|
4420
4431
|
if (header?.config !== void 0 && modelSelection(header.config) === void 0) return void 0;
|
|
4421
4432
|
selected = fixedPreviewModel(header?.config);
|
|
4422
4433
|
}
|
|
@@ -4448,7 +4459,7 @@ function modelPreferencesView(ctx, accountModels, error) {
|
|
|
4448
4459
|
if (!Number.isSafeInteger(descriptor.revision) || descriptor.revision < 0) return unavailable("COPILOT_MODEL_SETTINGS_INVALID");
|
|
4449
4460
|
let excludedModelIds;
|
|
4450
4461
|
try {
|
|
4451
|
-
const raw = object$
|
|
4462
|
+
const raw = object$4(descriptor.value);
|
|
4452
4463
|
if (raw === void 0) return unavailable("COPILOT_MODEL_SETTINGS_INVALID");
|
|
4453
4464
|
excludedModelIds = normalizeExcludedModelIds(raw.excludedModelIds);
|
|
4454
4465
|
} catch {
|
|
@@ -4566,7 +4577,7 @@ async function repairGitHubCopilotProviderProfile(ctx) {
|
|
|
4566
4577
|
try {
|
|
4567
4578
|
await settings.mutate(namespace, operations, revision);
|
|
4568
4579
|
} catch (error) {
|
|
4569
|
-
if (object$
|
|
4580
|
+
if (object$4(error)?.code === "SETTINGS_CONFLICT") throw new TemporaryRouteConflictError();
|
|
4570
4581
|
throw error;
|
|
4571
4582
|
}
|
|
4572
4583
|
};
|
|
@@ -4977,7 +4988,7 @@ let GitHubCopilotAuthorizationController = (() => {
|
|
|
4977
4988
|
}], current.revision);
|
|
4978
4989
|
this.modelPreferenceFailure = void 0;
|
|
4979
4990
|
} catch (cause) {
|
|
4980
|
-
const record = object$
|
|
4991
|
+
const record = object$4(cause);
|
|
4981
4992
|
this.modelPreferenceFailure = record?.code === "SETTINGS_CONFLICT" || cause instanceof Error && /conflict/i.test(cause.message) ? "COPILOT_MODEL_EXCLUSION_CONFLICT" : "COPILOT_MODEL_EXCLUSION_SAVE_FAILED";
|
|
4982
4993
|
}
|
|
4983
4994
|
return this.status();
|
|
@@ -5122,7 +5133,7 @@ const levels = [
|
|
|
5122
5133
|
"xhigh",
|
|
5123
5134
|
"max"
|
|
5124
5135
|
];
|
|
5125
|
-
function object$
|
|
5136
|
+
function object$2(value) {
|
|
5126
5137
|
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
|
|
5127
5138
|
}
|
|
5128
5139
|
function unavailable() {
|
|
@@ -5131,18 +5142,18 @@ function unavailable() {
|
|
|
5131
5142
|
/** Resolve only the selected model's declared/native efforts, with the same precedence as Core. */
|
|
5132
5143
|
function resolveCopilotResponsesReasoning(ctx, request, candidate) {
|
|
5133
5144
|
if (request.provider !== "github-copilot" || candidate.protocol !== "openai-responses" || candidate.model !== request.model) return unavailable();
|
|
5134
|
-
const profile = object$
|
|
5145
|
+
const profile = object$2(object$2(object$2(readSettingsNamespace(ctx, "llm-pi-ai"))?.providers)?.["github-copilot"]);
|
|
5135
5146
|
const effort = request.reasoningEffort ?? profile?.reasoning;
|
|
5136
5147
|
if (effort === void 0) return void 0;
|
|
5137
5148
|
const level = levels.find((value) => value === effort);
|
|
5138
5149
|
if (level === void 0 || profile === void 0) return unavailable();
|
|
5139
5150
|
const configured = Array.isArray(profile.models) ? profile.models : [];
|
|
5140
|
-
const entry = configured.length > 0 ? object$
|
|
5151
|
+
const entry = configured.length > 0 ? object$2(configured.find((value) => object$2(value)?.id === request.model)) : object$2(object$2(profile.modelOverrides)?.[request.model]);
|
|
5141
5152
|
if (configured.length > 0 && entry === void 0) return unavailable();
|
|
5142
5153
|
const declared = entry?.reasoningEfforts;
|
|
5143
5154
|
if (declared !== void 0) {
|
|
5144
5155
|
if (declared === false) return level === "off" ? void 0 : unavailable();
|
|
5145
|
-
const mapping = object$
|
|
5156
|
+
const mapping = object$2(declared);
|
|
5146
5157
|
if (mapping === void 0) return unavailable();
|
|
5147
5158
|
const wire = mapping[level];
|
|
5148
5159
|
if (level === "off" && (wire === null || typeof wire === "string" && wire.length > 0)) return void 0;
|
|
@@ -6343,7 +6354,7 @@ function createAccountModelSource(dependencies) {
|
|
|
6343
6354
|
}
|
|
6344
6355
|
//#endregion
|
|
6345
6356
|
//#region lib/types/compaction-pressure.js
|
|
6346
|
-
function object(value) {
|
|
6357
|
+
function object$1(value) {
|
|
6347
6358
|
return typeof value === "object" && value !== null ? value : void 0;
|
|
6348
6359
|
}
|
|
6349
6360
|
/** Optional public services are not dependencies of the retained development baseline. */
|
|
@@ -6374,7 +6385,7 @@ function installCopilotCompactionPressure(ctx, callbacks) {
|
|
|
6374
6385
|
const pressureFailure = (request) => {
|
|
6375
6386
|
if (!isAgentLoopRequest(request) || request.purpose !== void 0 || request.provider !== "github-copilot-preview" || request.sessionId === void 0 || request.signal?.aborted) return void 0;
|
|
6376
6387
|
if (!isPluginPreviewProvider(ctx, request.provider)) return void 0;
|
|
6377
|
-
if (typeof object(ctx.get("agents"))?.currentInitiator !== "function") {
|
|
6388
|
+
if (typeof object$1(ctx.get("agents"))?.currentInitiator !== "function") {
|
|
6378
6389
|
unavailable();
|
|
6379
6390
|
return;
|
|
6380
6391
|
}
|
|
@@ -6388,15 +6399,15 @@ function installCopilotCompactionPressure(ctx, callbacks) {
|
|
|
6388
6399
|
if (header === void 0 || !callConfigEquals(header.config, request)) return void 0;
|
|
6389
6400
|
const budget = callbacks.resolve(request);
|
|
6390
6401
|
if (budget === void 0 || !positiveInteger(budget.inputBudgetTokens)) return void 0;
|
|
6391
|
-
const compaction = object(optionalService(ctx, "compaction"));
|
|
6392
|
-
const config = object(compaction?.config);
|
|
6402
|
+
const compaction = object$1(optionalService(ctx, "compaction"));
|
|
6403
|
+
const config = object$1(compaction?.config);
|
|
6393
6404
|
if (config?.auto === false) return void 0;
|
|
6394
6405
|
if (config?.auto !== true || typeof compaction?.compactIfNeeded !== "function") {
|
|
6395
6406
|
unavailable();
|
|
6396
6407
|
return;
|
|
6397
6408
|
}
|
|
6398
|
-
const retries = (Array.isArray(config.modelPolicies) ? object(config.modelPolicies.find((value) => {
|
|
6399
|
-
const candidate = object(value);
|
|
6409
|
+
const retries = (Array.isArray(config.modelPolicies) ? object$1(config.modelPolicies.find((value) => {
|
|
6410
|
+
const candidate = object$1(value);
|
|
6400
6411
|
return candidate?.provider === request.provider && candidate.model === request.model;
|
|
6401
6412
|
})) : void 0)?.maxOverflowRetries ?? config.maxOverflowRetries;
|
|
6402
6413
|
if (retries === 0) return void 0;
|
|
@@ -6404,12 +6415,12 @@ function installCopilotCompactionPressure(ctx, callbacks) {
|
|
|
6404
6415
|
unavailable();
|
|
6405
6416
|
return;
|
|
6406
6417
|
}
|
|
6407
|
-
const meter = object(optionalService(ctx, "tokenMeter"));
|
|
6418
|
+
const meter = object$1(optionalService(ctx, "tokenMeter"));
|
|
6408
6419
|
if (typeof meter?.measure !== "function") {
|
|
6409
6420
|
unavailable();
|
|
6410
6421
|
return;
|
|
6411
6422
|
}
|
|
6412
|
-
const tokens = object(meter.measure(owner.session))?.totalTokens;
|
|
6423
|
+
const tokens = object$1(meter.measure(owner.session))?.totalTokens;
|
|
6413
6424
|
if (typeof tokens !== "number" || !Number.isSafeInteger(tokens) || tokens < 0) {
|
|
6414
6425
|
unavailable();
|
|
6415
6426
|
return;
|
|
@@ -6726,6 +6737,123 @@ var TurnSelectionStore = class {
|
|
|
6726
6737
|
}
|
|
6727
6738
|
};
|
|
6728
6739
|
//#endregion
|
|
6740
|
+
//#region lib/types/parent-model-follow.js
|
|
6741
|
+
const PARENT_MODEL_FOLLOW_PROJECTION = "githubCopilotParentModelFollow";
|
|
6742
|
+
function object(value) {
|
|
6743
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6744
|
+
}
|
|
6745
|
+
function followSelection(value) {
|
|
6746
|
+
if (!object(value) || typeof value.provider !== "string" || !value.provider || typeof value.model !== "string" || !value.model) return void 0;
|
|
6747
|
+
return {
|
|
6748
|
+
provider: value.provider,
|
|
6749
|
+
model: value.model
|
|
6750
|
+
};
|
|
6751
|
+
}
|
|
6752
|
+
function initialFollowState(inherited = 0) {
|
|
6753
|
+
return {
|
|
6754
|
+
inherited,
|
|
6755
|
+
turn: null,
|
|
6756
|
+
started: false,
|
|
6757
|
+
explicit: null,
|
|
6758
|
+
descriptor: false,
|
|
6759
|
+
blocked: false
|
|
6760
|
+
};
|
|
6761
|
+
}
|
|
6762
|
+
/** Fold only the child's own suffix; copied fork selections are not child overrides. */
|
|
6763
|
+
function foldFollowState(state, event) {
|
|
6764
|
+
if (event.seq < state.inherited) return state;
|
|
6765
|
+
if (event.type === "turn/start") {
|
|
6766
|
+
if (!object(event.data) || !Number.isSafeInteger(event.data.turn) || Number(event.data.turn) < 0) return {
|
|
6767
|
+
...state,
|
|
6768
|
+
blocked: true
|
|
6769
|
+
};
|
|
6770
|
+
return {
|
|
6771
|
+
...state,
|
|
6772
|
+
turn: Number(event.data.turn),
|
|
6773
|
+
started: false
|
|
6774
|
+
};
|
|
6775
|
+
}
|
|
6776
|
+
if (event.type === "step/start") return {
|
|
6777
|
+
...state,
|
|
6778
|
+
started: true
|
|
6779
|
+
};
|
|
6780
|
+
if (event.type === "model/selection") {
|
|
6781
|
+
const selection = followSelection(event.data);
|
|
6782
|
+
return selection ? {
|
|
6783
|
+
...state,
|
|
6784
|
+
explicit: selection
|
|
6785
|
+
} : {
|
|
6786
|
+
...state,
|
|
6787
|
+
blocked: true
|
|
6788
|
+
};
|
|
6789
|
+
}
|
|
6790
|
+
if (event.type === "github-copilot/dual-model-policy") return {
|
|
6791
|
+
...state,
|
|
6792
|
+
blocked: true
|
|
6793
|
+
};
|
|
6794
|
+
if (event.type === "subagent/descriptor") {
|
|
6795
|
+
const data = event.data;
|
|
6796
|
+
const valid = object(data) && data.version === 3 && data.provider === "spawn" && (data.mode === "continuable" || data.mode === "one-shot");
|
|
6797
|
+
return {
|
|
6798
|
+
...state,
|
|
6799
|
+
descriptor: valid,
|
|
6800
|
+
blocked: state.blocked || !valid || state.descriptor
|
|
6801
|
+
};
|
|
6802
|
+
}
|
|
6803
|
+
return state;
|
|
6804
|
+
}
|
|
6805
|
+
var ParentModelFollowError = class extends Error {
|
|
6806
|
+
code;
|
|
6807
|
+
constructor(code) {
|
|
6808
|
+
super(code);
|
|
6809
|
+
this.code = code;
|
|
6810
|
+
this.name = "ParentModelFollowError";
|
|
6811
|
+
}
|
|
6812
|
+
};
|
|
6813
|
+
function supportsParentFollowing(subject) {
|
|
6814
|
+
return !subject.state.blocked && subject.state.descriptor && subject.origin === "subagent";
|
|
6815
|
+
}
|
|
6816
|
+
/** Resolve a new turn's intent without changing any Session, setting or descriptor. */
|
|
6817
|
+
function resolveParentModel(child, bindings, lookup, followAll = false) {
|
|
6818
|
+
const matches = bindings.filter((binding) => binding.childSessionId === child.id);
|
|
6819
|
+
const automatic = matches.length === 0;
|
|
6820
|
+
if (automatic && (!followAll || !supportsParentFollowing(child))) return void 0;
|
|
6821
|
+
const fail = (code) => {
|
|
6822
|
+
throw new ParentModelFollowError(`COPILOT_PARENT_MODEL_${code}`);
|
|
6823
|
+
};
|
|
6824
|
+
if (!automatic && matches.length !== 1) fail("BINDING_INVALID");
|
|
6825
|
+
if (!supportsParentFollowing(child)) fail("CHILD_UNSUPPORTED");
|
|
6826
|
+
if (!child.parentId || !automatic && child.parentId !== matches[0]?.parentSessionId) fail("LINEAGE_INVALID");
|
|
6827
|
+
if (child.state.explicit !== null) return void 0;
|
|
6828
|
+
const seen = /* @__PURE__ */ new Set([child.id]);
|
|
6829
|
+
let current = child;
|
|
6830
|
+
while (true) {
|
|
6831
|
+
const parentId = current.parentId;
|
|
6832
|
+
if (!parentId || seen.has(parentId)) return fail("LINEAGE_INVALID");
|
|
6833
|
+
seen.add(parentId);
|
|
6834
|
+
const parent = lookup(parentId);
|
|
6835
|
+
if (!parent) return fail("PARENT_UNAVAILABLE");
|
|
6836
|
+
if (parent.state.blocked) {
|
|
6837
|
+
if (automatic) return void 0;
|
|
6838
|
+
fail("PARENT_UNSUPPORTED");
|
|
6839
|
+
}
|
|
6840
|
+
const parentBindings = bindings.filter((binding) => binding.childSessionId === parent.id);
|
|
6841
|
+
if (parentBindings.length > 1) fail("BINDING_INVALID");
|
|
6842
|
+
if ((parentBindings.length === 1 || followAll && supportsParentFollowing(parent)) && parent.state.explicit === null) {
|
|
6843
|
+
if (!parent.state.descriptor || parent.origin !== "subagent" || parentBindings.length === 1 && parent.parentId !== parentBindings[0]?.parentSessionId) fail("LINEAGE_INVALID");
|
|
6844
|
+
current = parent;
|
|
6845
|
+
continue;
|
|
6846
|
+
}
|
|
6847
|
+
const selection = parent.pending ?? parent.recorded;
|
|
6848
|
+
if (!selection) return fail("SELECTION_UNAVAILABLE");
|
|
6849
|
+
if (selection.provider !== "github-copilot-preview") {
|
|
6850
|
+
if (automatic) return void 0;
|
|
6851
|
+
fail("PROVIDER_UNSUPPORTED");
|
|
6852
|
+
}
|
|
6853
|
+
return { ...selection };
|
|
6854
|
+
}
|
|
6855
|
+
}
|
|
6856
|
+
//#endregion
|
|
6729
6857
|
//#region lib/types/auto-model-host.js
|
|
6730
6858
|
function failure$1(code) {
|
|
6731
6859
|
return new LlmError(code, "INVALID_REQUEST");
|
|
@@ -6808,10 +6936,110 @@ function installAutoModelRouting(ctx, dependencies) {
|
|
|
6808
6936
|
const routed = /* @__PURE__ */ new WeakMap();
|
|
6809
6937
|
const agentDisposers = /* @__PURE__ */ new WeakMap();
|
|
6810
6938
|
const activeDisposers = /* @__PURE__ */ new Set();
|
|
6939
|
+
const followed = /* @__PURE__ */ new WeakMap();
|
|
6940
|
+
const selectionSchema = z$1.object({
|
|
6941
|
+
provider: z$1.string().min(1),
|
|
6942
|
+
model: z$1.string().min(1)
|
|
6943
|
+
}).strict();
|
|
6944
|
+
const followSchema = z$1.object({
|
|
6945
|
+
inherited: z$1.number().int().nonnegative(),
|
|
6946
|
+
turn: z$1.number().int().nonnegative().nullable(),
|
|
6947
|
+
started: z$1.boolean(),
|
|
6948
|
+
explicit: selectionSchema.nullable(),
|
|
6949
|
+
descriptor: z$1.boolean(),
|
|
6950
|
+
blocked: z$1.boolean()
|
|
6951
|
+
}).strict();
|
|
6952
|
+
let removeFollowProjection;
|
|
6953
|
+
const followIntent = (agent) => {
|
|
6954
|
+
const previous = followed.get(agent);
|
|
6955
|
+
if (previous) {
|
|
6956
|
+
const registry = ctx.get("sessionProjections");
|
|
6957
|
+
if (!record(registry) || typeof registry.stateOf !== "function") throw failure$1("COPILOT_PARENT_MODEL_PROJECTIONS_UNAVAILABLE");
|
|
6958
|
+
const state = followSchema.safeParse(registry.stateOf(agent.session, PARENT_MODEL_FOLLOW_PROJECTION));
|
|
6959
|
+
if (!state.success) throw failure$1("COPILOT_PARENT_MODEL_TURN_UNAVAILABLE");
|
|
6960
|
+
if (state.data.turn === previous.turn) return previous.selection;
|
|
6961
|
+
}
|
|
6962
|
+
const bindings = dependencies.parentModelBindings?.() ?? [];
|
|
6963
|
+
const followAll = dependencies.followParentModel?.() === true;
|
|
6964
|
+
if (!bindings.some((binding) => binding.childSessionId === agent.session.id) && (!followAll || agent.session.header.origin !== "subagent")) return void 0;
|
|
6965
|
+
const projections = ctx.get("sessionProjections");
|
|
6966
|
+
if (!record(projections) || typeof projections.register !== "function" || typeof projections.stateOf !== "function") throw failure$1("COPILOT_PARENT_MODEL_PROJECTIONS_UNAVAILABLE");
|
|
6967
|
+
const stateOf = projections.stateOf;
|
|
6968
|
+
if (!removeFollowProjection) {
|
|
6969
|
+
const remove = projections.register({
|
|
6970
|
+
key: PARENT_MODEL_FOLLOW_PROJECTION,
|
|
6971
|
+
stateVersion: 1,
|
|
6972
|
+
stateSchema: followSchema,
|
|
6973
|
+
init: (_header, inherited = 0) => initialFollowState(inherited),
|
|
6974
|
+
apply: foldFollowState
|
|
6975
|
+
});
|
|
6976
|
+
if (typeof remove !== "function") throw failure$1("COPILOT_PARENT_MODEL_PROJECTIONS_UNAVAILABLE");
|
|
6977
|
+
removeFollowProjection = () => {
|
|
6978
|
+
remove();
|
|
6979
|
+
};
|
|
6980
|
+
}
|
|
6981
|
+
const readSubject = (value) => {
|
|
6982
|
+
if (!record(value) || !record(value.session)) return void 0;
|
|
6983
|
+
const session = value.session;
|
|
6984
|
+
if (typeof session.id !== "string" || !record(session.header) || typeof session.requestHeader !== "function") return void 0;
|
|
6985
|
+
const parsed = followSchema.safeParse(Reflect.apply(stateOf, projections, [session, PARENT_MODEL_FOLLOW_PROJECTION]));
|
|
6986
|
+
const selection = Reflect.apply(stateOf, projections, [session, "modelSelection"]);
|
|
6987
|
+
if (!parsed.success || !record(selection) || !Object.hasOwn(selection, "pending")) throw failure$1("COPILOT_PARENT_MODEL_SELECTION_UNAVAILABLE");
|
|
6988
|
+
const pending = selection.pending === null ? null : followSelection(selection.pending);
|
|
6989
|
+
if (pending === void 0) throw failure$1("COPILOT_PARENT_MODEL_SELECTION_UNAVAILABLE");
|
|
6990
|
+
const header = session.requestHeader();
|
|
6991
|
+
return {
|
|
6992
|
+
id: session.id,
|
|
6993
|
+
parentId: typeof session.header.parentSession === "string" ? session.header.parentSession : void 0,
|
|
6994
|
+
origin: typeof session.header.origin === "string" ? session.header.origin : void 0,
|
|
6995
|
+
state: parsed.data,
|
|
6996
|
+
pending,
|
|
6997
|
+
recorded: record(header) ? followSelection(header.config) : void 0
|
|
6998
|
+
};
|
|
6999
|
+
};
|
|
7000
|
+
const child = readSubject(agent);
|
|
7001
|
+
if (!child || child.state.turn === null) throw failure$1("COPILOT_PARENT_MODEL_TURN_UNAVAILABLE");
|
|
7002
|
+
if (child.state.started) {
|
|
7003
|
+
followed.set(agent, {
|
|
7004
|
+
turn: child.state.turn,
|
|
7005
|
+
selection: void 0
|
|
7006
|
+
});
|
|
7007
|
+
return;
|
|
7008
|
+
}
|
|
7009
|
+
const agents = ctx.get("agents");
|
|
7010
|
+
try {
|
|
7011
|
+
const selection = resolveParentModel(child, bindings, (id) => {
|
|
7012
|
+
if (!record(agents) || typeof agents.get !== "function") return void 0;
|
|
7013
|
+
return readSubject(agents.get(id));
|
|
7014
|
+
}, followAll);
|
|
7015
|
+
followed.set(agent, {
|
|
7016
|
+
turn: child.state.turn,
|
|
7017
|
+
selection
|
|
7018
|
+
});
|
|
7019
|
+
return selection;
|
|
7020
|
+
} catch (cause) {
|
|
7021
|
+
if (cause instanceof ParentModelFollowError) throw failure$1(cause.code);
|
|
7022
|
+
throw cause;
|
|
7023
|
+
}
|
|
7024
|
+
};
|
|
7025
|
+
const effectiveAuto = (agent) => {
|
|
7026
|
+
const inherited = followIntent(agent);
|
|
7027
|
+
if (inherited !== void 0) return autoModelPreference(inherited.model) !== void 0 ? inherited.model : void 0;
|
|
7028
|
+
return pendingAuto(ctx, agent);
|
|
7029
|
+
};
|
|
6811
7030
|
const installAgent = (agent) => {
|
|
6812
7031
|
if (agentDisposers.has(agent)) return;
|
|
6813
7032
|
const removeAssembly = agent.ctx.on("system-prompt/assemble", async (_assembly, _context, next) => {
|
|
7033
|
+
const inherited = followIntent(agent);
|
|
6814
7034
|
const assembled = await next();
|
|
7035
|
+
if (inherited !== void 0) return {
|
|
7036
|
+
...assembled,
|
|
7037
|
+
variables: {
|
|
7038
|
+
...assembled.variables,
|
|
7039
|
+
provider: inherited.provider,
|
|
7040
|
+
model: inherited.model
|
|
7041
|
+
}
|
|
7042
|
+
};
|
|
6815
7043
|
const pending = pendingAuto(ctx, agent);
|
|
6816
7044
|
if (pending === void 0) return assembled;
|
|
6817
7045
|
return {
|
|
@@ -6830,8 +7058,17 @@ function installAutoModelRouting(ctx, dependencies) {
|
|
|
6830
7058
|
turn,
|
|
6831
7059
|
messages: entered
|
|
6832
7060
|
});
|
|
6833
|
-
const pending =
|
|
7061
|
+
const pending = effectiveAuto(agent);
|
|
6834
7062
|
const preference = pending === void 0 ? void 0 : autoModelPreference(pending);
|
|
7063
|
+
const inherited = followIntent(agent);
|
|
7064
|
+
if (result.kind === "enter" && !signal.aborted && inherited !== void 0 && preference === void 0) {
|
|
7065
|
+
const filtered = result.messages.filter((message) => !modelSelectionNotice(message));
|
|
7066
|
+
const notice = actualNotice(agent, inherited.model);
|
|
7067
|
+
return {
|
|
7068
|
+
...result,
|
|
7069
|
+
messages: notice === void 0 ? filtered : [...filtered, notice]
|
|
7070
|
+
};
|
|
7071
|
+
}
|
|
6835
7072
|
if (result.kind !== "enter" || signal.aborted || preference === void 0) return result;
|
|
6836
7073
|
let state = routed.get(agent);
|
|
6837
7074
|
if (state?.turn !== turn) {
|
|
@@ -6869,11 +7106,19 @@ function installAutoModelRouting(ctx, dependencies) {
|
|
|
6869
7106
|
agentDisposers.delete(agent);
|
|
6870
7107
|
captured.delete(agent);
|
|
6871
7108
|
routed.delete(agent);
|
|
7109
|
+
followed.delete(agent);
|
|
6872
7110
|
selections.remove(agent);
|
|
6873
7111
|
});
|
|
6874
7112
|
const removeRequest = ctx.on("agent/request", async ({ agent, turn, signal }, next) => {
|
|
6875
|
-
|
|
6876
|
-
const
|
|
7113
|
+
installAgent(agent);
|
|
7114
|
+
const native = await next();
|
|
7115
|
+
const inherited = followIntent(agent);
|
|
7116
|
+
const { reasoningEffort: _nativeEffort, ...withoutEffort } = native;
|
|
7117
|
+
const resolved = inherited === void 0 ? native : {
|
|
7118
|
+
...withoutEffort,
|
|
7119
|
+
...inherited
|
|
7120
|
+
};
|
|
7121
|
+
const pending = effectiveAuto(agent);
|
|
6877
7122
|
const virtualPreference = resolved.provider === "github-copilot-preview" ? autoModelPreference(resolved.model) : void 0;
|
|
6878
7123
|
const virtual = virtualPreference !== void 0;
|
|
6879
7124
|
if (!virtual && pending === void 0) {
|
|
@@ -6904,7 +7149,7 @@ function installAutoModelRouting(ctx, dependencies) {
|
|
|
6904
7149
|
}
|
|
6905
7150
|
if (!state.recorded) {
|
|
6906
7151
|
const projections = ctx.get("sessionProjections");
|
|
6907
|
-
if (virtual && record(projections) && typeof projections.stateOf === "function") {
|
|
7152
|
+
if (inherited === void 0 && virtual && record(projections) && typeof projections.stateOf === "function") {
|
|
6908
7153
|
const selection = projections.stateOf(agent.session, "modelSelection");
|
|
6909
7154
|
if (record(selection) && selection.pending === null && agent.session.requestHeader() === void 0) Reflect.apply(agent.session.append, agent.session, ["model/selection", {
|
|
6910
7155
|
provider: GITHUB_COPILOT_PREVIEW_PROVIDER_ID,
|
|
@@ -6929,6 +7174,7 @@ function installAutoModelRouting(ctx, dependencies) {
|
|
|
6929
7174
|
removeCreated();
|
|
6930
7175
|
removeDisposed();
|
|
6931
7176
|
removeRequest();
|
|
7177
|
+
removeFollowProjection?.();
|
|
6932
7178
|
for (const dispose of activeDisposers) dispose();
|
|
6933
7179
|
activeDisposers.clear();
|
|
6934
7180
|
selections.clear();
|
|
@@ -7646,7 +7892,9 @@ function apply$1(ctx, config = {}) {
|
|
|
7646
7892
|
const excluded = excludedModels();
|
|
7647
7893
|
return (await discoverSnapshot({ signal })).models.filter((model) => !excluded.has(model.id));
|
|
7648
7894
|
},
|
|
7649
|
-
budgetPolicy: () => budgetSettings()
|
|
7895
|
+
budgetPolicy: () => budgetSettings(),
|
|
7896
|
+
parentModelBindings: () => cacheSettings().parentModelFollow ?? [],
|
|
7897
|
+
followParentModel: () => cacheSettings().followParentModel === true
|
|
7650
7898
|
});
|
|
7651
7899
|
const registration = ctx.llm.registerAdapter([GITHUB_COPILOT_PREVIEW_PROVIDER_ID], new PreviewAdapter(lifetime, optionsFor, discoverSnapshot, refreshRejected, budgetSettings, cacheSettings));
|
|
7652
7900
|
let exclusionSignature = JSON.stringify([...excludedModels()]);
|