dsh-opendesign-corouter 0.1.14 → 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.
- package/README.md +3 -3
- package/lib/client.d.ts +11 -0
- package/lib/client.js +132 -4
- package/lib/config.d.ts +6 -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 +20 -1
- package/lib/generated/typert.remote-client.js +20 -1
- package/lib/index.d.ts +2 -0
- package/lib/index.js +441 -33
- package/lib/index.js.map +4 -4
- package/lib/remote.d.ts +4 -0
- package/lib/turn-monitor-status.d.ts +16 -0
- package/lib/turn-monitor.d.ts +99 -0
- package/package.json +1 -1
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";
|
|
@@ -20,6 +21,8 @@ export interface StatusConfig {
|
|
|
20
21
|
streamIdleTimeoutMs?: number;
|
|
21
22
|
quotaRefreshSeconds?: number;
|
|
22
23
|
maxRequestImageBytes?: number;
|
|
24
|
+
turnReviewMaxContinuations?: number;
|
|
25
|
+
turnReviewNoProgressLimit?: number;
|
|
23
26
|
}
|
|
24
27
|
/** One selectable model; `group` selects which of the two Providers owns it. */
|
|
25
28
|
export interface StatusModel {
|
|
@@ -78,6 +81,7 @@ export interface Status {
|
|
|
78
81
|
config: StatusConfig;
|
|
79
82
|
/** Turns the empty-turn guard actually intercepted since process start. */
|
|
80
83
|
guardedTurns: number;
|
|
84
|
+
turnMonitor?: TurnMonitorStatus;
|
|
81
85
|
models: readonly StatusModel[];
|
|
82
86
|
modelsSource?: 'builtin' | 'openai';
|
|
83
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 {};
|