dsh-github-copilot 0.4.0-alpha.56 → 0.4.0-alpha.58
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 +3 -1
- package/CHANGELOG.md +13 -2
- package/README.md +14 -10
- package/README.zh.md +14 -10
- package/deployment-baseline.json +8 -4
- package/docs/automatic-model-routing.md +5 -20
- package/docs/model-compatibility-acceptance.md +1 -0
- package/docs/web-lifecycle-rc2.md +55 -0
- package/lib/client.js +472 -68
- package/lib/client.js.map +1 -1
- package/lib/index.js +92 -9
- package/lib/remote.js +55 -3
- package/lib/types/auto-model-host.d.ts +9 -0
- package/lib/types/auto-model-presentation.d.ts +2 -2
- package/lib/types/preview-provider.d.ts +8 -0
- package/lib/types/turn-model-provenance.d.ts +45 -0
- package/lib/types/turn-selection-card.d.ts +8 -0
- package/lib/types/turn-selection-remote.d.ts +13 -0
- package/lib/types/turn-selection.d.ts +42 -0
- package/package.json +2 -1
package/lib/index.js
CHANGED
|
@@ -1647,7 +1647,7 @@ let GitHubCopilotUsageController = (() => {
|
|
|
1647
1647
|
//#endregion
|
|
1648
1648
|
//#region package.json
|
|
1649
1649
|
var name$1 = "dsh-github-copilot";
|
|
1650
|
-
var version = "0.4.0-alpha.
|
|
1650
|
+
var version = "0.4.0-alpha.58";
|
|
1651
1651
|
//#endregion
|
|
1652
1652
|
//#region lib/types/probe.js
|
|
1653
1653
|
/**
|
|
@@ -5109,6 +5109,15 @@ async function isCopilotInputItemScopeError(response, signal) {
|
|
|
5109
5109
|
}
|
|
5110
5110
|
//#endregion
|
|
5111
5111
|
//#region lib/types/preview-provider.js
|
|
5112
|
+
/** Identity, not upstream error text, proves that the plugin revoked this wire. */
|
|
5113
|
+
var ManagedWireAbortError = class extends Error {
|
|
5114
|
+
code;
|
|
5115
|
+
constructor(code) {
|
|
5116
|
+
super(code);
|
|
5117
|
+
this.code = code;
|
|
5118
|
+
this.name = "ManagedWireAbortError";
|
|
5119
|
+
}
|
|
5120
|
+
};
|
|
5112
5121
|
const enabledLevels = [
|
|
5113
5122
|
"minimal",
|
|
5114
5123
|
"low",
|
|
@@ -5332,7 +5341,10 @@ function createAccountProvider(descriptors, guard, baseURL) {
|
|
|
5332
5341
|
}
|
|
5333
5342
|
return (async function* () {
|
|
5334
5343
|
try {
|
|
5335
|
-
|
|
5344
|
+
for await (const event of native.streamSimple(model, context, wireOptions)) {
|
|
5345
|
+
if (event.type === "error" && event.reason === "aborted" && lease.signal.reason instanceof ManagedWireAbortError) guard.onWireAbort?.(lease.signal.reason.code);
|
|
5346
|
+
yield event;
|
|
5347
|
+
}
|
|
5336
5348
|
} finally {
|
|
5337
5349
|
lease.release();
|
|
5338
5350
|
if (unauthorized && !guard.signal.aborted && !options.signal?.aborted) try {
|
|
@@ -6368,6 +6380,51 @@ function selectAutoModel(models, messages, preference = "balance", context) {
|
|
|
6368
6380
|
function autoModelInputModalities(models) {
|
|
6369
6381
|
return models.filter((model) => autoModelPreference(model.id) === void 0 && model.input.includes("text")).some((model) => model.input.includes("image")) ? ["text", "image"] : ["text"];
|
|
6370
6382
|
}
|
|
6383
|
+
z$1.discriminatedUnion("mode", [
|
|
6384
|
+
z$1.object({ mode: z$1.literal("unknown") }).strict(),
|
|
6385
|
+
z$1.object({ mode: z$1.literal("manual") }).strict(),
|
|
6386
|
+
z$1.object({
|
|
6387
|
+
mode: z$1.literal("auto"),
|
|
6388
|
+
preference: z$1.enum([
|
|
6389
|
+
"efficiency",
|
|
6390
|
+
"balance",
|
|
6391
|
+
"intelligence"
|
|
6392
|
+
]),
|
|
6393
|
+
reason: z$1.enum([
|
|
6394
|
+
"short-text-turn",
|
|
6395
|
+
"standard-turn",
|
|
6396
|
+
"large-structured-turn",
|
|
6397
|
+
"image-capability"
|
|
6398
|
+
]),
|
|
6399
|
+
candidateCount: z$1.number().int().positive(),
|
|
6400
|
+
fittingCandidateCount: z$1.number().int().nonnegative().optional()
|
|
6401
|
+
}).strict()
|
|
6402
|
+
]);
|
|
6403
|
+
/** Ephemeral decision evidence only; never session content, model usage or credentials. */
|
|
6404
|
+
var TurnSelectionStore = class {
|
|
6405
|
+
agents = /* @__PURE__ */ new Map();
|
|
6406
|
+
record(agent, turn, selection) {
|
|
6407
|
+
if (!Number.isSafeInteger(turn) || turn < 0) throw new Error("COPILOT_TURN_SELECTION_INVALID_TURN");
|
|
6408
|
+
let turns = this.agents.get(agent);
|
|
6409
|
+
if (!turns) {
|
|
6410
|
+
turns = /* @__PURE__ */ new Map();
|
|
6411
|
+
this.agents.set(agent, turns);
|
|
6412
|
+
if (this.agents.size > 64) this.agents.delete(this.agents.keys().next().value);
|
|
6413
|
+
}
|
|
6414
|
+
if (!turns.has(turn)) turns.set(turn, Object.freeze({ ...selection }));
|
|
6415
|
+
if (turns.size > 128) turns.delete(turns.keys().next().value);
|
|
6416
|
+
}
|
|
6417
|
+
get(agent, turn) {
|
|
6418
|
+
if (!Number.isSafeInteger(turn) || turn < 0) throw new Error("COPILOT_TURN_SELECTION_INVALID_TURN");
|
|
6419
|
+
return this.agents.get(agent)?.get(turn) ?? { mode: "unknown" };
|
|
6420
|
+
}
|
|
6421
|
+
remove(agent) {
|
|
6422
|
+
this.agents.delete(agent);
|
|
6423
|
+
}
|
|
6424
|
+
clear() {
|
|
6425
|
+
this.agents.clear();
|
|
6426
|
+
}
|
|
6427
|
+
};
|
|
6371
6428
|
//#endregion
|
|
6372
6429
|
//#region lib/types/auto-model-host.js
|
|
6373
6430
|
function failure$1(code) {
|
|
@@ -6431,6 +6488,8 @@ function actualNotice(agent, model) {
|
|
|
6431
6488
|
}
|
|
6432
6489
|
/** Resolve virtual Auto once per Core turn before request/header persistence. */
|
|
6433
6490
|
function installAutoModelRouting(ctx, dependencies) {
|
|
6491
|
+
const selections = new TurnSelectionStore();
|
|
6492
|
+
ctx.provide("githubCopilotTurnSelection", { get: (agent, turn) => selections.get(agent, turn) });
|
|
6434
6493
|
const captured = /* @__PURE__ */ new WeakMap();
|
|
6435
6494
|
const routed = /* @__PURE__ */ new WeakMap();
|
|
6436
6495
|
const agentDisposers = /* @__PURE__ */ new WeakMap();
|
|
@@ -6496,6 +6555,7 @@ function installAutoModelRouting(ctx, dependencies) {
|
|
|
6496
6555
|
agentDisposers.delete(agent);
|
|
6497
6556
|
captured.delete(agent);
|
|
6498
6557
|
routed.delete(agent);
|
|
6558
|
+
selections.remove(agent);
|
|
6499
6559
|
});
|
|
6500
6560
|
const removeRequest = ctx.on("agent/request", async ({ agent, turn, signal }, next) => {
|
|
6501
6561
|
const resolved = await next();
|
|
@@ -6504,6 +6564,10 @@ function installAutoModelRouting(ctx, dependencies) {
|
|
|
6504
6564
|
const virtual = virtualPreference !== void 0;
|
|
6505
6565
|
if (!virtual && pending === void 0) {
|
|
6506
6566
|
routed.delete(agent);
|
|
6567
|
+
const projections = ctx.get("sessionProjections");
|
|
6568
|
+
const selection = record(projections) && typeof projections.stateOf === "function" ? projections.stateOf(agent.session, "modelSelection") : void 0;
|
|
6569
|
+
const fixed = record(selection) && record(selection.pending) && selection.pending.provider === resolved.provider && selection.pending.model === resolved.model;
|
|
6570
|
+
if (!signal.aborted && (resolved.provider === "github-copilot-preview" || resolved.provider === "github-copilot")) selections.record(agent, turn, { mode: fixed ? "manual" : "unknown" });
|
|
6507
6571
|
return resolved;
|
|
6508
6572
|
}
|
|
6509
6573
|
if (resolved.provider !== "github-copilot-preview") {
|
|
@@ -6535,6 +6599,13 @@ function installAutoModelRouting(ctx, dependencies) {
|
|
|
6535
6599
|
}
|
|
6536
6600
|
state.recorded = true;
|
|
6537
6601
|
}
|
|
6602
|
+
if (!signal.aborted) selections.record(agent, turn, {
|
|
6603
|
+
mode: "auto",
|
|
6604
|
+
preference: state.decision.preference,
|
|
6605
|
+
reason: state.decision.reason,
|
|
6606
|
+
candidateCount: state.decision.candidateCount,
|
|
6607
|
+
fittingCandidateCount: state.decision.fittingCandidateCount
|
|
6608
|
+
});
|
|
6538
6609
|
return {
|
|
6539
6610
|
...resolved,
|
|
6540
6611
|
model: state.decision.model.id
|
|
@@ -6546,6 +6617,7 @@ function installAutoModelRouting(ctx, dependencies) {
|
|
|
6546
6617
|
removeRequest();
|
|
6547
6618
|
for (const dispose of activeDisposers) dispose();
|
|
6548
6619
|
activeDisposers.clear();
|
|
6620
|
+
selections.clear();
|
|
6549
6621
|
};
|
|
6550
6622
|
}
|
|
6551
6623
|
//#endregion
|
|
@@ -6553,6 +6625,9 @@ function installAutoModelRouting(ctx, dependencies) {
|
|
|
6553
6625
|
function failure(code, category = "AUTH") {
|
|
6554
6626
|
return new LlmError(code, category);
|
|
6555
6627
|
}
|
|
6628
|
+
function abortFailure(signal) {
|
|
6629
|
+
return failure(signal.reason instanceof ManagedWireAbortError ? signal.reason.code : "COPILOT_PREVIEW_ABORTED", "ABORTED");
|
|
6630
|
+
}
|
|
6556
6631
|
function tokenFingerprint(value) {
|
|
6557
6632
|
return createHash("sha256").update(value).digest("hex");
|
|
6558
6633
|
}
|
|
@@ -6595,13 +6670,13 @@ var PreviewLifetime = class {
|
|
|
6595
6670
|
this.assertActive();
|
|
6596
6671
|
this.revision++;
|
|
6597
6672
|
this.source.invalidate();
|
|
6598
|
-
for (const wire of this.wires) wire.abort(
|
|
6673
|
+
for (const wire of this.wires) wire.abort(new ManagedWireAbortError("COPILOT_PREVIEW_CREDENTIAL_CHANGED"));
|
|
6599
6674
|
}
|
|
6600
6675
|
dispose() {
|
|
6601
6676
|
if (!this.active) return;
|
|
6602
6677
|
this.active = false;
|
|
6603
6678
|
this.source.dispose();
|
|
6604
|
-
this.controller.abort(
|
|
6679
|
+
this.controller.abort(new ManagedWireAbortError("COPILOT_PREVIEW_DISPOSED"));
|
|
6605
6680
|
for (const wire of this.wires) wire.abort();
|
|
6606
6681
|
this.wires.clear();
|
|
6607
6682
|
}
|
|
@@ -6618,7 +6693,7 @@ var PreviewLifetime = class {
|
|
|
6618
6693
|
credential = await abortable$1(this.credentials.read(GITHUB_COPILOT_PREVIEW_PROVIDER_ID), signal);
|
|
6619
6694
|
} catch {
|
|
6620
6695
|
this.assertActive();
|
|
6621
|
-
if (signal.aborted) throw
|
|
6696
|
+
if (signal.aborted) throw abortFailure(signal);
|
|
6622
6697
|
if (revision === this.revision) invalidateRead();
|
|
6623
6698
|
throw failure("COPILOT_PREVIEW_CREDENTIAL_READ_FAILED");
|
|
6624
6699
|
}
|
|
@@ -6875,7 +6950,7 @@ var PreviewAdapter = class extends PiAiAdapter {
|
|
|
6875
6950
|
owned(options.provider);
|
|
6876
6951
|
if (options.model !== lease.descriptor.id) throw failure("COPILOT_PREVIEW_MODEL_MISMATCH");
|
|
6877
6952
|
const signal = AbortSignal.any([lease.signal, ...options.signal === void 0 ? [] : [options.signal]]);
|
|
6878
|
-
if (signal.aborted) throw
|
|
6953
|
+
if (signal.aborted) throw abortFailure(signal);
|
|
6879
6954
|
const policy = resolveRequestBudgetPolicy(owner.requestBudgetSettings());
|
|
6880
6955
|
const model = accountModelFromDescriptor(lease.descriptor, lease.proof.baseURL);
|
|
6881
6956
|
if (options.reasoningEffort !== void 0) {
|
|
@@ -6883,8 +6958,9 @@ var PreviewAdapter = class extends PiAiAdapter {
|
|
|
6883
6958
|
if (typeof mapping !== "string" || mapping.length === 0) throw failure("COPILOT_PREVIEW_REASONING_UNSUPPORTED", "INVALID_REQUEST");
|
|
6884
6959
|
}
|
|
6885
6960
|
let requestFailure;
|
|
6961
|
+
let wireAbort;
|
|
6886
6962
|
const inspectRequest = (_model, context, nativeOptions) => {
|
|
6887
|
-
if (signal.aborted) throw
|
|
6963
|
+
if (signal.aborted) throw abortFailure(signal);
|
|
6888
6964
|
const calculated = calculateRequestBudget(lease.descriptor, nativeOptions?.maxTokens, policy);
|
|
6889
6965
|
if (!calculated.ok) {
|
|
6890
6966
|
requestFailure = budgetFailure(calculated);
|
|
@@ -6900,6 +6976,9 @@ var PreviewAdapter = class extends PiAiAdapter {
|
|
|
6900
6976
|
try {
|
|
6901
6977
|
const native = new PiAiAdapter(owner.optionsFor(lease, {
|
|
6902
6978
|
inspectRequest,
|
|
6979
|
+
onWireAbort(code) {
|
|
6980
|
+
wireAbort = code;
|
|
6981
|
+
},
|
|
6903
6982
|
onReplayFailure(error) {
|
|
6904
6983
|
if (!signal.aborted) requestFailure = new LlmError(error.message, "INVALID_REQUEST");
|
|
6905
6984
|
}
|
|
@@ -6914,15 +6993,19 @@ var PreviewAdapter = class extends PiAiAdapter {
|
|
|
6914
6993
|
};
|
|
6915
6994
|
for await (const chunk of native.stream(request)) {
|
|
6916
6995
|
if (requestFailure !== void 0) {
|
|
6917
|
-
if (signal.aborted) throw
|
|
6996
|
+
if (signal.aborted) throw abortFailure(signal);
|
|
6918
6997
|
throw requestFailure;
|
|
6919
6998
|
}
|
|
6999
|
+
if (chunk.type === "finish" && wireAbort !== void 0) {
|
|
7000
|
+
if (signal.aborted) throw abortFailure(signal);
|
|
7001
|
+
throw failure(wireAbort, "ABORTED");
|
|
7002
|
+
}
|
|
6920
7003
|
if (chunk.type === "finish" && chunk.reason.kind === "error" && chunk.reason.failure.code === "UNKNOWN_MODEL") await owner.refreshRejected(lease.snapshot, signal);
|
|
6921
7004
|
yield chunk;
|
|
6922
7005
|
}
|
|
6923
7006
|
if (requestFailure !== void 0) throw requestFailure;
|
|
6924
7007
|
} catch (cause) {
|
|
6925
|
-
if (signal.aborted) throw
|
|
7008
|
+
if (signal.aborted) throw abortFailure(signal);
|
|
6926
7009
|
if (cause instanceof LlmError && cause.code === "UNKNOWN_MODEL") await owner.refreshRejected(lease.snapshot, signal);
|
|
6927
7010
|
throw requestFailure ?? cause;
|
|
6928
7011
|
}
|
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$
|
|
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$
|
|
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$
|
|
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
|
|
@@ -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
|
|
@@ -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 {
|
|
@@ -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
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { AutoModelPreference } from './copilot-identity.ts';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
export declare const TurnSelectionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
4
|
+
mode: z.ZodLiteral<"unknown">;
|
|
5
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
6
|
+
mode: z.ZodLiteral<"manual">;
|
|
7
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
8
|
+
mode: z.ZodLiteral<"auto">;
|
|
9
|
+
preference: z.ZodEnum<{
|
|
10
|
+
efficiency: "efficiency";
|
|
11
|
+
balance: "balance";
|
|
12
|
+
intelligence: "intelligence";
|
|
13
|
+
}>;
|
|
14
|
+
reason: z.ZodEnum<{
|
|
15
|
+
"short-text-turn": "short-text-turn";
|
|
16
|
+
"standard-turn": "standard-turn";
|
|
17
|
+
"large-structured-turn": "large-structured-turn";
|
|
18
|
+
"image-capability": "image-capability";
|
|
19
|
+
}>;
|
|
20
|
+
candidateCount: z.ZodNumber;
|
|
21
|
+
fittingCandidateCount: z.ZodOptional<z.ZodNumber>;
|
|
22
|
+
}, z.core.$strict>], "mode">;
|
|
23
|
+
export type TurnSelection = {
|
|
24
|
+
readonly mode: 'unknown';
|
|
25
|
+
} | {
|
|
26
|
+
readonly mode: 'manual';
|
|
27
|
+
} | {
|
|
28
|
+
readonly mode: 'auto';
|
|
29
|
+
readonly preference: AutoModelPreference;
|
|
30
|
+
readonly reason: 'short-text-turn' | 'standard-turn' | 'large-structured-turn' | 'image-capability';
|
|
31
|
+
readonly candidateCount: number;
|
|
32
|
+
readonly fittingCandidateCount?: number;
|
|
33
|
+
};
|
|
34
|
+
/** Ephemeral decision evidence only; never session content, model usage or credentials. */
|
|
35
|
+
export declare class TurnSelectionStore {
|
|
36
|
+
private readonly agents;
|
|
37
|
+
record(agent: object, turn: number, selection: TurnSelection): void;
|
|
38
|
+
get(agent: object, turn: number): TurnSelection;
|
|
39
|
+
remove(agent: object): void;
|
|
40
|
+
clear(): void;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=turn-selection.d.ts.map
|
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.58",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
7
7
|
"registry": "https://registry.npmjs.org/",
|
|
@@ -57,6 +57,7 @@
|
|
|
57
57
|
"docs/official-first-016-alpha2.md",
|
|
58
58
|
"docs/official-first-020-rc1.md",
|
|
59
59
|
"docs/official-first-020-rc2.md",
|
|
60
|
+
"docs/web-lifecycle-rc2.md",
|
|
60
61
|
"docs/copilot-compaction.md",
|
|
61
62
|
"docs/copilot-usage.md",
|
|
62
63
|
"docs/automatic-model-routing.md",
|