新增: 待发箱/唤醒原语/预算随窗口 + 治理门禁与场景护栏
- 待发箱地基: V51 ai_outbox 表 + 手写 OutboxRepo(claim CAS/崩溃残留复位/瞬时失败保留) + outbox.rs 调度器(KV 默认关/Notify 唤醒/会话忙跳过不丢)
- Wake 异步唤醒原语: 三条件(delay/file-appear/process-exit)+纯判定+注入走正典 spawn_agentic_session,默认关
- 上下文预算随模型窗口: model_context.rs 三级优先(池显式>预设表>回退 128K);上界取 1M 而非 128K——max_tokens 仅裁剪预算,卡 128K 等于不治根因
- 文件租约补纯函数与单测(未另造双轨:LEASE 早随 cb260ab 落地) / 跨会话召回补纯函数单测(主体早已落地)
- 子代理: 完整卡已消化 + 子会话压缩层 + P3 批量
- 隧道/中继: 指令离线不丢 + Hello proto 版本 + 心跳与 runbook
- df-mcp: 写工具后落 KV 变更标记(供 GUI 轮询兜底,补独立 stdio 进程无感知)
- 迁移链顶点改单一真值常量 LATEST_SCHEMA_VERSION(修 2 处因 V51 失效的断言)
- 治理: i18n 特殊字符提交门禁(含反引号覆盖 + 10 自测) / 根目录卫生门禁 / 看板归档器 / 单一 lockfile(bun) / swap-install 落 temp/ 且兼容无 Get-FileHash
- 场景护栏: 流式正文可见性 e2e(playwright 免真机事件回放) + 列表续写/外置句柄 node 测试
This commit is contained in:
@@ -46,6 +46,10 @@ pub mod get_app_config;
|
||||
pub mod knowledge_inject;
|
||||
// 文件租约注册表(W-h1 感知租约):写类文件工具跨会话互斥 + query_leases 兄弟感知
|
||||
pub mod lease;
|
||||
// C2 GUI 侧接点:轮询 df-mcp 落库变更标记,stdio MCP 独立进程写库后补发 df-data-changed
|
||||
pub mod mcp_watch;
|
||||
// 939 ★③:按目标模型上下文窗口构造上下文预算配置(收口会话构造点)
|
||||
pub mod model_context;
|
||||
// 系统通知(P1 bg 化补完):完成/失败/需介入三类事件,主窗托盘化时补位提醒(条件发送)
|
||||
pub(crate) mod notify;
|
||||
pub(crate) mod feishu_notify;
|
||||
@@ -66,6 +70,10 @@ pub mod tool_result_offload;
|
||||
pub mod tools;
|
||||
// B5 无人值守续作引擎:看板轮询自动领单 + parked 自动恢复(收敛回读钩子在 agentic 出口)
|
||||
pub mod unattended;
|
||||
// 待发箱调度器(定时消息与待发箱持久化 P0 地基):到点且会话空闲即经正典 spawn_agentic_session 派发
|
||||
pub mod outbox;
|
||||
// W-b 异步唤醒原语:内存 registry 三条件(delay/file-appear/process-exit)满足即注入续跑
|
||||
pub mod wake;
|
||||
|
||||
use agentic::conv_state::{ConvState, ConvStateStore};
|
||||
|
||||
@@ -1223,7 +1231,8 @@ impl PerConvState {
|
||||
/// 新建默认会话级状态。
|
||||
///
|
||||
/// 各字段初值**逐字对齐 [`AiSession::new`]** —— 批2 迁移调用方时行为不变。
|
||||
/// - messages: ContextManager::new(ContextConfig::default())
|
||||
/// - messages: 先 `ContextConfig::default()`(128K),发送入口再经 [`Self::apply_model_window`]
|
||||
/// 按目标模型实际窗口重设(939 ★③;未重设时等价旧 128K 行为)
|
||||
/// - generating: false
|
||||
/// - stop_flag: Arc::new(AtomicBool::new(false))
|
||||
/// - notify: Arc::new(tokio::sync::Notify::new())
|
||||
@@ -1261,6 +1270,19 @@ impl PerConvState {
|
||||
readonly_cache_floor: 0,
|
||||
}
|
||||
}
|
||||
|
||||
/// 按目标模型上下文窗口重设消息预算(939 ★③,收口见 [`model_context`])。
|
||||
///
|
||||
/// **仅在会话尚无消息时生效**:已有消息时重建 `ContextManager` 会丢弃
|
||||
/// `pending_topic_marker`/`needs_full_rewrite` 等内存态、且可能错位 `persisted_msg_count`
|
||||
/// 持久化基线,风险大于收益。故只对「构造点语义」的空会话重建;已存在的会话沿用其
|
||||
/// 创建时(同样走本方法)设定的窗口——模型切换不回溯改预算(切换后新会话生效)。
|
||||
pub fn apply_model_window(&mut self, model_id: &str, model_configs: &[df_ai::df_ai_core::model::ModelConfig]) {
|
||||
if !self.messages.is_empty() {
|
||||
return;
|
||||
}
|
||||
self.messages = ContextManager::new(model_context::context_config_for_model(model_id, model_configs));
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for PerConvState {
|
||||
@@ -1444,6 +1466,11 @@ pub(crate) fn emit_task_parked(app: &tauri::AppHandle, conv_id: &str, reason: &s
|
||||
if let Err(e) = repo.set_loop_state(&cid, Some("parked")).await {
|
||||
tracing::warn!(conv_id = %cid, error = %e, "[ai] 停靠写 loop_state=parked 失败");
|
||||
}
|
||||
// V50 终局态:停靠=未完成终局(断流/审批超时/重试预算耗尽等),标 incomplete 供未完成率统计。
|
||||
// 用户恢复(ai_continue_loop)时由 recover_parked_inner 复位 active,避免续作后误标。
|
||||
if let Err(e) = repo.set_status(&cid, "incomplete").await {
|
||||
tracing::warn!(conv_id = %cid, error = %e, "[ai] 停靠写 status=incomplete 失败");
|
||||
}
|
||||
});
|
||||
}
|
||||
// ② 发停靠事件(前端渲染停靠卡+继续按钮)。
|
||||
|
||||
Reference in New Issue
Block a user