dsh-github-copilot 0.4.0-alpha.115 → 0.4.0-alpha.117
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 +11 -2
- package/CHANGELOG.md +14 -0
- package/CONTRIBUTING.md +9 -0
- package/README.md +25 -6
- package/README.zh.md +20 -6
- package/deployment-baseline.json +23 -2
- package/docs/auto-high-cost.md +132 -0
- package/docs/auto-iteration-review.json +22 -0
- package/docs/auto-task-routing.md +8 -6
- package/docs/automatic-model-routing.md +4 -1
- package/docs/evidence-driven-iteration.md +86 -0
- package/lib/client.js +267 -89
- package/lib/client.js.map +1 -1
- package/lib/index.js +247 -17
- package/lib/remote.js +125 -40
- package/lib/types/authorization-controller.d.ts +2 -0
- package/lib/types/auto-allocation-card.d.ts +9 -0
- package/lib/types/auto-allocation-evidence.d.ts +38 -0
- package/lib/types/auto-allocation.d.ts +24 -0
- package/lib/types/auto-model-host.d.ts +2 -0
- package/lib/types/auto-model-routing.d.ts +6 -2
- package/lib/types/auto-task-classifier.d.ts +1 -1
- package/lib/types/config.d.ts +8 -2
- package/lib/types/model-preferences-card.d.ts +1 -1
- package/lib/types/preview-route.d.ts +1 -1
- package/lib/types/remote.d.ts +3 -0
- package/lib/types/turn-selection-card.d.ts +2 -1
- package/lib/types/turn-selection-host.d.ts +21 -0
- package/lib/types/turn-selection-remote.d.ts +2 -0
- package/lib/types/turn-selection.d.ts +15 -0
- package/package.json +5 -1
- package/scripts/iteration-review.mjs +53 -0
package/lib/remote.js
CHANGED
|
@@ -286,6 +286,51 @@ const TaskAssessmentSchema = z.object({
|
|
|
286
286
|
])).max(7)
|
|
287
287
|
}).strict();
|
|
288
288
|
//#endregion
|
|
289
|
+
//#region lib/types/auto-allocation.js
|
|
290
|
+
const AUTO_ALLOCATION_POLICY = "high-cost-v1";
|
|
291
|
+
const AutoAllocationSchema = z.object({
|
|
292
|
+
policyVersion: z.literal(AUTO_ALLOCATION_POLICY),
|
|
293
|
+
selectedModelId: z.string().min(1).max(512),
|
|
294
|
+
candidates: z.array(z.object({
|
|
295
|
+
modelId: z.string().min(1).max(512),
|
|
296
|
+
highCost: z.boolean(),
|
|
297
|
+
previous: z.boolean(),
|
|
298
|
+
weight: z.number().positive().max(1.5),
|
|
299
|
+
expectedShare: z.number().positive().max(1)
|
|
300
|
+
}).strict()).min(1).max(512)
|
|
301
|
+
}).strict().refine((value) => {
|
|
302
|
+
const total = value.candidates.reduce((sum, row) => sum + row.weight, 0);
|
|
303
|
+
return new Set(value.candidates.map((row) => row.modelId)).size === value.candidates.length && value.candidates.some((row) => row.modelId === value.selectedModelId) && value.candidates.filter((row) => row.previous).length <= 1 && value.candidates.every((row) => row.weight === (row.highCost ? 2 : 10) * (row.previous ? 1.5 : 1) / 10 && Math.abs(row.expectedShare - row.weight / total) <= 1e-12);
|
|
304
|
+
}, { message: "Invalid allocation policy evidence" });
|
|
305
|
+
//#endregion
|
|
306
|
+
//#region lib/types/auto-allocation-evidence.js
|
|
307
|
+
const AutoAllocationSummarySchema = z.object({
|
|
308
|
+
policyVersion: z.literal(AUTO_ALLOCATION_POLICY),
|
|
309
|
+
scope: z.literal("viewed-session-host-lifetime"),
|
|
310
|
+
status: z.enum(["observed", "not-collected"]),
|
|
311
|
+
retainedDecisions: z.number().int().nonnegative().max(128),
|
|
312
|
+
noFitDecisions: z.number().int().nonnegative().max(128),
|
|
313
|
+
rowsTruncated: z.boolean(),
|
|
314
|
+
completeHistory: z.literal(false),
|
|
315
|
+
observationStart: z.number().int().nonnegative().nullable(),
|
|
316
|
+
observationEnd: z.number().int().nonnegative().nullable(),
|
|
317
|
+
rows: z.array(z.object({
|
|
318
|
+
modelId: z.string().min(1).max(512),
|
|
319
|
+
category: z.enum([
|
|
320
|
+
"powerful",
|
|
321
|
+
"versatile",
|
|
322
|
+
"lightweight",
|
|
323
|
+
"unknown"
|
|
324
|
+
]),
|
|
325
|
+
highCost: z.boolean(),
|
|
326
|
+
previous: z.boolean(),
|
|
327
|
+
weight: z.number().positive().max(1.5),
|
|
328
|
+
opportunities: z.number().int().positive().max(128),
|
|
329
|
+
expectedSelections: z.number().nonnegative().max(128),
|
|
330
|
+
selections: z.number().int().nonnegative().max(128)
|
|
331
|
+
}).strict()).max(512)
|
|
332
|
+
}).strict();
|
|
333
|
+
//#endregion
|
|
289
334
|
//#region lib/types/turn-selection.js
|
|
290
335
|
const ExplanationSchema = z.object({
|
|
291
336
|
assessment: TaskAssessmentSchema.extend({
|
|
@@ -315,10 +360,12 @@ const ExplanationSchema = z.object({
|
|
|
315
360
|
method: z.enum([
|
|
316
361
|
"continuity",
|
|
317
362
|
"equal-distribution",
|
|
363
|
+
"weighted-distribution",
|
|
318
364
|
"only-candidate",
|
|
319
365
|
"no-fit"
|
|
320
366
|
]),
|
|
321
|
-
fallback: z.boolean()
|
|
367
|
+
fallback: z.boolean(),
|
|
368
|
+
allocation: AutoAllocationSchema.optional()
|
|
322
369
|
}).strict();
|
|
323
370
|
const TurnSelectionSchema = z.discriminatedUnion("mode", [
|
|
324
371
|
z.object({ mode: z.literal("unknown") }).strict(),
|
|
@@ -364,45 +411,63 @@ z.object({
|
|
|
364
411
|
//#region lib/types/turn-selection-remote.js
|
|
365
412
|
const contribution$5 = {
|
|
366
413
|
package: "dsh-github-copilot",
|
|
367
|
-
descriptors: [
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
414
|
+
descriptors: [
|
|
415
|
+
{
|
|
416
|
+
id: "dsh-github-copilot:githubCopilotTurnSelection.get",
|
|
417
|
+
namespace: "githubCopilotTurnSelection",
|
|
418
|
+
service: "githubCopilotTurnSelection",
|
|
419
|
+
method: "get",
|
|
420
|
+
invocation: { kind: "direct" },
|
|
421
|
+
parameters: [{
|
|
422
|
+
name: "agent",
|
|
423
|
+
wire: "agentId",
|
|
424
|
+
source: "lookup",
|
|
425
|
+
lookup: "agent",
|
|
426
|
+
codec: strictRemoteCodec("@deepseek-ai/dsh-session/types#SessionId", z.string().min(1).max(256))
|
|
427
|
+
}, {
|
|
428
|
+
name: "turn",
|
|
429
|
+
wire: "turn",
|
|
430
|
+
source: "json",
|
|
431
|
+
codec: strictRemoteCodec("dsh-github-copilot#TurnSelectionTurn", z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER))
|
|
432
|
+
}],
|
|
433
|
+
result: strictRemoteCodec("dsh-github-copilot#TurnSelection", TurnSelectionSchema)
|
|
434
|
+
},
|
|
435
|
+
{
|
|
436
|
+
id: "dsh-github-copilot:githubCopilotTurnSelection.requestedModels",
|
|
437
|
+
namespace: "githubCopilotTurnSelection",
|
|
438
|
+
service: "githubCopilotTurnSelection",
|
|
439
|
+
method: "requestedModels",
|
|
440
|
+
invocation: { kind: "direct" },
|
|
441
|
+
parameters: [{
|
|
442
|
+
name: "agent",
|
|
443
|
+
wire: "agentId",
|
|
444
|
+
source: "lookup",
|
|
445
|
+
lookup: "agent",
|
|
446
|
+
codec: strictRemoteCodec("@deepseek-ai/dsh-session/types#SessionId", z.string().min(1).max(256))
|
|
447
|
+
}, {
|
|
448
|
+
name: "turn",
|
|
449
|
+
wire: "turn",
|
|
450
|
+
source: "json",
|
|
451
|
+
codec: strictRemoteCodec("dsh-github-copilot#TurnSelectionTurn", z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER))
|
|
452
|
+
}],
|
|
453
|
+
result: strictRemoteCodec("dsh-github-copilot#RequestedModels", RequestedModelsSchema)
|
|
454
|
+
},
|
|
455
|
+
{
|
|
456
|
+
id: "dsh-github-copilot:githubCopilotTurnSelection.allocationSummary",
|
|
457
|
+
namespace: "githubCopilotTurnSelection",
|
|
458
|
+
service: "githubCopilotTurnSelection",
|
|
459
|
+
method: "allocationSummary",
|
|
460
|
+
invocation: { kind: "direct" },
|
|
461
|
+
parameters: [{
|
|
462
|
+
name: "agent",
|
|
463
|
+
wire: "agentId",
|
|
464
|
+
source: "lookup",
|
|
465
|
+
lookup: "agent",
|
|
466
|
+
codec: strictRemoteCodec("@deepseek-ai/dsh-session/types#SessionId", z.string().min(1).max(256))
|
|
467
|
+
}],
|
|
468
|
+
result: strictRemoteCodec("dsh-github-copilot#AutoAllocationSummary", AutoAllocationSummarySchema)
|
|
469
|
+
}
|
|
470
|
+
]
|
|
406
471
|
};
|
|
407
472
|
//#endregion
|
|
408
473
|
//#region lib/types/replay-recovery-types.js
|
|
@@ -748,6 +813,7 @@ const GitHubCopilotAuthorizationViewSchema = z.object({
|
|
|
748
813
|
excludedModelIds: z.array(z.string().min(1).max(512)).max(512),
|
|
749
814
|
lockedModelIds: z.array(z.string().min(1).max(512)).max(512),
|
|
750
815
|
unavailableExcludedModelIds: z.array(z.string().min(1).max(512)).max(512),
|
|
816
|
+
highCostModelIds: z.array(z.string().min(1).max(512)).max(512).optional(),
|
|
751
817
|
error: z.enum([
|
|
752
818
|
"COPILOT_MODEL_PREFERENCES_UNAVAILABLE",
|
|
753
819
|
"COPILOT_MODEL_SETTINGS_UNAVAILABLE",
|
|
@@ -880,6 +946,25 @@ const contribution = {
|
|
|
880
946
|
}],
|
|
881
947
|
result: strictRemoteCodec("dsh-github-copilot#GitHubCopilotModelPreferencesView", GitHubCopilotModelPreferencesViewSchema)
|
|
882
948
|
},
|
|
949
|
+
{
|
|
950
|
+
id: "dsh-github-copilot:githubCopilot.setModelHighCost",
|
|
951
|
+
service: "githubCopilotAuthorization",
|
|
952
|
+
namespace: "githubCopilot",
|
|
953
|
+
method: "setModelHighCost",
|
|
954
|
+
invocation: direct,
|
|
955
|
+
parameters: [{
|
|
956
|
+
name: "modelId",
|
|
957
|
+
wire: "modelId",
|
|
958
|
+
source: "json",
|
|
959
|
+
codec: strictRemoteCodec("dsh-github-copilot#GitHubCopilotModelId", z.string().min(1).max(512))
|
|
960
|
+
}, {
|
|
961
|
+
name: "highCost",
|
|
962
|
+
wire: "highCost",
|
|
963
|
+
source: "json",
|
|
964
|
+
codec: strictRemoteCodec("dsh-github-copilot#GitHubCopilotModelHighCost", z.boolean())
|
|
965
|
+
}],
|
|
966
|
+
result: strictRemoteCodec("dsh-github-copilot#GitHubCopilotModelPreferencesView", GitHubCopilotModelPreferencesViewSchema)
|
|
967
|
+
},
|
|
883
968
|
{
|
|
884
969
|
id: "dsh-github-copilot:githubCopilot.migrationStatus",
|
|
885
970
|
service: "githubCopilotAuthorization",
|
|
@@ -58,6 +58,7 @@ export interface GitHubCopilotModelPreferencesView {
|
|
|
58
58
|
readonly excludedModelIds: readonly string[];
|
|
59
59
|
readonly lockedModelIds: readonly string[];
|
|
60
60
|
readonly unavailableExcludedModelIds: readonly string[];
|
|
61
|
+
readonly highCostModelIds?: readonly string[];
|
|
61
62
|
readonly error?: 'COPILOT_MODEL_PREFERENCES_UNAVAILABLE' | 'COPILOT_MODEL_EXCLUSION_SELECTED' | 'COPILOT_MODEL_EXCLUSION_CONFLICT' | 'COPILOT_MODEL_EXCLUSION_SAVE_FAILED' | 'COPILOT_MODEL_SETTINGS_UNAVAILABLE' | 'COPILOT_MODEL_SETTINGS_INVALID' | 'COPILOT_MODEL_SELECTION_UNAVAILABLE';
|
|
62
63
|
}
|
|
63
64
|
export interface GitHubCopilotAuthorizationView {
|
|
@@ -102,6 +103,7 @@ export declare class GitHubCopilotAuthorizationController extends TypertRemoteSe
|
|
|
102
103
|
excludeModel(modelId: string): Promise<GitHubCopilotAuthorizationView>;
|
|
103
104
|
restoreModel(modelId: string): Promise<GitHubCopilotAuthorizationView>;
|
|
104
105
|
setModelExcluded(modelId: string, excluded: boolean): Promise<GitHubCopilotModelPreferencesView>;
|
|
106
|
+
setModelHighCost(modelId: string, highCost: boolean): Promise<GitHubCopilotModelPreferencesView>;
|
|
105
107
|
/** Explicit model discovery: may refresh OAuth and GET the account catalog, never changes selection. */
|
|
106
108
|
discoverModels(): Promise<GitHubCopilotAuthorizationView>;
|
|
107
109
|
/** Ensure metadata for a visible account view, honoring shared cache and failure cooldown. */
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
export declare function AutoAllocationCard({ read, locale }: {
|
|
3
|
+
readonly read: () => Promise<{
|
|
4
|
+
ok: boolean;
|
|
5
|
+
value?: unknown;
|
|
6
|
+
}>;
|
|
7
|
+
readonly locale: string;
|
|
8
|
+
}): ReactElement;
|
|
9
|
+
//# sourceMappingURL=auto-allocation-card.d.ts.map
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { AutoSelectionExplanation } from './auto-model-routing.ts';
|
|
3
|
+
export declare const AutoAllocationSummarySchema: z.ZodObject<{
|
|
4
|
+
policyVersion: z.ZodLiteral<"high-cost-v1">;
|
|
5
|
+
scope: z.ZodLiteral<"viewed-session-host-lifetime">;
|
|
6
|
+
status: z.ZodEnum<{
|
|
7
|
+
observed: "observed";
|
|
8
|
+
"not-collected": "not-collected";
|
|
9
|
+
}>;
|
|
10
|
+
retainedDecisions: z.ZodNumber;
|
|
11
|
+
noFitDecisions: z.ZodNumber;
|
|
12
|
+
rowsTruncated: z.ZodBoolean;
|
|
13
|
+
completeHistory: z.ZodLiteral<false>;
|
|
14
|
+
observationStart: z.ZodNullable<z.ZodNumber>;
|
|
15
|
+
observationEnd: z.ZodNullable<z.ZodNumber>;
|
|
16
|
+
rows: z.ZodArray<z.ZodObject<{
|
|
17
|
+
modelId: z.ZodString;
|
|
18
|
+
category: z.ZodEnum<{
|
|
19
|
+
unknown: "unknown";
|
|
20
|
+
powerful: "powerful";
|
|
21
|
+
versatile: "versatile";
|
|
22
|
+
lightweight: "lightweight";
|
|
23
|
+
}>;
|
|
24
|
+
highCost: z.ZodBoolean;
|
|
25
|
+
previous: z.ZodBoolean;
|
|
26
|
+
weight: z.ZodNumber;
|
|
27
|
+
opportunities: z.ZodNumber;
|
|
28
|
+
expectedSelections: z.ZodNumber;
|
|
29
|
+
selections: z.ZodNumber;
|
|
30
|
+
}, z.core.$strict>>;
|
|
31
|
+
}, z.core.$strict>;
|
|
32
|
+
export type AutoAllocationSummary = z.infer<typeof AutoAllocationSummarySchema>;
|
|
33
|
+
/** Recompute only from captured bounded decisions, never today's settings or history content. */
|
|
34
|
+
export declare function summarizeAutoAllocations(explanations: readonly AutoSelectionExplanation[], window?: {
|
|
35
|
+
readonly start: number;
|
|
36
|
+
readonly end: number;
|
|
37
|
+
}): AutoAllocationSummary;
|
|
38
|
+
//# sourceMappingURL=auto-allocation-evidence.d.ts.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const AUTO_ALLOCATION_POLICY = "high-cost-v1";
|
|
3
|
+
export declare const AutoAllocationSchema: z.ZodObject<{
|
|
4
|
+
policyVersion: z.ZodLiteral<"high-cost-v1">;
|
|
5
|
+
selectedModelId: z.ZodString;
|
|
6
|
+
candidates: z.ZodArray<z.ZodObject<{
|
|
7
|
+
modelId: z.ZodString;
|
|
8
|
+
highCost: z.ZodBoolean;
|
|
9
|
+
previous: z.ZodBoolean;
|
|
10
|
+
weight: z.ZodNumber;
|
|
11
|
+
expectedShare: z.ZodNumber;
|
|
12
|
+
}, z.core.$strict>>;
|
|
13
|
+
}, z.core.$strict>;
|
|
14
|
+
type AllocationValue = z.infer<typeof AutoAllocationSchema>;
|
|
15
|
+
export type AutoAllocation = Readonly<Omit<AllocationValue, 'candidates'>> & {
|
|
16
|
+
readonly candidates: readonly Readonly<AllocationValue['candidates'][number]>[];
|
|
17
|
+
};
|
|
18
|
+
export declare function normalizeHighCostModelIds(value: unknown): readonly string[];
|
|
19
|
+
/** Integer policy units avoid cumulative decimal drift; avalanche sequential turn seeds. */
|
|
20
|
+
export declare function allocateAutoModel(pool: readonly {
|
|
21
|
+
readonly id: string;
|
|
22
|
+
}[], highCostModelIds: unknown, previousModelId: string | undefined, seed: number): AutoAllocation;
|
|
23
|
+
export {};
|
|
24
|
+
//# sourceMappingURL=auto-allocation.d.ts.map
|
|
@@ -19,6 +19,8 @@ export interface AutoModelHostDependencies {
|
|
|
19
19
|
followParentModel?: () => boolean;
|
|
20
20
|
admitModel?: (agent: Agent, turn: number, model: string, signal: AbortSignal) => void;
|
|
21
21
|
semanticAssessment?: () => boolean;
|
|
22
|
+
highCostModelIds?: () => readonly string[];
|
|
23
|
+
allocationEvidence?: () => boolean;
|
|
22
24
|
classifyTask?: TaskAssessmentDependencies['classify'];
|
|
23
25
|
assessmentDiagnostic?: (code: string) => void;
|
|
24
26
|
}
|
|
@@ -2,6 +2,7 @@ import type { AccountModelCategory, AccountModelDescriptor } from './account-mod
|
|
|
2
2
|
import type { TaskAssessment } from './auto-task-assessment.ts';
|
|
3
3
|
import type { AutoModelPreference } from './copilot-identity.ts';
|
|
4
4
|
import type { RequestBudgetPolicy } from './request-budget.ts';
|
|
5
|
+
import type { AutoAllocation } from './auto-allocation.ts';
|
|
5
6
|
export type AutoModelClass = 'fast' | 'balanced' | 'strong';
|
|
6
7
|
export interface AutoModelFeatures {
|
|
7
8
|
readonly taskClass: AutoModelClass;
|
|
@@ -27,8 +28,9 @@ export interface AutoSelectionExplanation {
|
|
|
27
28
|
readonly targetCategory: AccountModelCategory;
|
|
28
29
|
readonly selectedCategory: AccountModelCategory | 'unknown';
|
|
29
30
|
readonly categoryCandidateCount: number;
|
|
30
|
-
readonly method: 'continuity' | 'equal-distribution' | 'only-candidate' | 'no-fit';
|
|
31
|
+
readonly method: 'continuity' | 'equal-distribution' | 'weighted-distribution' | 'only-candidate' | 'no-fit';
|
|
31
32
|
readonly fallback: boolean;
|
|
33
|
+
readonly allocation?: AutoAllocation;
|
|
32
34
|
}
|
|
33
35
|
export interface AutoModelRoutingContext {
|
|
34
36
|
readonly estimateMessage?: (message: unknown) => number;
|
|
@@ -42,6 +44,8 @@ export interface AutoModelRoutingContext {
|
|
|
42
44
|
readonly hasCompactionSummary?: boolean;
|
|
43
45
|
readonly assessment?: TaskAssessment;
|
|
44
46
|
readonly previousModelId?: string;
|
|
47
|
+
readonly highCostModelIds?: readonly string[];
|
|
48
|
+
readonly collectAllocationEvidence?: boolean;
|
|
45
49
|
}
|
|
46
50
|
export declare class AutoModelRoutingError extends Error {
|
|
47
51
|
readonly code: 'COPILOT_AUTO_NO_ELIGIBLE_MODEL' | 'COPILOT_AUTO_TOKEN_METER_UNAVAILABLE' | 'COPILOT_AUTO_TOKEN_ESTIMATE_INVALID';
|
|
@@ -51,7 +55,7 @@ export declare function classifyAutoModelTurn(messages: readonly unknown[]): Aut
|
|
|
51
55
|
export declare function estimateTurnInputTokens(messages: readonly unknown[], estimateMessage?: (message: unknown) => number): number;
|
|
52
56
|
/**
|
|
53
57
|
* Filter input headroom before task-aware supplier categories.
|
|
54
|
-
*
|
|
58
|
+
* Apply finite continuity and positive cost weights within the fitting category.
|
|
55
59
|
* Preserves Core compaction ownership if no candidate currently fits.
|
|
56
60
|
*/
|
|
57
61
|
export declare function selectAutoModel(models: readonly AccountModelDescriptor[], messages: readonly unknown[], preference?: AutoModelPreference, context?: AutoModelRoutingContext): AutoModelDecision;
|
|
@@ -3,7 +3,7 @@ import type { AccountModelDescriptor } from './account-model-catalog.ts';
|
|
|
3
3
|
import type { AssessmentInput } from './auto-task-assessment.ts';
|
|
4
4
|
import type { TaskClassifierObserver } from './auto-assessment-evidence.ts';
|
|
5
5
|
export declare const TASK_CLASSIFIER_MAX_TOKENS = 128;
|
|
6
|
-
export declare function taskClassifierModel(models: readonly AccountModelDescriptor[]): AccountModelDescriptor | undefined;
|
|
6
|
+
export declare function taskClassifierModel(models: readonly AccountModelDescriptor[], highCostModelIds?: readonly string[]): AccountModelDescriptor | undefined;
|
|
7
7
|
/** One auxiliary concrete-model call; no Auto recursion, tools, history writes or retry loop. */
|
|
8
8
|
export declare function classifyTaskWithAdapter(model: AccountModelDescriptor, input: AssessmentInput, signal: AbortSignal, stream: (request: GenerateOptions) => AsyncIterable<StreamChunk>, observe?: TaskClassifierObserver, reasoningOffSupported?: boolean, checkpoint?: () => void): Promise<string>;
|
|
9
9
|
//# sourceMappingURL=auto-task-classifier.d.ts.map
|
package/lib/types/config.d.ts
CHANGED
|
@@ -41,6 +41,8 @@ export interface InlineConfig {
|
|
|
41
41
|
accountModelFailureCooldownMs?: number;
|
|
42
42
|
/** Exact account model IDs hidden from the managed directory and every Auto candidate pool. */
|
|
43
43
|
excludedModelIds?: string[];
|
|
44
|
+
/** User-marked costly IDs; reduced positive Auto weight, independent of category. */
|
|
45
|
+
highCostModelIds?: string[];
|
|
44
46
|
/** Opaque profile-wide account selector; absence retains canonical compatibility. */
|
|
45
47
|
activeAccountId?: string;
|
|
46
48
|
/** Explicit Session overrides; absence means follow the profile default. */
|
|
@@ -57,6 +59,8 @@ export interface InlineConfig {
|
|
|
57
59
|
followParentModel?: boolean;
|
|
58
60
|
/** Default-on bounded task assessment; explicit false opts out of auxiliary inference. */
|
|
59
61
|
autoSemanticAssessment?: boolean;
|
|
62
|
+
/** Capture bounded local candidate opportunities for future policy review. */
|
|
63
|
+
autoAllocationEvidence?: boolean;
|
|
60
64
|
/** Estimated managed-route input headroom, separate from truthful catalog capacities. */
|
|
61
65
|
requestBudgetSafetyTokens?: number;
|
|
62
66
|
/** Fraction of admissible input used by eligible automatic-compaction requests. */
|
|
@@ -74,7 +78,7 @@ export interface InlineConfig {
|
|
|
74
78
|
/** Internal JSON backup of route leaves temporarily owned by the GPT-6 overlay. */
|
|
75
79
|
temporaryRouteBackup?: string;
|
|
76
80
|
}
|
|
77
|
-
export type LiveInlineConfig = Omit<InlineConfig, 'searchModel' | 'searchRouting' | 'temporaryRouteBackup' | 'excludedModelIds' | 'parentModelFollow' | 'followParentModel' | 'activeAccountId' | 'sessionAccounts' | 'sessionContinuation' | 'continuationDefaultHistory'> & {
|
|
81
|
+
export type LiveInlineConfig = Omit<InlineConfig, 'searchModel' | 'searchRouting' | 'temporaryRouteBackup' | 'excludedModelIds' | 'highCostModelIds' | 'parentModelFollow' | 'followParentModel' | 'activeAccountId' | 'sessionAccounts' | 'sessionContinuation' | 'continuationDefaultHistory'> & {
|
|
78
82
|
continuationDefaultHistory?: InlineConfig['continuationDefaultHistory'] | LiveSetting<ArrayLike<{
|
|
79
83
|
enabled: boolean;
|
|
80
84
|
changedAt: number;
|
|
@@ -84,12 +88,13 @@ export type LiveInlineConfig = Omit<InlineConfig, 'searchModel' | 'searchRouting
|
|
|
84
88
|
activeAccountId?: string | LiveSetting<string | undefined>;
|
|
85
89
|
followParentModel?: boolean | LiveSetting<boolean>;
|
|
86
90
|
parentModelFollow?: ParentModelBinding[] | LiveSetting<ArrayLike<ParentModelBinding>>;
|
|
91
|
+
highCostModelIds?: string[] | LiveSetting<ArrayLike<string>>;
|
|
87
92
|
excludedModelIds?: string[] | LiveSetting<ArrayLike<string>>;
|
|
88
93
|
searchModel?: string | LiveSetting<string | undefined>;
|
|
89
94
|
searchRouting?: WebSearchRoutingConfig | LiveSetting<WebSearchRoutingConfig | undefined>;
|
|
90
95
|
temporaryRouteBackup?: string | LiveSetting<string | undefined>;
|
|
91
96
|
};
|
|
92
|
-
export type ResolvedInlineConfig = Omit<InlineConfig, 'searchModel' | 'searchRouting' | 'temporaryRouteBackup' | 'excludedModelIds' | 'parentModelFollow' | 'followParentModel' | 'activeAccountId' | 'sessionAccounts' | 'sessionContinuation' | 'continuationDefaultHistory'> & {
|
|
97
|
+
export type ResolvedInlineConfig = Omit<InlineConfig, 'searchModel' | 'searchRouting' | 'temporaryRouteBackup' | 'excludedModelIds' | 'highCostModelIds' | 'parentModelFollow' | 'followParentModel' | 'activeAccountId' | 'sessionAccounts' | 'sessionContinuation' | 'continuationDefaultHistory'> & {
|
|
93
98
|
continuationDefaultHistory: LiveSetting<ArrayLike<{
|
|
94
99
|
enabled: boolean;
|
|
95
100
|
changedAt: number;
|
|
@@ -99,6 +104,7 @@ export type ResolvedInlineConfig = Omit<InlineConfig, 'searchModel' | 'searchRou
|
|
|
99
104
|
activeAccountId: LiveSetting<string | undefined>;
|
|
100
105
|
followParentModel: LiveSetting<boolean>;
|
|
101
106
|
parentModelFollow: LiveSetting<ArrayLike<ParentModelBinding>>;
|
|
107
|
+
highCostModelIds: LiveSetting<ArrayLike<string>>;
|
|
102
108
|
excludedModelIds: LiveSetting<ArrayLike<string>>;
|
|
103
109
|
searchModel: LiveSetting<string | undefined>;
|
|
104
110
|
searchRouting: LiveSetting<WebSearchRoutingConfig>;
|
|
@@ -2,7 +2,7 @@ import type { Context as ClientContext } from '@deepseek-ai/cordis';
|
|
|
2
2
|
import type { ReactElement } from 'react';
|
|
3
3
|
import type { GitHubCopilotAuthorizationView } from './authorization-controller.ts';
|
|
4
4
|
export declare function GitHubCopilotModelPreferencesPanel(props: {
|
|
5
|
-
readonly remote: ClientContext['remote']['githubCopilot']
|
|
5
|
+
readonly remote: Pick<ClientContext['remote']['githubCopilot'], 'status' | 'setModelExcluded' | 'setModelHighCost'>;
|
|
6
6
|
readonly models: GitHubCopilotAuthorizationView['accountModels'];
|
|
7
7
|
readonly preferences: GitHubCopilotAuthorizationView['modelPreferences'];
|
|
8
8
|
}): ReactElement;
|
|
@@ -10,7 +10,7 @@ import type { RequestBudgetPolicy } from './request-budget.ts';
|
|
|
10
10
|
export type PreviewRouteConfig = Pick<PiAiProviderProfile, 'reasoning' | 'cacheRetention' | 'transport' | 'timeoutMs' | 'websocketConnectTimeoutMs' | 'streamIdleTimeoutMs' | 'maxRequestImageBytes' | 'requestImagePixelBudget' | 'requestImageMaxBytes' | 'retryPolicy'> & Pick<InlineConfig, 'accountModelTtlMs' | 'accountModelFailureCooldownMs'> & {
|
|
11
11
|
readonly streamLiveness?: boolean;
|
|
12
12
|
readonly chatRequestSettings?: () => Pick<InlineConfig, 'chatStreamIdleTimeoutMs' | 'chatStreamLiveness' | 'chatMaxRequestImageBytes'>;
|
|
13
|
-
readonly accountModelSettings?: () => Pick<InlineConfig, 'accountModelTtlMs' | 'accountModelFailureCooldownMs' | 'excludedModelIds' | 'parentModelFollow' | 'followParentModel' | 'autoSemanticAssessment'>;
|
|
13
|
+
readonly accountModelSettings?: () => Pick<InlineConfig, 'accountModelTtlMs' | 'accountModelFailureCooldownMs' | 'excludedModelIds' | 'highCostModelIds' | 'parentModelFollow' | 'followParentModel' | 'autoSemanticAssessment' | 'autoAllocationEvidence'>;
|
|
14
14
|
readonly requestBudget?: Partial<RequestBudgetPolicy>;
|
|
15
15
|
readonly requestBudgetSettings?: () => Partial<RequestBudgetPolicy>;
|
|
16
16
|
};
|
package/lib/types/remote.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ declare module '@deepseek-ai/dsh-typert-protocol' {
|
|
|
16
16
|
excludeModel(modelId: string): Promise<RemoteResult<GitHubCopilotAuthorizationView>>;
|
|
17
17
|
restoreModel(modelId: string): Promise<RemoteResult<GitHubCopilotAuthorizationView>>;
|
|
18
18
|
setModelExcluded(modelId: string, excluded: boolean): Promise<RemoteResult<GitHubCopilotModelPreferencesView>>;
|
|
19
|
+
setModelHighCost(modelId: string, highCost: boolean): Promise<RemoteResult<GitHubCopilotModelPreferencesView>>;
|
|
19
20
|
start(): Promise<RemoteResult<GitHubCopilotAuthorizationView>>;
|
|
20
21
|
cancel(): Promise<RemoteResult<GitHubCopilotAuthorizationView>>;
|
|
21
22
|
signOut(): Promise<RemoteResult<GitHubCopilotAuthorizationView>>;
|
|
@@ -87,6 +88,7 @@ export declare const GitHubCopilotAuthorizationViewSchema: z.ZodObject<{
|
|
|
87
88
|
excludedModelIds: z.ZodArray<z.ZodString>;
|
|
88
89
|
lockedModelIds: z.ZodArray<z.ZodString>;
|
|
89
90
|
unavailableExcludedModelIds: z.ZodArray<z.ZodString>;
|
|
91
|
+
highCostModelIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
90
92
|
error: z.ZodOptional<z.ZodEnum<{
|
|
91
93
|
COPILOT_MODEL_PREFERENCES_UNAVAILABLE: "COPILOT_MODEL_PREFERENCES_UNAVAILABLE";
|
|
92
94
|
COPILOT_MODEL_EXCLUSION_SELECTED: "COPILOT_MODEL_EXCLUSION_SELECTED";
|
|
@@ -128,6 +130,7 @@ export declare const GitHubCopilotModelPreferencesViewSchema: z.ZodObject<{
|
|
|
128
130
|
excludedModelIds: z.ZodArray<z.ZodString>;
|
|
129
131
|
lockedModelIds: z.ZodArray<z.ZodString>;
|
|
130
132
|
unavailableExcludedModelIds: z.ZodArray<z.ZodString>;
|
|
133
|
+
highCostModelIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
131
134
|
error: z.ZodOptional<z.ZodEnum<{
|
|
132
135
|
COPILOT_MODEL_PREFERENCES_UNAVAILABLE: "COPILOT_MODEL_PREFERENCES_UNAVAILABLE";
|
|
133
136
|
COPILOT_MODEL_EXCLUSION_SELECTED: "COPILOT_MODEL_EXCLUSION_SELECTED";
|
|
@@ -7,7 +7,7 @@ export interface TurnModelEvidence {
|
|
|
7
7
|
readonly routes: readonly RecordedModel[];
|
|
8
8
|
readonly incomplete: boolean;
|
|
9
9
|
}
|
|
10
|
-
export declare function TurnSelectionCard({ selection, locale, incomplete, readState, retry, account, accountFailed, retryAccount, models, modelsFailed, retryModels }: {
|
|
10
|
+
export declare function TurnSelectionCard({ selection, locale, incomplete, readState, retry, account, accountFailed, retryAccount, models, modelsFailed, retryModels, allocationEvidence }: {
|
|
11
11
|
selection: TurnSelection;
|
|
12
12
|
locale?: string;
|
|
13
13
|
incomplete?: boolean;
|
|
@@ -19,5 +19,6 @@ export declare function TurnSelectionCard({ selection, locale, incomplete, readS
|
|
|
19
19
|
models?: TurnModelEvidence;
|
|
20
20
|
modelsFailed?: boolean;
|
|
21
21
|
retryModels?: () => void;
|
|
22
|
+
allocationEvidence?: ReactElement;
|
|
22
23
|
}): ReactElement;
|
|
23
24
|
//# sourceMappingURL=turn-selection-card.d.ts.map
|
|
@@ -8,6 +8,27 @@ export declare class TurnSelectionController extends TypertRemoteService {
|
|
|
8
8
|
private readonly selections;
|
|
9
9
|
constructor(ctx: Context, selections: TurnSelectionStore);
|
|
10
10
|
get(agent: Agent, turn: number): TurnSelection;
|
|
11
|
+
allocationSummary(agent: Agent): {
|
|
12
|
+
policyVersion: "high-cost-v1";
|
|
13
|
+
scope: "viewed-session-host-lifetime";
|
|
14
|
+
status: "observed" | "not-collected";
|
|
15
|
+
retainedDecisions: number;
|
|
16
|
+
noFitDecisions: number;
|
|
17
|
+
rowsTruncated: boolean;
|
|
18
|
+
completeHistory: false;
|
|
19
|
+
observationStart: number | null;
|
|
20
|
+
observationEnd: number | null;
|
|
21
|
+
rows: {
|
|
22
|
+
modelId: string;
|
|
23
|
+
category: "unknown" | "powerful" | "versatile" | "lightweight";
|
|
24
|
+
highCost: boolean;
|
|
25
|
+
previous: boolean;
|
|
26
|
+
weight: number;
|
|
27
|
+
opportunities: number;
|
|
28
|
+
expectedSelections: number;
|
|
29
|
+
selections: number;
|
|
30
|
+
}[];
|
|
31
|
+
};
|
|
11
32
|
requestedModels(agent: Agent, turn: number): RequestedModels;
|
|
12
33
|
}
|
|
13
34
|
//# sourceMappingURL=turn-selection-host.d.ts.map
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import type { RemoteResult, TypertRemoteContribution } from '@deepseek-ai/dsh-typert-protocol';
|
|
2
2
|
import type { TurnSelection } from './turn-selection.ts';
|
|
3
3
|
import type { RequestedModels } from './turn-request-models.ts';
|
|
4
|
+
import type { AutoAllocationSummary } from './auto-allocation-evidence.ts';
|
|
4
5
|
export { TurnSelectionSchema } from './turn-selection.ts';
|
|
5
6
|
declare module '@deepseek-ai/dsh-typert-protocol' {
|
|
6
7
|
interface TypertRemoteNamespaceMap {
|
|
7
8
|
githubCopilotTurnSelection: {
|
|
8
9
|
get(agentId: string, turn: number): Promise<RemoteResult<TurnSelection>>;
|
|
9
10
|
requestedModels(agentId: string, turn: number): Promise<RemoteResult<RequestedModels>>;
|
|
11
|
+
allocationSummary(agentId: string): Promise<RemoteResult<AutoAllocationSummary>>;
|
|
10
12
|
};
|
|
11
13
|
}
|
|
12
14
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { AutoModelPreference } from './copilot-identity.ts';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import type { AutoSelectionExplanation } from './auto-model-routing.ts';
|
|
4
|
+
import type { AutoAllocationSummary } from './auto-allocation-evidence.ts';
|
|
4
5
|
export declare const TurnSelectionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
5
6
|
mode: z.ZodLiteral<"unknown">;
|
|
6
7
|
}, z.core.$strict>, z.ZodObject<{
|
|
@@ -90,10 +91,22 @@ export declare const TurnSelectionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
90
91
|
method: z.ZodEnum<{
|
|
91
92
|
continuity: "continuity";
|
|
92
93
|
"equal-distribution": "equal-distribution";
|
|
94
|
+
"weighted-distribution": "weighted-distribution";
|
|
93
95
|
"only-candidate": "only-candidate";
|
|
94
96
|
"no-fit": "no-fit";
|
|
95
97
|
}>;
|
|
96
98
|
fallback: z.ZodBoolean;
|
|
99
|
+
allocation: z.ZodOptional<z.ZodObject<{
|
|
100
|
+
policyVersion: z.ZodLiteral<"high-cost-v1">;
|
|
101
|
+
selectedModelId: z.ZodString;
|
|
102
|
+
candidates: z.ZodArray<z.ZodObject<{
|
|
103
|
+
modelId: z.ZodString;
|
|
104
|
+
highCost: z.ZodBoolean;
|
|
105
|
+
previous: z.ZodBoolean;
|
|
106
|
+
weight: z.ZodNumber;
|
|
107
|
+
expectedShare: z.ZodNumber;
|
|
108
|
+
}, z.core.$strict>>;
|
|
109
|
+
}, z.core.$strict>>;
|
|
97
110
|
}, z.core.$strict>>;
|
|
98
111
|
}, z.core.$strict>], "mode">;
|
|
99
112
|
export type TurnSelection = {
|
|
@@ -111,8 +124,10 @@ export type TurnSelection = {
|
|
|
111
124
|
/** Ephemeral decision evidence only; never session content, model usage or credentials. */
|
|
112
125
|
export declare class TurnSelectionStore {
|
|
113
126
|
private readonly agents;
|
|
127
|
+
private timestamps;
|
|
114
128
|
record(agent: object, turn: number, selection: TurnSelection): void;
|
|
115
129
|
get(agent: object, turn: number): TurnSelection;
|
|
130
|
+
allocationSummary(agent: object): AutoAllocationSummary;
|
|
116
131
|
remove(agent: object): void;
|
|
117
132
|
clear(): void;
|
|
118
133
|
}
|
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.117",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
7
7
|
"registry": "https://registry.npmjs.org/",
|
|
@@ -72,6 +72,10 @@
|
|
|
72
72
|
"docs/mockups/copilot-account-dropdown.html",
|
|
73
73
|
"docs/automatic-model-routing.md",
|
|
74
74
|
"docs/auto-task-routing.md",
|
|
75
|
+
"docs/auto-high-cost.md",
|
|
76
|
+
"docs/evidence-driven-iteration.md",
|
|
77
|
+
"docs/auto-iteration-review.json",
|
|
78
|
+
"scripts/iteration-review.mjs",
|
|
75
79
|
"docs/image-input-compatibility.md",
|
|
76
80
|
"output/auto-model-mockup/index.html",
|
|
77
81
|
"docs/images/dual-model-provenance.json",
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { open } from 'node:fs/promises'
|
|
2
|
+
import { resolve } from 'node:path'
|
|
3
|
+
import { fileURLToPath } from 'node:url'
|
|
4
|
+
|
|
5
|
+
export function validateIterationReview(value) {
|
|
6
|
+
const require = (condition, message) => { if (!condition) throw new Error(`Iteration review: ${message}`) }
|
|
7
|
+
const object = value => value !== null && typeof value === 'object' && !Array.isArray(value)
|
|
8
|
+
const keys = (value, allowed) => require(object(value) && Object.keys(value).every(key => allowed.includes(key)), 'unknown or invalid fields')
|
|
9
|
+
const text = value => typeof value === 'string' && value.trim().length > 0 && value.length <= 2000
|
|
10
|
+
keys(value, ['schemaVersion', 'feature', 'status', 'policyVersion', 'observation', 'previousReview', 'findings', 'decision', 'validation', 'followUp'])
|
|
11
|
+
require(value.schemaVersion === 1 && value.feature === 'autorouting', 'unsupported version or feature')
|
|
12
|
+
require(['observed', 'not-collected', 'insufficient-sample', 'unavailable'].includes(value.status), 'explicit evidence status required')
|
|
13
|
+
require(text(value.policyVersion), 'policy version required')
|
|
14
|
+
keys(value.observation, ['start', 'end', 'sampleCount', 'limitations'])
|
|
15
|
+
const { start, end, sampleCount, limitations } = value.observation
|
|
16
|
+
require(Number.isSafeInteger(sampleCount) && sampleCount >= 0, 'invalid sample count')
|
|
17
|
+
require(text(limitations), 'observation limitations required')
|
|
18
|
+
if (value.status === 'observed' || value.status === 'insufficient-sample') {
|
|
19
|
+
require(typeof start === 'string' && typeof end === 'string'
|
|
20
|
+
&& Number.isFinite(Date.parse(start)) && Number.isFinite(Date.parse(end))
|
|
21
|
+
&& Date.parse(start) <= Date.parse(end), 'valid observation window required')
|
|
22
|
+
require(sampleCount > 0, 'observed evidence needs samples')
|
|
23
|
+
} else require(start === null && end === null && sampleCount === 0, 'missing evidence cannot claim a window')
|
|
24
|
+
require(value.previousReview === null || text(value.previousReview), 'invalid prior review reference')
|
|
25
|
+
for (const field of ['findings', 'decision', 'validation']) require(text(value[field]), `${field} required`)
|
|
26
|
+
keys(value.followUp, ['owner', 'trigger', 'metric', 'action'])
|
|
27
|
+
for (const field of ['owner', 'trigger', 'metric', 'action']) require(text(value.followUp[field]), `follow-up ${field} required`)
|
|
28
|
+
return { schemaVersion: 1, ok: true, feature: value.feature, evidenceStatus: value.status,
|
|
29
|
+
sampleCount, reviewDocumentOnly: true, evidenceTruthVerified: false }
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export async function main(args = process.argv.slice(2)) {
|
|
33
|
+
try {
|
|
34
|
+
if (args.length !== 2 || args[0] !== '--report') throw new Error('Invalid arguments')
|
|
35
|
+
const handle = await open(resolve(args[1]), 'r')
|
|
36
|
+
let value
|
|
37
|
+
try {
|
|
38
|
+
const info = await handle.stat()
|
|
39
|
+
if (!info.isFile() || info.size > 32768) throw new Error('Invalid report file')
|
|
40
|
+
const bytes = Buffer.alloc(32769)
|
|
41
|
+
const { bytesRead } = await handle.read(bytes, 0, bytes.length, 0)
|
|
42
|
+
if (bytesRead > 32768) throw new Error('Report exceeds 32 KiB')
|
|
43
|
+
value = JSON.parse(bytes.subarray(0, bytesRead).toString('utf8'))
|
|
44
|
+
} finally { await handle.close() }
|
|
45
|
+
const review = validateIterationReview(value)
|
|
46
|
+
console.log(JSON.stringify({ ...review, report: value }))
|
|
47
|
+
return 0
|
|
48
|
+
} catch {
|
|
49
|
+
console.error('ITERATION_REVIEW_INVALID: provide a bounded report matching docs/evidence-driven-iteration.md')
|
|
50
|
+
return 1
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
if (process.argv[1] && resolve(process.argv[1]) === fileURLToPath(import.meta.url)) process.exitCode = await main()
|