dsh-opendesign-corouter 0.1.13 → 0.1.15

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.
@@ -6,7 +6,7 @@
6
6
  * `redirect: 'error'`,20 秒上限,响应体上限 2 MiB。
7
7
  * - 与推理协议解耦:本函数不接受 protocol 参数,也不根据协议挑选路径。
8
8
  * - 归一化只接受 `data[]` 中可用且有界的 id;已知 id 继承 catalog 的分组与能力,
9
- * 新 id 一律归 `paid` 且**不**凭名称推断能力(未识别的上游能力字段直接忽略)。
9
+ * 新 id 归 `paid`。显式上下文容量只作为保守参考,不凭名称推断能力。
10
10
  * - 媒体输出模型(图像/视频/语音,走 `/api/v1/media/*`)不进对话目录。
11
11
  * - 所有失败折叠为 `ModelDiscoveryError` 的固定分类与固定文字,不回显凭据、
12
12
  * 请求头或响应体。
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";
@@ -19,6 +20,9 @@ export interface StatusConfig {
19
20
  requestTimeoutMs?: number;
20
21
  streamIdleTimeoutMs?: number;
21
22
  quotaRefreshSeconds?: number;
23
+ maxRequestImageBytes?: number;
24
+ turnReviewMaxContinuations?: number;
25
+ turnReviewNoProgressLimit?: number;
22
26
  }
23
27
  /** One selectable model; `group` selects which of the two Providers owns it. */
24
28
  export interface StatusModel {
@@ -77,6 +81,7 @@ export interface Status {
77
81
  config: StatusConfig;
78
82
  /** Turns the empty-turn guard actually intercepted since process start. */
79
83
  guardedTurns: number;
84
+ turnMonitor?: TurnMonitorStatus;
80
85
  models: readonly StatusModel[];
81
86
  modelsSource?: 'builtin' | 'openai';
82
87
  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.13",
3
+ "version": "0.1.15",
4
4
  "description": "OpenDesign CoRouter:套餐赠送与付费模型双 Provider、桌面登录态额度及独立登录",
5
5
  "type": "module",
6
6
  "license": "MIT",