@listdoing/core 0.1.5 → 0.2.0
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/dist/index.d.mts +160 -27
- package/dist/index.d.ts +160 -27
- package/dist/index.js +1232 -517
- package/dist/index.mjs +1222 -517
- package/package.json +5 -2
package/dist/index.d.ts
CHANGED
|
@@ -143,6 +143,8 @@ interface SkillDefinition {
|
|
|
143
143
|
parallelSafe?: boolean;
|
|
144
144
|
tier?: SkillTier;
|
|
145
145
|
timeout?: number;
|
|
146
|
+
/** Opt in only for handlers whose late side effects are controlled by the host. */
|
|
147
|
+
timeoutMode?: 'cooperative' | 'deadline';
|
|
146
148
|
/** Direct handler (execution mode: call) */
|
|
147
149
|
handler?: SkillHandler;
|
|
148
150
|
/** Agent-based skill: model autonomously loops using tools */
|
|
@@ -242,6 +244,19 @@ interface WorkflowProgress {
|
|
|
242
244
|
failedSteps: string[];
|
|
243
245
|
}
|
|
244
246
|
interface LLMAdapterConfig {
|
|
247
|
+
/** Disabled by default. Covers headers, response body and retry delays. */
|
|
248
|
+
requestTimeoutMs?: number;
|
|
249
|
+
/** Disabled by default. Maximum wait between streaming chunks. */
|
|
250
|
+
streamIdleTimeoutMs?: number;
|
|
251
|
+
/** Opt in for providers that reliably emit finish_reason or [DONE]. */
|
|
252
|
+
strictStream?: boolean;
|
|
253
|
+
/** Opt in to provider-reported prompt cache usage. Streaming requests may include stream_options. */
|
|
254
|
+
collectPromptCacheUsage?: boolean;
|
|
255
|
+
/** Retries only HTTP 429/502/503/504 before consuming a response. Default: no retries. */
|
|
256
|
+
retry?: {
|
|
257
|
+
maxRetries?: number;
|
|
258
|
+
baseDelayMs?: number;
|
|
259
|
+
};
|
|
245
260
|
adapter: 'openai' | 'anthropic' | 'ollama' | 'custom';
|
|
246
261
|
model: string;
|
|
247
262
|
baseUrl?: string;
|
|
@@ -268,12 +283,20 @@ interface StandardLLMResponse {
|
|
|
268
283
|
input: number;
|
|
269
284
|
output: number;
|
|
270
285
|
};
|
|
286
|
+
promptCacheUsage?: PromptCacheUsage;
|
|
271
287
|
finishReason?: string;
|
|
272
288
|
}
|
|
289
|
+
interface PromptCacheUsage {
|
|
290
|
+
inputTokens?: number;
|
|
291
|
+
cachedTokens?: number;
|
|
292
|
+
cacheWriteTokens?: number;
|
|
293
|
+
}
|
|
273
294
|
interface ToolCall {
|
|
274
295
|
id: string;
|
|
275
296
|
name: string;
|
|
276
297
|
arguments: Record<string, any>;
|
|
298
|
+
/** Adapter detected invalid arguments; the handler must not be invoked. */
|
|
299
|
+
parseError?: string;
|
|
277
300
|
}
|
|
278
301
|
interface ToolDef {
|
|
279
302
|
name: string;
|
|
@@ -322,7 +345,16 @@ interface Session {
|
|
|
322
345
|
systemPrompt?: string;
|
|
323
346
|
messages: Message[];
|
|
324
347
|
}
|
|
348
|
+
/** Instructions and local tools scoped to one chat invocation. */
|
|
349
|
+
interface ChatRunContext {
|
|
350
|
+
systemPromptSuffix?: string;
|
|
351
|
+
skills?: readonly SkillDefinition[];
|
|
352
|
+
}
|
|
325
353
|
interface ChatOptions {
|
|
354
|
+
/** Optional, transient context. It is not written to the session. */
|
|
355
|
+
runContext?: ChatRunContext;
|
|
356
|
+
/** Optional parent cancellation, also used by nested tasks. */
|
|
357
|
+
signal?: AbortSignal;
|
|
326
358
|
sessionId?: string;
|
|
327
359
|
requireApproval?: string[];
|
|
328
360
|
/** Skip all approval checks for this chat call (overrides everything) */
|
|
@@ -356,6 +388,7 @@ interface ChatOptions {
|
|
|
356
388
|
_skipLock?: boolean;
|
|
357
389
|
}
|
|
358
390
|
interface ChatResult {
|
|
391
|
+
terminationReason?: 'stop' | 'max_turns' | 'cancelled';
|
|
359
392
|
reply: string;
|
|
360
393
|
sessionId: string;
|
|
361
394
|
executionTrace: ExecutionTrace[];
|
|
@@ -510,13 +543,31 @@ type StreamEvent = {
|
|
|
510
543
|
output: number;
|
|
511
544
|
};
|
|
512
545
|
totalDuration: number;
|
|
546
|
+
terminationReason?: 'stop' | 'max_turns' | 'cancelled';
|
|
513
547
|
} | {
|
|
514
548
|
type: 'error';
|
|
515
549
|
code: number;
|
|
516
550
|
message: string;
|
|
517
551
|
};
|
|
552
|
+
type LLMProxyMode = 'backend' | 'listdoing-server';
|
|
553
|
+
type McpConnectionStatus = 'not-configured' | 'unchecked' | 'connected' | 'failed';
|
|
554
|
+
interface LLMRouteStatus {
|
|
555
|
+
mode: LLMProxyMode | 'legacy';
|
|
556
|
+
endpoint: string;
|
|
557
|
+
verified: boolean;
|
|
558
|
+
}
|
|
518
559
|
interface LdoingConfig {
|
|
560
|
+
/** Observability only: exceptions in this callback never interrupt the agent. */
|
|
561
|
+
onDiagnostic?: (event: {
|
|
562
|
+
kind: string;
|
|
563
|
+
sessionId?: string;
|
|
564
|
+
message: string;
|
|
565
|
+
model?: string;
|
|
566
|
+
promptCacheUsage?: PromptCacheUsage;
|
|
567
|
+
}) => void;
|
|
519
568
|
llm: LLMAdapterConfig;
|
|
569
|
+
/** Opt in to explicit proxy routing. Omit to keep legacy routing. */
|
|
570
|
+
llmProxyMode?: LLMProxyMode;
|
|
520
571
|
serverUrl?: string;
|
|
521
572
|
authToken?: string;
|
|
522
573
|
/** Custom headers sent on every request (health, MCP, LLM) */
|
|
@@ -558,6 +609,8 @@ interface ContextConfig {
|
|
|
558
609
|
syncToServer?: boolean;
|
|
559
610
|
}
|
|
560
611
|
interface SkillsConfig {
|
|
612
|
+
/** Opt-in JSON Schema validation; legacy definitions remain accepted by default. */
|
|
613
|
+
validateInputs?: boolean;
|
|
561
614
|
loadDefaults?: boolean;
|
|
562
615
|
disable?: string[];
|
|
563
616
|
enable?: string[];
|
|
@@ -572,6 +625,8 @@ interface LimitsConfig {
|
|
|
572
625
|
interface InitResult {
|
|
573
626
|
agentId: string;
|
|
574
627
|
mode: 'local' | 'remote' | 'hybrid';
|
|
628
|
+
llmRoute?: LLMRouteStatus;
|
|
629
|
+
mcpStatus?: McpConnectionStatus;
|
|
575
630
|
llm: {
|
|
576
631
|
connected: boolean;
|
|
577
632
|
provider: string;
|
|
@@ -598,7 +653,9 @@ interface ILLMAdapter {
|
|
|
598
653
|
}): AsyncIterable<StreamEvent>;
|
|
599
654
|
}
|
|
600
655
|
interface ITransport {
|
|
601
|
-
send(method: string, params: any
|
|
656
|
+
send(method: string, params: any, options?: {
|
|
657
|
+
signal?: AbortSignal;
|
|
658
|
+
}): Promise<any>;
|
|
602
659
|
notify(method: string, params: any): void;
|
|
603
660
|
}
|
|
604
661
|
interface IPersistence {
|
|
@@ -714,6 +771,7 @@ declare const ACPErrorCodes: {
|
|
|
714
771
|
readonly LLM_CALL_FAILED: -32130;
|
|
715
772
|
readonly LLM_EMPTY_RESPONSE: -32135;
|
|
716
773
|
readonly LLM_TOKEN_LIMIT: -32131;
|
|
774
|
+
readonly LLM_PROXY_CONFIG_INVALID: -32136;
|
|
717
775
|
readonly LLM_RATE_LIMIT: -32132;
|
|
718
776
|
readonly LLM_PROVIDER_UNAVAILABLE: -32133;
|
|
719
777
|
readonly TOKEN_BUDGET_EXCEEDED: -32134;
|
|
@@ -753,11 +811,19 @@ declare class ACPError extends Error {
|
|
|
753
811
|
* Works with OpenAI, OneAPI, FastGPT, Azure OpenAI, and any compatible proxy.
|
|
754
812
|
*/
|
|
755
813
|
declare class OpenAIAdapter implements ILLMAdapter {
|
|
814
|
+
private options?;
|
|
756
815
|
private config;
|
|
757
816
|
private contentAdapter;
|
|
758
|
-
|
|
817
|
+
private verified;
|
|
818
|
+
constructor(config: LLMAdapterConfig, options?: {
|
|
819
|
+
rejectRedirects?: boolean;
|
|
820
|
+
} | undefined);
|
|
759
821
|
private getBaseUrl;
|
|
760
822
|
private getEndpoint;
|
|
823
|
+
getConnectionStatus(): {
|
|
824
|
+
endpoint: string;
|
|
825
|
+
verified: boolean;
|
|
826
|
+
};
|
|
761
827
|
private buildHeaders;
|
|
762
828
|
private messagesToOpenAI;
|
|
763
829
|
private toolsToOpenAI;
|
|
@@ -772,12 +838,19 @@ declare class OpenAIAdapter implements ILLMAdapter {
|
|
|
772
838
|
chatStream(messages: Message[], tools: ToolDef[], options?: {
|
|
773
839
|
signal?: AbortSignal;
|
|
774
840
|
}): AsyncGenerator<StreamEvent>;
|
|
841
|
+
private parseToolCall;
|
|
842
|
+
private createRequest;
|
|
843
|
+
private fetchResponse;
|
|
844
|
+
private readChunk;
|
|
775
845
|
/**
|
|
776
846
|
* Check if the error response indicates context length exceeded.
|
|
777
847
|
* Throws ACPError with CONTEXT_OVERFLOW code if detected.
|
|
778
848
|
*/
|
|
779
849
|
private checkContextOverflow;
|
|
850
|
+
/** AbortError for the given signal — used so a cancelled stream surfaces an abort, not a parse error. */
|
|
851
|
+
private throwIfAborted;
|
|
780
852
|
private parseResponse;
|
|
853
|
+
private parsePromptCacheUsage;
|
|
781
854
|
}
|
|
782
855
|
|
|
783
856
|
declare class SkillRegistry {
|
|
@@ -785,6 +858,8 @@ declare class SkillRegistry {
|
|
|
785
858
|
register(skill: SkillDefinition): void;
|
|
786
859
|
unregister(name: string): boolean;
|
|
787
860
|
get(name: string): SkillDefinition | undefined;
|
|
861
|
+
/** Identity of this registration, replaced on every register call. */
|
|
862
|
+
getRegistrationIdentity(skill: SkillDefinition): object;
|
|
788
863
|
getHandler(name: string): SkillHandler | undefined;
|
|
789
864
|
list(): SkillDefinition[];
|
|
790
865
|
listToolDefs(filter?: {
|
|
@@ -796,12 +871,17 @@ declare class SkillRegistry {
|
|
|
796
871
|
}
|
|
797
872
|
|
|
798
873
|
declare class SkillExecutor {
|
|
874
|
+
private options?;
|
|
799
875
|
private registry;
|
|
800
876
|
private worker;
|
|
801
|
-
|
|
877
|
+
private validators;
|
|
878
|
+
constructor(registry: SkillRegistry, worker?: SkillWorker, options?: {
|
|
879
|
+
validateInputs?: boolean;
|
|
880
|
+
} | undefined);
|
|
802
881
|
getWorker(): SkillWorker;
|
|
803
882
|
getRegistry(): SkillRegistry;
|
|
804
883
|
execute(name: string, params: Record<string, any>, context: SkillContext): Promise<SkillResult>;
|
|
884
|
+
private getValidator;
|
|
805
885
|
/**
|
|
806
886
|
* Directly invoke a skill by name — used by ctx.invoke().
|
|
807
887
|
* No LLM loop, no approval. Shares parent's signal and timeout context.
|
|
@@ -816,7 +896,9 @@ interface McpServerConnection {
|
|
|
816
896
|
name: string;
|
|
817
897
|
transport: 'stdio' | 'http';
|
|
818
898
|
toolDefs: ToolDef[];
|
|
819
|
-
call(toolName: string, args: Record<string, any
|
|
899
|
+
call(toolName: string, args: Record<string, any>, options?: {
|
|
900
|
+
signal?: AbortSignal;
|
|
901
|
+
}): Promise<any>;
|
|
820
902
|
disconnect(): Promise<void>;
|
|
821
903
|
}
|
|
822
904
|
/**
|
|
@@ -860,7 +942,9 @@ declare class McpRouter {
|
|
|
860
942
|
/**
|
|
861
943
|
* Route a tool call to the appropriate MCP Server.
|
|
862
944
|
*/
|
|
863
|
-
call(prefixedName: string, args: Record<string, any
|
|
945
|
+
call(prefixedName: string, args: Record<string, any>, options?: {
|
|
946
|
+
signal?: AbortSignal;
|
|
947
|
+
}): Promise<any>;
|
|
864
948
|
/**
|
|
865
949
|
* Resolve `mcp:` prefixed tool names from a tools list to ToolDef[].
|
|
866
950
|
* Non-mcp names are silently skipped.
|
|
@@ -872,6 +956,7 @@ declare class McpRouter {
|
|
|
872
956
|
isConnected(serverName: string): boolean;
|
|
873
957
|
}
|
|
874
958
|
|
|
959
|
+
type SessionMergeStrategy = 'full' | 'summary' | 'summary_and_artifacts';
|
|
875
960
|
declare class SessionManager {
|
|
876
961
|
private sessions;
|
|
877
962
|
create(options?: {
|
|
@@ -880,6 +965,7 @@ declare class SessionManager {
|
|
|
880
965
|
systemPrompt?: string;
|
|
881
966
|
}): Session;
|
|
882
967
|
get(sessionId: string): Session | undefined;
|
|
968
|
+
restore(session: Session): void;
|
|
883
969
|
getOrThrow(sessionId: string): Session;
|
|
884
970
|
list(options?: {
|
|
885
971
|
status?: string;
|
|
@@ -900,8 +986,9 @@ declare class SessionManager {
|
|
|
900
986
|
addMessage(sessionId: string, message: Message): void;
|
|
901
987
|
delete(sessionId: string): boolean;
|
|
902
988
|
archive(sessionId: string): void;
|
|
903
|
-
merge(fromId: string, toId: string, strategy?:
|
|
904
|
-
|
|
989
|
+
merge(fromId: string, toId: string, strategy?: SessionMergeStrategy): void;
|
|
990
|
+
static mergeContent(from: Session, to: Session, strategy?: SessionMergeStrategy): void;
|
|
991
|
+
private static createSummary;
|
|
905
992
|
}
|
|
906
993
|
|
|
907
994
|
/**
|
|
@@ -926,7 +1013,9 @@ interface CompressResult {
|
|
|
926
1013
|
interface EnsureContextFitsResult {
|
|
927
1014
|
messages: Message[];
|
|
928
1015
|
wasCompressed: boolean;
|
|
1016
|
+
/** Estimated full input before compression, including the system prompt and tools. */
|
|
929
1017
|
beforeTokens?: number;
|
|
1018
|
+
/** Estimated input of the request window built from the compressed messages. */
|
|
930
1019
|
afterTokens?: number;
|
|
931
1020
|
}
|
|
932
1021
|
declare class ContextManager {
|
|
@@ -952,6 +1041,10 @@ declare class ContextManager {
|
|
|
952
1041
|
* summarization (when a summarizer is set and enabled) over mechanical truncation.
|
|
953
1042
|
*/
|
|
954
1043
|
ensureContextFits(messages: Message[], systemPrompt: string | undefined, tools: ToolDef[], model?: string, signal?: AbortSignal): Promise<EnsureContextFitsResult>;
|
|
1044
|
+
/** Build one smaller request after a provider rejects the current window. */
|
|
1045
|
+
compressForOverflow(messages: Message[], rejected: BuildWindowResult, systemPrompt: string, tools: ToolDef[], signal: AbortSignal): Promise<(CompressResult & {
|
|
1046
|
+
window: BuildWindowResult;
|
|
1047
|
+
}) | undefined>;
|
|
955
1048
|
/**
|
|
956
1049
|
* Compress context by summarizing older messages. When strategy is
|
|
957
1050
|
* 'llm_summary' (or resolved via config) it uses the injected summarizer,
|
|
@@ -1049,12 +1142,16 @@ declare class HttpTransport implements ITransport {
|
|
|
1049
1142
|
setSessionId(id: string): void;
|
|
1050
1143
|
setAuthToken(token: string): void;
|
|
1051
1144
|
private buildHeaders;
|
|
1052
|
-
send(method: string, params: any
|
|
1145
|
+
send(method: string, params: any, options?: {
|
|
1146
|
+
signal?: AbortSignal;
|
|
1147
|
+
}): Promise<any>;
|
|
1053
1148
|
notify(method: string, params: any): void;
|
|
1054
1149
|
/**
|
|
1055
1150
|
* Stream a chat request via SSE.
|
|
1056
1151
|
*/
|
|
1057
|
-
streamChat(method: string, params: any
|
|
1152
|
+
streamChat(method: string, params: any, options?: {
|
|
1153
|
+
signal?: AbortSignal;
|
|
1154
|
+
}): AsyncGenerator<{
|
|
1058
1155
|
method: string;
|
|
1059
1156
|
params: any;
|
|
1060
1157
|
} | {
|
|
@@ -1070,6 +1167,8 @@ declare class Ldoing {
|
|
|
1070
1167
|
private agentId;
|
|
1071
1168
|
private initialized;
|
|
1072
1169
|
private startTime;
|
|
1170
|
+
private mcpStatus;
|
|
1171
|
+
private discoveredServerSkills;
|
|
1073
1172
|
protected llmAdapter: OpenAIAdapter;
|
|
1074
1173
|
protected skillRegistry: SkillRegistry;
|
|
1075
1174
|
protected skillExecutor: SkillExecutor;
|
|
@@ -1080,45 +1179,45 @@ declare class Ldoing {
|
|
|
1080
1179
|
protected persistence: IPersistence;
|
|
1081
1180
|
private currentSessionId;
|
|
1082
1181
|
private abortControllers;
|
|
1182
|
+
private runContexts;
|
|
1083
1183
|
private runningSessions;
|
|
1084
1184
|
private approvalResolvers;
|
|
1185
|
+
private sessionStorageQueues;
|
|
1186
|
+
private managingSessions;
|
|
1187
|
+
private compressingSessions;
|
|
1085
1188
|
private eventHandlers;
|
|
1086
1189
|
private tokenCalibrationRatio;
|
|
1087
1190
|
constructor(config: LdoingConfig);
|
|
1088
1191
|
init(): Promise<InitResult>;
|
|
1089
1192
|
destroy(): Promise<void>;
|
|
1090
1193
|
getStatus(): {
|
|
1091
|
-
agentId: string;
|
|
1092
|
-
mode: string;
|
|
1093
|
-
uptime: number;
|
|
1094
|
-
activeSessions: number;
|
|
1095
|
-
loadedSkills: number;
|
|
1096
1194
|
llm: {
|
|
1097
1195
|
adapter: "custom" | "openai" | "anthropic" | "ollama";
|
|
1098
1196
|
model: string;
|
|
1099
1197
|
connected: boolean;
|
|
1100
1198
|
};
|
|
1199
|
+
mcpStatus: McpConnectionStatus;
|
|
1200
|
+
llmRoute?: LLMRouteStatus;
|
|
1201
|
+
agentId: string;
|
|
1202
|
+
mode: string;
|
|
1203
|
+
uptime: number;
|
|
1204
|
+
activeSessions: number;
|
|
1205
|
+
loadedSkills: number;
|
|
1101
1206
|
};
|
|
1207
|
+
private getConnectionDetails;
|
|
1102
1208
|
chat(message: string | ContentBlock[], options?: ChatOptions): Promise<ChatResult>;
|
|
1103
1209
|
chatStream(message: string | ContentBlock[], options?: ChatOptions): AsyncGenerator<StreamEvent>;
|
|
1104
1210
|
abort(sessionId?: string): Promise<void>;
|
|
1105
1211
|
/**
|
|
1106
1212
|
* 在启动新的 agent loop 前获取会话锁。
|
|
1107
1213
|
* 根据并发策略处理正在运行的旧请求:
|
|
1108
|
-
* - 'abort' (默认):
|
|
1214
|
+
* - 'abort' (默认): 中止旧请求,等待其真正退出,发送前修复未配对消息,然后返回
|
|
1109
1215
|
* - 'reject': 若已有运行请求,抛错
|
|
1110
1216
|
* - 'queue': 预留,当前回退到 'abort'
|
|
1111
1217
|
*
|
|
1112
1218
|
* 返回一个 release 函数,agent loop 结束时必须调用以释放锁。
|
|
1113
1219
|
*/
|
|
1114
1220
|
private acquireSessionLock;
|
|
1115
|
-
/**
|
|
1116
|
-
* 清理被 abort 打断的半截消息:
|
|
1117
|
-
* 如果 session.messages 最后一条是 assistant 且带 tool_calls,
|
|
1118
|
-
* 但后面没有对应的 tool 消息,则删除这条 assistant。
|
|
1119
|
-
* 避免下次 LLM 调用因 tool_calls 未配对而报错。
|
|
1120
|
-
*/
|
|
1121
|
-
private cleanupInterruptedMessages;
|
|
1122
1221
|
approveTool(callId: string, approved: boolean, _reason?: string): void;
|
|
1123
1222
|
private waitForApproval;
|
|
1124
1223
|
registerSkill(skill: SkillDefinition): void;
|
|
@@ -1152,6 +1251,7 @@ declare class Ldoing {
|
|
|
1152
1251
|
title?: string;
|
|
1153
1252
|
meta?: Record<string, any>;
|
|
1154
1253
|
systemPrompt?: string;
|
|
1254
|
+
activate?: boolean;
|
|
1155
1255
|
}): Session;
|
|
1156
1256
|
getSession(sessionId: string): Session | undefined;
|
|
1157
1257
|
listSessions(options?: {
|
|
@@ -1172,7 +1272,22 @@ declare class Ldoing {
|
|
|
1172
1272
|
}[];
|
|
1173
1273
|
mergeSessions(fromId: string, toId: string, strategy?: 'full' | 'summary' | 'summary_and_artifacts'): void;
|
|
1174
1274
|
deleteSession(sessionId: string): void;
|
|
1275
|
+
private removeLiveSession;
|
|
1175
1276
|
archiveSession(sessionId: string): void;
|
|
1277
|
+
/** List committed history without loading it into the Agent. */
|
|
1278
|
+
listStoredSessions(options?: Parameters<IPersistence['listSessions']>[0]): Promise<Session[]>;
|
|
1279
|
+
/** Load one stored session on demand. A live session takes precedence. */
|
|
1280
|
+
restoreSession(sessionId: string, options?: {
|
|
1281
|
+
activate?: boolean;
|
|
1282
|
+
}): Promise<Session | null>;
|
|
1283
|
+
/** Archive a stored or live session, publishing the update after commit. */
|
|
1284
|
+
archiveStoredSession(sessionId: string): Promise<void>;
|
|
1285
|
+
/** Commit an idle session, then release its live copy. Restore it by ID when needed. */
|
|
1286
|
+
unloadSession(sessionId: string): Promise<boolean>;
|
|
1287
|
+
/** Merge history into the target session and commit the target. */
|
|
1288
|
+
mergeStoredSessions(fromId: string, toId: string, strategy?: SessionMergeStrategy): Promise<void>;
|
|
1289
|
+
/** Delete committed and live history, including when a chat save is pending. */
|
|
1290
|
+
deleteStoredSession(sessionId: string): Promise<void>;
|
|
1176
1291
|
getContext(sessionId: string, format?: 'messages' | 'summary' | 'window'): Message[] | string;
|
|
1177
1292
|
searchContext(query: string, options?: {
|
|
1178
1293
|
limit?: number;
|
|
@@ -1188,13 +1303,14 @@ declare class Ldoing {
|
|
|
1188
1303
|
afterTokens: number;
|
|
1189
1304
|
compressionRatio: number;
|
|
1190
1305
|
}>;
|
|
1306
|
+
private prepareOverflowRetry;
|
|
1191
1307
|
configure(config: Partial<LdoingConfig>): void;
|
|
1308
|
+
private configureProxy;
|
|
1192
1309
|
on(event: string, handler: EventHandler): void;
|
|
1193
1310
|
off(event: string, handler: EventHandler): void;
|
|
1194
1311
|
private emit;
|
|
1195
1312
|
/**
|
|
1196
|
-
*
|
|
1197
|
-
* Forwards llm_text events to the caller and collects the full StandardLLMResponse.
|
|
1313
|
+
* Forward streaming events, or emit the complete response for a non-streaming adapter.
|
|
1198
1314
|
*/
|
|
1199
1315
|
private streamLlmResponse;
|
|
1200
1316
|
/**
|
|
@@ -1218,12 +1334,26 @@ declare class Ldoing {
|
|
|
1218
1334
|
private planToolExecution;
|
|
1219
1335
|
private processApprovalQueue;
|
|
1220
1336
|
private executeToolBatch;
|
|
1337
|
+
private streamToolBatch;
|
|
1221
1338
|
private executeToolBatchStream;
|
|
1222
1339
|
/**
|
|
1223
1340
|
* Execute a tool call, routing mcp: prefixed tools to McpRouter.
|
|
1224
1341
|
*/
|
|
1225
1342
|
private executeToolCall;
|
|
1343
|
+
private prepareRunContext;
|
|
1344
|
+
private buildRunSystemPrompt;
|
|
1345
|
+
private listRunTools;
|
|
1346
|
+
private beginExecution;
|
|
1347
|
+
private ensureSessionIsNotBeingManaged;
|
|
1348
|
+
private manageSessionStorage;
|
|
1349
|
+
private readSessionForStorage;
|
|
1350
|
+
private requireSessionForStorage;
|
|
1351
|
+
private commitStoredSession;
|
|
1352
|
+
private snapshotSession;
|
|
1353
|
+
private queueSessionStorage;
|
|
1354
|
+
private saveSessionSafely;
|
|
1226
1355
|
private ensureInitialized;
|
|
1356
|
+
private reportPromptCacheUsage;
|
|
1227
1357
|
private ensureSession;
|
|
1228
1358
|
/** Resolve system prompt — can be overridden by subclasses to inject context */
|
|
1229
1359
|
protected resolveSystemPrompt(sessionId: string, base: string): string;
|
|
@@ -1318,7 +1448,7 @@ declare class MemoryPersistence implements IPersistence {
|
|
|
1318
1448
|
declare class TaskPlanner {
|
|
1319
1449
|
private llmAdapter;
|
|
1320
1450
|
constructor(llmAdapter: ILLMAdapter);
|
|
1321
|
-
plan(goal: string, availableTools: ToolDef[]): Promise<TaskPlan>;
|
|
1451
|
+
plan(goal: string, availableTools: ToolDef[], signal?: AbortSignal): Promise<TaskPlan>;
|
|
1322
1452
|
private buildPlanningPrompt;
|
|
1323
1453
|
private parsePlan;
|
|
1324
1454
|
private extractSteps;
|
|
@@ -1395,7 +1525,7 @@ declare class TaskGraph {
|
|
|
1395
1525
|
declare class GraphPlanner {
|
|
1396
1526
|
protected llmAdapter: ILLMAdapter;
|
|
1397
1527
|
constructor(llmAdapter: ILLMAdapter);
|
|
1398
|
-
planGraph(goal: string, availableTools: ToolDef[]): Promise<GraphPlan>;
|
|
1528
|
+
planGraph(goal: string, availableTools: ToolDef[], signal?: AbortSignal): Promise<GraphPlan>;
|
|
1399
1529
|
private buildGraphPlanningPrompt;
|
|
1400
1530
|
private parseGraphPlan;
|
|
1401
1531
|
private extractGraphNodes;
|
|
@@ -1419,9 +1549,11 @@ declare class GraphExecutor {
|
|
|
1419
1549
|
private abortController;
|
|
1420
1550
|
private toolFailureCount;
|
|
1421
1551
|
private emit;
|
|
1552
|
+
private unlinkParent;
|
|
1422
1553
|
constructor(options: {
|
|
1423
1554
|
graph: TaskGraph;
|
|
1424
1555
|
parentAgent: Ldoing;
|
|
1556
|
+
parentSignal?: AbortSignal;
|
|
1425
1557
|
plan: GraphPlan;
|
|
1426
1558
|
maxConcurrency?: number;
|
|
1427
1559
|
maxDepth?: number;
|
|
@@ -1464,6 +1596,7 @@ declare class SubAgent {
|
|
|
1464
1596
|
private parentAgent;
|
|
1465
1597
|
private sessionId;
|
|
1466
1598
|
private abortController;
|
|
1599
|
+
private unlinkParent;
|
|
1467
1600
|
private status;
|
|
1468
1601
|
constructor(options: {
|
|
1469
1602
|
nodeId: string;
|
|
@@ -1505,4 +1638,4 @@ declare class OpenAIContentAdapter implements IContentAdapter {
|
|
|
1505
1638
|
formatMessageContent(content: string | ContentBlock[]): string | any[];
|
|
1506
1639
|
}
|
|
1507
1640
|
|
|
1508
|
-
export { ACPError, ACPErrorCodes, type BuildWindowResult, type ChatOptions, type ChatResult, type CodeExecutionConfig, type ContentBlock, type ContextConfig, ContextManager, type ExecutionTrace, type FallbackStrategy, type FileInput, type GraphCheckpoint, type GraphDefinition, GraphExecutor, type GraphNode, type GraphPlan, GraphPlanner, type GraphProgress, HttpTransport, type IContentAdapter, type ILLMAdapter, type IPersistence, type ISkillProvider, type ITransport, type InitResult, type InstallOptions, type JsonRpcRequest, type JsonRpcResponse, type LLMAdapterConfig, Ldoing, type LdoingConfig, type LimitsConfig, type LoadedSkill, LocalTransport, McpRouter, type McpServerConnection, MemoryPersistence, type Message, type ModelCapabilities, type NodeResult, type NodeStatus, OpenAIAdapter, OpenAIContentAdapter, PERMISSION_MODE_DEFAULTS, type PermissionMode, type PermissionPolicy, PlanTracker, type RetryPolicy, SENSITIVE_PERMISSIONS, type ServerConfig, type Session, SessionManager, type SkillContext, type SkillDefinition, SkillExecutor, type SkillHandler, type SkillInstallRequest, type SkillInstallResult, type SkillPack, type SkillPackEnv, type SkillPackRegistration, type SkillPackResult, SkillRegistry, type SkillResult, type SkillSource, type SkillTier, type SkillWorker, type SkillsConfig, type StandardLLMResponse, type StepPlan, type StepResult, type StepStatus, type StreamEvent, SubAgent, type SubAgentConfig, type TaskCheckpoint, TaskGraph, type TaskPlan, type TaskPlanStatus, TaskPlanner, type TaskProgress, type ToolCall, type ToolDef, type TriggerRule, type UploadConfig, type WorkflowDefinition, type WorkflowProgress, type WorkflowStep, contentToPreview, contentToString, detectRuntime, estimateContentTokens, estimateMessageTokens, estimateRequestTokens, estimateTextTokens, estimateToolDefTokens, fileInputsToContentBlocks, interpolateInstruction, interpolateTemplate, resolveModelCapabilities, resolveModelContextLength, resolvePermissionPolicy };
|
|
1641
|
+
export { ACPError, ACPErrorCodes, type BuildWindowResult, type ChatOptions, type ChatResult, type ChatRunContext, type CodeExecutionConfig, type ContentBlock, type ContextConfig, ContextManager, type ExecutionTrace, type FallbackStrategy, type FileInput, type GraphCheckpoint, type GraphDefinition, GraphExecutor, type GraphNode, type GraphPlan, GraphPlanner, type GraphProgress, HttpTransport, type IContentAdapter, type ILLMAdapter, type IPersistence, type ISkillProvider, type ITransport, type InitResult, type InstallOptions, type JsonRpcRequest, type JsonRpcResponse, type LLMAdapterConfig, type LLMProxyMode, type LLMRouteStatus, Ldoing, type LdoingConfig, type LimitsConfig, type LoadedSkill, LocalTransport, type McpConnectionStatus, McpRouter, type McpServerConnection, MemoryPersistence, type Message, type ModelCapabilities, type NodeResult, type NodeStatus, OpenAIAdapter, OpenAIContentAdapter, PERMISSION_MODE_DEFAULTS, type PermissionMode, type PermissionPolicy, PlanTracker, type PromptCacheUsage, type RetryPolicy, SENSITIVE_PERMISSIONS, type ServerConfig, type Session, SessionManager, type SkillContext, type SkillDefinition, SkillExecutor, type SkillHandler, type SkillInstallRequest, type SkillInstallResult, type SkillPack, type SkillPackEnv, type SkillPackRegistration, type SkillPackResult, SkillRegistry, type SkillResult, type SkillSource, type SkillTier, type SkillWorker, type SkillsConfig, type StandardLLMResponse, type StepPlan, type StepResult, type StepStatus, type StreamEvent, SubAgent, type SubAgentConfig, type TaskCheckpoint, TaskGraph, type TaskPlan, type TaskPlanStatus, TaskPlanner, type TaskProgress, type ToolCall, type ToolDef, type TriggerRule, type UploadConfig, type WorkflowDefinition, type WorkflowProgress, type WorkflowStep, contentToPreview, contentToString, detectRuntime, estimateContentTokens, estimateMessageTokens, estimateRequestTokens, estimateTextTokens, estimateToolDefTokens, fileInputsToContentBlocks, interpolateInstruction, interpolateTemplate, resolveModelCapabilities, resolveModelContextLength, resolvePermissionPolicy };
|