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/model-settings.d.ts
CHANGED
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
* - 错误文字固定,不回显设置值或模型 ID。
|
|
13
13
|
*/
|
|
14
14
|
import type { CatalogModel } from './catalog.js';
|
|
15
|
-
|
|
15
|
+
import { type ContextWindowPresetId } from './context-budget.js';
|
|
16
|
+
/** One model's overrides; absent context uses the default working-window preset. */
|
|
16
17
|
export interface ModelSettings {
|
|
17
18
|
/** 是否出现在模型选择器;缺省视为启用。 */
|
|
18
19
|
enabled?: boolean;
|
|
@@ -24,8 +25,10 @@ export interface ModelSettings {
|
|
|
24
25
|
topP?: number;
|
|
25
26
|
/** 单次输出上限;覆盖目录行的 maxOutputTokens。 */
|
|
26
27
|
maxTokens?: number;
|
|
27
|
-
/**
|
|
28
|
+
/** 旧版自定义总窗口;数值原样保留,不按档位解释。 */
|
|
28
29
|
contextWindow?: number;
|
|
30
|
+
/** 总窗口档位;与旧 contextWindow 数值互斥,缺省使用默认档。 */
|
|
31
|
+
contextTier?: ContextWindowPresetId;
|
|
29
32
|
/** 思考深度;只允许目录同一套档位。 */
|
|
30
33
|
reasoningEffort?: string;
|
|
31
34
|
}
|
|
@@ -38,8 +41,8 @@ export type ModelSettingsMap = Record<string, ModelSettings>;
|
|
|
38
41
|
*/
|
|
39
42
|
export declare function parseModelSettingsMap(value: unknown): ModelSettingsMap;
|
|
40
43
|
/**
|
|
41
|
-
* Copy a catalog row
|
|
42
|
-
*
|
|
44
|
+
* Copy a catalog row, resolve the working window, and apply explicit output/image
|
|
45
|
+
* overrides. Catalog references remain unchanged; sampling/effort belong to requests.
|
|
43
46
|
*/
|
|
44
47
|
export declare function applyModelSettings(row: CatalogModel, settings?: ModelSettings): CatalogModel;
|
|
45
48
|
/** A model is selectable unless the map explicitly disables it; unknown ids and an absent map stay enabled. */
|
package/lib/remote.d.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import type { QuotaSnapshot, SessionSource } from './quota.js';
|
|
3
3
|
import { type ApiProtocol } from './protocol-options.js';
|
|
4
4
|
import { type ModelSettingsMap } from './model-settings.js';
|
|
5
|
+
import { type TurnMonitorStatus } from './turn-monitor-status.js';
|
|
5
6
|
export type { QuotaSnapshot, QuotaWindow, SessionSource } from './quota.js';
|
|
6
7
|
/** npm package that owns the Remote methods; must satisfy typert's segment rules. */
|
|
7
8
|
export declare const REMOTE_PACKAGE = "dsh-opendesign-corouter";
|
|
@@ -10,6 +11,8 @@ export declare const REMOTE_SERVICE = "openDesignCoRouter";
|
|
|
10
11
|
/** Live switches of this plugin, mirrored for a settings page that only has this RPC. */
|
|
11
12
|
export interface StatusConfig {
|
|
12
13
|
emptyTurnGuard: boolean;
|
|
14
|
+
/** Opt-in completion handshake; absent on a Host that predates it. */
|
|
15
|
+
turnCompletionReview?: boolean;
|
|
13
16
|
useDesktopCredential: boolean;
|
|
14
17
|
baseURL: string;
|
|
15
18
|
/** Credential reference name (an env var or a DSH credential ref), never the value. */
|
|
@@ -20,6 +23,8 @@ export interface StatusConfig {
|
|
|
20
23
|
streamIdleTimeoutMs?: number;
|
|
21
24
|
quotaRefreshSeconds?: number;
|
|
22
25
|
maxRequestImageBytes?: number;
|
|
26
|
+
turnReviewMaxContinuations?: number;
|
|
27
|
+
turnReviewNoProgressLimit?: number;
|
|
23
28
|
}
|
|
24
29
|
/** One selectable model; `group` selects which of the two Providers owns it. */
|
|
25
30
|
export interface StatusModel {
|
|
@@ -78,6 +83,7 @@ export interface Status {
|
|
|
78
83
|
config: StatusConfig;
|
|
79
84
|
/** Turns the empty-turn guard actually intercepted since process start. */
|
|
80
85
|
guardedTurns: number;
|
|
86
|
+
turnMonitor?: TurnMonitorStatus;
|
|
81
87
|
models: readonly StatusModel[];
|
|
82
88
|
modelsSource?: 'builtin' | 'openai';
|
|
83
89
|
modelsUpdatedAt?: string;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** Credential-free monitor diagnostics shared with settings. Counters reset on plugin reload. */
|
|
2
|
+
export declare const REVIEW_DECISIONS: readonly ["continued", "completed", "waiting-user", "waiting-work", "blocked", "limited", "skipped", "unverified"];
|
|
3
|
+
export type ReviewDecision = typeof REVIEW_DECISIONS[number];
|
|
4
|
+
export declare const REVIEW_REASONS: readonly ["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"];
|
|
5
|
+
export type ReviewReason = typeof REVIEW_REASONS[number];
|
|
6
|
+
export interface TurnMonitorStatus {
|
|
7
|
+
available: boolean;
|
|
8
|
+
checks: number;
|
|
9
|
+
continuations: number;
|
|
10
|
+
requestRetries: number;
|
|
11
|
+
last?: {
|
|
12
|
+
at: string;
|
|
13
|
+
decision: ReviewDecision;
|
|
14
|
+
reason: ReviewReason;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
2
|
+
import { type ContentBlock, type MessageId, type ToolSchema, type UserMessage } from '@deepseek-ai/dsh-llm';
|
|
3
|
+
import { type RuntimeConfig } from './config.js';
|
|
4
|
+
import type { TurnMonitorStatus } from './turn-monitor-status.js';
|
|
5
|
+
export declare const FINISH_TURN_TOOL = "opendesign_finish_turn";
|
|
6
|
+
declare module '@deepseek-ai/dsh-llm' {
|
|
7
|
+
interface MessageSourceMap {
|
|
8
|
+
'opendesign-review': {
|
|
9
|
+
kind: 'opendesign-review';
|
|
10
|
+
turn: number;
|
|
11
|
+
checkpoint: number;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
/** Optional Core services are consumed structurally so provider-only compositions need no Agent dependencies. */
|
|
16
|
+
export interface MonitorSession {
|
|
17
|
+
readonly id: string;
|
|
18
|
+
requestHeader(): {
|
|
19
|
+
config: {
|
|
20
|
+
provider: string;
|
|
21
|
+
model: string;
|
|
22
|
+
};
|
|
23
|
+
tools?: readonly ToolSchema[];
|
|
24
|
+
} | undefined;
|
|
25
|
+
}
|
|
26
|
+
export interface MonitorAgent {
|
|
27
|
+
readonly id: string;
|
|
28
|
+
readonly session: MonitorSession;
|
|
29
|
+
readonly ctx: Context;
|
|
30
|
+
readonly status: string;
|
|
31
|
+
readonly inbox: {
|
|
32
|
+
readonly nextStep: readonly UserMessage[];
|
|
33
|
+
readonly nextTurn: readonly UserMessage[];
|
|
34
|
+
remove(id: MessageId): boolean;
|
|
35
|
+
};
|
|
36
|
+
steer(message: UserMessage): void;
|
|
37
|
+
}
|
|
38
|
+
export interface MonitorToolExecution {
|
|
39
|
+
readonly name: string;
|
|
40
|
+
readonly callId: string;
|
|
41
|
+
readonly rootCallId?: string;
|
|
42
|
+
readonly agent?: MonitorAgent;
|
|
43
|
+
readonly signal: AbortSignal;
|
|
44
|
+
concludeTurn(): void;
|
|
45
|
+
}
|
|
46
|
+
export interface MonitorToolDefinition extends ToolSchema {
|
|
47
|
+
output: {
|
|
48
|
+
schema: Record<string, unknown>;
|
|
49
|
+
render(args: unknown, value: unknown): ContentBlock[];
|
|
50
|
+
};
|
|
51
|
+
execute(args: unknown, exec: MonitorToolExecution): Promise<unknown>;
|
|
52
|
+
}
|
|
53
|
+
interface LogEvent {
|
|
54
|
+
seq: number;
|
|
55
|
+
type: string;
|
|
56
|
+
data: unknown;
|
|
57
|
+
}
|
|
58
|
+
interface StreamFrame {
|
|
59
|
+
type: string;
|
|
60
|
+
turn?: number;
|
|
61
|
+
chunk?: {
|
|
62
|
+
type: string;
|
|
63
|
+
reason?: {
|
|
64
|
+
kind: string;
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
/** Per-turn completion handshake. It never executes, retries, or replays a business tool. */
|
|
69
|
+
export declare class TurnMonitor {
|
|
70
|
+
#private;
|
|
71
|
+
readonly ctx: Context;
|
|
72
|
+
readonly config: () => RuntimeConfig;
|
|
73
|
+
readonly now: () => number;
|
|
74
|
+
constructor(ctx: Context, config: () => RuntimeConfig, now?: () => number);
|
|
75
|
+
status(): TurnMonitorStatus;
|
|
76
|
+
requestRetried(): void;
|
|
77
|
+
configurationChanged(): void;
|
|
78
|
+
dispose(): void;
|
|
79
|
+
readonly observe: (session: MonitorSession, event: LogEvent) => void;
|
|
80
|
+
readonly stream: ({ agent, frame }: {
|
|
81
|
+
agent: MonitorAgent;
|
|
82
|
+
frame: StreamFrame;
|
|
83
|
+
}) => void;
|
|
84
|
+
readonly toolResult: (exec: MonitorToolExecution, result: {
|
|
85
|
+
isError: boolean;
|
|
86
|
+
value?: unknown;
|
|
87
|
+
concludesTurn?: true;
|
|
88
|
+
}) => void;
|
|
89
|
+
readonly stopping: ({ agent, turn, signal }: {
|
|
90
|
+
agent: MonitorAgent;
|
|
91
|
+
turn: number;
|
|
92
|
+
signal: AbortSignal;
|
|
93
|
+
}) => void;
|
|
94
|
+
readonly disposedAgent: ({ agent }: {
|
|
95
|
+
agent: MonitorAgent;
|
|
96
|
+
}) => void;
|
|
97
|
+
}
|
|
98
|
+
export declare function installTurnMonitor(ctx: Context, config: () => RuntimeConfig): TurnMonitor;
|
|
99
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-opendesign-corouter",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.16",
|
|
4
4
|
"description": "OpenDesign CoRouter:套餐赠送与付费模型双 Provider、桌面登录态额度及独立登录",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -63,6 +63,8 @@
|
|
|
63
63
|
"inject": [
|
|
64
64
|
"@deepseek-ai/dsh-client-ui-settings",
|
|
65
65
|
"@deepseek-ai/dsh-client-ui-slots",
|
|
66
|
+
"@deepseek-ai/dsh-client-ui-conversation",
|
|
67
|
+
"@deepseek-ai/dsh-client-ui-model-selection",
|
|
66
68
|
"@deepseek-ai/dsh-api-remotes"
|
|
67
69
|
]
|
|
68
70
|
}
|