dsh-opendesign-corouter 0.1.14 → 0.1.16
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/README.md +8 -4
- package/lib/client-config-writes.d.ts +36 -0
- package/lib/client-context-quick.d.ts +35 -0
- package/lib/client.d.ts +39 -5
- package/lib/client.js +1151 -427
- package/lib/config.d.ts +9 -0
- package/lib/context-budget.d.ts +23 -0
- package/lib/device-auth.d.ts +1 -1
- package/lib/empty-turn.d.ts +0 -5
- package/lib/eot-recovery.d.ts +3 -2
- package/lib/generated/typert.host.js +29 -2
- package/lib/generated/typert.remote-client.js +29 -2
- package/lib/index.d.ts +2 -0
- package/lib/index.js +473 -38
- package/lib/index.js.map +4 -4
- package/lib/model-settings.d.ts +7 -4
- package/lib/remote.d.ts +6 -0
- package/lib/turn-monitor-status.d.ts +16 -0
- package/lib/turn-monitor.d.ts +99 -0
- package/package.json +3 -1
package/lib/config.d.ts
CHANGED
|
@@ -13,6 +13,9 @@ export declare const Config: Schema<Schemastery.ObjectS<NoInfer<{
|
|
|
13
13
|
modelSettings: Schema<NoInfer<import("@deepseek-ai/cosmokit").Dict<unknown, string>>, NoInfer<ModelSettingsMap>, "volatile-defined">;
|
|
14
14
|
useDesktopCredential: Schema<boolean, boolean, "volatile-defined">;
|
|
15
15
|
emptyTurnGuard: Schema<boolean, boolean, "volatile-defined">;
|
|
16
|
+
turnCompletionReview: Schema<boolean, boolean, "volatile-defined">;
|
|
17
|
+
turnReviewMaxContinuations: Schema<number, number, "volatile-defined">;
|
|
18
|
+
turnReviewNoProgressLimit: Schema<number, number, "volatile-defined">;
|
|
16
19
|
quotaRefreshSeconds: Schema<number, number, "volatile-defined">;
|
|
17
20
|
requestTimeoutMs: Schema<number, number, "volatile-defined">;
|
|
18
21
|
streamIdleTimeoutMs: Schema<number, number, "volatile-defined">;
|
|
@@ -24,6 +27,9 @@ export declare const Config: Schema<Schemastery.ObjectS<NoInfer<{
|
|
|
24
27
|
modelSettings: Schema<NoInfer<import("@deepseek-ai/cosmokit").Dict<unknown, string>>, NoInfer<ModelSettingsMap>, "volatile-defined">;
|
|
25
28
|
useDesktopCredential: Schema<boolean, boolean, "volatile-defined">;
|
|
26
29
|
emptyTurnGuard: Schema<boolean, boolean, "volatile-defined">;
|
|
30
|
+
turnCompletionReview: Schema<boolean, boolean, "volatile-defined">;
|
|
31
|
+
turnReviewMaxContinuations: Schema<number, number, "volatile-defined">;
|
|
32
|
+
turnReviewNoProgressLimit: Schema<number, number, "volatile-defined">;
|
|
27
33
|
quotaRefreshSeconds: Schema<number, number, "volatile-defined">;
|
|
28
34
|
requestTimeoutMs: Schema<number, number, "volatile-defined">;
|
|
29
35
|
streamIdleTimeoutMs: Schema<number, number, "volatile-defined">;
|
|
@@ -41,6 +47,9 @@ export interface RuntimeConfig {
|
|
|
41
47
|
modelSettings?: ModelSettingsMap;
|
|
42
48
|
quotaRefreshSeconds?: number;
|
|
43
49
|
maxRequestImageBytes?: number;
|
|
50
|
+
turnCompletionReview?: boolean;
|
|
51
|
+
turnReviewMaxContinuations?: number;
|
|
52
|
+
turnReviewNoProgressLimit?: number;
|
|
44
53
|
}
|
|
45
54
|
export declare function assertBaseURL(raw: string): string;
|
|
46
55
|
export declare function readConfig(config: LiveConfig): RuntimeConfig;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** Client working windows, including both input and reserved output tokens. */
|
|
2
|
+
export declare const CONTEXT_WINDOW_PRESETS: readonly [{
|
|
3
|
+
readonly id: "default";
|
|
4
|
+
readonly label: "默认";
|
|
5
|
+
readonly tokens: 272000;
|
|
6
|
+
}, {
|
|
7
|
+
readonly id: "extended";
|
|
8
|
+
readonly label: "扩展";
|
|
9
|
+
readonly tokens: 500000;
|
|
10
|
+
}, {
|
|
11
|
+
readonly id: "maximum";
|
|
12
|
+
readonly label: "最大";
|
|
13
|
+
readonly tokens: 872000;
|
|
14
|
+
}];
|
|
15
|
+
export type ContextWindowPresetId = typeof CONTEXT_WINDOW_PRESETS[number]['id'];
|
|
16
|
+
/** Saved numbers are always legacy custom windows; only an explicit tier selects a preset. */
|
|
17
|
+
export declare function contextWindowPreset(legacyOverride: number | undefined, tier?: ContextWindowPresetId): ContextWindowPresetId | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* Presets never increase a known catalog/gateway reference. Historical custom
|
|
20
|
+
* numbers retain their prior meaning until the user explicitly chooses a preset.
|
|
21
|
+
* An unknown reference does not imply model capacity: the preset is a local budget.
|
|
22
|
+
*/
|
|
23
|
+
export declare function effectiveContextWindow(reference: number | undefined, override?: number, tier?: ContextWindowPresetId): number;
|
package/lib/device-auth.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export interface DeviceTokens {
|
|
|
3
3
|
runtimeKey: string;
|
|
4
4
|
}
|
|
5
5
|
export declare const DEVICE_AUTH_ENDPOINT = "https://amr-api.open-design.ai/api/v1/cli/device-authorizations";
|
|
6
|
-
export declare const DEVICE_AUTH_PLUGIN_VERSION = "0.1.
|
|
6
|
+
export declare const DEVICE_AUTH_PLUGIN_VERSION = "0.1.16";
|
|
7
7
|
export declare const DEVICE_REQUEST_TIMEOUT_MS = 20000;
|
|
8
8
|
/** One bounded launch step of the temporary activation window. */
|
|
9
9
|
export declare const DEVICE_OPEN_TIMEOUT_MS = 30000;
|
package/lib/empty-turn.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { type FinishReason, type StreamChunk } from '@deepseek-ai/dsh-llm';
|
|
2
2
|
/** Failure message a rewritten empty turn carries. */
|
|
3
3
|
export declare const EMPTY_TURN_MESSAGE = "OpenDesign\uFF1A\u6A21\u578B\u672A\u4EA7\u751F\u53EF\u7528\u56DE\u7B54\u6216\u6709\u6548\u5DE5\u5177\u8C03\u7528";
|
|
4
|
-
export declare const INCOMPLETE_TURN_MESSAGE = "OpenDesign\uFF1A\u6A21\u578B\u505C\u5728\u64CD\u4F5C\u8BF4\u660E\uFF0C\u672A\u7EE7\u7EED\u53D1\u8D77\u5DE5\u5177\u8C03\u7528";
|
|
5
4
|
/**
|
|
6
5
|
* Remove protocol residue from one assembled channel.
|
|
7
6
|
* @param text - concatenated text or reasoning content.
|
|
@@ -14,8 +13,6 @@ export declare function stripProtocolResidue(text: string): string;
|
|
|
14
13
|
* @returns true for absent, blank, or residue-only content.
|
|
15
14
|
*/
|
|
16
15
|
export declare function isResidueOnly(text: string | undefined): boolean;
|
|
17
|
-
/** Recognize a short action promise, optionally after a concise progress update. */
|
|
18
|
-
export declare function isPendingActionTurn(text: string | undefined): boolean;
|
|
19
16
|
/** Stream facts one attempt produced, as the adapter accumulated them. */
|
|
20
17
|
export interface EmptyTurnInput {
|
|
21
18
|
/** Whether any tool-call block was opened or streamed during this attempt. */
|
|
@@ -32,8 +29,6 @@ export interface EmptyTurnEvidence {
|
|
|
32
29
|
readonly reasoningLength: number;
|
|
33
30
|
/** True when the visible text channel is empty once protocol residue is removed. */
|
|
34
31
|
readonly markupOnly: boolean;
|
|
35
|
-
/** True for a narrowly recognized pending-action statement. */
|
|
36
|
-
readonly pendingAction: boolean;
|
|
37
32
|
}
|
|
38
33
|
/**
|
|
39
34
|
* Whether this finish is the empty turn the guard exists for.
|
package/lib/eot-recovery.d.ts
CHANGED
|
@@ -24,10 +24,11 @@ export declare class EotRecovery {
|
|
|
24
24
|
#private;
|
|
25
25
|
readonly enabled: () => boolean;
|
|
26
26
|
readonly wait: typeof cancellableDelay;
|
|
27
|
-
|
|
27
|
+
readonly onRetry?: (() => void) | undefined;
|
|
28
|
+
constructor(enabled: () => boolean, wait?: typeof cancellableDelay, onRetry?: (() => void) | undefined);
|
|
28
29
|
readonly handle: RecoveryListener;
|
|
29
30
|
dispose(): Promise<void>;
|
|
30
31
|
}
|
|
31
32
|
/** Register against the host's documented scoped recovery waterfall. */
|
|
32
|
-
export declare function installEotRecovery(ctx: Context, enabled: () => boolean): void;
|
|
33
|
+
export declare function installEotRecovery(ctx: Context, enabled: () => boolean, onRetry?: () => void): void;
|
|
33
34
|
export {};
|
|
@@ -43,7 +43,7 @@ function parseModelSettingsMap(value) {
|
|
|
43
43
|
if (value === null || typeof value !== "object" || Array.isArray(value)) throw new Error("\u6A21\u578B\u8BBE\u7F6E\u5FC5\u987B\u662F\u5BF9\u8C61");
|
|
44
44
|
const keys = Object.keys(value);
|
|
45
45
|
if (keys.length > 512) throw new Error("\u6A21\u578B\u8BBE\u7F6E\u6700\u591A\u5141\u8BB8 512 \u4E2A\u6A21\u578B");
|
|
46
|
-
const fields = /* @__PURE__ */ new Set(["enabled", "imageInput", "temperature", "topP", "maxTokens", "contextWindow", "reasoningEffort"]);
|
|
46
|
+
const fields = /* @__PURE__ */ new Set(["enabled", "imageInput", "temperature", "topP", "maxTokens", "contextWindow", "contextTier", "reasoningEffort"]);
|
|
47
47
|
const efforts = ["none", "minimal", "low", "medium", "high", "xhigh", "ultra", "max"];
|
|
48
48
|
const out = {};
|
|
49
49
|
for (const id of keys) {
|
|
@@ -76,6 +76,13 @@ function parseModelSettingsMap(value) {
|
|
|
76
76
|
if (typeof item !== "number" || !Number.isSafeInteger(item) || item < 1 || item > max) throw new Error(`\u6A21\u578B\u8BBE\u7F6E\u7684 ${field} \u5FC5\u987B\u662F 1 \u5230 ${max} \u4E4B\u95F4\u7684\u6574\u6570`);
|
|
77
77
|
parsed[field] = item;
|
|
78
78
|
}
|
|
79
|
+
if (settings.contextTier !== void 0) {
|
|
80
|
+
if (settings.contextTier !== "default" && settings.contextTier !== "extended" && settings.contextTier !== "maximum") throw new Error("\u6A21\u578B\u8BBE\u7F6E\u7684 contextTier \u4E0D\u5728\u5141\u8BB8\u7684\u53D6\u503C\u5185");
|
|
81
|
+
if (parsed.contextWindow !== void 0) throw new Error("\u4E0A\u4E0B\u6587\u6863\u4F4D\u4E0E\u65E7\u81EA\u5B9A\u4E49\u7A97\u53E3\u4E0D\u80FD\u540C\u65F6\u8BBE\u7F6E");
|
|
82
|
+
parsed.contextTier = settings.contextTier;
|
|
83
|
+
const window = parsed.contextTier === "default" ? 272e3 : parsed.contextTier === "extended" ? 5e5 : 872e3;
|
|
84
|
+
if (parsed.maxTokens !== void 0 && parsed.maxTokens >= window) throw new Error("\u6A21\u578B\u8BBE\u7F6E\u7684 maxTokens \u5FC5\u987B\u5C0F\u4E8E\u6863\u4F4D\u603B\u7A97\u53E3");
|
|
85
|
+
}
|
|
79
86
|
if (settings.reasoningEffort !== void 0) {
|
|
80
87
|
if (typeof settings.reasoningEffort !== "string" || !efforts.includes(settings.reasoningEffort)) throw new Error("\u6A21\u578B\u8BBE\u7F6E\u7684 reasoningEffort \u4E0D\u5728\u5141\u8BB8\u7684\u53D6\u503C\u5185");
|
|
81
88
|
parsed.reasoningEffort = settings.reasoningEffort;
|
|
@@ -91,6 +98,10 @@ var MIN_REQUEST_IMAGE_BYTES = 1024 * 1024;
|
|
|
91
98
|
var DEFAULT_MAX_REQUEST_IMAGE_BYTES = 20 * 1024 * 1024;
|
|
92
99
|
var MAX_REQUEST_IMAGE_BYTES = 100 * 1024 * 1024;
|
|
93
100
|
|
|
101
|
+
// src/turn-monitor-status.ts
|
|
102
|
+
var REVIEW_DECISIONS = ["continued", "completed", "waiting-user", "waiting-work", "blocked", "limited", "skipped", "unverified"];
|
|
103
|
+
var REVIEW_REASONS = ["missing-outcome", "pending-action", "reported-complete", "needs-user", "work-running", "reported-blocked", "continuation-limit", "no-progress", "goal-owned", "service-unavailable", "cancelled", "truncated", "request-failed", "disabled", "superseded", "invalid-evidence", "tool-concluded"];
|
|
104
|
+
|
|
94
105
|
// src/remote.ts
|
|
95
106
|
var MAX_REVISION = 256;
|
|
96
107
|
var MAX_JOB_ID = 128;
|
|
@@ -272,6 +283,7 @@ function parseStatusConfig(value) {
|
|
|
272
283
|
if (!ENV_REF.test(apiKeyEnv)) throw new Error("\u51ED\u636E\u5F15\u7528\u540D\u5FC5\u987B\u662F\u5408\u6CD5\u6807\u8BC6\u7B26");
|
|
273
284
|
return {
|
|
274
285
|
emptyTurnGuard: flag(value.emptyTurnGuard, "\u7A7A\u8F6E\u4FDD\u62A4\u5F00\u5173"),
|
|
286
|
+
...value.turnCompletionReview === void 0 ? {} : { turnCompletionReview: flag(value.turnCompletionReview, "\u7ED3\u675F\u56DE\u5408\u6838\u9A8C\u5F00\u5173") },
|
|
275
287
|
useDesktopCredential: flag(value.useDesktopCredential, "\u684C\u9762\u767B\u5F55\u6001\u5F00\u5173"),
|
|
276
288
|
baseURL: text(value.baseURL, "\u63A8\u7406\u5730\u5740", MAX_BASE_URL),
|
|
277
289
|
apiKeyEnv,
|
|
@@ -280,7 +292,9 @@ function parseStatusConfig(value) {
|
|
|
280
292
|
...value.requestTimeoutMs === void 0 ? {} : { requestTimeoutMs: positiveInteger(value.requestTimeoutMs, "\u8BF7\u6C42\u8D85\u65F6", 36e5, 1e3) },
|
|
281
293
|
...value.streamIdleTimeoutMs === void 0 ? {} : { streamIdleTimeoutMs: positiveInteger(value.streamIdleTimeoutMs, "\u6D41\u7A7A\u95F2\u8D85\u65F6", 18e5, 1e3) },
|
|
282
294
|
...value.quotaRefreshSeconds === void 0 ? {} : { quotaRefreshSeconds: positiveInteger(value.quotaRefreshSeconds, "\u81EA\u52A8\u5237\u65B0\u95F4\u9694", 3600, 5) },
|
|
283
|
-
...value.maxRequestImageBytes === void 0 ? {} : { maxRequestImageBytes: positiveInteger(value.maxRequestImageBytes, "\u8BF7\u6C42\u56FE\u7247\u9884\u7B97", MAX_REQUEST_IMAGE_BYTES, MIN_REQUEST_IMAGE_BYTES) }
|
|
295
|
+
...value.maxRequestImageBytes === void 0 ? {} : { maxRequestImageBytes: positiveInteger(value.maxRequestImageBytes, "\u8BF7\u6C42\u56FE\u7247\u9884\u7B97", MAX_REQUEST_IMAGE_BYTES, MIN_REQUEST_IMAGE_BYTES) },
|
|
296
|
+
...value.turnReviewMaxContinuations === void 0 ? {} : { turnReviewMaxContinuations: positiveInteger(value.turnReviewMaxContinuations, "\u6536\u5C3E\u7EED\u529E\u6B21\u6570", 10) },
|
|
297
|
+
...value.turnReviewNoProgressLimit === void 0 ? {} : { turnReviewNoProgressLimit: positiveInteger(value.turnReviewNoProgressLimit, "\u65E0\u8FDB\u5C55\u6B21\u6570", 5) }
|
|
284
298
|
};
|
|
285
299
|
}
|
|
286
300
|
function parseStatus(value) {
|
|
@@ -305,12 +319,25 @@ function parseStatus(value) {
|
|
|
305
319
|
login: parseLoginState(value.login),
|
|
306
320
|
config: parseStatusConfig(value.config),
|
|
307
321
|
guardedTurns: count(value.guardedTurns, "\u5DF2\u62E6\u622A\u7A7A\u8F6E\u6570"),
|
|
322
|
+
...value.turnMonitor === void 0 ? {} : { turnMonitor: parseTurnMonitor(value.turnMonitor) },
|
|
308
323
|
models: parsed,
|
|
309
324
|
...value.modelsSource === void 0 ? {} : { modelsSource: member(value.modelsSource, ["builtin", "openai"], "\u6A21\u578B\u76EE\u5F55\u6765\u6E90") },
|
|
310
325
|
...value.modelsUpdatedAt === void 0 ? {} : { modelsUpdatedAt: isoTime(value.modelsUpdatedAt, "\u6A21\u578B\u66F4\u65B0\u65F6\u95F4") },
|
|
311
326
|
...value.modelsError === void 0 ? {} : { modelsError: text(value.modelsError, "\u6A21\u578B\u66F4\u65B0\u63D0\u793A", MAX_MESSAGE) }
|
|
312
327
|
};
|
|
313
328
|
}
|
|
329
|
+
function parseTurnMonitor(value) {
|
|
330
|
+
if (!record(value)) throw new Error("\u7ED3\u675F\u6838\u9A8C\u72B6\u6001\u5FC5\u987B\u662F\u5BF9\u8C61");
|
|
331
|
+
const last = value.last;
|
|
332
|
+
if (last !== void 0 && !record(last)) throw new Error("\u6700\u8FD1\u7ED3\u675F\u6838\u9A8C\u5FC5\u987B\u662F\u5BF9\u8C61");
|
|
333
|
+
return {
|
|
334
|
+
available: flag(value.available, "\u6536\u5C3E\u6838\u9A8C\u662F\u5426\u53EF\u7528"),
|
|
335
|
+
checks: count(value.checks, "\u6536\u5C3E\u6838\u9A8C\u6B21\u6570"),
|
|
336
|
+
continuations: count(value.continuations, "\u4EFB\u52A1\u7EED\u529E\u6B21\u6570"),
|
|
337
|
+
requestRetries: count(value.requestRetries, "\u8BF7\u6C42\u91CD\u8BD5\u6B21\u6570"),
|
|
338
|
+
...record(last) ? { last: { at: isoTime(last.at, "\u6536\u5C3E\u6838\u9A8C\u65F6\u95F4"), decision: member(last.decision, REVIEW_DECISIONS, "\u6536\u5C3E\u6838\u9A8C\u51B3\u5B9A"), reason: member(last.reason, REVIEW_REASONS, "\u6536\u5C3E\u6838\u9A8C\u539F\u56E0") } } : {}
|
|
339
|
+
};
|
|
340
|
+
}
|
|
314
341
|
function parseStartLoginRequest(value) {
|
|
315
342
|
if (!record(value)) throw new Error("\u767B\u5F55\u8BF7\u6C42\u5FC5\u987B\u662F\u5BF9\u8C61");
|
|
316
343
|
return { expectedRevision: text(value.expectedRevision, "\u914D\u7F6E\u7248\u672C", MAX_REVISION) };
|
|
@@ -43,7 +43,7 @@ function parseModelSettingsMap(value) {
|
|
|
43
43
|
if (value === null || typeof value !== "object" || Array.isArray(value)) throw new Error("\u6A21\u578B\u8BBE\u7F6E\u5FC5\u987B\u662F\u5BF9\u8C61");
|
|
44
44
|
const keys = Object.keys(value);
|
|
45
45
|
if (keys.length > 512) throw new Error("\u6A21\u578B\u8BBE\u7F6E\u6700\u591A\u5141\u8BB8 512 \u4E2A\u6A21\u578B");
|
|
46
|
-
const fields = /* @__PURE__ */ new Set(["enabled", "imageInput", "temperature", "topP", "maxTokens", "contextWindow", "reasoningEffort"]);
|
|
46
|
+
const fields = /* @__PURE__ */ new Set(["enabled", "imageInput", "temperature", "topP", "maxTokens", "contextWindow", "contextTier", "reasoningEffort"]);
|
|
47
47
|
const efforts = ["none", "minimal", "low", "medium", "high", "xhigh", "ultra", "max"];
|
|
48
48
|
const out = {};
|
|
49
49
|
for (const id of keys) {
|
|
@@ -76,6 +76,13 @@ function parseModelSettingsMap(value) {
|
|
|
76
76
|
if (typeof item !== "number" || !Number.isSafeInteger(item) || item < 1 || item > max) throw new Error(`\u6A21\u578B\u8BBE\u7F6E\u7684 ${field} \u5FC5\u987B\u662F 1 \u5230 ${max} \u4E4B\u95F4\u7684\u6574\u6570`);
|
|
77
77
|
parsed[field] = item;
|
|
78
78
|
}
|
|
79
|
+
if (settings.contextTier !== void 0) {
|
|
80
|
+
if (settings.contextTier !== "default" && settings.contextTier !== "extended" && settings.contextTier !== "maximum") throw new Error("\u6A21\u578B\u8BBE\u7F6E\u7684 contextTier \u4E0D\u5728\u5141\u8BB8\u7684\u53D6\u503C\u5185");
|
|
81
|
+
if (parsed.contextWindow !== void 0) throw new Error("\u4E0A\u4E0B\u6587\u6863\u4F4D\u4E0E\u65E7\u81EA\u5B9A\u4E49\u7A97\u53E3\u4E0D\u80FD\u540C\u65F6\u8BBE\u7F6E");
|
|
82
|
+
parsed.contextTier = settings.contextTier;
|
|
83
|
+
const window = parsed.contextTier === "default" ? 272e3 : parsed.contextTier === "extended" ? 5e5 : 872e3;
|
|
84
|
+
if (parsed.maxTokens !== void 0 && parsed.maxTokens >= window) throw new Error("\u6A21\u578B\u8BBE\u7F6E\u7684 maxTokens \u5FC5\u987B\u5C0F\u4E8E\u6863\u4F4D\u603B\u7A97\u53E3");
|
|
85
|
+
}
|
|
79
86
|
if (settings.reasoningEffort !== void 0) {
|
|
80
87
|
if (typeof settings.reasoningEffort !== "string" || !efforts.includes(settings.reasoningEffort)) throw new Error("\u6A21\u578B\u8BBE\u7F6E\u7684 reasoningEffort \u4E0D\u5728\u5141\u8BB8\u7684\u53D6\u503C\u5185");
|
|
81
88
|
parsed.reasoningEffort = settings.reasoningEffort;
|
|
@@ -91,6 +98,10 @@ var MIN_REQUEST_IMAGE_BYTES = 1024 * 1024;
|
|
|
91
98
|
var DEFAULT_MAX_REQUEST_IMAGE_BYTES = 20 * 1024 * 1024;
|
|
92
99
|
var MAX_REQUEST_IMAGE_BYTES = 100 * 1024 * 1024;
|
|
93
100
|
|
|
101
|
+
// src/turn-monitor-status.ts
|
|
102
|
+
var REVIEW_DECISIONS = ["continued", "completed", "waiting-user", "waiting-work", "blocked", "limited", "skipped", "unverified"];
|
|
103
|
+
var REVIEW_REASONS = ["missing-outcome", "pending-action", "reported-complete", "needs-user", "work-running", "reported-blocked", "continuation-limit", "no-progress", "goal-owned", "service-unavailable", "cancelled", "truncated", "request-failed", "disabled", "superseded", "invalid-evidence", "tool-concluded"];
|
|
104
|
+
|
|
94
105
|
// src/remote.ts
|
|
95
106
|
var MAX_REVISION = 256;
|
|
96
107
|
var MAX_JOB_ID = 128;
|
|
@@ -272,6 +283,7 @@ function parseStatusConfig(value) {
|
|
|
272
283
|
if (!ENV_REF.test(apiKeyEnv)) throw new Error("\u51ED\u636E\u5F15\u7528\u540D\u5FC5\u987B\u662F\u5408\u6CD5\u6807\u8BC6\u7B26");
|
|
273
284
|
return {
|
|
274
285
|
emptyTurnGuard: flag(value.emptyTurnGuard, "\u7A7A\u8F6E\u4FDD\u62A4\u5F00\u5173"),
|
|
286
|
+
...value.turnCompletionReview === void 0 ? {} : { turnCompletionReview: flag(value.turnCompletionReview, "\u7ED3\u675F\u56DE\u5408\u6838\u9A8C\u5F00\u5173") },
|
|
275
287
|
useDesktopCredential: flag(value.useDesktopCredential, "\u684C\u9762\u767B\u5F55\u6001\u5F00\u5173"),
|
|
276
288
|
baseURL: text(value.baseURL, "\u63A8\u7406\u5730\u5740", MAX_BASE_URL),
|
|
277
289
|
apiKeyEnv,
|
|
@@ -280,7 +292,9 @@ function parseStatusConfig(value) {
|
|
|
280
292
|
...value.requestTimeoutMs === void 0 ? {} : { requestTimeoutMs: positiveInteger(value.requestTimeoutMs, "\u8BF7\u6C42\u8D85\u65F6", 36e5, 1e3) },
|
|
281
293
|
...value.streamIdleTimeoutMs === void 0 ? {} : { streamIdleTimeoutMs: positiveInteger(value.streamIdleTimeoutMs, "\u6D41\u7A7A\u95F2\u8D85\u65F6", 18e5, 1e3) },
|
|
282
294
|
...value.quotaRefreshSeconds === void 0 ? {} : { quotaRefreshSeconds: positiveInteger(value.quotaRefreshSeconds, "\u81EA\u52A8\u5237\u65B0\u95F4\u9694", 3600, 5) },
|
|
283
|
-
...value.maxRequestImageBytes === void 0 ? {} : { maxRequestImageBytes: positiveInteger(value.maxRequestImageBytes, "\u8BF7\u6C42\u56FE\u7247\u9884\u7B97", MAX_REQUEST_IMAGE_BYTES, MIN_REQUEST_IMAGE_BYTES) }
|
|
295
|
+
...value.maxRequestImageBytes === void 0 ? {} : { maxRequestImageBytes: positiveInteger(value.maxRequestImageBytes, "\u8BF7\u6C42\u56FE\u7247\u9884\u7B97", MAX_REQUEST_IMAGE_BYTES, MIN_REQUEST_IMAGE_BYTES) },
|
|
296
|
+
...value.turnReviewMaxContinuations === void 0 ? {} : { turnReviewMaxContinuations: positiveInteger(value.turnReviewMaxContinuations, "\u6536\u5C3E\u7EED\u529E\u6B21\u6570", 10) },
|
|
297
|
+
...value.turnReviewNoProgressLimit === void 0 ? {} : { turnReviewNoProgressLimit: positiveInteger(value.turnReviewNoProgressLimit, "\u65E0\u8FDB\u5C55\u6B21\u6570", 5) }
|
|
284
298
|
};
|
|
285
299
|
}
|
|
286
300
|
function parseStatus(value) {
|
|
@@ -305,12 +319,25 @@ function parseStatus(value) {
|
|
|
305
319
|
login: parseLoginState(value.login),
|
|
306
320
|
config: parseStatusConfig(value.config),
|
|
307
321
|
guardedTurns: count(value.guardedTurns, "\u5DF2\u62E6\u622A\u7A7A\u8F6E\u6570"),
|
|
322
|
+
...value.turnMonitor === void 0 ? {} : { turnMonitor: parseTurnMonitor(value.turnMonitor) },
|
|
308
323
|
models: parsed,
|
|
309
324
|
...value.modelsSource === void 0 ? {} : { modelsSource: member(value.modelsSource, ["builtin", "openai"], "\u6A21\u578B\u76EE\u5F55\u6765\u6E90") },
|
|
310
325
|
...value.modelsUpdatedAt === void 0 ? {} : { modelsUpdatedAt: isoTime(value.modelsUpdatedAt, "\u6A21\u578B\u66F4\u65B0\u65F6\u95F4") },
|
|
311
326
|
...value.modelsError === void 0 ? {} : { modelsError: text(value.modelsError, "\u6A21\u578B\u66F4\u65B0\u63D0\u793A", MAX_MESSAGE) }
|
|
312
327
|
};
|
|
313
328
|
}
|
|
329
|
+
function parseTurnMonitor(value) {
|
|
330
|
+
if (!record(value)) throw new Error("\u7ED3\u675F\u6838\u9A8C\u72B6\u6001\u5FC5\u987B\u662F\u5BF9\u8C61");
|
|
331
|
+
const last = value.last;
|
|
332
|
+
if (last !== void 0 && !record(last)) throw new Error("\u6700\u8FD1\u7ED3\u675F\u6838\u9A8C\u5FC5\u987B\u662F\u5BF9\u8C61");
|
|
333
|
+
return {
|
|
334
|
+
available: flag(value.available, "\u6536\u5C3E\u6838\u9A8C\u662F\u5426\u53EF\u7528"),
|
|
335
|
+
checks: count(value.checks, "\u6536\u5C3E\u6838\u9A8C\u6B21\u6570"),
|
|
336
|
+
continuations: count(value.continuations, "\u4EFB\u52A1\u7EED\u529E\u6B21\u6570"),
|
|
337
|
+
requestRetries: count(value.requestRetries, "\u8BF7\u6C42\u91CD\u8BD5\u6B21\u6570"),
|
|
338
|
+
...record(last) ? { last: { at: isoTime(last.at, "\u6536\u5C3E\u6838\u9A8C\u65F6\u95F4"), decision: member(last.decision, REVIEW_DECISIONS, "\u6536\u5C3E\u6838\u9A8C\u51B3\u5B9A"), reason: member(last.reason, REVIEW_REASONS, "\u6536\u5C3E\u6838\u9A8C\u539F\u56E0") } } : {}
|
|
339
|
+
};
|
|
340
|
+
}
|
|
314
341
|
function parseStartLoginRequest(value) {
|
|
315
342
|
if (!record(value)) throw new Error("\u767B\u5F55\u8BF7\u6C42\u5FC5\u987B\u662F\u5BF9\u8C61");
|
|
316
343
|
return { expectedRevision: text(value.expectedRevision, "\u914D\u7F6E\u7248\u672C", MAX_REVISION) };
|
package/lib/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Context } from '@deepseek-ai/cordis';
|
|
2
2
|
import { TypertRemoteService } from '@deepseek-ai/dsh-typert-protocol';
|
|
3
|
+
import type { TurnMonitorStatus } from './turn-monitor-status.js';
|
|
3
4
|
import { fetchModelCatalog } from './model-discovery.js';
|
|
4
5
|
import { fetchPricingSnapshot } from './pricing.js';
|
|
5
6
|
import type { CatalogModel } from './catalog.js';
|
|
@@ -41,6 +42,7 @@ export declare class OpenDesignCoRouterService extends TypertRemoteService {
|
|
|
41
42
|
private _quotaPending;
|
|
42
43
|
private _quotaController;
|
|
43
44
|
guardedTurns: number;
|
|
45
|
+
turnMonitorStatus: (() => TurnMonitorStatus) | undefined;
|
|
44
46
|
private _models;
|
|
45
47
|
private _modelsUpdatedAt;
|
|
46
48
|
private _modelsError;
|