dsh-github-copilot 0.4.0-alpha.128 → 0.4.0-alpha.130
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 +21 -2
- package/CHANGELOG.md +12 -0
- package/README.md +16 -13
- package/README.zh.md +13 -12
- package/deployment-baseline.json +5 -2
- package/docs/copilot-usage.md +4 -4
- package/docs/plugin-diagnostics.md +64 -0
- package/lib/client.js +97 -42
- package/lib/client.js.map +1 -1
- package/lib/diagnostics-analysis-io.js +78 -0
- package/lib/diagnostics-analysis.js +425 -0
- package/lib/diagnostics-types-FVf6zjob.js +182 -0
- package/lib/index.js +68 -38
- package/lib/manual-compaction-recovery.js +2 -1
- package/lib/request-budget-DLY_aRq0.js +87 -0
- package/lib/types/context-evidence-ui.d.ts +14 -1
- package/lib/types/context-evidence.d.ts +29 -1
- package/lib/types/diagnostics-analysis-io.d.ts +23 -0
- package/lib/types/diagnostics-analysis.d.ts +295 -0
- package/package.json +3 -1
- package/scripts/analyze-diagnostics.mjs +91 -0
- package/lib/request-budget-Cui2hCi1.js +0 -268
package/lib/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { c as DiagnosticsViewSchema, d as diagnosticsReason, i as DIAGNOSTICS_RETENTION_MS, l as diagnosticsBucket, o as DiagnosticsRowSchema, s as DiagnosticsSnapshotSchema, u as diagnosticsOutcome } from "./diagnostics-types-FVf6zjob.js";
|
|
2
2
|
import { C as providerErrorMessage, D as onSettingsNamespaceUpdated, E as readCopilotCatalog, O as readConfigValue, S as isAbortError, T as isPluginPreviewProvider, _ as sameCandidates, a as COPILOT_HOSTED_SEARCH_PROVIDER_ID, b as currentSearchSelection, c as applyRequestAuth, d as ANTHROPIC_WEB_SEARCH_TOOL_TYPE, f as GITHUB_COPILOT_CREDENTIAL_KEY$1, g as candidatesForRoute, h as WEB_SEARCH_TOOL_TYPE, i as describeSearchBackend, k as readSettingsNamespace, l as normalizeRequestAuth, m as SearchPlan, n as routeSessionSearch, o as GITHUB_COPILOT_HOSTED_SEARCH_PROVIDER_ID, p as RESPONSES_WEB_SEARCH_TOOL_TYPE, r as DescribedSearchFallbackError, s as createTraditionalSearchProvider, t as isCopilotSearchSelection, u as providerRequestHeaders, v as currentChatRoute, w as readBounded, x as abortable$1, y as currentSearchInitiator } from "./search-routing-CV2hs8as.js";
|
|
3
3
|
import { a as GITHUB_COPILOT_PREVIEW_PROVIDER_ID, i as GITHUB_COPILOT_CREDENTIAL_KEY, n as GITHUB_COPILOT_AUTO_INTELLIGENCE_MODEL_ID, o as GITHUB_COPILOT_PROVIDER_ID, r as GITHUB_COPILOT_AUTO_MODEL_ID, s as autoModelPreference, t as GITHUB_COPILOT_AUTO_EFFICIENCY_MODEL_ID } from "./copilot-identity-DRZY_d2X.js";
|
|
4
|
+
import { a as selectCompactionReasoning, i as resolveRequestBudgetPolicy, n as assessRequestBudget, r as calculateRequestBudget, t as DEFAULT_REQUEST_BUDGET_POLICY } from "./request-budget-DLY_aRq0.js";
|
|
4
5
|
import { Remote, RemoteError, TypertRemoteService } from "@deepseek-ai/dsh-typert-protocol";
|
|
5
6
|
import { z } from "zod";
|
|
6
7
|
import AuthorizationService from "@deepseek-ai/dsh-authorization";
|
|
@@ -310,7 +311,7 @@ const result$1 = strictRemoteCodec("dsh-github-copilot#DiagnosticsView", Diagnos
|
|
|
310
311
|
var package_default = {
|
|
311
312
|
name: "dsh-github-copilot",
|
|
312
313
|
description: "DSH companion for GitHub Copilot sign-in, account-aware model profiles, tool compatibility, and provider-hosted search.",
|
|
313
|
-
version: "0.4.0-alpha.
|
|
314
|
+
version: "0.4.0-alpha.130",
|
|
314
315
|
publishConfig: {
|
|
315
316
|
"access": "public",
|
|
316
317
|
"registry": "https://registry.npmjs.org/",
|
|
@@ -386,6 +387,7 @@ var package_default = {
|
|
|
386
387
|
"docs/evidence-driven-iteration.md",
|
|
387
388
|
"docs/plugin-diagnostics.md",
|
|
388
389
|
"docs/auto-iteration-review.json",
|
|
390
|
+
"scripts/analyze-diagnostics.mjs",
|
|
389
391
|
"scripts/iteration-review.mjs",
|
|
390
392
|
"docs/image-input-compatibility.md",
|
|
391
393
|
"output/auto-model-mockup/index.html",
|
|
@@ -421,6 +423,7 @@ var package_default = {
|
|
|
421
423
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
422
424
|
"typecheck:tests": "tsc -p tsconfig.tests.json",
|
|
423
425
|
"test:scripts": "node --test \"tests/scripts/*.test.mjs\"",
|
|
426
|
+
"diagnostics:analyze": "node scripts/analyze-diagnostics.mjs",
|
|
424
427
|
"agent:describe": "node scripts/agent.mjs describe --json",
|
|
425
428
|
"agent:doctor": "node scripts/agent.mjs doctor --json",
|
|
426
429
|
"agent:plan": "node scripts/agent.mjs plan",
|
|
@@ -6117,6 +6120,10 @@ const sampleSchema = z.object({
|
|
|
6117
6120
|
seq: count$2,
|
|
6118
6121
|
route: routeSchema
|
|
6119
6122
|
}).strict();
|
|
6123
|
+
const incidentSchema = z.object({
|
|
6124
|
+
kind: z.enum(["failed-zero", "invalid-sample"]),
|
|
6125
|
+
seq: count$2
|
|
6126
|
+
}).strict();
|
|
6120
6127
|
const stepSchema = z.object({
|
|
6121
6128
|
turn: count$2,
|
|
6122
6129
|
step: count$2
|
|
@@ -6151,10 +6158,12 @@ const ContextEvidenceSchema = z.object({
|
|
|
6151
6158
|
reason: z.enum([
|
|
6152
6159
|
"none",
|
|
6153
6160
|
"failed-zero",
|
|
6161
|
+
"invalid-sample",
|
|
6154
6162
|
"compaction",
|
|
6155
6163
|
"selection",
|
|
6156
6164
|
"unknown"
|
|
6157
6165
|
]),
|
|
6166
|
+
incident: incidentSchema.nullable(),
|
|
6158
6167
|
compaction: compactionSchema.nullable().optional(),
|
|
6159
6168
|
activeStep: stepSchema.nullable().optional()
|
|
6160
6169
|
}).strict();
|
|
@@ -6181,6 +6190,7 @@ function initialContextEvidence() {
|
|
|
6181
6190
|
sample: null,
|
|
6182
6191
|
invalid: false,
|
|
6183
6192
|
reason: "none",
|
|
6193
|
+
incident: null,
|
|
6184
6194
|
compaction: null,
|
|
6185
6195
|
activeStep: null
|
|
6186
6196
|
};
|
|
@@ -6204,8 +6214,9 @@ function foldContextEvidence(state, event) {
|
|
|
6204
6214
|
return {
|
|
6205
6215
|
...state,
|
|
6206
6216
|
sample: null,
|
|
6207
|
-
invalid:
|
|
6217
|
+
invalid: false,
|
|
6208
6218
|
reason: "compaction",
|
|
6219
|
+
incident: null,
|
|
6209
6220
|
compaction: id.success && seq.success ? {
|
|
6210
6221
|
id: id.data,
|
|
6211
6222
|
startSeq: seq.data,
|
|
@@ -6226,8 +6237,6 @@ function foldContextEvidence(state, event) {
|
|
|
6226
6237
|
});
|
|
6227
6238
|
return {
|
|
6228
6239
|
...state,
|
|
6229
|
-
invalid: true,
|
|
6230
|
-
reason: "unknown",
|
|
6231
6240
|
compaction: {
|
|
6232
6241
|
...state.compaction,
|
|
6233
6242
|
step: step.success ? step.data : null,
|
|
@@ -6281,6 +6290,7 @@ function foldContextEvidence(state, event) {
|
|
|
6281
6290
|
sample: null,
|
|
6282
6291
|
invalid: true,
|
|
6283
6292
|
reason: "unknown",
|
|
6293
|
+
incident: null,
|
|
6284
6294
|
compaction: revoke()
|
|
6285
6295
|
};
|
|
6286
6296
|
const parsed = routeSchema.safeParse({
|
|
@@ -6293,6 +6303,7 @@ function foldContextEvidence(state, event) {
|
|
|
6293
6303
|
sample: null,
|
|
6294
6304
|
invalid: true,
|
|
6295
6305
|
reason: "unknown",
|
|
6306
|
+
incident: null,
|
|
6296
6307
|
compaction: revoke()
|
|
6297
6308
|
};
|
|
6298
6309
|
const route = parsed.data;
|
|
@@ -6318,7 +6329,9 @@ function foldContextEvidence(state, event) {
|
|
|
6318
6329
|
...state,
|
|
6319
6330
|
route,
|
|
6320
6331
|
sample: null,
|
|
6321
|
-
|
|
6332
|
+
invalid: false,
|
|
6333
|
+
reason: "selection",
|
|
6334
|
+
incident: null
|
|
6322
6335
|
};
|
|
6323
6336
|
}
|
|
6324
6337
|
if (event.type.startsWith("compaction/") || event.surfaceOp !== void 0 && event.surfaceOp !== "append") {
|
|
@@ -6326,8 +6339,9 @@ function foldContextEvidence(state, event) {
|
|
|
6326
6339
|
return {
|
|
6327
6340
|
...state,
|
|
6328
6341
|
sample: null,
|
|
6329
|
-
invalid:
|
|
6342
|
+
invalid: false,
|
|
6330
6343
|
reason: "compaction",
|
|
6344
|
+
incident: null,
|
|
6331
6345
|
compaction: event.type.startsWith("compaction/") || checkpoint || !state.compaction ? state.compaction : {
|
|
6332
6346
|
...state.compaction,
|
|
6333
6347
|
request: "unknown",
|
|
@@ -6345,19 +6359,26 @@ function foldContextEvidence(state, event) {
|
|
|
6345
6359
|
provider: source.provider,
|
|
6346
6360
|
model: source.model
|
|
6347
6361
|
} : source);
|
|
6348
|
-
if (!parsed.success || !sameRoute$1(state.route, parsed.data))
|
|
6349
|
-
|
|
6350
|
-
|
|
6351
|
-
|
|
6352
|
-
|
|
6353
|
-
|
|
6354
|
-
|
|
6355
|
-
|
|
6356
|
-
|
|
6357
|
-
|
|
6358
|
-
|
|
6359
|
-
|
|
6360
|
-
|
|
6362
|
+
if (!parsed.success || !sameRoute$1(state.route, parsed.data)) {
|
|
6363
|
+
const seq = count$2.safeParse(event.seq);
|
|
6364
|
+
return {
|
|
6365
|
+
...state,
|
|
6366
|
+
sample: null,
|
|
6367
|
+
invalid: true,
|
|
6368
|
+
reason: seq.success ? "invalid-sample" : "unknown",
|
|
6369
|
+
incident: seq.success ? {
|
|
6370
|
+
kind: "invalid-sample",
|
|
6371
|
+
seq: seq.data
|
|
6372
|
+
} : null,
|
|
6373
|
+
compaction: state.compaction ? {
|
|
6374
|
+
...state.compaction,
|
|
6375
|
+
request: "unknown",
|
|
6376
|
+
step: null,
|
|
6377
|
+
headerSeq: null,
|
|
6378
|
+
requestRoute: null
|
|
6379
|
+
} : state.compaction
|
|
6380
|
+
};
|
|
6381
|
+
}
|
|
6361
6382
|
}
|
|
6362
6383
|
const stream = Array.isArray(event.data.stream) ? event.data.stream : [];
|
|
6363
6384
|
let usage = event.type === "assistant/message" ? event.data.usage : void 0;
|
|
@@ -6389,33 +6410,41 @@ function foldContextEvidence(state, event) {
|
|
|
6389
6410
|
}
|
|
6390
6411
|
};
|
|
6391
6412
|
} else if (compact?.state === "running") return state;
|
|
6392
|
-
if (usage === void 0) return
|
|
6393
|
-
...state,
|
|
6394
|
-
invalid: true,
|
|
6395
|
-
reason: "unknown"
|
|
6396
|
-
} : state;
|
|
6413
|
+
if (usage === void 0) return state;
|
|
6397
6414
|
const parsed = usageSchema.safeParse(usage);
|
|
6398
|
-
if (!parsed.success || !count$2.safeParse(event.seq).success)
|
|
6399
|
-
|
|
6400
|
-
sample: null,
|
|
6401
|
-
invalid: true,
|
|
6402
|
-
reason: "unknown"
|
|
6403
|
-
};
|
|
6404
|
-
const value = parsed.data;
|
|
6405
|
-
if (isZeroContextUsage(value) && !successful) {
|
|
6406
|
-
const reason = state.sample !== null || state.reason === "none" ? "failed-zero" : state.reason;
|
|
6415
|
+
if (!parsed.success || !count$2.safeParse(event.seq).success) {
|
|
6416
|
+
const seq = count$2.safeParse(event.seq);
|
|
6407
6417
|
return {
|
|
6408
6418
|
...state,
|
|
6419
|
+
sample: null,
|
|
6409
6420
|
invalid: true,
|
|
6410
|
-
reason
|
|
6421
|
+
reason: seq.success ? "invalid-sample" : "unknown",
|
|
6422
|
+
incident: seq.success ? {
|
|
6423
|
+
kind: "invalid-sample",
|
|
6424
|
+
seq: seq.data
|
|
6425
|
+
} : null
|
|
6411
6426
|
};
|
|
6412
6427
|
}
|
|
6428
|
+
const value = parsed.data;
|
|
6429
|
+
if (isZeroContextUsage(value) && !successful) return {
|
|
6430
|
+
...state,
|
|
6431
|
+
invalid: true,
|
|
6432
|
+
reason: "failed-zero",
|
|
6433
|
+
incident: {
|
|
6434
|
+
kind: "failed-zero",
|
|
6435
|
+
seq: count$2.parse(event.seq)
|
|
6436
|
+
}
|
|
6437
|
+
};
|
|
6413
6438
|
const tokens = value.inputTokens + (value.cacheReadTokens ?? 0) + (value.cacheWriteTokens ?? 0);
|
|
6414
6439
|
if (!Number.isSafeInteger(tokens) || state.route === null) return {
|
|
6415
6440
|
...state,
|
|
6416
6441
|
sample: null,
|
|
6417
6442
|
invalid: true,
|
|
6418
|
-
reason: "
|
|
6443
|
+
reason: "invalid-sample",
|
|
6444
|
+
incident: {
|
|
6445
|
+
kind: "invalid-sample",
|
|
6446
|
+
seq: count$2.parse(event.seq)
|
|
6447
|
+
}
|
|
6419
6448
|
};
|
|
6420
6449
|
return {
|
|
6421
6450
|
...state,
|
|
@@ -6425,13 +6454,14 @@ function foldContextEvidence(state, event) {
|
|
|
6425
6454
|
route: state.route
|
|
6426
6455
|
},
|
|
6427
6456
|
invalid: false,
|
|
6428
|
-
reason: "none"
|
|
6457
|
+
reason: "none",
|
|
6458
|
+
incident: null
|
|
6429
6459
|
};
|
|
6430
6460
|
}
|
|
6431
6461
|
/** Separate bounded replay unit; never register under or modify a Core key. */
|
|
6432
6462
|
const contextEvidenceDefinition = {
|
|
6433
6463
|
key: COPILOT_CONTEXT_EVIDENCE,
|
|
6434
|
-
stateVersion:
|
|
6464
|
+
stateVersion: 3,
|
|
6435
6465
|
stateSchema: ContextEvidenceSchema,
|
|
6436
6466
|
init: initialContextEvidence,
|
|
6437
6467
|
apply: foldContextEvidence,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { d as diagnosticsReason, u as diagnosticsOutcome } from "./diagnostics-types-FVf6zjob.js";
|
|
2
2
|
import "./copilot-identity-DRZY_d2X.js";
|
|
3
|
+
import { i as resolveRequestBudgetPolicy, r as calculateRequestBudget } from "./request-budget-DLY_aRq0.js";
|
|
3
4
|
import z from "@deepseek-ai/schemastery";
|
|
4
5
|
import { LlmError, createUserMessage } from "@deepseek-ai/dsh-llm";
|
|
5
6
|
import BasicCompactionEngine from "@deepseek-ai/dsh-compaction-basic";
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
//#region lib/types/request-budget.js
|
|
2
|
+
/** The safety allowance matches the pinned native SDK; pressure is a separate opt-in check. */
|
|
3
|
+
const DEFAULT_REQUEST_BUDGET_POLICY = Object.freeze({
|
|
4
|
+
safetyTokens: 4096,
|
|
5
|
+
pressureRatio: .9,
|
|
6
|
+
compactionReasoning: "prefer-low"
|
|
7
|
+
});
|
|
8
|
+
/** Validate deployment policy before applying defaults; unknown keys fail rather than silently drift. */
|
|
9
|
+
function resolveRequestBudgetPolicy(config = {}) {
|
|
10
|
+
const keys = /* @__PURE__ */ new Set([
|
|
11
|
+
"safetyTokens",
|
|
12
|
+
"pressureRatio",
|
|
13
|
+
"compactionReasoning"
|
|
14
|
+
]);
|
|
15
|
+
for (const key of Object.keys(config)) if (!keys.has(key)) throw new Error(`COPILOT_REQUEST_BUDGET_POLICY_INVALID: unknown setting ${key}`);
|
|
16
|
+
const safetyTokens = config.safetyTokens === void 0 ? DEFAULT_REQUEST_BUDGET_POLICY.safetyTokens : config.safetyTokens;
|
|
17
|
+
const pressureRatio = config.pressureRatio === void 0 ? DEFAULT_REQUEST_BUDGET_POLICY.pressureRatio : config.pressureRatio;
|
|
18
|
+
const compactionReasoning = config.compactionReasoning === void 0 ? DEFAULT_REQUEST_BUDGET_POLICY.compactionReasoning : config.compactionReasoning;
|
|
19
|
+
if (!Number.isSafeInteger(safetyTokens) || safetyTokens < 0) throw new Error("COPILOT_REQUEST_BUDGET_POLICY_INVALID: safetyTokens must be a non-negative safe integer");
|
|
20
|
+
if (!Number.isFinite(pressureRatio) || pressureRatio <= 0 || pressureRatio > 1) throw new Error("COPILOT_REQUEST_BUDGET_POLICY_INVALID: pressureRatio must be greater than zero and at most one");
|
|
21
|
+
if (compactionReasoning !== "prefer-low" && compactionReasoning !== "preserve") throw new Error("COPILOT_REQUEST_BUDGET_POLICY_INVALID: unsupported compactionReasoning");
|
|
22
|
+
return Object.freeze({
|
|
23
|
+
safetyTokens,
|
|
24
|
+
pressureRatio,
|
|
25
|
+
compactionReasoning
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
function failure(code, message) {
|
|
29
|
+
return Object.freeze({
|
|
30
|
+
ok: false,
|
|
31
|
+
code,
|
|
32
|
+
message: `${code}: ${message}`
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
function positiveInteger(value) {
|
|
36
|
+
return Number.isSafeInteger(value) && value > 0;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Reserve output under the combined context and independently enforce the prompt ceiling.
|
|
40
|
+
* `policy` must come from resolveRequestBudgetPolicy; no caller cap or catalog object is changed.
|
|
41
|
+
*/
|
|
42
|
+
function calculateRequestBudget(limits, requestedMaxTokens, policy = DEFAULT_REQUEST_BUDGET_POLICY) {
|
|
43
|
+
const { contextWindow, maxInputTokens, maxTokens } = limits;
|
|
44
|
+
if (!positiveInteger(contextWindow) || !positiveInteger(maxTokens) || maxInputTokens !== void 0 && !positiveInteger(maxInputTokens)) return failure("COPILOT_REQUEST_INVALID_LIMITS", "model token capacities must be positive safe integers");
|
|
45
|
+
if (requestedMaxTokens !== void 0 && !positiveInteger(requestedMaxTokens)) return failure("COPILOT_REQUEST_INVALID_OUTPUT_LIMIT", "request output cap must be a positive safe integer");
|
|
46
|
+
const outputReservation = requestedMaxTokens ?? maxTokens;
|
|
47
|
+
if (outputReservation > maxTokens) return failure("COPILOT_REQUEST_OUTPUT_LIMIT_EXCEEDED", `request output cap ${outputReservation} exceeds model output capacity ${maxTokens}`);
|
|
48
|
+
const contextInputLimit = contextWindow - outputReservation;
|
|
49
|
+
const limitingFactor = maxInputTokens !== void 0 && maxInputTokens <= contextInputLimit ? "prompt" : "context";
|
|
50
|
+
const hardInputLimit = Math.min(maxInputTokens ?? contextInputLimit, contextInputLimit) - policy.safetyTokens;
|
|
51
|
+
if (hardInputLimit <= 0) return failure("COPILOT_REQUEST_NO_INPUT_HEADROOM", "output reservation and safety allowance leave no positive input budget");
|
|
52
|
+
return Object.freeze({
|
|
53
|
+
ok: true,
|
|
54
|
+
budget: Object.freeze({
|
|
55
|
+
contextWindow,
|
|
56
|
+
...maxInputTokens === void 0 ? {} : { maxInputTokens },
|
|
57
|
+
maxOutputTokens: maxTokens,
|
|
58
|
+
outputReservation,
|
|
59
|
+
hardInputLimit,
|
|
60
|
+
pressureInputLimit: Math.floor(hardInputLimit * policy.pressureRatio),
|
|
61
|
+
limitingFactor
|
|
62
|
+
})
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Check an estimated full prompt; estimates are not provider-exact token counts.
|
|
67
|
+
* Enable pressure only for an owned ordinary loop call with a compaction recovery path.
|
|
68
|
+
* Auxiliary and agentless calls use hard admission, including compaction itself.
|
|
69
|
+
*/
|
|
70
|
+
function assessRequestBudget(estimatedInput, budget, pressure = false) {
|
|
71
|
+
if (!Number.isFinite(estimatedInput) || estimatedInput < 0 || estimatedInput > Number.MAX_SAFE_INTEGER) return failure("COPILOT_REQUEST_INVALID_ESTIMATE", "estimated input must be finite, non-negative, and safely representable");
|
|
72
|
+
const input = Math.ceil(estimatedInput);
|
|
73
|
+
if (input > budget.hardInputLimit) return failure(budget.limitingFactor === "prompt" ? "COPILOT_REQUEST_INPUT_LIMIT_EXCEEDED" : "COPILOT_REQUEST_CONTEXT_LIMIT_EXCEEDED", `estimated input ${input} exceeds input budget ${budget.hardInputLimit} with output reservation ${budget.outputReservation}`);
|
|
74
|
+
if (pressure && input > budget.pressureInputLimit) return failure("COPILOT_REQUEST_PRESSURE_EXCEEDED", `estimated input ${input} exceeds proactive compaction budget ${budget.pressureInputLimit}`);
|
|
75
|
+
return Object.freeze({ ok: true });
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Select a low-cost supported effort only for a caller-confirmed compaction request.
|
|
79
|
+
* A supplied effort, including a materialized provider default, wins unchanged; native validation
|
|
80
|
+
* remains authoritative. Unsupported low-cost controls preserve the provider default, never off/none.
|
|
81
|
+
*/
|
|
82
|
+
function selectCompactionReasoning(supportedEfforts, requestedEffort, mode = DEFAULT_REQUEST_BUDGET_POLICY.compactionReasoning) {
|
|
83
|
+
if (requestedEffort !== void 0 || mode === "preserve") return requestedEffort;
|
|
84
|
+
return supportedEfforts.find((effort) => effort === "minimal") ?? supportedEfforts.find((effort) => effort === "low");
|
|
85
|
+
}
|
|
86
|
+
//#endregion
|
|
87
|
+
export { selectCompactionReasoning as a, resolveRequestBudgetPolicy as i, assessRequestBudget as n, calculateRequestBudget as r, DEFAULT_REQUEST_BUDGET_POLICY as t };
|
|
@@ -2,13 +2,26 @@ import type { Context } from '@deepseek-ai/cordis';
|
|
|
2
2
|
import type { ReactElement } from 'react';
|
|
3
3
|
import type { ContextEvidence } from './context-evidence.ts';
|
|
4
4
|
import type { CompactionContinuationStatus } from './session-continuation-types.ts';
|
|
5
|
-
export declare
|
|
5
|
+
export declare class ContextIncidentPresentation {
|
|
6
|
+
private dismissed;
|
|
7
|
+
private listeners;
|
|
8
|
+
private version;
|
|
9
|
+
subscribe: (listener: () => void) => () => void;
|
|
10
|
+
snapshot: () => number;
|
|
11
|
+
private key;
|
|
12
|
+
visible(sessionId: string, incident: NonNullable<ContextEvidence['incident']>): boolean;
|
|
13
|
+
dismiss(sessionId: string, incident: NonNullable<ContextEvidence['incident']>): void;
|
|
14
|
+
dispose(): void;
|
|
15
|
+
}
|
|
16
|
+
export declare function ContextEvidenceNotice({ evidence, locale, applicable, compactionStatus, showCompactionResult, controls, sessionId, presentation }: {
|
|
6
17
|
evidence: ContextEvidence | undefined;
|
|
7
18
|
locale?: string;
|
|
8
19
|
applicable?: boolean;
|
|
9
20
|
compactionStatus?: CompactionContinuationStatus;
|
|
10
21
|
showCompactionResult?: boolean;
|
|
11
22
|
controls?: ReactElement | null;
|
|
23
|
+
sessionId?: string;
|
|
24
|
+
presentation?: ContextIncidentPresentation;
|
|
12
25
|
}): ReactElement | null;
|
|
13
26
|
/** Additive disclosure only: native input, context ring and billing remain untouched. */
|
|
14
27
|
export declare function registerContextEvidenceUi(ctx: Context): () => void;
|
|
@@ -20,8 +20,16 @@ export declare const ContextEvidenceSchema: z.ZodObject<{
|
|
|
20
20
|
compaction: "compaction";
|
|
21
21
|
unknown: "unknown";
|
|
22
22
|
"failed-zero": "failed-zero";
|
|
23
|
+
"invalid-sample": "invalid-sample";
|
|
23
24
|
selection: "selection";
|
|
24
25
|
}>;
|
|
26
|
+
incident: z.ZodNullable<z.ZodObject<{
|
|
27
|
+
kind: z.ZodEnum<{
|
|
28
|
+
"failed-zero": "failed-zero";
|
|
29
|
+
"invalid-sample": "invalid-sample";
|
|
30
|
+
}>;
|
|
31
|
+
seq: z.ZodNumber;
|
|
32
|
+
}, z.core.$strict>>;
|
|
25
33
|
compaction: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
26
34
|
id: z.ZodString;
|
|
27
35
|
startSeq: z.ZodNumber;
|
|
@@ -91,8 +99,16 @@ export declare const contextEvidenceDefinition: {
|
|
|
91
99
|
compaction: "compaction";
|
|
92
100
|
unknown: "unknown";
|
|
93
101
|
"failed-zero": "failed-zero";
|
|
102
|
+
"invalid-sample": "invalid-sample";
|
|
94
103
|
selection: "selection";
|
|
95
104
|
}>;
|
|
105
|
+
incident: z.ZodNullable<z.ZodObject<{
|
|
106
|
+
kind: z.ZodEnum<{
|
|
107
|
+
"failed-zero": "failed-zero";
|
|
108
|
+
"invalid-sample": "invalid-sample";
|
|
109
|
+
}>;
|
|
110
|
+
seq: z.ZodNumber;
|
|
111
|
+
}, z.core.$strict>>;
|
|
96
112
|
compaction: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
97
113
|
id: z.ZodString;
|
|
98
114
|
startSeq: z.ZodNumber;
|
|
@@ -149,8 +165,16 @@ export declare const contextEvidenceDefinition: {
|
|
|
149
165
|
compaction: "compaction";
|
|
150
166
|
unknown: "unknown";
|
|
151
167
|
"failed-zero": "failed-zero";
|
|
168
|
+
"invalid-sample": "invalid-sample";
|
|
152
169
|
selection: "selection";
|
|
153
170
|
}>;
|
|
171
|
+
incident: z.ZodNullable<z.ZodObject<{
|
|
172
|
+
kind: z.ZodEnum<{
|
|
173
|
+
"failed-zero": "failed-zero";
|
|
174
|
+
"invalid-sample": "invalid-sample";
|
|
175
|
+
}>;
|
|
176
|
+
seq: z.ZodNumber;
|
|
177
|
+
}, z.core.$strict>>;
|
|
154
178
|
compaction: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
155
179
|
id: z.ZodString;
|
|
156
180
|
startSeq: z.ZodNumber;
|
|
@@ -199,7 +223,11 @@ export declare const contextEvidenceDefinition: {
|
|
|
199
223
|
};
|
|
200
224
|
} | null;
|
|
201
225
|
invalid: boolean;
|
|
202
|
-
reason: "none" | "compaction" | "unknown" | "failed-zero" | "selection";
|
|
226
|
+
reason: "none" | "compaction" | "unknown" | "failed-zero" | "invalid-sample" | "selection";
|
|
227
|
+
incident: {
|
|
228
|
+
kind: "failed-zero" | "invalid-sample";
|
|
229
|
+
seq: number;
|
|
230
|
+
} | null;
|
|
203
231
|
compaction?: {
|
|
204
232
|
id: string;
|
|
205
233
|
startSeq: number;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export declare const DIAGNOSTICS_ANALYSIS_MAX_INPUT_BYTES: number;
|
|
2
|
+
interface FileStat {
|
|
3
|
+
isFile(): boolean;
|
|
4
|
+
isSymbolicLink(): boolean;
|
|
5
|
+
size: number;
|
|
6
|
+
mtimeMs: number;
|
|
7
|
+
dev: number;
|
|
8
|
+
ino: number;
|
|
9
|
+
}
|
|
10
|
+
interface ReadHandle {
|
|
11
|
+
stat(): Promise<FileStat>;
|
|
12
|
+
read(buffer: Buffer, offset: number, length: number, position: number): Promise<{
|
|
13
|
+
bytesRead: number;
|
|
14
|
+
}>;
|
|
15
|
+
close(): Promise<void>;
|
|
16
|
+
}
|
|
17
|
+
export interface DiagnosticsAnalysisFileSystem {
|
|
18
|
+
lstat(path: string): Promise<FileStat>;
|
|
19
|
+
open(path: string, flags: 'r'): Promise<ReadHandle>;
|
|
20
|
+
}
|
|
21
|
+
export declare function readBoundedDiagnosticsFile(filePath: string, io?: DiagnosticsAnalysisFileSystem): Promise<string>;
|
|
22
|
+
export {};
|
|
23
|
+
//# sourceMappingURL=diagnostics-analysis-io.d.ts.map
|