Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
19ae548
fix(windows-updater): silence NSIS update retry dialog
XingYu-Zhong Jul 24, 2026
b8833f1
fix(kun): preserve compacted Codex response input
XingYu-Zhong Jul 24, 2026
0ec391c
feat: enhance TurnService to support attachment binding and improve a…
XingYu-Zhong Jul 24, 2026
a4c967b
feat: enhance MessageTimeline and WorkMetaRow for improved process vi…
XingYu-Zhong Jul 24, 2026
e0dfe4e
feat: add tests for guided input handling and improve message reconci…
XingYu-Zhong Jul 24, 2026
baf4965
feat: enhance context capacity model and runtime attachment handling
XingYu-Zhong Jul 24, 2026
32d3168
feat: add support for delegated runtime state and enhance context cap…
XingYu-Zhong Jul 24, 2026
4e2ef4c
feat: Enhance agent perspective events with delegated SDK continuity …
XingYu-Zhong Jul 24, 2026
37a1cf4
feat: enhance app settings normalization and migration logic
XingYu-Zhong Jul 25, 2026
0f0838d
feat: implement model provider API key requirement logic and update r…
XingYu-Zhong Jul 25, 2026
8d01642
feat: refactor speech-to-text configuration logic and enhance voice d…
XingYu-Zhong Jul 25, 2026
629eb48
feat: enhance thread composer selection logic and add source tracking…
XingYu-Zhong Jul 25, 2026
55855cc
Refactor TurnService to use bindScopes for attachment binding
XingYu-Zhong Jul 25, 2026
0d1cbf9
feat: add Gemini OpenAI host detection and reasoning effort handling
XingYu-Zhong Jul 25, 2026
92e9e4f
feat: enhance Cursor SDK runtime to manage partial outputs and improv…
XingYu-Zhong Jul 25, 2026
bf81db1
feat: implement checkpoint workspace resolution for rollback actions
XingYu-Zhong Jul 25, 2026
193001a
feat: increase tool call limits for improved performance and flexibility
XingYu-Zhong Jul 25, 2026
25a3efd
feat: enhance FloatingComposer with input history management and shor…
XingYu-Zhong Jul 25, 2026
292116d
feat: implement parallel LLM title generation and enhance thread titl…
XingYu-Zhong Jul 25, 2026
de811c6
feat: add optional Git checkpoint creation and enhance cleanup settings
XingYu-Zhong Jul 25, 2026
5a93cc6
fix(git-checkpoint): add 'disabled' reason to restore result to fix t…
XingYu-Zhong Jul 25, 2026
5d61523
feat: enhance MessageTimeline to separate live reasoning from complet…
XingYu-Zhong Jul 25, 2026
e701a83
feat: enhance user input handling and cleanup processes
XingYu-Zhong Jul 25, 2026
ddb4493
feat: update user input handling to allow optional fields in CoreTurn…
XingYu-Zhong Jul 25, 2026
3c9f419
fix(checkpoint): preserve referenced rollback points
XingYu-Zhong Jul 25, 2026
0b9a7ef
fix(credentials): recover unreadable Windows DPAPI state
whitelonng Jul 25, 2026
de53a03
docs(release): add 0.2.31 notes
XingYu-Zhong Jul 25, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ TestResults.xml
.workbuddy/
.kun-design/
.kun-canvas/
.kunsdd/
openspec/

### Internal docs
Expand Down
10 changes: 10 additions & 0 deletions build/installer.nsh
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
!macro customInit
${if} ${isUpdated}
# electron-updater always passes --updated, including older Kun versions
# that launched the assisted installer without /S. Force only that path
# into silent mode so retry/cancel dialogs use their safe default while a
# manually launched installer remains interactive.
SetSilent silent
${endif}
!macroend

!macro customCheckAppRunning
Var /GLOBAL KunInstallerCurrentPid
Var /GLOBAL KunInstallerStopAttempt
Expand Down
36 changes: 21 additions & 15 deletions docs/kun-architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,16 @@ provider 原生缓存字段;这些历史数据只能作为旧实现的证据

## Subagent 召回与派发

`delegate_task` 把可信的内置、GUI 配置和工作区 `.kun/agents/*.md` 目标统一成
独立 agent profile 检索集合,不再存在 skill worker。仓库可编辑的
`delegate_task` 是唯一创建 child run 的入口,`list_subagent_profiles` 是主代理专用的
只读发现工具。开启“使用现有代理”时,发现结果只按页返回当前 workspace 和 product
surface 的有效 profile;`delegate_task` 只公开可选 `profile`,省略时由 Kun 在有效
目录中自动路由。该模式不向模型公开 `custom_agent`,宿主也会拒绝旧客户端或手工请求
携带的该字段。关闭该开关时不读取或返回注入目录,发现结果只描述一次性 custom
能力,且 `delegate_task` 必须提供 `custom_agent`。
动态目录只出现在工具结果中,不写入稳定 system prompt 或工具 schema。

可信的内置、GUI 配置和工作区 `.kun/agents/*.md` 目标统一成独立 agent profile
检索集合,不再存在 skill worker。仓库可编辑的
`.kun/agents/*.md` 进入自动 BM25/LLM 召回(仅索引 id/name/description,不索引
body),也可按精确 ID 显式选择,并出现在设置页与工作台右侧子代理面板(带
「自定义」标签;定义来自 markdown,面板内只读)。未写 `toolPolicy` 时默认只读;显式
Expand All @@ -113,29 +121,27 @@ shared 读取,保持升级前的全局可用语义。
工作台可通过“扩展代理”总开关一次性启用这 37 个角色,或通过“仅保留基础代理”
清空全部扩展角色的 surface 分配。

未显式指定 `profile` 或 `custom_agent` 时,派发顺序固定为:
在“使用现有代理”模式下未显式指定 `profile` 时,派发顺序固定为:

1. 对 ID/名称、description 和单一权威目录中的双语能力 facets 建立字段加权
BM25 索引,使用 `k1=1.2`、`b=0.75`,并按任务显式只读/修改意图做策略加权后
只保留 Top 5。真实 33-Agent 中英 query 集持续验证 Recall@5。
2. 使用 `roles.smallModel`(未配置则父会话/运行时模型)做一次无工具、JSON
约束的判断。模型只能选择 Top 5 中的 profile,且 confidence 至少为 0.60;
低于阈值或没有完整匹配时返回生成角色所需的 brief。
3. 无合适项时由独立 `SubagentGenerator` 从最多 3 个可信内置 agent prompt 中总结
设计模式,生成只对本次 child run 生效的完整 profile;它不写入 settings 或
workspace,并强制屏蔽 `delegate_task`、`generate_subagent`、`load_skill`。
4. 判断模型超时、报错、输出非法 JSON 或虚构候选 ID 时,只有任务明确点名
Top 1 的 ID/名称才直达该候选;普通词面重叠不足以证明适配,此时与完全无召回
一样进入独立生成器;失败路径默认 read-only,只有显式权限选择或一次有效的
LLM 判断可以要求 inherit。父 abort 会直接终止派发,不会生成 fallback child。
3. 没有有效 specialist、判断模型超时/报错/输出非法 JSON 或虚构候选 ID 时,
复用配置的 default profile(通常是 `general`),而不是现场生成角色。父 abort
会直接终止派发,不会启动 fallback child。

显式 `profile` 是稳定直达路径;选中的 profile 会连同来源和权限在执行前快照,
不在 recall 与 run 之间重新读取。`custom_agent` 允许主 agent 直接给出一次性角色,
`generate_subagent` 则显式要求系统自动设计并立即执行临时角色。任何路径都不能扩大
不在 recall 与 run 之间重新读取。只有关闭“使用现有代理”后,`custom_agent` 才允许
主 agent 直接给出一次性角色;它不写入 settings/workspace,并继承当前 turn 的
model/provider/reasoning 选择。升级前已经持久化的 `custom:*` child record 仍可读取,
但不会让严格现有代理模式重新开放 custom 派发。任何路径都不能扩大
父 turn 的 approval policy、sandbox 根、工具/工具 Provider allowlist、denylist 或 Memory
边界;有效能力始终是父快照与 profile 约束的交集。独立 workflow agent 和生成 agent
都禁用 Skills 自动激活。child record 持久化 route method、Top 5、选择理由、置信度
生成样例及临时角色快照;router 与 generator 的 usage 分别计入父 thread。
边界;有效能力始终是父快照与 profile 约束的交集。独立 workflow agent 和一次性
custom agent 都禁用 Skills 自动激活。child record 持久化 route method、Top 5、
选择理由、置信度及临时角色快照;router usage 计入父 thread。

下一阶段仍值得推进的缓存能力:

Expand Down
14 changes: 14 additions & 0 deletions electron-builder.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,20 @@ module.exports = {
from: 'resources/whisper',
to: 'whisper',
filter: ['**/*']
},
{
from: 'resources/officecli/current',
to: 'officecli',
filter: ['officecli', 'officecli.exe', 'selected.json']
},
{
from: 'resources/officecli/manifest.json',
to: 'officecli/manifest.json'
},
{
from: 'resources/officecli/legal',
to: 'officecli/legal',
filter: ['LICENSE', 'NOTICE', 'THIRD-PARTY-NOTICES.txt']
}
],
artifactName: `Kun-${artifactVersion}-\${os}-\${arch}.\${ext}`,
Expand Down
88 changes: 50 additions & 38 deletions kun/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions kun/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"dev": "tsc -p tsconfig.build.json --watch"
},
"dependencies": {
"@anthropic-ai/claude-agent-sdk": "^0.3.193",
"@anthropic-ai/claude-agent-sdk": "^0.3.220",
"@computer-use/nut-js": "^4.2.0",
"@cursor/sdk": "1.0.24",
"@emnapi/core": "^1.10.0",
Expand All @@ -83,6 +83,8 @@
"proxy-agent": "^8.0.2",
"safe-regex2": "5.1.1",
"semver": "^7.8.5",
"typescript": "5.9.3",
"typescript-language-server": "5.3.0",
"undici": "^7.28.0",
"yauzl": "^3.4.0",
"yazl": "^3.3.1",
Expand All @@ -93,7 +95,6 @@
"@types/semver": "^7.7.1",
"@types/yauzl": "^3.4.0",
"@types/yazl": "^3.3.1",
"typescript": "^5.8.2",
"vitest": "^4.1.7"
},
"overrides": {
Expand Down
14 changes: 12 additions & 2 deletions kun/src/adapters/model/compat-message-projector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ import type { ModelRequest } from '../../ports/model-client.js'
import { isToolResultBridgeItem, repairModelHistoryItems } from '../../domain/model-history-repair.js'
import { extractToolResultImages, toolResultTextWithoutImages } from '../../loop/tool-result-image.js'
import { wrapUntrustedContent } from '../../security/untrusted-content.js'
import type { CompatChatMessage, CompatChatMessageContentPart } from './compat-request-codecs.js'
import {
COMPAT_HISTORY_CONTEXT,
type CompatChatMessage,
type CompatChatMessageContentPart
} from './compat-request-codecs.js'
import { userMessageTextWithComposerContexts } from '../../domain/composer-context.js'

export type CompatMessageProjectionOptions = {
Expand Down Expand Up @@ -233,7 +237,11 @@ class CompatMessageProjector {
return this.toolResultToMessage(item, supportsImages)
case 'compaction':
return item.replacedTokens > 0
? { role: 'system', content: `Conversation summary from earlier turns:\n${item.summary}` }
? {
role: 'system',
content: `Conversation summary from earlier turns:\n${item.summary}`,
[COMPAT_HISTORY_CONTEXT]: true
}
: null
case 'review':
return item.status === 'completed' && item.reviewText?.trim()
Expand Down Expand Up @@ -404,6 +412,8 @@ function formatAttachmentDocument(
`Name: ${document.name}`,
`FilePath: ${document.localFilePath ?? 'unknown'}`,
`MIME: ${document.mimeType}`,
...(document.documentFormat ? [`Format: ${document.documentFormat}`] : []),
...(document.sourceSha256 ? [`SourceSHA256: ${document.sourceSha256}`] : []),
...(document.pageCount ? [`Pages: ${document.pageCount}`] : []),
...(document.truncated ? ['Note: text truncated to fit the context limit'] : []),
'Content:',
Expand Down
Loading
Loading