@linnlabs/linnkit 0.9.0 → 0.10.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/CHANGELOG.md +13 -0
- package/bin/linnkit.cjs +7 -0
- package/dist/{agentSpec-EkmviZjy.d.cts → agentSpec-Du4Iye0q.d.cts} +16 -1
- package/dist/{agentSpec-EkmviZjy.d.ts → agentSpec-Du4Iye0q.d.ts} +16 -1
- package/dist/cli.cjs +118 -65
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +118 -65
- package/dist/cli.js.map +1 -1
- package/dist/context-manager.cjs +234 -32
- package/dist/context-manager.cjs.map +1 -1
- package/dist/context-manager.d.cts +52 -15
- package/dist/context-manager.d.ts +52 -15
- package/dist/context-manager.js +234 -33
- package/dist/context-manager.js.map +1 -1
- package/dist/{context-trace-HE2qY5Q-.d.cts → context-trace-BHKDS-eq.d.cts} +2 -2
- package/dist/{context-trace-DRi5M4lX.d.ts → context-trace-CHbqHmyE.d.ts} +2 -2
- package/dist/contracts.cjs +3 -1
- package/dist/contracts.cjs.map +1 -1
- package/dist/contracts.d.cts +3 -3
- package/dist/contracts.d.ts +3 -3
- package/dist/contracts.js +3 -1
- package/dist/contracts.js.map +1 -1
- package/dist/{defaultGraphExecutor-BBswR8wn.d.ts → defaultGraphExecutor-B29_qTHy.d.ts} +16 -15
- package/dist/{defaultGraphExecutor-BIjJj7WF.d.cts → defaultGraphExecutor-C2E59v_R.d.cts} +16 -15
- package/dist/{index-BanRABEt.d.cts → index-BAaUP9yU.d.cts} +26 -14
- package/dist/{index-Z8NXKNwI.d.ts → index-BaVpVNi2.d.ts} +26 -14
- package/dist/{index-DO4dQgf2.d.cts → index-BnYCS8Zg.d.cts} +2 -2
- package/dist/{index-CJeWHopy.d.ts → index-C0DAjsdX.d.ts} +2 -2
- package/dist/{index-Dl5PLgAv.d.cts → index-CKQzzZ5Y.d.cts} +2 -2
- package/dist/{index-CHqwkvGp.d.ts → index-D0mKxTR5.d.ts} +2 -2
- package/dist/index.cjs +186 -85
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +10 -10
- package/dist/index.d.ts +10 -10
- package/dist/index.js +186 -85
- package/dist/index.js.map +1 -1
- package/dist/{ports-DnLuKfpE.d.ts → ports-DpPTFhSd.d.ts} +2 -2
- package/dist/{ports-DaatKJXp.d.cts → ports-s-tSp3sB.d.cts} +2 -2
- package/dist/quickstart.cjs +119 -65
- package/dist/quickstart.cjs.map +1 -1
- package/dist/quickstart.d.cts +7 -7
- package/dist/quickstart.d.ts +7 -7
- package/dist/quickstart.js +119 -65
- package/dist/quickstart.js.map +1 -1
- package/dist/{runAgent-CPj_9e58.d.ts → runAgent-C6F-399C.d.ts} +5 -5
- package/dist/{runAgent-HYKlXbVr.d.cts → runAgent-ilEj66Ik.d.cts} +5 -5
- package/dist/{runHandle-D3gPsD7B.d.cts → runHandle-BNOqS-Bl.d.cts} +3 -3
- package/dist/{runHandle-CyXvzgzk.d.ts → runHandle-BdLXOFqF.d.ts} +3 -3
- package/dist/runtime-kernel/events.cjs +1 -0
- package/dist/runtime-kernel/events.cjs.map +1 -1
- package/dist/runtime-kernel/events.d.cts +4 -4
- package/dist/runtime-kernel/events.d.ts +4 -4
- package/dist/runtime-kernel/events.js +1 -0
- package/dist/runtime-kernel/events.js.map +1 -1
- package/dist/runtime-kernel.cjs +181 -82
- package/dist/runtime-kernel.cjs.map +1 -1
- package/dist/runtime-kernel.d.cts +8 -8
- package/dist/runtime-kernel.d.ts +8 -8
- package/dist/runtime-kernel.js +181 -83
- package/dist/runtime-kernel.js.map +1 -1
- package/dist/testkit.cjs +181 -82
- package/dist/testkit.cjs.map +1 -1
- package/dist/testkit.d.cts +8 -8
- package/dist/testkit.d.ts +8 -8
- package/dist/testkit.js +181 -82
- package/dist/testkit.js.map +1 -1
- package/dist/{todo-B1PmDlp3.d.cts → todo-Ca8llpRQ.d.cts} +1 -1
- package/dist/{todo-B1PmDlp3.d.ts → todo-Ca8llpRQ.d.ts} +1 -1
- package/dist/{toolContracts-CLkQmhTG.d.cts → toolContracts-Bm3EZ1UM.d.cts} +13 -2
- package/dist/{toolContracts-Blll0241.d.ts → toolContracts-f8lzZBNa.d.ts} +13 -2
- package/docs/integration/README.md +1 -1
- package/docs/integration/agent-registration-guide.md +1 -1
- package/docs/integration/child-runs.md +4 -1
- package/docs/integration/context-engineering.md +30 -15
- package/docs/integration/context-fences.md +32 -3
- package/docs/integration/llm-provider.md +1 -1
- package/docs/integration/persistence.md +1 -0
- package/docs/integration/run-supervisor.md +3 -0
- package/docs/integration/tool-development-guide.md +7 -5
- package/docs/integration/tool-history.md +43 -17
- package/package.json +4 -3
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { A as AiMessage, a as AssistantMessage } from './messages-XthmnHZ3.cjs';
|
|
2
|
-
import { C as ChatMessage, P as ProviderContext$2, M as MessageProcessingState, B as BaseContextProvider$2, a as ProviderResult, I as IContextProvider$2, b as ContextTraceCollector, S as SummarizationCallbacks, G as GenerateRequest, c as GenerateResponse, d as ContextTrace } from './context-trace-
|
|
3
|
-
export { e as ChatDocumentMetadata, f as ChatProjectMetadata, g as ChatUserQuote, h as ContextProviderError, i as ContextProviderErrorCode, j as ContextProviderErrorOptions, k as ContextTraceEvent, l as ContextTraceMessageDecisionEvent, m as ContextTraceProviderEvent, n as MessageRole, o as MessageType, R as RecentRejection, p as SUMMARIZATION_FAILED_ERROR_CODE, T as TOOL_HISTORY_OVERFLOW_ERROR_CODE, q as isContextProviderError } from './context-trace-
|
|
2
|
+
import { C as ChatMessage, P as ProviderContext$2, M as MessageProcessingState, B as BaseContextProvider$2, a as ProviderResult, I as IContextProvider$2, b as ContextTraceCollector, S as SummarizationCallbacks, G as GenerateRequest, c as GenerateResponse, d as ContextTrace } from './context-trace-BHKDS-eq.cjs';
|
|
3
|
+
export { e as ChatDocumentMetadata, f as ChatProjectMetadata, g as ChatUserQuote, h as ContextProviderError, i as ContextProviderErrorCode, j as ContextProviderErrorOptions, k as ContextTraceEvent, l as ContextTraceMessageDecisionEvent, m as ContextTraceProviderEvent, n as MessageRole, o as MessageType, R as RecentRejection, p as SUMMARIZATION_FAILED_ERROR_CODE, T as TOOL_HISTORY_OVERFLOW_ERROR_CODE, q as isContextProviderError } from './context-trace-BHKDS-eq.cjs';
|
|
4
4
|
export { C as CHECKPOINT_MARKER_TYPE } from './checkpointMarker-DAI3wUQu.cjs';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { A as AgentSpecToolOutputPolicy, a as AgentSpecProviderReplayPolicy, b as AgentSpecCheckpointPolicy, c as AgentSpecSummarizationPolicy, d as AgentSpecContextTracePolicy, e as AgentSpecSystemReminderPolicy, f as AgentSpec, g as AgentSpecContextPolicy, h as AgentSpecContextPolicyInput } from './agentSpec-Du4Iye0q.cjs';
|
|
6
|
+
import { R as RuntimeEvent } from './todo-Ca8llpRQ.cjs';
|
|
7
7
|
import { T as TokenizerPort } from './tokenizer-DH_JXv-H.cjs';
|
|
8
|
-
import {
|
|
8
|
+
import { T as ToolArgs } from './toolContracts-Bm3EZ1UM.cjs';
|
|
9
9
|
import 'zod';
|
|
10
10
|
import './ai-engine.types-BpeU_XQG.cjs';
|
|
11
11
|
|
|
@@ -118,6 +118,7 @@ interface AgentContextBuilderConfigOverrides {
|
|
|
118
118
|
interface AgentSpecPreprocessorOptions {
|
|
119
119
|
toolHistory?: {
|
|
120
120
|
strategy?: 'per-pair' | 'per-run' | 'none';
|
|
121
|
+
retentionMode?: 'drop' | 'compress';
|
|
121
122
|
keepLatestToolPairs?: number;
|
|
122
123
|
keepLatestRuns?: number;
|
|
123
124
|
maxInteractionGroups?: number;
|
|
@@ -243,6 +244,26 @@ declare class FenceLifetimePreprocessor extends BasePreprocessor$1 {
|
|
|
243
244
|
process(messages: AiMessage[], context: PreprocessorContext$1): Promise<PreprocessorResult$1>;
|
|
244
245
|
}
|
|
245
246
|
|
|
247
|
+
interface CurrentTurnMessageAssemblerOptions {
|
|
248
|
+
fenceRegistry: FenceRegistry;
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* 组装当前轮 prompt block。
|
|
252
|
+
*
|
|
253
|
+
* 中文说明:
|
|
254
|
+
* - formatter 只负责把单条消息转成 wire 形态,不负责猜测相邻消息是否应该合并;
|
|
255
|
+
* - 当前轮 system-side fence 在这里合入 system_prompt;
|
|
256
|
+
* - 当前轮 user-side fence 在这里合入同一条 user_input,未注入的 fence 不产生空标签。
|
|
257
|
+
*/
|
|
258
|
+
declare class CurrentTurnMessageAssembler extends BasePreprocessor$1 {
|
|
259
|
+
readonly name = "CurrentTurnMessageAssembler";
|
|
260
|
+
readonly description = "Assembles current-turn fences into system_prompt and user_input messages";
|
|
261
|
+
readonly priority = 10;
|
|
262
|
+
private readonly fenceRegistry;
|
|
263
|
+
constructor(options: CurrentTurnMessageAssemblerOptions);
|
|
264
|
+
process(messages: AiMessage[], _context: PreprocessorContext$1): Promise<PreprocessorResult$1>;
|
|
265
|
+
}
|
|
266
|
+
|
|
246
267
|
interface SummarizationConfig {
|
|
247
268
|
SUMMARIZATION_TRIGGER_THRESHOLD: number;
|
|
248
269
|
SUMMARY_OLDEST_MESSAGES_PERCENTAGE: number;
|
|
@@ -372,6 +393,11 @@ interface AgentConfig {
|
|
|
372
393
|
defaultTools: string[];
|
|
373
394
|
timeoutMs: number;
|
|
374
395
|
debug: boolean;
|
|
396
|
+
/**
|
|
397
|
+
* @deprecated 不再参与上下文裁剪。
|
|
398
|
+
* 中文备注:Agent 历史保留现在由 `contextPolicy.budget` 与 `contextPolicy.toolHistory`
|
|
399
|
+
* 共同决定;保留这个字段只是为了兼容可能读取 `DEFAULT_AGENT_CONFIG` 的旧接入方。
|
|
400
|
+
*/
|
|
375
401
|
maxHistoryLength: number;
|
|
376
402
|
tokenBudget: {
|
|
377
403
|
maxTokens: number;
|
|
@@ -821,8 +847,8 @@ declare class AgentCoreContextProvider extends BaseContextProvider$1 {
|
|
|
821
847
|
* @file src/agent/context/providers/AgentWorkingMemoryProvider.ts
|
|
822
848
|
* @description Agent专用工作记忆填充层Provider - 第二阶段上下文构建
|
|
823
849
|
*
|
|
824
|
-
* 🎯 职责: 实现Agent的P1-
|
|
825
|
-
* 📖 策略: P1(工具交互) > P2(纯文本对话) > P3(历史工具交互)
|
|
850
|
+
* 🎯 职责: 实现Agent的P1-P3优先级填充策略
|
|
851
|
+
* 📖 策略: P1(工具交互) > P2(纯文本对话) > P3(历史工具交互)
|
|
826
852
|
* ✨ Agent特性: 工具调用优先级、配对保留策略
|
|
827
853
|
* 🔧 核心逻辑: 保留工具调用时,必须确保其对应的另一半也被保留
|
|
828
854
|
*/
|
|
@@ -1190,8 +1216,10 @@ declare abstract class BasePreprocessor implements IPreprocessor {
|
|
|
1190
1216
|
|
|
1191
1217
|
type ToolHistoryCompressionStrategy = 'per-pair' | 'per-run' | 'none';
|
|
1192
1218
|
type ToolHistoryOverflowStrategy = 'keep-latest' | 'fail-fast';
|
|
1219
|
+
type ToolHistoryRetentionMode = 'drop' | 'compress';
|
|
1193
1220
|
interface ToolHistoryCompressorOptions {
|
|
1194
1221
|
strategy?: ToolHistoryCompressionStrategy;
|
|
1222
|
+
retentionMode?: ToolHistoryRetentionMode;
|
|
1195
1223
|
keepLatestToolPairs?: number;
|
|
1196
1224
|
keepLatestRuns?: number;
|
|
1197
1225
|
maxInteractionGroups?: number;
|
|
@@ -1200,26 +1228,30 @@ interface ToolHistoryCompressorOptions {
|
|
|
1200
1228
|
maxOutputSummaryTokens?: number;
|
|
1201
1229
|
}
|
|
1202
1230
|
/**
|
|
1203
|
-
*
|
|
1231
|
+
* 工具历史保留预处理器。
|
|
1204
1232
|
*
|
|
1205
1233
|
* 三种策略边界:
|
|
1206
|
-
* - per-pair
|
|
1234
|
+
* - per-pair:按全局最近 N 组完整工具交互保留,其余按 retentionMode 处理。
|
|
1207
1235
|
* - per-run:按 user_input 划分 run,完整保留最近 K 个历史 run 内的工具组,避免腰斩同一轮工具链。
|
|
1208
1236
|
* - none:不做常规压缩,仅在 maxInteractionGroups 显式触发时执行安全阀。
|
|
1209
1237
|
*
|
|
1238
|
+
* retentionMode 边界:
|
|
1239
|
+
* - drop:默认行为。旧工具组超过保留窗口后直接移除,避免改写历史前缀和制造伪 final_answer。
|
|
1240
|
+
* - compress:兼容旧行为。把旧工具组替换为自然语言摘要,用于小上下文或审计友好的历史线索保留。
|
|
1241
|
+
*
|
|
1210
1242
|
* 注意:单个 tool_output 的 token 截断不在这里做,那是 WorkingMemory 阶段
|
|
1211
|
-
* ToolPairTruncator
|
|
1243
|
+
* ToolPairTruncator 的职责;本处理器只决定“工具组是原样保留、删除,还是压缩为摘要消息”。
|
|
1212
1244
|
*/
|
|
1213
1245
|
declare class ToolHistoryCompressorPreprocessor extends BasePreprocessor {
|
|
1214
1246
|
readonly name = "ToolHistoryCompressorPreprocessor";
|
|
1215
|
-
readonly description = "\u5DE5\u5177\u5386\u53F2\
|
|
1247
|
+
readonly description = "\u5DE5\u5177\u5386\u53F2\u4FDD\u7559\u5904\u7406\u5668 - \u6309\u7B56\u7565\u4FDD\u7559\u3001\u5220\u9664\u6216\u538B\u7F29\u8F83\u65E9\u7684\u5386\u53F2\u5DE5\u5177\u8C03\u7528\u5BF9";
|
|
1216
1248
|
readonly priority = 0;
|
|
1217
1249
|
private summarizer;
|
|
1218
1250
|
private readonly options;
|
|
1219
1251
|
constructor(options?: ToolHistoryCompressorOptions);
|
|
1220
1252
|
process(messages: AiMessage[], context: PreprocessorContext): Promise<PreprocessorResult>;
|
|
1221
1253
|
shouldSkip(messages: AiMessage[], context: PreprocessorContext): boolean;
|
|
1222
|
-
private
|
|
1254
|
+
private processToolCallPairsInHistory;
|
|
1223
1255
|
private selectGroupsToKeep;
|
|
1224
1256
|
private enforceMaxInteractionGroups;
|
|
1225
1257
|
private compressToolInteractionGroup;
|
|
@@ -1335,7 +1367,7 @@ interface PreprocessorPipelineResult {
|
|
|
1335
1367
|
* 创建默认的Agent预处理器注册表
|
|
1336
1368
|
*
|
|
1337
1369
|
* 🔥 这里定义了Agent预处理管道的默认配置:
|
|
1338
|
-
* 1. ToolHistoryCompressorPreprocessor (priority: 0) -
|
|
1370
|
+
* 1. ToolHistoryCompressorPreprocessor (priority: 0) - 工具历史保留/删除,最先执行
|
|
1339
1371
|
* 2. ToolReplayProtocolGuardPreprocessor (priority: 0.5) - 工具回放协议守卫,仅治理历史轮次
|
|
1340
1372
|
* 3. HistoryPurificationPreprocessor (priority: 1) - Agent历史净化,在压缩后执行
|
|
1341
1373
|
*
|
|
@@ -1354,6 +1386,8 @@ declare function createDefaultAgentPreprocessorPipeline(context?: PreprocessorCo
|
|
|
1354
1386
|
|
|
1355
1387
|
type index$4_BasePreprocessor = BasePreprocessor;
|
|
1356
1388
|
declare const index$4_BasePreprocessor: typeof BasePreprocessor;
|
|
1389
|
+
type index$4_CurrentTurnMessageAssembler = CurrentTurnMessageAssembler;
|
|
1390
|
+
declare const index$4_CurrentTurnMessageAssembler: typeof CurrentTurnMessageAssembler;
|
|
1357
1391
|
type index$4_DefaultAgentPreprocessorRegistryOptions = DefaultAgentPreprocessorRegistryOptions;
|
|
1358
1392
|
type index$4_FenceLifetimePreprocessor = FenceLifetimePreprocessor;
|
|
1359
1393
|
declare const index$4_FenceLifetimePreprocessor: typeof FenceLifetimePreprocessor;
|
|
@@ -1373,6 +1407,7 @@ type index$4_ToolHistoryCompressorOptions = ToolHistoryCompressorOptions;
|
|
|
1373
1407
|
type index$4_ToolHistoryCompressorPreprocessor = ToolHistoryCompressorPreprocessor;
|
|
1374
1408
|
declare const index$4_ToolHistoryCompressorPreprocessor: typeof ToolHistoryCompressorPreprocessor;
|
|
1375
1409
|
type index$4_ToolHistoryOverflowStrategy = ToolHistoryOverflowStrategy;
|
|
1410
|
+
type index$4_ToolHistoryRetentionMode = ToolHistoryRetentionMode;
|
|
1376
1411
|
type index$4_ToolReplayProtocolGuardOptions = ToolReplayProtocolGuardOptions;
|
|
1377
1412
|
type index$4_ToolReplayProtocolGuardPreprocessor = ToolReplayProtocolGuardPreprocessor;
|
|
1378
1413
|
declare const index$4_ToolReplayProtocolGuardPreprocessor: typeof ToolReplayProtocolGuardPreprocessor;
|
|
@@ -1381,7 +1416,7 @@ declare const index$4_createDefaultAgentPreprocessorPipeline: typeof createDefau
|
|
|
1381
1416
|
declare const index$4_createDefaultAgentPreprocessorRegistry: typeof createDefaultAgentPreprocessorRegistry;
|
|
1382
1417
|
declare const index$4_resolveToolReplayProtocolPolicy: typeof resolveToolReplayProtocolPolicy;
|
|
1383
1418
|
declare namespace index$4 {
|
|
1384
|
-
export { index$4_BasePreprocessor as BasePreprocessor, type index$4_DefaultAgentPreprocessorRegistryOptions as DefaultAgentPreprocessorRegistryOptions, index$4_FenceLifetimePreprocessor as FenceLifetimePreprocessor, index$4_HistoryPurificationPreprocessor as HistoryPurificationPreprocessor, type index$4_IPreprocessor as IPreprocessor, type index$4_MissingSidecarBehavior as MissingSidecarBehavior, type index$4_PreprocessorContext as PreprocessorContext, index$4_PreprocessorPipeline as PreprocessorPipeline, type index$4_PreprocessorPipelineResult as PreprocessorPipelineResult, index$4_PreprocessorRegistry as PreprocessorRegistry, type index$4_PreprocessorResult as PreprocessorResult, type index$4_ToolHistoryCompressionStrategy as ToolHistoryCompressionStrategy, type index$4_ToolHistoryCompressorOptions as ToolHistoryCompressorOptions, index$4_ToolHistoryCompressorPreprocessor as ToolHistoryCompressorPreprocessor, type index$4_ToolHistoryOverflowStrategy as ToolHistoryOverflowStrategy, type index$4_ToolReplayProtocolGuardOptions as ToolReplayProtocolGuardOptions, index$4_ToolReplayProtocolGuardPreprocessor as ToolReplayProtocolGuardPreprocessor, type index$4_ToolReplayProtocolPolicy as ToolReplayProtocolPolicy, index$4_createDefaultAgentPreprocessorPipeline as createDefaultAgentPreprocessorPipeline, index$4_createDefaultAgentPreprocessorRegistry as createDefaultAgentPreprocessorRegistry, index$4_resolveToolReplayProtocolPolicy as resolveToolReplayProtocolPolicy };
|
|
1419
|
+
export { index$4_BasePreprocessor as BasePreprocessor, index$4_CurrentTurnMessageAssembler as CurrentTurnMessageAssembler, type index$4_DefaultAgentPreprocessorRegistryOptions as DefaultAgentPreprocessorRegistryOptions, index$4_FenceLifetimePreprocessor as FenceLifetimePreprocessor, index$4_HistoryPurificationPreprocessor as HistoryPurificationPreprocessor, type index$4_IPreprocessor as IPreprocessor, type index$4_MissingSidecarBehavior as MissingSidecarBehavior, type index$4_PreprocessorContext as PreprocessorContext, index$4_PreprocessorPipeline as PreprocessorPipeline, type index$4_PreprocessorPipelineResult as PreprocessorPipelineResult, index$4_PreprocessorRegistry as PreprocessorRegistry, type index$4_PreprocessorResult as PreprocessorResult, type index$4_ToolHistoryCompressionStrategy as ToolHistoryCompressionStrategy, type index$4_ToolHistoryCompressorOptions as ToolHistoryCompressorOptions, index$4_ToolHistoryCompressorPreprocessor as ToolHistoryCompressorPreprocessor, type index$4_ToolHistoryOverflowStrategy as ToolHistoryOverflowStrategy, type index$4_ToolHistoryRetentionMode as ToolHistoryRetentionMode, type index$4_ToolReplayProtocolGuardOptions as ToolReplayProtocolGuardOptions, index$4_ToolReplayProtocolGuardPreprocessor as ToolReplayProtocolGuardPreprocessor, type index$4_ToolReplayProtocolPolicy as ToolReplayProtocolPolicy, index$4_createDefaultAgentPreprocessorPipeline as createDefaultAgentPreprocessorPipeline, index$4_createDefaultAgentPreprocessorRegistry as createDefaultAgentPreprocessorRegistry, index$4_resolveToolReplayProtocolPolicy as resolveToolReplayProtocolPolicy };
|
|
1385
1420
|
}
|
|
1386
1421
|
|
|
1387
1422
|
interface ToolManagerRegistry extends ToolSummaryProvider {
|
|
@@ -1470,6 +1505,7 @@ declare class AgentMessageOrchestrator {
|
|
|
1470
1505
|
private resolvePreprocessorModel;
|
|
1471
1506
|
private resolveContextPolicy;
|
|
1472
1507
|
private applyContextPolicy;
|
|
1508
|
+
private resolveEffectiveContextBudget;
|
|
1473
1509
|
processAgentConversation(request: AgentProfileRequest, history: RuntimeEvent[], toolManager: ToolManager, callbacks?: SummarizationCallbacks, extraOptions?: {
|
|
1474
1510
|
generate?: (request: GenerateRequest) => Promise<GenerateResponse>;
|
|
1475
1511
|
}): Promise<AgentProcessingResult>;
|
|
@@ -1521,6 +1557,7 @@ declare abstract class BaseAgentTask implements IAgentTask {
|
|
|
1521
1557
|
protected abstract getSystemPrompt(request: AgentProfileRequest): string;
|
|
1522
1558
|
getSystemPromptForRequest(request: AgentProfileRequest): string;
|
|
1523
1559
|
buildMessages(request: AgentProfileRequest, history: AiMessage[]): AiMessage[];
|
|
1560
|
+
private createCurrentUserMessage;
|
|
1524
1561
|
private createFenceMessages;
|
|
1525
1562
|
private createFenceMessage;
|
|
1526
1563
|
private insertAfterLastToolResult;
|
|
@@ -2187,4 +2224,4 @@ interface ChatGenerateRequestAdapterInput extends AgentProfileRequest {
|
|
|
2187
2224
|
*/
|
|
2188
2225
|
declare function buildGenerateRequestFromAgentRequest(request: ChatGenerateRequestAdapterInput, conversationHistory: AiMessage[]): GenerateRequest;
|
|
2189
2226
|
|
|
2190
|
-
export { AGENT_CONSTANTS, AGENT_CONTEXT_BUILDER_CONFIG, AISummaryGenerator, type AgentContextBuilderConfigOverrides, type AgentSpecExecutionOptions, type AgentSpecPreprocessorOptions, type AgentSpecProviderOptions, type AgentSpecRuntimeOptions, BaseContextProvider$1 as BaseContextProvider, BaseConversationalTask, BasePreprocessor$1 as BasePreprocessor, ContextProviderRegistry as ChatContextProviderRegistry, CoreContextProvider as ChatCoreContextProvider, ChatMessage, MessageOrchestrator as ChatMessageOrchestrator, type OrchestratorOptions as ChatOrchestratorOptions, type ChatTaskResolver, WorkingMemoryProvider as ChatWorkingMemoryProvider, ContextProviderRegistry$2 as ContextProviderRegistry, ContextTrace, ContextTraceCollector, DEFAULT_MUST_KEEP_POLICY, type FenceDescriptor, type FenceInjection, type FenceLifetime, FenceLifetimePreprocessor, type FenceLifetimePreprocessorOptions, type FenceLlmRole, type FencePlacement, type FenceRegistry, GenerateRequest, GenerateResponse, type HistoryPurificationConfig, HistoryPurificationPreprocessor, type IChatTask, type IContextProvider$1 as IContextProvider, type IPreprocessor$1 as IPreprocessor, type LlmMessage, type MergeContextPolicyParams, type MessageFormatOptions, type MessageFormatterOptions, MessageProcessingState, type MustKeepPolicy, type MustKeepTruncationRule, type NativeToolCallingMessage, type PreprocessorContext$1 as PreprocessorContext, type PreprocessorResult$1 as PreprocessorResult, type ProviderContext$1 as ProviderContext, ProviderResult, SummarizationCallbacks, SummarizationCandidateSelector, type SummarizationOptions, SummarizationProvider, SummarizationStateUtils, SummarizationTrigger, type ToolSummaryProvider, config as agentConfig, index$5 as agentContext, contracts as agentContracts, index$3 as agentOrchestration, index$4 as agentPreprocessors, agentSpecToContextBuilderConfig, agentSpecToRuntimeOptions, index$2 as agentTasks, index$1 as agentTools, index as agentUtils, aiMessageToChatMessage, buildGenerateRequestFromAgentRequest, chatMessageToAiMessage, contextPolicyToContextBuilderConfig, contextPolicyToExecutionOptions, contextPolicyToMustKeepPolicy, contextPolicyToPreprocessorOptions, contextPolicyToProviderOptions, contextPolicyToRuntimeOptions, contextPolicyToSystemReminderOptions, convertEventToChatMessage, convertEventsToChatMessages, createFenceRegistry, createMessageFormatter, findMatchingTruncationRule, formatAgentLlmMessages, getDefaultTokenConfig, mergeContextPolicy, messageFormatter };
|
|
2227
|
+
export { AGENT_CONSTANTS, AGENT_CONTEXT_BUILDER_CONFIG, AISummaryGenerator, type AgentContextBuilderConfigOverrides, type AgentSpecExecutionOptions, type AgentSpecPreprocessorOptions, type AgentSpecProviderOptions, type AgentSpecRuntimeOptions, BaseContextProvider$1 as BaseContextProvider, BaseConversationalTask, BasePreprocessor$1 as BasePreprocessor, ContextProviderRegistry as ChatContextProviderRegistry, CoreContextProvider as ChatCoreContextProvider, ChatMessage, MessageOrchestrator as ChatMessageOrchestrator, type OrchestratorOptions as ChatOrchestratorOptions, type ChatTaskResolver, WorkingMemoryProvider as ChatWorkingMemoryProvider, ContextProviderRegistry$2 as ContextProviderRegistry, ContextTrace, ContextTraceCollector, CurrentTurnMessageAssembler, type CurrentTurnMessageAssemblerOptions, DEFAULT_MUST_KEEP_POLICY, type FenceDescriptor, type FenceInjection, type FenceLifetime, FenceLifetimePreprocessor, type FenceLifetimePreprocessorOptions, type FenceLlmRole, type FencePlacement, type FenceRegistry, GenerateRequest, GenerateResponse, type HistoryPurificationConfig, HistoryPurificationPreprocessor, type IChatTask, type IContextProvider$1 as IContextProvider, type IPreprocessor$1 as IPreprocessor, type LlmMessage, type MergeContextPolicyParams, type MessageFormatOptions, type MessageFormatterOptions, MessageProcessingState, type MustKeepPolicy, type MustKeepTruncationRule, type NativeToolCallingMessage, type PreprocessorContext$1 as PreprocessorContext, type PreprocessorResult$1 as PreprocessorResult, type ProviderContext$1 as ProviderContext, ProviderResult, SummarizationCallbacks, SummarizationCandidateSelector, type SummarizationOptions, SummarizationProvider, SummarizationStateUtils, SummarizationTrigger, type ToolSummaryProvider, config as agentConfig, index$5 as agentContext, contracts as agentContracts, index$3 as agentOrchestration, index$4 as agentPreprocessors, agentSpecToContextBuilderConfig, agentSpecToRuntimeOptions, index$2 as agentTasks, index$1 as agentTools, index as agentUtils, aiMessageToChatMessage, buildGenerateRequestFromAgentRequest, chatMessageToAiMessage, contextPolicyToContextBuilderConfig, contextPolicyToExecutionOptions, contextPolicyToMustKeepPolicy, contextPolicyToPreprocessorOptions, contextPolicyToProviderOptions, contextPolicyToRuntimeOptions, contextPolicyToSystemReminderOptions, convertEventToChatMessage, convertEventsToChatMessages, createFenceRegistry, createMessageFormatter, findMatchingTruncationRule, formatAgentLlmMessages, getDefaultTokenConfig, mergeContextPolicy, messageFormatter };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { A as AiMessage, a as AssistantMessage } from './messages-XthmnHZ3.js';
|
|
2
|
-
import { C as ChatMessage, P as ProviderContext$2, M as MessageProcessingState, B as BaseContextProvider$2, a as ProviderResult, I as IContextProvider$2, b as ContextTraceCollector, S as SummarizationCallbacks, G as GenerateRequest, c as GenerateResponse, d as ContextTrace } from './context-trace-
|
|
3
|
-
export { e as ChatDocumentMetadata, f as ChatProjectMetadata, g as ChatUserQuote, h as ContextProviderError, i as ContextProviderErrorCode, j as ContextProviderErrorOptions, k as ContextTraceEvent, l as ContextTraceMessageDecisionEvent, m as ContextTraceProviderEvent, n as MessageRole, o as MessageType, R as RecentRejection, p as SUMMARIZATION_FAILED_ERROR_CODE, T as TOOL_HISTORY_OVERFLOW_ERROR_CODE, q as isContextProviderError } from './context-trace-
|
|
2
|
+
import { C as ChatMessage, P as ProviderContext$2, M as MessageProcessingState, B as BaseContextProvider$2, a as ProviderResult, I as IContextProvider$2, b as ContextTraceCollector, S as SummarizationCallbacks, G as GenerateRequest, c as GenerateResponse, d as ContextTrace } from './context-trace-CHbqHmyE.js';
|
|
3
|
+
export { e as ChatDocumentMetadata, f as ChatProjectMetadata, g as ChatUserQuote, h as ContextProviderError, i as ContextProviderErrorCode, j as ContextProviderErrorOptions, k as ContextTraceEvent, l as ContextTraceMessageDecisionEvent, m as ContextTraceProviderEvent, n as MessageRole, o as MessageType, R as RecentRejection, p as SUMMARIZATION_FAILED_ERROR_CODE, T as TOOL_HISTORY_OVERFLOW_ERROR_CODE, q as isContextProviderError } from './context-trace-CHbqHmyE.js';
|
|
4
4
|
export { C as CHECKPOINT_MARKER_TYPE } from './checkpointMarker-DAI3wUQu.js';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { A as AgentSpecToolOutputPolicy, a as AgentSpecProviderReplayPolicy, b as AgentSpecCheckpointPolicy, c as AgentSpecSummarizationPolicy, d as AgentSpecContextTracePolicy, e as AgentSpecSystemReminderPolicy, f as AgentSpec, g as AgentSpecContextPolicy, h as AgentSpecContextPolicyInput } from './agentSpec-Du4Iye0q.js';
|
|
6
|
+
import { R as RuntimeEvent } from './todo-Ca8llpRQ.js';
|
|
7
7
|
import { T as TokenizerPort } from './tokenizer-DFL4I7-I.js';
|
|
8
|
-
import {
|
|
8
|
+
import { T as ToolArgs } from './toolContracts-f8lzZBNa.js';
|
|
9
9
|
import 'zod';
|
|
10
10
|
import './ai-engine.types-vZRnQcJa.js';
|
|
11
11
|
|
|
@@ -118,6 +118,7 @@ interface AgentContextBuilderConfigOverrides {
|
|
|
118
118
|
interface AgentSpecPreprocessorOptions {
|
|
119
119
|
toolHistory?: {
|
|
120
120
|
strategy?: 'per-pair' | 'per-run' | 'none';
|
|
121
|
+
retentionMode?: 'drop' | 'compress';
|
|
121
122
|
keepLatestToolPairs?: number;
|
|
122
123
|
keepLatestRuns?: number;
|
|
123
124
|
maxInteractionGroups?: number;
|
|
@@ -243,6 +244,26 @@ declare class FenceLifetimePreprocessor extends BasePreprocessor$1 {
|
|
|
243
244
|
process(messages: AiMessage[], context: PreprocessorContext$1): Promise<PreprocessorResult$1>;
|
|
244
245
|
}
|
|
245
246
|
|
|
247
|
+
interface CurrentTurnMessageAssemblerOptions {
|
|
248
|
+
fenceRegistry: FenceRegistry;
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* 组装当前轮 prompt block。
|
|
252
|
+
*
|
|
253
|
+
* 中文说明:
|
|
254
|
+
* - formatter 只负责把单条消息转成 wire 形态,不负责猜测相邻消息是否应该合并;
|
|
255
|
+
* - 当前轮 system-side fence 在这里合入 system_prompt;
|
|
256
|
+
* - 当前轮 user-side fence 在这里合入同一条 user_input,未注入的 fence 不产生空标签。
|
|
257
|
+
*/
|
|
258
|
+
declare class CurrentTurnMessageAssembler extends BasePreprocessor$1 {
|
|
259
|
+
readonly name = "CurrentTurnMessageAssembler";
|
|
260
|
+
readonly description = "Assembles current-turn fences into system_prompt and user_input messages";
|
|
261
|
+
readonly priority = 10;
|
|
262
|
+
private readonly fenceRegistry;
|
|
263
|
+
constructor(options: CurrentTurnMessageAssemblerOptions);
|
|
264
|
+
process(messages: AiMessage[], _context: PreprocessorContext$1): Promise<PreprocessorResult$1>;
|
|
265
|
+
}
|
|
266
|
+
|
|
246
267
|
interface SummarizationConfig {
|
|
247
268
|
SUMMARIZATION_TRIGGER_THRESHOLD: number;
|
|
248
269
|
SUMMARY_OLDEST_MESSAGES_PERCENTAGE: number;
|
|
@@ -372,6 +393,11 @@ interface AgentConfig {
|
|
|
372
393
|
defaultTools: string[];
|
|
373
394
|
timeoutMs: number;
|
|
374
395
|
debug: boolean;
|
|
396
|
+
/**
|
|
397
|
+
* @deprecated 不再参与上下文裁剪。
|
|
398
|
+
* 中文备注:Agent 历史保留现在由 `contextPolicy.budget` 与 `contextPolicy.toolHistory`
|
|
399
|
+
* 共同决定;保留这个字段只是为了兼容可能读取 `DEFAULT_AGENT_CONFIG` 的旧接入方。
|
|
400
|
+
*/
|
|
375
401
|
maxHistoryLength: number;
|
|
376
402
|
tokenBudget: {
|
|
377
403
|
maxTokens: number;
|
|
@@ -821,8 +847,8 @@ declare class AgentCoreContextProvider extends BaseContextProvider$1 {
|
|
|
821
847
|
* @file src/agent/context/providers/AgentWorkingMemoryProvider.ts
|
|
822
848
|
* @description Agent专用工作记忆填充层Provider - 第二阶段上下文构建
|
|
823
849
|
*
|
|
824
|
-
* 🎯 职责: 实现Agent的P1-
|
|
825
|
-
* 📖 策略: P1(工具交互) > P2(纯文本对话) > P3(历史工具交互)
|
|
850
|
+
* 🎯 职责: 实现Agent的P1-P3优先级填充策略
|
|
851
|
+
* 📖 策略: P1(工具交互) > P2(纯文本对话) > P3(历史工具交互)
|
|
826
852
|
* ✨ Agent特性: 工具调用优先级、配对保留策略
|
|
827
853
|
* 🔧 核心逻辑: 保留工具调用时,必须确保其对应的另一半也被保留
|
|
828
854
|
*/
|
|
@@ -1190,8 +1216,10 @@ declare abstract class BasePreprocessor implements IPreprocessor {
|
|
|
1190
1216
|
|
|
1191
1217
|
type ToolHistoryCompressionStrategy = 'per-pair' | 'per-run' | 'none';
|
|
1192
1218
|
type ToolHistoryOverflowStrategy = 'keep-latest' | 'fail-fast';
|
|
1219
|
+
type ToolHistoryRetentionMode = 'drop' | 'compress';
|
|
1193
1220
|
interface ToolHistoryCompressorOptions {
|
|
1194
1221
|
strategy?: ToolHistoryCompressionStrategy;
|
|
1222
|
+
retentionMode?: ToolHistoryRetentionMode;
|
|
1195
1223
|
keepLatestToolPairs?: number;
|
|
1196
1224
|
keepLatestRuns?: number;
|
|
1197
1225
|
maxInteractionGroups?: number;
|
|
@@ -1200,26 +1228,30 @@ interface ToolHistoryCompressorOptions {
|
|
|
1200
1228
|
maxOutputSummaryTokens?: number;
|
|
1201
1229
|
}
|
|
1202
1230
|
/**
|
|
1203
|
-
*
|
|
1231
|
+
* 工具历史保留预处理器。
|
|
1204
1232
|
*
|
|
1205
1233
|
* 三种策略边界:
|
|
1206
|
-
* - per-pair
|
|
1234
|
+
* - per-pair:按全局最近 N 组完整工具交互保留,其余按 retentionMode 处理。
|
|
1207
1235
|
* - per-run:按 user_input 划分 run,完整保留最近 K 个历史 run 内的工具组,避免腰斩同一轮工具链。
|
|
1208
1236
|
* - none:不做常规压缩,仅在 maxInteractionGroups 显式触发时执行安全阀。
|
|
1209
1237
|
*
|
|
1238
|
+
* retentionMode 边界:
|
|
1239
|
+
* - drop:默认行为。旧工具组超过保留窗口后直接移除,避免改写历史前缀和制造伪 final_answer。
|
|
1240
|
+
* - compress:兼容旧行为。把旧工具组替换为自然语言摘要,用于小上下文或审计友好的历史线索保留。
|
|
1241
|
+
*
|
|
1210
1242
|
* 注意:单个 tool_output 的 token 截断不在这里做,那是 WorkingMemory 阶段
|
|
1211
|
-
* ToolPairTruncator
|
|
1243
|
+
* ToolPairTruncator 的职责;本处理器只决定“工具组是原样保留、删除,还是压缩为摘要消息”。
|
|
1212
1244
|
*/
|
|
1213
1245
|
declare class ToolHistoryCompressorPreprocessor extends BasePreprocessor {
|
|
1214
1246
|
readonly name = "ToolHistoryCompressorPreprocessor";
|
|
1215
|
-
readonly description = "\u5DE5\u5177\u5386\u53F2\
|
|
1247
|
+
readonly description = "\u5DE5\u5177\u5386\u53F2\u4FDD\u7559\u5904\u7406\u5668 - \u6309\u7B56\u7565\u4FDD\u7559\u3001\u5220\u9664\u6216\u538B\u7F29\u8F83\u65E9\u7684\u5386\u53F2\u5DE5\u5177\u8C03\u7528\u5BF9";
|
|
1216
1248
|
readonly priority = 0;
|
|
1217
1249
|
private summarizer;
|
|
1218
1250
|
private readonly options;
|
|
1219
1251
|
constructor(options?: ToolHistoryCompressorOptions);
|
|
1220
1252
|
process(messages: AiMessage[], context: PreprocessorContext): Promise<PreprocessorResult>;
|
|
1221
1253
|
shouldSkip(messages: AiMessage[], context: PreprocessorContext): boolean;
|
|
1222
|
-
private
|
|
1254
|
+
private processToolCallPairsInHistory;
|
|
1223
1255
|
private selectGroupsToKeep;
|
|
1224
1256
|
private enforceMaxInteractionGroups;
|
|
1225
1257
|
private compressToolInteractionGroup;
|
|
@@ -1335,7 +1367,7 @@ interface PreprocessorPipelineResult {
|
|
|
1335
1367
|
* 创建默认的Agent预处理器注册表
|
|
1336
1368
|
*
|
|
1337
1369
|
* 🔥 这里定义了Agent预处理管道的默认配置:
|
|
1338
|
-
* 1. ToolHistoryCompressorPreprocessor (priority: 0) -
|
|
1370
|
+
* 1. ToolHistoryCompressorPreprocessor (priority: 0) - 工具历史保留/删除,最先执行
|
|
1339
1371
|
* 2. ToolReplayProtocolGuardPreprocessor (priority: 0.5) - 工具回放协议守卫,仅治理历史轮次
|
|
1340
1372
|
* 3. HistoryPurificationPreprocessor (priority: 1) - Agent历史净化,在压缩后执行
|
|
1341
1373
|
*
|
|
@@ -1354,6 +1386,8 @@ declare function createDefaultAgentPreprocessorPipeline(context?: PreprocessorCo
|
|
|
1354
1386
|
|
|
1355
1387
|
type index$4_BasePreprocessor = BasePreprocessor;
|
|
1356
1388
|
declare const index$4_BasePreprocessor: typeof BasePreprocessor;
|
|
1389
|
+
type index$4_CurrentTurnMessageAssembler = CurrentTurnMessageAssembler;
|
|
1390
|
+
declare const index$4_CurrentTurnMessageAssembler: typeof CurrentTurnMessageAssembler;
|
|
1357
1391
|
type index$4_DefaultAgentPreprocessorRegistryOptions = DefaultAgentPreprocessorRegistryOptions;
|
|
1358
1392
|
type index$4_FenceLifetimePreprocessor = FenceLifetimePreprocessor;
|
|
1359
1393
|
declare const index$4_FenceLifetimePreprocessor: typeof FenceLifetimePreprocessor;
|
|
@@ -1373,6 +1407,7 @@ type index$4_ToolHistoryCompressorOptions = ToolHistoryCompressorOptions;
|
|
|
1373
1407
|
type index$4_ToolHistoryCompressorPreprocessor = ToolHistoryCompressorPreprocessor;
|
|
1374
1408
|
declare const index$4_ToolHistoryCompressorPreprocessor: typeof ToolHistoryCompressorPreprocessor;
|
|
1375
1409
|
type index$4_ToolHistoryOverflowStrategy = ToolHistoryOverflowStrategy;
|
|
1410
|
+
type index$4_ToolHistoryRetentionMode = ToolHistoryRetentionMode;
|
|
1376
1411
|
type index$4_ToolReplayProtocolGuardOptions = ToolReplayProtocolGuardOptions;
|
|
1377
1412
|
type index$4_ToolReplayProtocolGuardPreprocessor = ToolReplayProtocolGuardPreprocessor;
|
|
1378
1413
|
declare const index$4_ToolReplayProtocolGuardPreprocessor: typeof ToolReplayProtocolGuardPreprocessor;
|
|
@@ -1381,7 +1416,7 @@ declare const index$4_createDefaultAgentPreprocessorPipeline: typeof createDefau
|
|
|
1381
1416
|
declare const index$4_createDefaultAgentPreprocessorRegistry: typeof createDefaultAgentPreprocessorRegistry;
|
|
1382
1417
|
declare const index$4_resolveToolReplayProtocolPolicy: typeof resolveToolReplayProtocolPolicy;
|
|
1383
1418
|
declare namespace index$4 {
|
|
1384
|
-
export { index$4_BasePreprocessor as BasePreprocessor, type index$4_DefaultAgentPreprocessorRegistryOptions as DefaultAgentPreprocessorRegistryOptions, index$4_FenceLifetimePreprocessor as FenceLifetimePreprocessor, index$4_HistoryPurificationPreprocessor as HistoryPurificationPreprocessor, type index$4_IPreprocessor as IPreprocessor, type index$4_MissingSidecarBehavior as MissingSidecarBehavior, type index$4_PreprocessorContext as PreprocessorContext, index$4_PreprocessorPipeline as PreprocessorPipeline, type index$4_PreprocessorPipelineResult as PreprocessorPipelineResult, index$4_PreprocessorRegistry as PreprocessorRegistry, type index$4_PreprocessorResult as PreprocessorResult, type index$4_ToolHistoryCompressionStrategy as ToolHistoryCompressionStrategy, type index$4_ToolHistoryCompressorOptions as ToolHistoryCompressorOptions, index$4_ToolHistoryCompressorPreprocessor as ToolHistoryCompressorPreprocessor, type index$4_ToolHistoryOverflowStrategy as ToolHistoryOverflowStrategy, type index$4_ToolReplayProtocolGuardOptions as ToolReplayProtocolGuardOptions, index$4_ToolReplayProtocolGuardPreprocessor as ToolReplayProtocolGuardPreprocessor, type index$4_ToolReplayProtocolPolicy as ToolReplayProtocolPolicy, index$4_createDefaultAgentPreprocessorPipeline as createDefaultAgentPreprocessorPipeline, index$4_createDefaultAgentPreprocessorRegistry as createDefaultAgentPreprocessorRegistry, index$4_resolveToolReplayProtocolPolicy as resolveToolReplayProtocolPolicy };
|
|
1419
|
+
export { index$4_BasePreprocessor as BasePreprocessor, index$4_CurrentTurnMessageAssembler as CurrentTurnMessageAssembler, type index$4_DefaultAgentPreprocessorRegistryOptions as DefaultAgentPreprocessorRegistryOptions, index$4_FenceLifetimePreprocessor as FenceLifetimePreprocessor, index$4_HistoryPurificationPreprocessor as HistoryPurificationPreprocessor, type index$4_IPreprocessor as IPreprocessor, type index$4_MissingSidecarBehavior as MissingSidecarBehavior, type index$4_PreprocessorContext as PreprocessorContext, index$4_PreprocessorPipeline as PreprocessorPipeline, type index$4_PreprocessorPipelineResult as PreprocessorPipelineResult, index$4_PreprocessorRegistry as PreprocessorRegistry, type index$4_PreprocessorResult as PreprocessorResult, type index$4_ToolHistoryCompressionStrategy as ToolHistoryCompressionStrategy, type index$4_ToolHistoryCompressorOptions as ToolHistoryCompressorOptions, index$4_ToolHistoryCompressorPreprocessor as ToolHistoryCompressorPreprocessor, type index$4_ToolHistoryOverflowStrategy as ToolHistoryOverflowStrategy, type index$4_ToolHistoryRetentionMode as ToolHistoryRetentionMode, type index$4_ToolReplayProtocolGuardOptions as ToolReplayProtocolGuardOptions, index$4_ToolReplayProtocolGuardPreprocessor as ToolReplayProtocolGuardPreprocessor, type index$4_ToolReplayProtocolPolicy as ToolReplayProtocolPolicy, index$4_createDefaultAgentPreprocessorPipeline as createDefaultAgentPreprocessorPipeline, index$4_createDefaultAgentPreprocessorRegistry as createDefaultAgentPreprocessorRegistry, index$4_resolveToolReplayProtocolPolicy as resolveToolReplayProtocolPolicy };
|
|
1385
1420
|
}
|
|
1386
1421
|
|
|
1387
1422
|
interface ToolManagerRegistry extends ToolSummaryProvider {
|
|
@@ -1470,6 +1505,7 @@ declare class AgentMessageOrchestrator {
|
|
|
1470
1505
|
private resolvePreprocessorModel;
|
|
1471
1506
|
private resolveContextPolicy;
|
|
1472
1507
|
private applyContextPolicy;
|
|
1508
|
+
private resolveEffectiveContextBudget;
|
|
1473
1509
|
processAgentConversation(request: AgentProfileRequest, history: RuntimeEvent[], toolManager: ToolManager, callbacks?: SummarizationCallbacks, extraOptions?: {
|
|
1474
1510
|
generate?: (request: GenerateRequest) => Promise<GenerateResponse>;
|
|
1475
1511
|
}): Promise<AgentProcessingResult>;
|
|
@@ -1521,6 +1557,7 @@ declare abstract class BaseAgentTask implements IAgentTask {
|
|
|
1521
1557
|
protected abstract getSystemPrompt(request: AgentProfileRequest): string;
|
|
1522
1558
|
getSystemPromptForRequest(request: AgentProfileRequest): string;
|
|
1523
1559
|
buildMessages(request: AgentProfileRequest, history: AiMessage[]): AiMessage[];
|
|
1560
|
+
private createCurrentUserMessage;
|
|
1524
1561
|
private createFenceMessages;
|
|
1525
1562
|
private createFenceMessage;
|
|
1526
1563
|
private insertAfterLastToolResult;
|
|
@@ -2187,4 +2224,4 @@ interface ChatGenerateRequestAdapterInput extends AgentProfileRequest {
|
|
|
2187
2224
|
*/
|
|
2188
2225
|
declare function buildGenerateRequestFromAgentRequest(request: ChatGenerateRequestAdapterInput, conversationHistory: AiMessage[]): GenerateRequest;
|
|
2189
2226
|
|
|
2190
|
-
export { AGENT_CONSTANTS, AGENT_CONTEXT_BUILDER_CONFIG, AISummaryGenerator, type AgentContextBuilderConfigOverrides, type AgentSpecExecutionOptions, type AgentSpecPreprocessorOptions, type AgentSpecProviderOptions, type AgentSpecRuntimeOptions, BaseContextProvider$1 as BaseContextProvider, BaseConversationalTask, BasePreprocessor$1 as BasePreprocessor, ContextProviderRegistry as ChatContextProviderRegistry, CoreContextProvider as ChatCoreContextProvider, ChatMessage, MessageOrchestrator as ChatMessageOrchestrator, type OrchestratorOptions as ChatOrchestratorOptions, type ChatTaskResolver, WorkingMemoryProvider as ChatWorkingMemoryProvider, ContextProviderRegistry$2 as ContextProviderRegistry, ContextTrace, ContextTraceCollector, DEFAULT_MUST_KEEP_POLICY, type FenceDescriptor, type FenceInjection, type FenceLifetime, FenceLifetimePreprocessor, type FenceLifetimePreprocessorOptions, type FenceLlmRole, type FencePlacement, type FenceRegistry, GenerateRequest, GenerateResponse, type HistoryPurificationConfig, HistoryPurificationPreprocessor, type IChatTask, type IContextProvider$1 as IContextProvider, type IPreprocessor$1 as IPreprocessor, type LlmMessage, type MergeContextPolicyParams, type MessageFormatOptions, type MessageFormatterOptions, MessageProcessingState, type MustKeepPolicy, type MustKeepTruncationRule, type NativeToolCallingMessage, type PreprocessorContext$1 as PreprocessorContext, type PreprocessorResult$1 as PreprocessorResult, type ProviderContext$1 as ProviderContext, ProviderResult, SummarizationCallbacks, SummarizationCandidateSelector, type SummarizationOptions, SummarizationProvider, SummarizationStateUtils, SummarizationTrigger, type ToolSummaryProvider, config as agentConfig, index$5 as agentContext, contracts as agentContracts, index$3 as agentOrchestration, index$4 as agentPreprocessors, agentSpecToContextBuilderConfig, agentSpecToRuntimeOptions, index$2 as agentTasks, index$1 as agentTools, index as agentUtils, aiMessageToChatMessage, buildGenerateRequestFromAgentRequest, chatMessageToAiMessage, contextPolicyToContextBuilderConfig, contextPolicyToExecutionOptions, contextPolicyToMustKeepPolicy, contextPolicyToPreprocessorOptions, contextPolicyToProviderOptions, contextPolicyToRuntimeOptions, contextPolicyToSystemReminderOptions, convertEventToChatMessage, convertEventsToChatMessages, createFenceRegistry, createMessageFormatter, findMatchingTruncationRule, formatAgentLlmMessages, getDefaultTokenConfig, mergeContextPolicy, messageFormatter };
|
|
2227
|
+
export { AGENT_CONSTANTS, AGENT_CONTEXT_BUILDER_CONFIG, AISummaryGenerator, type AgentContextBuilderConfigOverrides, type AgentSpecExecutionOptions, type AgentSpecPreprocessorOptions, type AgentSpecProviderOptions, type AgentSpecRuntimeOptions, BaseContextProvider$1 as BaseContextProvider, BaseConversationalTask, BasePreprocessor$1 as BasePreprocessor, ContextProviderRegistry as ChatContextProviderRegistry, CoreContextProvider as ChatCoreContextProvider, ChatMessage, MessageOrchestrator as ChatMessageOrchestrator, type OrchestratorOptions as ChatOrchestratorOptions, type ChatTaskResolver, WorkingMemoryProvider as ChatWorkingMemoryProvider, ContextProviderRegistry$2 as ContextProviderRegistry, ContextTrace, ContextTraceCollector, CurrentTurnMessageAssembler, type CurrentTurnMessageAssemblerOptions, DEFAULT_MUST_KEEP_POLICY, type FenceDescriptor, type FenceInjection, type FenceLifetime, FenceLifetimePreprocessor, type FenceLifetimePreprocessorOptions, type FenceLlmRole, type FencePlacement, type FenceRegistry, GenerateRequest, GenerateResponse, type HistoryPurificationConfig, HistoryPurificationPreprocessor, type IChatTask, type IContextProvider$1 as IContextProvider, type IPreprocessor$1 as IPreprocessor, type LlmMessage, type MergeContextPolicyParams, type MessageFormatOptions, type MessageFormatterOptions, MessageProcessingState, type MustKeepPolicy, type MustKeepTruncationRule, type NativeToolCallingMessage, type PreprocessorContext$1 as PreprocessorContext, type PreprocessorResult$1 as PreprocessorResult, type ProviderContext$1 as ProviderContext, ProviderResult, SummarizationCallbacks, SummarizationCandidateSelector, type SummarizationOptions, SummarizationProvider, SummarizationStateUtils, SummarizationTrigger, type ToolSummaryProvider, config as agentConfig, index$5 as agentContext, contracts as agentContracts, index$3 as agentOrchestration, index$4 as agentPreprocessors, agentSpecToContextBuilderConfig, agentSpecToRuntimeOptions, index$2 as agentTasks, index$1 as agentTools, index as agentUtils, aiMessageToChatMessage, buildGenerateRequestFromAgentRequest, chatMessageToAiMessage, contextPolicyToContextBuilderConfig, contextPolicyToExecutionOptions, contextPolicyToMustKeepPolicy, contextPolicyToPreprocessorOptions, contextPolicyToProviderOptions, contextPolicyToRuntimeOptions, contextPolicyToSystemReminderOptions, convertEventToChatMessage, convertEventsToChatMessages, createFenceRegistry, createMessageFormatter, findMatchingTruncationRule, formatAgentLlmMessages, getDefaultTokenConfig, mergeContextPolicy, messageFormatter };
|