Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
fe4a406
feat(v3-dev): 添加可选会话续接并完善后台工具与上下文配置
xhcz Oct 25, 2026
f5df20a
feat(v3-dev): 添加可选群聊平衡意愿算法
xhcz Oct 25, 2026
f57a770
feat(model): add native Gemini and Anthropic protocols and refresh pr…
xhcz Oct 25, 2026
1af4628
fix(model): bind named providers to their native APIs and remove prot…
xhcz Oct 25, 2026
b67d05b
chore(v3-dev): remove legacy provider address checks and migration no…
xhcz Oct 26, 2026
1acf3fd
fix(core): preserve topic willingness across fallback paths
xhcz Oct 27, 2026
b63238e
chore(docs): defer provider documentation to separate work
xhcz Oct 27, 2026
002d3d5
fix(core): preserve confirmed partial deliveries and QQ send diagnostics
xhcz Oct 27, 2026
9c0b132
Merge QQ delivery fixes into provider protocol improvements
xhcz Oct 27, 2026
841cbc4
feat(v3-dev): 整理配置分组并完善公共错误接口
xhcz Oct 27, 2026
b19be87
fix(core): align reply score diagnostics across pending branches
xhcz Oct 27, 2026
92efb91
fix(v3-dev): 修复图片上下文生命周期与模型组管理问题
xhcz Oct 27, 2026
ff5ff4d
fix(agent): 保留已准入续接轮次的后续心跳
Oct 28, 2026
1c0f382
fix(core): 迁移旧官方模型地址并记录逐条发送回执
Oct 28, 2026
213fd5c
fix(core): 修复后台回复安静/静默逻辑,部分平台适配问题
Oct 28, 2026
8b28390
fix(config): prevent native renderer from inheriting section headings
xhcz Oct 28, 2026
61edf85
fix(config): synchronize native section heading repair
xhcz Oct 28, 2026
29b655b
fix(config): restore offline controls and configuration validation
xhcz Oct 29, 2026
a6220c5
fix(config): synchronize configuration rendering and validation
xhcz Oct 29, 2026
18727cd
fix(config): preserve validation roles on native model cards
xhcz Oct 29, 2026
13a6355
feat(v3-dev): 完善公共错误接口与人物记忆冲突处理
xhcz Oct 29, 2026
33547b3
fix(model): remove configuration page validation metadata
xhcz Oct 29, 2026
f89ca96
fix(core): separate image lifecycle and model groups from configurati…
xhcz Oct 29, 2026
907c2d5
fix(config): make provider migration safe in serialized console schemas
xhcz Oct 29, 2026
b1e6252
refactor(core): simplify willingness calculation
xhcz Nov 1, 2026
96a1505
fix(core): recover native tool calls with configurable corrections an…
xhcz Nov 2, 2026
3d94187
fix(person-memory): bound retention queries for WASM SQLite
xhcz Nov 3, 2026
1e63c2c
fix(v3-dev): 修复上下文、记忆与工具执行链路
xhcz Nov 6, 2026
78637af
fix(v3-dev): 完善视觉上下文、工具恢复与配置分组
xhcz Nov 8, 2026
6cc5eb5
fix(v3-dev): 联动历史重置并完善对话上下文与人物记忆
xhcz Nov 9, 2026
2b4a67b
Merge upstream v3-dev into audit integration
xhcz Nov 13, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions docs/configuration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# 核心插件配置

打开 YesImBot 核心插件的配置页,先按用途选择大类,再展开需要调整的功能。收起功能组不会清除尚未保存的修改。开关、数字输入、模型选择、表格和模板编辑框均可直接操作;修改完成后使用控制台的保存操作。

| 大类 | 可以调整什么 | 配置文件字段 |
| ------------ | ---------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 模型与连接 | 提供商地址与密钥、模型能力、模型组、聊天及嵌入任务分配 | `providers`、`modelGroups`、`task` |
| 对话与回复 | 响应频道、唤醒条件、新消息策略、回复暂停、发言意愿、参与保持、等待后续消息、接话判断、发送节奏 | `allowedChannels`、`prioritizeMentions`、`debounceMs`、`newMessageStrategy`、`deferredProcessingTime`、`replySuppression`、`base`、`attribute`、`interest`、`lifecycle`、`participation`、`continuation`、`typesafe`、`topics`、`extra.core_util.typing`、`extra.core_util.deliveryTimeoutMs` |
| 记忆与上下文 | 是否记录机器人自己的消息、输入预算、近期完整轮次、核心记忆文件、语义检索和长期日记 | `ignoreSelfMessage`、`contextInputBudgetTokens`、`l1_memory`、`coreMemoryPath`、`l2_memory`、`l3_memory` |
| 视觉与图片 | 视觉开关、附图数量与保留规则、辅助识图模型与超时、图片处理、图片占位符说明 | `enableVision`、`allowedImageTypes`、`maxImagesInContext`、`imageLifecycleCount`、`imageFollowUpWindowSeconds`、`imageFollowUpMaxTurns`、`detail`、`extra.core_util.vision`、`image`、`multiModalSystemTemplate` |
| 角色与提示词 | 系统和用户模板、扩展注入占位符、模板渲染选项 | `systemTemplate`、`userTemplate`、`injectionPlaceholder`、`maxRenderDepth` |
| 工具与任务 | 原生工具调用、动作纠正、单轮执行次数、后台任务、超时与重试、扩展工具开关 | `nativeToolCalling`、`nativeToolCorrectionRetries`、`streamAction`、`heartbeat`、`backgroundTools`、`advanced`、`extra` 中其余扩展设置 |
| 存储与维护 | 文件存储与下载、资源清理、历史保留、日志、错误上报、决策记录 | `storagePath`、`driver`、`assetEndpoint`、`maxFileSize`、`downloadTimeout`、`recoveryEnabled`、`autoClear`、`logLengthLimit`、`dataRetentionDays`、`cleanupIntervalSec`、`logging`、`errorReporting`、`decisionRecording` |

## 图片设置

先在“模型与连接”的提供商中登记模型,并勾选该模型支持的视觉能力。模型能力描述该模型可以做什么;“视觉与图片”决定聊天时是否附图、如何处理图片。

“视觉开关与附图规则”控制直接发送给聊天模型的图片。“辅助识图模型与超时”设置图片描述工具使用的模型、细节程度及等待时间;聊天模型已经收到图片时,是否仍允许辅助识图由该处的独立开关控制。

辅助识图和发送节奏属于核心工具集。关闭“工具与任务 → 扩展工具开关与设置”中的核心工具集后,这两项设置暂不显示;重新启用后可继续调整原先填写的值。其他扩展的设置仍在各自的扩展工具项中。

## 模型与工具超时

模型请求的等待时间在“模型与连接 → 模型提供商 → 模型列表 → 超时策略”中设置。普通工具的默认超时和单工具覆盖在“工具与任务 → 工具超时与重试”中设置。后台任务另有自己的超时。

| 设置位置 | 作用 |
| ------------------------------- | --------------------------------------------------------------------------- |
| 视觉与图片 → 辅助识图模型与超时 | 辅助识图总超时;填 `0` 时按所选模型的超时、重试和准备时间计算 |
| 对话与回复 → 发送节奏与超时 | 发送总超时;填 `0` 时按分段数量、打字延迟和传输预算计算 |
| 工具与任务 → 工具超时与重试 | 普通工具默认等待 10000 毫秒;可按工具名指定覆盖值,覆盖值优先于工具自身预算 |
| 工具与任务 → 后台任务 | 后台执行同时受工具预算和后台任务总上限约束,取较短者 |

只读工具失败后,模型可在本轮次数上限内调整查询或继续回复。消息发送等有副作用的操作不会自动重放;已经确认发送的消息会保留回执,结果不确定时也不会直接当作未发送。用户取消或新消息中断后,旧轮次不会继续执行。

## 历史清理与日记

`history.clear -a all` 会重置全部核心对话历史、意愿和等待中的对话状态,并取消相关旧任务。人物记忆扩展接入后,会同时清理可以证明属于自身的资料、来源、审计和总结队列。共享范围存在其他所有者,或者旧资料无法证明归属时,会保留并在回执中说明;不要把该回执理解为整个数据库已清空。配置和角色提示词不会被重置。

已经提交到远端的请求未必能撤回;本地会停止等待及重试,拒绝旧结果继续发送或写入。清理期间收到的新消息会在清理结束后重新校验处理。

自动日记失败后默认等待 30 秒再尝试,连续失败逐步延长,默认最多 300 秒。可在“记忆与上下文 → 长期日记”调整首次与最长等待时间;手动生成不受自动冷却限制。

## 手机上操作

先收起不用的大类,再展开当前功能。长表格可以在表格区域内横向滚动;数字、下拉选择和长文本输入会按屏幕宽度排列。
36 changes: 36 additions & 0 deletions docs/prompt-templates.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# 提示词模板与扩展内容

系统预设可使用 `NATIVE_TOOL_CALLING` 区分本次请求的输出协议。开启原生工具时使用工具接口;切换到 JSON fallback 时,该值为 `false`。人格、语气和记忆规则放在条件分支外,两种模式都会保留。

```mustache
你的人格与交流规则……
{{#NATIVE_TOOL_CALLING}}
通过原生工具接口执行动作,使用 send_message 发送回复。
{{/NATIVE_TOOL_CALLING}}
{{^NATIVE_TOOL_CALLING}}
只输出包含 thoughts、actions 和 request_heartbeat 的 JSON 对象。
{{/NATIVE_TOOL_CALLING}}
```

除 LF/CRLF 换行差异外,完全匹配旧版内置默认系统预设的配置,会在加载时自动使用新版默认预设。自定义预设保持原文;如果原生工具模式仍要求输出 JSON actions,请按上述分支调整。修改过的旧默认预设也属于自定义预设。

消息正文、记忆、工具结果、日程和人物资料中的 `{{…}}` 均按原文保留,不会再次展开。`maxRenderDepth` 仅为兼容旧配置保留,不再让动态内容递归渲染。

扩展的 `prompt.inject(name, priority, callback)` 回调应返回已经准备好的文字。需要组合可信模板时,可注册模板后使用 `injectTemplate`,把用户或模型产生的内容放进数据字段:

```ts
prompt.registerTemplate("my-extension.summary", "当前安排:{{plan}}");
prompt.injectTemplate("my-extension", 10, "my-extension.summary", async () => ({
plan: await readCurrentPlan(),
}));
```

这里仅解释注册模板本身。即使 `plan` 包含双大括号或不完整的模板语法,也会保留为普通文字。不要把用户正文或模型返回值拼入注册模板的源码。

## 上下文裁剪与工具历史

默认请求不包含内部裁剪报告。完整估算、删除计数和超软预算原因可在服务端调试日志“上下文裁剪”中查看。原样保存的旧默认用户模板也不会继续输出报告;自定义模板明确引用 `CONTEXT_BUDGET` 时保留该兼容能力,意味着这些内部统计将发送给主模型。报告中的 token 数是保守估算,事件数也不等于聊天消息数。

软预算只裁剪可替代的世界状态,不修改系统提示词或核心记忆。固定内容与必要来源已超过预算时,请求仍保留它们,并在服务端报告超预算。旧工具轨迹先于近期用户对话让出空间;同一执行中的工具结果和关联回执作为同一因果组保留。

模型历史不会重放原始思考或工具参数中的 `inner_thoughts`。同一次调用的结果已有观察记录时,不再重复展示框架回执;管理员或独立工具回执仍保留简洁结果。原始审计日志保持完整。实际机器人消息保留在对话中,已能逐段核对的发送动作只保留消息编号引用;没有确认消息或发送失败时仍保留动作记录。
38 changes: 38 additions & 0 deletions docs/superpowers/plans/2026-11-07-vision-delivery-config.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Vision, tool delivery, and configuration reliability

**Goal:** Preserve direct image input across a conversation, make execution deadlines match tool behavior, and organize configuration by user task.

**Architecture:** Keep existing configuration storage paths and native Koishi field types. Image selection remains before context budgeting. Tool execution preserves confirmed delivery independently of its final promise, and recoverable reads return observations without automatically repeating side effects.

## Constraints

- Global direct-vision settings and the selected chat group's declared abilities determine direct image input.
- Internal heartbeats do not consume separate user-task image allowances.
- Related-image restoration respects conversation scope, history generation, input budget, and image limits.
- Auxiliary image description serves text-only or explicitly enabled weak-vision use.
- Cancellation, revocation, and shutdown still suppress late side effects.
- A timeout cannot erase confirmed receipts or authorize replay of uncertain delivery.
- Existing configuration values and unknown extension fields survive edits and folding.
- Configuration checks must include native Koishi controls; an unrelated HTML mock does not validate the console.

## Tasks

1. Image continuation: reproduce image input followed by an unquoted question and intervening tool heartbeats; retain bounded related sources and expose exclusion diagnostics.
2. Tool deadlines: reproduce a slow image request and a segmented message with typing delays; provide explicit effective deadlines and preserve confirmed/uncertain delivery state.
3. Recovery: feed read failures back to the model within heartbeat limits, stop dependent batch actions, and avoid automatic replay of writes.
4. Format correction: preserve the original persona, question, tool history, and images during bounded correction; honor zero retries and immediate failover.
5. Configuration: project existing fields into seven purpose groups with compact native controls and actual nested folding; keep dynamic enable branches and a unique editor per path.
6. Verification: run focused regressions, complete suite, build, lint, formatting, independent installed-package smoke tests, and actual console interaction where the environment permits it.

## Review focus

- Image input after a model switch or context compaction.
- Revocation or history clearing during image restoration and tool execution.
- Confirmed first segment with a blocked second segment, including segments inside one platform encoder.
- An uncertain platform response must never be described as definitely unsent.
- Disabled extensions, dynamic schema updates, and unknown configuration fields during save.
- Repeated invalid outputs must neither lose the original context nor create unbounded correction history.

## Delivery

Publish verified changes to the existing fork integration branch after independent review. Preserve its current remote head and verify the published source tree against the tested tree.
77 changes: 77 additions & 0 deletions docs/superpowers/plans/2026-11-09-conversation-audit-repairs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# Conversation Audit Repairs Implementation Plan

> **For agentic workers:** Execute each independently owned repair with a failing regression, a minimal implementation, and verification before integration.

**Goal:** Repair confirmed conversation, reset, memory, delivery and diagnostic defects in the November 9 evidence.

**Architecture:** A shared history-reset lifecycle coordinates the core and registered extensions. Other repairs preserve runtime configuration paths and remove diagnostic duplication while retaining message and tool provenance.

**Tech Stack:** TypeScript, Koishi, Vitest, Yarn/Yakumo.

**Spec:** `2026-11-09-conversation-reset-spec.md` in this directory.

## Global Constraints

- Preserve user settings, persona text, scope authorization, and unrelated domains.
- No real history clearing, external model calls, or private evidence publication during verification.
- Publish only tested code to the existing fork integration branch; no new PR.

## Review Focus

- A capture begun before clearing must not enqueue after clearing.
- Late responses and already accepted writes must not resurrect deleted data.
- Audit replay and persistent retries must not recreate purged profiles after restart.
- ID-only multipart receipts must not invent message content.
- Removing diagnostics must preserve required tool results and conversation context.

## Tasks

### 1. Core reset and L3 lifecycle

Files: `world/commands.ts`, new reset coordination module, `agent/index.ts`, `agent/scheduler.ts`, `world/l3-archival-memory.ts`, corresponding tests.

- [ ] Reproduce queued stimulus/assessment surviving clear and repeated L3 failure fanout.
- [ ] Register clear participants; synchronously invalidate old work before asynchronous preparation, drain writes and release maintenance state in finally.
- [ ] Reset transient agent state, cancel L3 work, add bounded failure cooldown and owner-level logging.
- [ ] Verify late results are rejected and fresh messages work after clear.

### 2. Person memory

Files: `packages/person-memory/src/{index,shared-runtime,worker,store,summary-queue,profile-tools,profile-prompt}.ts`, tests.

- [ ] Reproduce list defaults, cached invalid candidate reuse, and clear during capture/model/commit.
- [ ] Join task 1 lifecycle through explicit participant registration; purge only owned scopes under the store serial barrier.
- [ ] Reset queues, timers and persisted candidates; validate/correct invalid output within a finite budget; declare existing profile limits in the generator prompt.
- [ ] Verify both modes, restart behavior, audit reconstruction and unrelated scope preservation.

### 3. Model input and visuals

Files: `agent/context-builder.ts`, `agent/context-packing.ts`, `agent/heartbeat-processor.ts` rendering, world history projection, prompt templates, tests.

- [ ] Reproduce forced budget injection, duplicate observations and skipped recent images.
- [ ] Remove forced internal reporting, deduplicate diagnostic representations and retain bounded new image provenance.
- [ ] Verify final native/JSON requests, image scope and clear invalidation; preserve tool causality and user templates.

### 4. Delivery provenance

Files: `agent/reply-turn.ts`, `extension/builtin/core-util/index.ts`, `world/event-listener.ts`, tool event projection, tests.

- [ ] Reproduce successful ID-only encoder output missing history content.
- [ ] Recover unambiguous sent content without attributing full content to ambiguous multipart receipts.
- [ ] Verify partial delivery, cancellation and read-back using actual encoder boundaries.

### 5. Failure classification and maintenance

Files: `model/service.ts`, native heartbeat error branch, `world/history-inspection.ts`, usage owner plumbing, decision journal, tests.

- [ ] Reproduce deterministic HTTP rejection retries, native-call error misclassification and implicit dependency warnings.
- [ ] Classify terminal versus transient errors, retain bounded native correction, pass existing service dependencies explicitly.
- [ ] Evaluate stale-lock recovery using provable ownership; preserve conservative behavior for ambiguous locks.
- [ ] Verify transient retries, cancellation and no replay of side effects.

### 6. Integration

- [ ] Independently review merged lifecycle and source projection boundaries.
- [ ] Run full Vitest suite, build, client typecheck, lint and format checks.
- [ ] Verify packed installations and actual Koishi lifecycle; inspect console if settings change.
- [ ] Publish with expected-head guard and compare remote tree to tested tree.
11 changes: 11 additions & 0 deletions docs/superpowers/plans/2026-11-09-conversation-reset-spec.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Conversation audit repair specification

Repair the confirmed defects observed in the November 9 conversation exports without editing user persona content or uploading private evidence.

Full history clearing is a lifecycle boundary: invalidate old stimuli and asynchronous captures before waiting, cancel associated requests and retries, drain accepted writes, purge selected conversation-derived state, and reject late results. Reset willingness and transient scheduling state. Preserve settings and unrelated instances/domains; shared physical history retains its existing shared scope. Do not execute destructive commands against supplied backups or user data during development.

Keep internal budget reports and duplicated diagnostic receipts out of default model input. Retain genuine conversational messages and necessary tool causality. Explicit custom template compatibility must not cause forced metadata injection. Recent visual sources must include images received while a reply was skipped and must remain bounded and scope checked.

Confirmed sends with ID-only receipts require safe history content recovery; never fabricate per-ID content for ambiguous multipart or partial deliveries. Person list defaults must work without weakening selector validation. Invalid cached profile candidates must not be retried unchanged; model corrections remain bounded. Deterministic provider rejections must not be resent unchanged. Missing native calls require accurate errors. L3 failure cooldown and single-owner logging must prevent repeated local failures and warning fanout.

Conversation drift and cache efficiency remain hypotheses. Validate final input composition and delayed addressed-to-others examples; do not claim model quality or cache improvements without evidence.
Loading
Loading