@botlearn-course/daemon 0.0.32-beta.1 → 0.0.32-beta.3
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 +58 -8
- package/dist/agent-service-sandbox.d.ts +9 -0
- package/dist/agent-service-sandbox.js +58 -4
- package/dist/model-credential-relay.d.ts +54 -0
- package/dist/model-credential-relay.js +270 -0
- package/dist/run-dispatcher.d.ts +1 -0
- package/dist/run-dispatcher.js +3 -0
- package/dist/runtimes/deepseek-tui.d.ts +45 -2
- package/dist/runtimes/deepseek-tui.js +536 -96
- package/dist/runtimes/engine.d.ts +2 -0
- package/dist/runtimes/engine.js +1 -0
- package/dist/runtimes/md-review-template.d.ts +2 -2
- package/dist/runtimes/md-review-template.js +2 -2
- package/dist/types.d.ts +2 -0
- package/package.json +1 -1
|
@@ -11,6 +11,16 @@ export interface DeepseekAdapterDeps {
|
|
|
11
11
|
spawnFn?: typeof spawn;
|
|
12
12
|
/** External servers must explicitly attest compatible progress tool events. */
|
|
13
13
|
progressEventMapping?: boolean;
|
|
14
|
+
/** 测试注入:冷线程预热上限;缺省为 THREAD_RESUME_PREWARM_TIMEOUT_MS。 */
|
|
15
|
+
threadPrewarmTimeoutMs?: number;
|
|
16
|
+
/** 测试注入:旧进程退出确认预算;缺省为 PROCESS_EXIT_CONFIRM_BUDGET_MS。 */
|
|
17
|
+
processExitBudgetMs?: number;
|
|
18
|
+
/** 测试注入:提交 turn/compact 取得 id 的窗口;缺省为 SUBMIT_TIMEOUT_MS。 */
|
|
19
|
+
submitTimeoutMs?: number;
|
|
20
|
+
}
|
|
21
|
+
export declare class DeepseekProcessNotReleasedError extends Error {
|
|
22
|
+
readonly errorCode = "runtime_previous_process_not_released";
|
|
23
|
+
constructor();
|
|
14
24
|
}
|
|
15
25
|
/** 解析 PATH 上的 `deepseek` dispatcher CLI。 */
|
|
16
26
|
export declare function resolveDeepseekCommand(deps?: ProbeDeps): string | null;
|
|
@@ -30,19 +40,27 @@ export declare class DeepseekTuiAdapter implements EngineAdapter {
|
|
|
30
40
|
private readonly explicitAuthToken;
|
|
31
41
|
private readonly fetchFn;
|
|
32
42
|
private readonly spawnFn;
|
|
43
|
+
private readonly threadPrewarmTimeoutMs;
|
|
44
|
+
private readonly processExitBudgetMs;
|
|
45
|
+
private readonly submitTimeoutMs;
|
|
33
46
|
readonly progressEventMappingEnabled: boolean;
|
|
34
47
|
readonly progressPromptInjectionEnabled: boolean;
|
|
35
48
|
private resolvedBinary;
|
|
49
|
+
private readonly runtimeVersions;
|
|
36
50
|
constructor(deps?: DeepseekAdapterDeps);
|
|
37
51
|
run(opts: EngineRunOptions): Promise<EngineRunResult>;
|
|
38
52
|
private resolveBinary;
|
|
39
53
|
private acquireHandle;
|
|
54
|
+
private spawnHandle;
|
|
55
|
+
private readExternalToolsCapability;
|
|
56
|
+
private runtimeVersion;
|
|
40
57
|
/**
|
|
41
58
|
* BYOA continues to use the user's default DeepSeek state directory. Managed mode
|
|
42
|
-
* pins the durable RuntimeThreadStore to the RuntimeSession workspace
|
|
43
|
-
* the
|
|
59
|
+
* pins the durable RuntimeThreadStore to the RuntimeSession workspace; the process
|
|
60
|
+
* holds only the daemon relay's local token, never a model grant.
|
|
44
61
|
*/
|
|
45
62
|
private spawnEnv;
|
|
63
|
+
private managedRuntimeDirPath;
|
|
46
64
|
private prepareManagedRuntimeDir;
|
|
47
65
|
private compactionMarkerPath;
|
|
48
66
|
private compactionRequired;
|
|
@@ -50,6 +68,13 @@ export declare class DeepseekTuiAdapter implements EngineAdapter {
|
|
|
50
68
|
private clearCompactionRequired;
|
|
51
69
|
private managedActivationId;
|
|
52
70
|
private createThread;
|
|
71
|
+
/**
|
|
72
|
+
* Loads an existing thread into a server process that has not touched it yet. Cold
|
|
73
|
+
* history rebuilding can take longer than the short compact/turn submit timeouts, so it
|
|
74
|
+
* runs here under the run signal plus a fixed cap. A missing
|
|
75
|
+
* thread keeps its HTTP status so the caller's missing-thread fallback still applies.
|
|
76
|
+
*/
|
|
77
|
+
private prewarmThread;
|
|
53
78
|
private logAppliedServerPrompt;
|
|
54
79
|
private patchThreadSettings;
|
|
55
80
|
private compactThread;
|
|
@@ -57,8 +82,26 @@ export declare class DeepseekTuiAdapter implements EngineAdapter {
|
|
|
57
82
|
private startTurnAndReadEvents;
|
|
58
83
|
private interruptTurn;
|
|
59
84
|
private readEvents;
|
|
85
|
+
private submitWithTimeout;
|
|
60
86
|
private requestJson;
|
|
61
87
|
}
|
|
88
|
+
/**
|
|
89
|
+
* Releases the server process owned by `sessionKey` (any process when null) and confirms
|
|
90
|
+
* that every stopped process has exited. Called by the RuntimeSession owner on session
|
|
91
|
+
* change or close, drain, shutdown and generation change. False means a process may still
|
|
92
|
+
* hold the runtime lock; it stays tracked and blocks the next spawn.
|
|
93
|
+
*/
|
|
94
|
+
export declare function releaseDeepseekRuntime(sessionKey: string | null, budgetMs?: number): Promise<boolean>;
|
|
95
|
+
/**
|
|
96
|
+
* Stops the managed server left by a previous daemon process (crash or SIGKILL), before
|
|
97
|
+
* this daemon starts any server. Only the recorded server process group is signalled, and
|
|
98
|
+
* only while its leader still has the recorded start time; learner commands run in their own
|
|
99
|
+
* process groups. Returns false when that group does not confirm exit; it then stays tracked
|
|
100
|
+
* and blocks every spawn, like any unconfirmed replacement.
|
|
101
|
+
*/
|
|
102
|
+
export declare function reapPreviousDeepseekRuntime(budgetMs?: number): Promise<boolean>;
|
|
103
|
+
/** 仅测试用:替换进程启动时间读取(非 Linux 测试机没有 /proc)。 */
|
|
104
|
+
export declare function __setProcessStartTimeForTests(fn: ((pid: number) => string | null) | null): void;
|
|
62
105
|
/** 仅测试用:清空进程池。 */
|
|
63
106
|
export declare function __resetDeepseekTuiPoolForTests(): void;
|
|
64
107
|
/** Accept both OpenAI-compatible and canonical usage fields from terminal SSE frames. */
|