dsh-github-copilot 0.4.0-alpha.77 → 0.4.0-alpha.78
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 -1
- package/CHANGELOG.md +6 -0
- package/README.md +9 -9
- package/README.zh.md +9 -9
- package/deployment-baseline.json +6 -2
- package/lib/client.js +40 -7
- package/lib/client.js.map +1 -1
- package/lib/index.js +89 -78
- package/lib/remote.js +21 -1
- package/lib/types/authorization-controller.d.ts +1 -0
- package/lib/types/auto-model-host.d.ts +1 -0
- package/lib/types/model-exclusions.d.ts +8 -0
- package/lib/types/remote.d.ts +22 -1
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -1847,7 +1847,7 @@ function installContextEvidence(ctx) {
|
|
|
1847
1847
|
//#endregion
|
|
1848
1848
|
//#region package.json
|
|
1849
1849
|
var name$1 = "dsh-github-copilot";
|
|
1850
|
-
var version = "0.4.0-alpha.
|
|
1850
|
+
var version = "0.4.0-alpha.78";
|
|
1851
1851
|
//#endregion
|
|
1852
1852
|
//#region lib/types/probe.js
|
|
1853
1853
|
/**
|
|
@@ -4365,6 +4365,38 @@ function migrationStatus(ctx) {
|
|
|
4365
4365
|
return result;
|
|
4366
4366
|
}
|
|
4367
4367
|
const MAX_MODEL_ID_LENGTH = 512;
|
|
4368
|
+
/** Admission is bound to the native turn and its request signal, not the global picker. */
|
|
4369
|
+
var ModelExclusionTurns = class {
|
|
4370
|
+
turns = /* @__PURE__ */ new WeakMap();
|
|
4371
|
+
signals = /* @__PURE__ */ new WeakMap();
|
|
4372
|
+
admit(owner, turn, model, signal, excluded) {
|
|
4373
|
+
const previous = this.turns.get(owner);
|
|
4374
|
+
if (signal.aborted || excluded.has(model) && (previous?.turn !== turn || previous.model !== model)) {
|
|
4375
|
+
if (previous?.turn !== turn) this.turns.delete(owner);
|
|
4376
|
+
return false;
|
|
4377
|
+
}
|
|
4378
|
+
this.turns.set(owner, {
|
|
4379
|
+
turn,
|
|
4380
|
+
model
|
|
4381
|
+
});
|
|
4382
|
+
this.signals.set(signal, {
|
|
4383
|
+
owner,
|
|
4384
|
+
turn,
|
|
4385
|
+
model
|
|
4386
|
+
});
|
|
4387
|
+
return true;
|
|
4388
|
+
}
|
|
4389
|
+
permits(signal, model) {
|
|
4390
|
+
if (signal === void 0 || signal.aborted) return false;
|
|
4391
|
+
const admitted = this.signals.get(signal);
|
|
4392
|
+
if (admitted?.model !== model) return false;
|
|
4393
|
+
const current = this.turns.get(admitted.owner);
|
|
4394
|
+
return current?.turn === admitted.turn && current.model === model;
|
|
4395
|
+
}
|
|
4396
|
+
end(owner) {
|
|
4397
|
+
this.turns.delete(owner);
|
|
4398
|
+
}
|
|
4399
|
+
};
|
|
4368
4400
|
function normalizeExcludedModelIds(value) {
|
|
4369
4401
|
if (value === void 0) return [];
|
|
4370
4402
|
if (!Array.isArray(value) || value.length > 512) throw new Error("COPILOT_MODEL_EXCLUSIONS_INVALID");
|
|
@@ -4503,56 +4535,6 @@ function accountModelsView(ctx) {
|
|
|
4503
4535
|
return empty;
|
|
4504
4536
|
}
|
|
4505
4537
|
}
|
|
4506
|
-
function modelSelection(value) {
|
|
4507
|
-
const selection = object$4(value);
|
|
4508
|
-
const provider = selection?.provider;
|
|
4509
|
-
const model = selection?.model;
|
|
4510
|
-
return typeof provider === "string" && provider.length > 0 && typeof model === "string" && model.length > 0 ? {
|
|
4511
|
-
provider,
|
|
4512
|
-
model
|
|
4513
|
-
} : void 0;
|
|
4514
|
-
}
|
|
4515
|
-
function fixedPreviewModel(value) {
|
|
4516
|
-
const selection = modelSelection(value);
|
|
4517
|
-
return selection?.provider === "github-copilot-preview" && autoModelPreference(selection.model) === void 0 ? selection.model : void 0;
|
|
4518
|
-
}
|
|
4519
|
-
function selectedFixedModelIds(ctx) {
|
|
4520
|
-
try {
|
|
4521
|
-
const defaults = service(ctx, "agentDefaultModel", ["currentSelection"]);
|
|
4522
|
-
const agents = service(ctx, "agents", ["list"]);
|
|
4523
|
-
const projections = service(ctx, "sessionProjections", ["stateOf"]);
|
|
4524
|
-
const locked = /* @__PURE__ */ new Set();
|
|
4525
|
-
const currentSelection = Reflect.get(defaults, "currentSelection");
|
|
4526
|
-
const defaultValue = typeof currentSelection === "function" ? Reflect.apply(currentSelection, defaults, []) : void 0;
|
|
4527
|
-
if (defaultValue !== null && defaultValue !== void 0 && modelSelection(defaultValue) === void 0) return void 0;
|
|
4528
|
-
const defaultSelection = fixedPreviewModel(defaultValue);
|
|
4529
|
-
if (defaultSelection !== void 0) locked.add(defaultSelection);
|
|
4530
|
-
const list = Reflect.get(agents, "list");
|
|
4531
|
-
const rows = typeof list === "function" ? Reflect.apply(list, agents, []) : void 0;
|
|
4532
|
-
if (!Array.isArray(rows) || rows.length > 1024) return void 0;
|
|
4533
|
-
const stateOf = Reflect.get(projections, "stateOf");
|
|
4534
|
-
if (typeof stateOf !== "function") return void 0;
|
|
4535
|
-
for (const candidate of rows) {
|
|
4536
|
-
const session = object$4(object$4(candidate)?.session);
|
|
4537
|
-
if (session === void 0) return void 0;
|
|
4538
|
-
const state = object$4(Reflect.apply(stateOf, projections, [session, "modelSelection"]));
|
|
4539
|
-
if (state === void 0 || !("pending" in state)) return void 0;
|
|
4540
|
-
const pending = state.pending;
|
|
4541
|
-
if (pending !== null && modelSelection(pending) === void 0) return void 0;
|
|
4542
|
-
let selected = pending === null ? void 0 : fixedPreviewModel(pending);
|
|
4543
|
-
if (pending === null) {
|
|
4544
|
-
const requestHeader = session.requestHeader;
|
|
4545
|
-
const header = typeof requestHeader === "function" ? object$4(Reflect.apply(requestHeader, session, [])) : void 0;
|
|
4546
|
-
if (header?.config !== void 0 && modelSelection(header.config) === void 0) return void 0;
|
|
4547
|
-
selected = fixedPreviewModel(header?.config);
|
|
4548
|
-
}
|
|
4549
|
-
if (selected !== void 0) locked.add(selected);
|
|
4550
|
-
}
|
|
4551
|
-
return [...locked].toSorted();
|
|
4552
|
-
} catch {
|
|
4553
|
-
return;
|
|
4554
|
-
}
|
|
4555
|
-
}
|
|
4556
4538
|
function modelPreferencesView(ctx, accountModels, error) {
|
|
4557
4539
|
const unavailable = (diagnostic) => ({
|
|
4558
4540
|
state: "error",
|
|
@@ -4580,15 +4562,14 @@ function modelPreferencesView(ctx, accountModels, error) {
|
|
|
4580
4562
|
} catch {
|
|
4581
4563
|
return unavailable("COPILOT_MODEL_SETTINGS_INVALID");
|
|
4582
4564
|
}
|
|
4583
|
-
const
|
|
4584
|
-
const diagnostic = lockedModelIds === void 0 ? "COPILOT_MODEL_SELECTION_UNAVAILABLE" : error;
|
|
4565
|
+
const diagnostic = error;
|
|
4585
4566
|
const available = new Set(accountModels?.models.map((model) => model.id) ?? []);
|
|
4586
4567
|
return {
|
|
4587
4568
|
state: diagnostic === void 0 ? "ready" : "error",
|
|
4588
|
-
writable:
|
|
4569
|
+
writable: true,
|
|
4589
4570
|
revision: descriptor.revision,
|
|
4590
4571
|
excludedModelIds,
|
|
4591
|
-
lockedModelIds:
|
|
4572
|
+
lockedModelIds: [],
|
|
4592
4573
|
unavailableExcludedModelIds: excludedModelIds.filter((id) => !available.has(id)),
|
|
4593
4574
|
...diagnostic === void 0 ? {} : { error: diagnostic }
|
|
4594
4575
|
};
|
|
@@ -4749,6 +4730,7 @@ let GitHubCopilotAuthorizationController = (() => {
|
|
|
4749
4730
|
let _status_decorators;
|
|
4750
4731
|
let _excludeModel_decorators;
|
|
4751
4732
|
let _restoreModel_decorators;
|
|
4733
|
+
let _setModelExcluded_decorators;
|
|
4752
4734
|
let _discoverModels_decorators;
|
|
4753
4735
|
let _ensureModels_decorators;
|
|
4754
4736
|
let _reconcile_decorators;
|
|
@@ -4762,6 +4744,7 @@ let GitHubCopilotAuthorizationController = (() => {
|
|
|
4762
4744
|
_status_decorators = [Remote];
|
|
4763
4745
|
_excludeModel_decorators = [Remote];
|
|
4764
4746
|
_restoreModel_decorators = [Remote];
|
|
4747
|
+
_setModelExcluded_decorators = [Remote];
|
|
4765
4748
|
_discoverModels_decorators = [Remote];
|
|
4766
4749
|
_ensureModels_decorators = [Remote];
|
|
4767
4750
|
_reconcile_decorators = [Remote];
|
|
@@ -4812,6 +4795,17 @@ let GitHubCopilotAuthorizationController = (() => {
|
|
|
4812
4795
|
},
|
|
4813
4796
|
metadata: _metadata
|
|
4814
4797
|
}, null, _instanceExtraInitializers);
|
|
4798
|
+
__esDecorate(this, null, _setModelExcluded_decorators, {
|
|
4799
|
+
kind: "method",
|
|
4800
|
+
name: "setModelExcluded",
|
|
4801
|
+
static: false,
|
|
4802
|
+
private: false,
|
|
4803
|
+
access: {
|
|
4804
|
+
has: (obj) => "setModelExcluded" in obj,
|
|
4805
|
+
get: (obj) => obj.setModelExcluded
|
|
4806
|
+
},
|
|
4807
|
+
metadata: _metadata
|
|
4808
|
+
}, null, _instanceExtraInitializers);
|
|
4815
4809
|
__esDecorate(this, null, _discoverModels_decorators, {
|
|
4816
4810
|
kind: "method",
|
|
4817
4811
|
name: "discoverModels",
|
|
@@ -4940,10 +4934,15 @@ let GitHubCopilotAuthorizationController = (() => {
|
|
|
4940
4934
|
};
|
|
4941
4935
|
}
|
|
4942
4936
|
async excludeModel(modelId) {
|
|
4943
|
-
|
|
4937
|
+
await this.updateModelExclusion(modelId, true);
|
|
4938
|
+
return this.status();
|
|
4944
4939
|
}
|
|
4945
4940
|
async restoreModel(modelId) {
|
|
4946
|
-
|
|
4941
|
+
await this.updateModelExclusion(modelId, false);
|
|
4942
|
+
return this.status();
|
|
4943
|
+
}
|
|
4944
|
+
async setModelExcluded(modelId, excluded) {
|
|
4945
|
+
return this.updateModelExclusion(modelId, excluded);
|
|
4947
4946
|
}
|
|
4948
4947
|
/** Explicit model discovery: may refresh OAuth and GET the account catalog, never changes selection. */
|
|
4949
4948
|
async discoverModels() {
|
|
@@ -5071,21 +5070,18 @@ let GitHubCopilotAuthorizationController = (() => {
|
|
|
5071
5070
|
return this.status();
|
|
5072
5071
|
}
|
|
5073
5072
|
async updateModelExclusion(modelId, exclude) {
|
|
5073
|
+
const view = () => modelPreferencesView(this.ctx, accountModelsView(this.ctx), this.modelPreferenceFailure);
|
|
5074
5074
|
let normalized;
|
|
5075
5075
|
try {
|
|
5076
5076
|
[normalized] = normalizeExcludedModelIds([modelId]);
|
|
5077
5077
|
} catch {
|
|
5078
5078
|
this.modelPreferenceFailure = "COPILOT_MODEL_EXCLUSION_SAVE_FAILED";
|
|
5079
|
-
return
|
|
5079
|
+
return view();
|
|
5080
5080
|
}
|
|
5081
5081
|
const current = modelPreferencesView(this.ctx, accountModelsView(this.ctx));
|
|
5082
5082
|
if (!current.writable || current.revision === void 0) {
|
|
5083
5083
|
this.modelPreferenceFailure = "COPILOT_MODEL_PREFERENCES_UNAVAILABLE";
|
|
5084
|
-
return
|
|
5085
|
-
}
|
|
5086
|
-
if (exclude && current.lockedModelIds.includes(normalized)) {
|
|
5087
|
-
this.modelPreferenceFailure = "COPILOT_MODEL_EXCLUSION_SELECTED";
|
|
5088
|
-
return this.status();
|
|
5084
|
+
return view();
|
|
5089
5085
|
}
|
|
5090
5086
|
const ids = new Set(current.excludedModelIds);
|
|
5091
5087
|
if (exclude) ids.add(normalized);
|
|
@@ -5093,7 +5089,7 @@ let GitHubCopilotAuthorizationController = (() => {
|
|
|
5093
5089
|
const next = normalizeExcludedModelIds([...ids]);
|
|
5094
5090
|
if (next.length === current.excludedModelIds.length && next.every((id, index) => id === current.excludedModelIds[index])) {
|
|
5095
5091
|
this.modelPreferenceFailure = void 0;
|
|
5096
|
-
return
|
|
5092
|
+
return current;
|
|
5097
5093
|
}
|
|
5098
5094
|
try {
|
|
5099
5095
|
await service(this.ctx, "settings", ["describe", "mutate"]).mutate(GITHUB_COPILOT_SETTINGS_NAMESPACE$1, [{
|
|
@@ -5106,7 +5102,7 @@ let GitHubCopilotAuthorizationController = (() => {
|
|
|
5106
5102
|
const record = object$4(cause);
|
|
5107
5103
|
this.modelPreferenceFailure = record?.code === "SETTINGS_CONFLICT" || cause instanceof Error && /conflict/i.test(cause.message) ? "COPILOT_MODEL_EXCLUSION_CONFLICT" : "COPILOT_MODEL_EXCLUSION_SAVE_FAILED";
|
|
5108
5104
|
}
|
|
5109
|
-
return
|
|
5105
|
+
return view();
|
|
5110
5106
|
}
|
|
5111
5107
|
async ensureProviderProfile() {
|
|
5112
5108
|
try {
|
|
@@ -7286,7 +7282,10 @@ function installAutoModelRouting(ctx, dependencies) {
|
|
|
7286
7282
|
const projections = ctx.get("sessionProjections");
|
|
7287
7283
|
const selection = record(projections) && typeof projections.stateOf === "function" ? projections.stateOf(agent.session, "modelSelection") : void 0;
|
|
7288
7284
|
const fixed = record(selection) && record(selection.pending) && selection.pending.provider === resolved.provider && selection.pending.model === resolved.model;
|
|
7289
|
-
if (!signal.aborted && (resolved.provider === "github-copilot-preview" || resolved.provider === "github-copilot"))
|
|
7285
|
+
if (!signal.aborted && (resolved.provider === "github-copilot-preview" || resolved.provider === "github-copilot")) {
|
|
7286
|
+
if (resolved.provider === "github-copilot-preview") dependencies.admitModel?.(agent, turn, resolved.model, signal);
|
|
7287
|
+
selections.record(agent, turn, { mode: fixed ? "manual" : "unknown" });
|
|
7288
|
+
}
|
|
7290
7289
|
return resolved;
|
|
7291
7290
|
}
|
|
7292
7291
|
if (resolved.provider !== "github-copilot-preview") {
|
|
@@ -7318,13 +7317,16 @@ function installAutoModelRouting(ctx, dependencies) {
|
|
|
7318
7317
|
}
|
|
7319
7318
|
state.recorded = true;
|
|
7320
7319
|
}
|
|
7321
|
-
if (!signal.aborted)
|
|
7322
|
-
|
|
7323
|
-
|
|
7324
|
-
|
|
7325
|
-
|
|
7326
|
-
|
|
7327
|
-
|
|
7320
|
+
if (!signal.aborted) {
|
|
7321
|
+
dependencies.admitModel?.(agent, turn, state.decision.model.id, signal);
|
|
7322
|
+
selections.record(agent, turn, {
|
|
7323
|
+
mode: "auto",
|
|
7324
|
+
preference: state.decision.preference,
|
|
7325
|
+
reason: state.decision.reason,
|
|
7326
|
+
candidateCount: state.decision.candidateCount,
|
|
7327
|
+
fittingCandidateCount: state.decision.fittingCandidateCount
|
|
7328
|
+
});
|
|
7329
|
+
}
|
|
7328
7330
|
return {
|
|
7329
7331
|
...resolved,
|
|
7330
7332
|
model: state.decision.model.id
|
|
@@ -7387,17 +7389,19 @@ var PreviewLifetime = class {
|
|
|
7387
7389
|
proofFor;
|
|
7388
7390
|
displayProofFor;
|
|
7389
7391
|
excluded;
|
|
7392
|
+
turns;
|
|
7390
7393
|
controller = new AbortController();
|
|
7391
7394
|
wires = /* @__PURE__ */ new Set();
|
|
7392
7395
|
retryEntries = /* @__PURE__ */ new Map();
|
|
7393
7396
|
revision = 0;
|
|
7394
7397
|
active = true;
|
|
7395
|
-
constructor(credentials, source, proofFor, displayProofFor, excluded) {
|
|
7398
|
+
constructor(credentials, source, proofFor, displayProofFor, excluded, turns) {
|
|
7396
7399
|
this.credentials = credentials;
|
|
7397
7400
|
this.source = source;
|
|
7398
7401
|
this.proofFor = proofFor;
|
|
7399
7402
|
this.displayProofFor = displayProofFor;
|
|
7400
7403
|
this.excluded = excluded;
|
|
7404
|
+
this.turns = turns;
|
|
7401
7405
|
}
|
|
7402
7406
|
assertActive() {
|
|
7403
7407
|
if (!this.active) throw failure("COPILOT_PREVIEW_DISPOSED", "ABORTED");
|
|
@@ -7499,7 +7503,7 @@ var PreviewLifetime = class {
|
|
|
7499
7503
|
const combined = signal === void 0 ? this.controller.signal : AbortSignal.any([signal, this.controller.signal]);
|
|
7500
7504
|
const grant = await this.read(combined);
|
|
7501
7505
|
if (grant === void 0) throw failure("COPILOT_PREVIEW_OAUTH_REQUIRED");
|
|
7502
|
-
if (this.excluded(model)) throw failure("COPILOT_PREVIEW_MODEL_EXCLUDED", "INVALID_REQUEST");
|
|
7506
|
+
if (!this.turns.permits(signal, model) && this.excluded(model)) throw failure("COPILOT_PREVIEW_MODEL_EXCLUDED", "INVALID_REQUEST");
|
|
7503
7507
|
const descriptor = snapshot.models.find((item) => item.id === model);
|
|
7504
7508
|
if (descriptor === void 0) throw failure("COPILOT_PREVIEW_MODEL_NOT_ENTITLED", "UNKNOWN_MODEL");
|
|
7505
7509
|
const proof = this.proofFor(snapshot);
|
|
@@ -7510,6 +7514,7 @@ var PreviewLifetime = class {
|
|
|
7510
7514
|
proof,
|
|
7511
7515
|
revision: this.revision,
|
|
7512
7516
|
signal: combined,
|
|
7517
|
+
retrySignal: signal,
|
|
7513
7518
|
started: false
|
|
7514
7519
|
};
|
|
7515
7520
|
this.entitled(lease, grant, model);
|
|
@@ -7526,7 +7531,7 @@ var PreviewLifetime = class {
|
|
|
7526
7531
|
}
|
|
7527
7532
|
entitled(lease, grant, model) {
|
|
7528
7533
|
this.account(lease, grant);
|
|
7529
|
-
if (this.excluded(model)) throw failure("COPILOT_PREVIEW_MODEL_EXCLUDED", "INVALID_REQUEST");
|
|
7534
|
+
if (!this.turns.permits(lease.retrySignal, model) && !lease.started && this.excluded(model)) throw failure("COPILOT_PREVIEW_MODEL_EXCLUDED", "INVALID_REQUEST");
|
|
7530
7535
|
if (lease.descriptor.id !== model) throw failure("COPILOT_PREVIEW_MODEL_MISMATCH", "UNKNOWN_MODEL");
|
|
7531
7536
|
if (this.source.readSnapshot() !== lease.snapshot || this.proofFor(lease.snapshot) !== lease.proof) throw failure("COPILOT_PREVIEW_METADATA_STALE");
|
|
7532
7537
|
if (tokenFingerprint(grant.access) !== lease.proof.tokenFingerprint || copilotEntitlementKey(grant) !== lease.proof.entitlementKey || grant.expires <= Date.now()) {
|
|
@@ -7538,6 +7543,7 @@ var PreviewLifetime = class {
|
|
|
7538
7543
|
start(lease) {
|
|
7539
7544
|
this.assertActive();
|
|
7540
7545
|
if (!lease.started && lease.revision !== this.revision) throw failure("COPILOT_PREVIEW_PREPARED_CALL_INVALIDATED", "ABORTED");
|
|
7546
|
+
if (!this.turns.permits(lease.retrySignal, lease.descriptor.id) && this.excluded(lease.descriptor.id)) throw failure("COPILOT_PREVIEW_MODEL_EXCLUDED", "INVALID_REQUEST");
|
|
7541
7547
|
lease.started = true;
|
|
7542
7548
|
}
|
|
7543
7549
|
guard(lease) {
|
|
@@ -7900,9 +7906,11 @@ function apply$1(ctx, config = {}) {
|
|
|
7900
7906
|
});
|
|
7901
7907
|
const displayProofFor = (snapshot) => source.readDisplaySnapshot() === snapshot && provenSnapshot === snapshot && snapshotProof?.accountKey === snapshot.accountKey ? snapshotProof : void 0;
|
|
7902
7908
|
const proofFor = (snapshot) => source.readSnapshot() === snapshot && snapshotProof !== void 0 && snapshotProof.expires > Date.now() ? displayProofFor(snapshot) : void 0;
|
|
7903
|
-
const
|
|
7909
|
+
const exclusionTurns = new ModelExclusionTurns();
|
|
7910
|
+
const lifetime = new PreviewLifetime(store, source, proofFor, displayProofFor, (modelId) => excludedModels().has(modelId), exclusionTurns);
|
|
7904
7911
|
const removeStepListener = ctx.on("session/event", (session, event) => {
|
|
7905
7912
|
if (event.type === "step/start" || event.type === "turn/end") lifetime.clearSessionRetries(session.id);
|
|
7913
|
+
if (event.type === "turn/end") exclusionTurns.end(session);
|
|
7906
7914
|
});
|
|
7907
7915
|
const template = resolvedProfile(createAccountProvider([], lifetime.guard(), "https://api.individual.githubcopilot.com").provider, requestConfig);
|
|
7908
7916
|
let configured = false;
|
|
@@ -8094,7 +8102,10 @@ function apply$1(ctx, config = {}) {
|
|
|
8094
8102
|
},
|
|
8095
8103
|
budgetPolicy: () => budgetSettings(),
|
|
8096
8104
|
parentModelBindings: () => cacheSettings().parentModelFollow ?? [],
|
|
8097
|
-
followParentModel: () => cacheSettings().followParentModel === true
|
|
8105
|
+
followParentModel: () => cacheSettings().followParentModel === true,
|
|
8106
|
+
admitModel(agent, turn, model, signal) {
|
|
8107
|
+
if (!exclusionTurns.admit(agent.session, turn, model, signal, excludedModels())) throw failure("COPILOT_PREVIEW_MODEL_EXCLUDED", "INVALID_REQUEST");
|
|
8108
|
+
}
|
|
8098
8109
|
});
|
|
8099
8110
|
const registration = ctx.llm.registerAdapter([GITHUB_COPILOT_PREVIEW_PROVIDER_ID], new PreviewAdapter(lifetime, optionsFor, discoverSnapshot, refreshRejected, budgetSettings, cacheSettings));
|
|
8100
8111
|
let exclusionSignature = JSON.stringify([...excludedModels()]);
|
package/lib/remote.js
CHANGED
|
@@ -340,6 +340,7 @@ const GitHubCopilotAuthorizationViewSchema = z.object({
|
|
|
340
340
|
]).optional()
|
|
341
341
|
}).strict();
|
|
342
342
|
const result = strictRemoteCodec(GITHUB_COPILOT_AUTHORIZATION_VIEW_TYPE_SYMBOL, GitHubCopilotAuthorizationViewSchema);
|
|
343
|
+
const GitHubCopilotModelPreferencesViewSchema = GitHubCopilotAuthorizationViewSchema.shape.modelPreferences.unwrap();
|
|
343
344
|
const GITHUB_COPILOT_MIGRATION_STATUS_TYPE_SYMBOL = "dsh-github-copilot#GitHubCopilotMigrationStatus";
|
|
344
345
|
const selectionSchema = z.object({
|
|
345
346
|
provider: z.string().min(1).max(512),
|
|
@@ -420,6 +421,25 @@ const contribution = {
|
|
|
420
421
|
}],
|
|
421
422
|
result
|
|
422
423
|
})),
|
|
424
|
+
{
|
|
425
|
+
id: "dsh-github-copilot:githubCopilot.setModelExcluded",
|
|
426
|
+
service: "githubCopilotAuthorization",
|
|
427
|
+
namespace: "githubCopilot",
|
|
428
|
+
method: "setModelExcluded",
|
|
429
|
+
invocation: direct,
|
|
430
|
+
parameters: [{
|
|
431
|
+
name: "modelId",
|
|
432
|
+
wire: "modelId",
|
|
433
|
+
source: "json",
|
|
434
|
+
codec: strictRemoteCodec("dsh-github-copilot#GitHubCopilotModelId", z.string().min(1).max(512))
|
|
435
|
+
}, {
|
|
436
|
+
name: "excluded",
|
|
437
|
+
wire: "excluded",
|
|
438
|
+
source: "json",
|
|
439
|
+
codec: strictRemoteCodec("dsh-github-copilot#GitHubCopilotModelExcluded", z.boolean())
|
|
440
|
+
}],
|
|
441
|
+
result: strictRemoteCodec("dsh-github-copilot#GitHubCopilotModelPreferencesView", GitHubCopilotModelPreferencesViewSchema)
|
|
442
|
+
},
|
|
423
443
|
{
|
|
424
444
|
id: "dsh-github-copilot:githubCopilot.migrationStatus",
|
|
425
445
|
service: "githubCopilotAuthorization",
|
|
@@ -436,4 +456,4 @@ const contribution = {
|
|
|
436
456
|
]
|
|
437
457
|
};
|
|
438
458
|
//#endregion
|
|
439
|
-
export { GITHUB_COPILOT_AUTHORIZATION_VIEW_TYPE_SYMBOL, GITHUB_COPILOT_MIGRATION_STATUS_TYPE_SYMBOL, GitHubCopilotAuthorizationViewSchema, GitHubCopilotMigrationStatusSchema, contribution as default };
|
|
459
|
+
export { GITHUB_COPILOT_AUTHORIZATION_VIEW_TYPE_SYMBOL, GITHUB_COPILOT_MIGRATION_STATUS_TYPE_SYMBOL, GitHubCopilotAuthorizationViewSchema, GitHubCopilotMigrationStatusSchema, GitHubCopilotModelPreferencesViewSchema, contribution as default };
|
|
@@ -101,6 +101,7 @@ export declare class GitHubCopilotAuthorizationController extends TypertRemoteSe
|
|
|
101
101
|
status(): Promise<GitHubCopilotAuthorizationView>;
|
|
102
102
|
excludeModel(modelId: string): Promise<GitHubCopilotAuthorizationView>;
|
|
103
103
|
restoreModel(modelId: string): Promise<GitHubCopilotAuthorizationView>;
|
|
104
|
+
setModelExcluded(modelId: string, excluded: boolean): Promise<GitHubCopilotModelPreferencesView>;
|
|
104
105
|
/** Explicit model discovery: may refresh OAuth and GET the account catalog, never changes selection. */
|
|
105
106
|
discoverModels(): Promise<GitHubCopilotAuthorizationView>;
|
|
106
107
|
/** Ensure metadata for a visible account view, honoring shared cache and failure cooldown. */
|
|
@@ -16,6 +16,7 @@ export interface AutoModelHostDependencies {
|
|
|
16
16
|
budgetPolicy?: () => Partial<RequestBudgetPolicy>;
|
|
17
17
|
parentModelBindings?: () => readonly ParentModelBinding[];
|
|
18
18
|
followParentModel?: () => boolean;
|
|
19
|
+
admitModel?: (agent: Agent, turn: number, model: string, signal: AbortSignal) => void;
|
|
19
20
|
}
|
|
20
21
|
/** Resolve virtual Auto once per Core turn before request/header persistence. */
|
|
21
22
|
export declare function installAutoModelRouting(ctx: Context, dependencies: AutoModelHostDependencies): () => void;
|
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
export declare const MAX_EXCLUDED_MODEL_IDS = 512;
|
|
2
|
+
/** Admission is bound to the native turn and its request signal, not the global picker. */
|
|
3
|
+
export declare class ModelExclusionTurns {
|
|
4
|
+
private readonly turns;
|
|
5
|
+
private readonly signals;
|
|
6
|
+
admit(owner: object, turn: number, model: string, signal: AbortSignal, excluded: ReadonlySet<string>): boolean;
|
|
7
|
+
permits(signal: AbortSignal | undefined, model: string): boolean;
|
|
8
|
+
end(owner: object): void;
|
|
9
|
+
}
|
|
2
10
|
export declare function normalizeExcludedModelIds(value: unknown): readonly string[];
|
|
3
11
|
export declare function excludedModelSet(value: unknown): ReadonlySet<string>;
|
|
4
12
|
export declare function filterExcludedModels<T extends {
|
package/lib/types/remote.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import type { RemoteResult, TypertRemoteContribution } from '@deepseek-ai/dsh-typert-protocol';
|
|
5
5
|
import { z } from 'zod';
|
|
6
|
-
import type { GitHubCopilotAuthorizationView } from './authorization-controller.ts';
|
|
6
|
+
import type { GitHubCopilotAuthorizationView, GitHubCopilotModelPreferencesView } from './authorization-controller.ts';
|
|
7
7
|
import type { GitHubCopilotMigrationStatus } from './migration-status.ts';
|
|
8
8
|
declare module '@deepseek-ai/dsh-typert-protocol' {
|
|
9
9
|
interface TypertRemoteNamespaceMap {
|
|
@@ -15,6 +15,7 @@ declare module '@deepseek-ai/dsh-typert-protocol' {
|
|
|
15
15
|
ensureModels(): Promise<RemoteResult<GitHubCopilotAuthorizationView>>;
|
|
16
16
|
excludeModel(modelId: string): Promise<RemoteResult<GitHubCopilotAuthorizationView>>;
|
|
17
17
|
restoreModel(modelId: string): Promise<RemoteResult<GitHubCopilotAuthorizationView>>;
|
|
18
|
+
setModelExcluded(modelId: string, excluded: boolean): Promise<RemoteResult<GitHubCopilotModelPreferencesView>>;
|
|
18
19
|
start(): Promise<RemoteResult<GitHubCopilotAuthorizationView>>;
|
|
19
20
|
cancel(): Promise<RemoteResult<GitHubCopilotAuthorizationView>>;
|
|
20
21
|
signOut(): Promise<RemoteResult<GitHubCopilotAuthorizationView>>;
|
|
@@ -117,6 +118,26 @@ export declare const GitHubCopilotAuthorizationViewSchema: z.ZodObject<{
|
|
|
117
118
|
INTERACTION_NOTICE_OBSERVED: "INTERACTION_NOTICE_OBSERVED";
|
|
118
119
|
}>>;
|
|
119
120
|
}, z.core.$strict>;
|
|
121
|
+
export declare const GitHubCopilotModelPreferencesViewSchema: z.ZodObject<{
|
|
122
|
+
state: z.ZodEnum<{
|
|
123
|
+
error: "error";
|
|
124
|
+
ready: "ready";
|
|
125
|
+
}>;
|
|
126
|
+
writable: z.ZodBoolean;
|
|
127
|
+
revision: z.ZodOptional<z.ZodNumber>;
|
|
128
|
+
excludedModelIds: z.ZodArray<z.ZodString>;
|
|
129
|
+
lockedModelIds: z.ZodArray<z.ZodString>;
|
|
130
|
+
unavailableExcludedModelIds: z.ZodArray<z.ZodString>;
|
|
131
|
+
error: z.ZodOptional<z.ZodEnum<{
|
|
132
|
+
COPILOT_MODEL_PREFERENCES_UNAVAILABLE: "COPILOT_MODEL_PREFERENCES_UNAVAILABLE";
|
|
133
|
+
COPILOT_MODEL_EXCLUSION_SELECTED: "COPILOT_MODEL_EXCLUSION_SELECTED";
|
|
134
|
+
COPILOT_MODEL_EXCLUSION_CONFLICT: "COPILOT_MODEL_EXCLUSION_CONFLICT";
|
|
135
|
+
COPILOT_MODEL_EXCLUSION_SAVE_FAILED: "COPILOT_MODEL_EXCLUSION_SAVE_FAILED";
|
|
136
|
+
COPILOT_MODEL_SETTINGS_UNAVAILABLE: "COPILOT_MODEL_SETTINGS_UNAVAILABLE";
|
|
137
|
+
COPILOT_MODEL_SETTINGS_INVALID: "COPILOT_MODEL_SETTINGS_INVALID";
|
|
138
|
+
COPILOT_MODEL_SELECTION_UNAVAILABLE: "COPILOT_MODEL_SELECTION_UNAVAILABLE";
|
|
139
|
+
}>>;
|
|
140
|
+
}, z.core.$strict>;
|
|
120
141
|
export declare const GITHUB_COPILOT_MIGRATION_STATUS_TYPE_SYMBOL = "dsh-github-copilot#GitHubCopilotMigrationStatus";
|
|
121
142
|
/** Independent Ops result: strict at every object level; no account or private Session data. */
|
|
122
143
|
export declare const GitHubCopilotMigrationStatusSchema: z.ZodObject<{
|
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.78",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
7
7
|
"registry": "https://registry.npmjs.org/",
|