22 KiB
Maka 能力成熟度审计 v1
Archived on 2026-07-13. This is a point-in-time audit against a May 2026 code baseline; its progress and frontend-document references are not current guidance.
编写:@xuan 日期:2026-05-22 基线:
mainat832bbac范围:能力 / runtime / storage / IPC / release gate。UI 视觉规则以docs/design-system.md为准。
本文档回应 task #12 中 "@xuan 详细挖掘现在项目存在的问题,和需要继续做的能力"。 目标不是再列一组 wish list,而是把 Maka 从 "能聊天的桌面 app" 推向 reference implementation / reference implementation 那类成熟工作台时必须补齐的系统 contract。
审计参考:
- Maka 当前代码:
packages/core/src/session.ts,packages/core/src/events.ts,packages/core/src/llm-connections.ts,packages/runtime/src/session-manager.ts,packages/runtime/src/builtin-tools.ts,apps/desktop/src/main/main.ts,apps/desktop/tests/smoke.md - reference implementation 本地资料:local research notes,
architecture gap notes,
docs/11-providers.md,docs/17-workspaces-git.md,docs/39-streaming-deep.md,readable/preload.js - reference implementation 本地资料:
~/.reference implementation-agent/docs/reference implementation-cli.md,~/.reference implementation-agent/release-notes/*.md
0. 当前基线判断
Maka 目前已经不是早期 chat demo:
- provider model discovery 已走 live fetch + source/fetchedAt contract;
- Settings / ModelTable / turn grouping / typed tool renderer / visual smoke fixture 已有基本 gate;
- Electron 安全边界、console audit、readiness reason、window state 等桌面基础已补了一轮;
docs/design-system.md已把 visual release gate 写成契约。
但能力层仍然薄:核心数据模型仍围绕 "session + JSONL messages",没有 artifact、 workspace status、turn control、source/automation、health、memory 这些成熟工作台必须有的持久化对象。 接下来最重要的不是继续堆 Settings polish,而是补数据结构和状态机。
1. 第一优先级:ArtifactRecord + right pane
现状问题
Maka 当前的 tool result 都落在 transcript 里:
ToolResultContent只有file_diff/file_write/terminal/image/summary等结果形状;- UI 通过 typed renderer 把 diff/terminal 渲染好,但仍然是 chat turn 的一部分;
- 大 HTML、图片、PDF、长 diff、生成文件没有成为可选择、可复看、可导出的工作成果。
用户路径上的不成熟感:
- 一次生成网页 / 图片 / 文档后,用户只能在长聊天里找结果;
- terminal/diff 输出占据主叙事,缺少 "成果面板";
- 后续 snapshot / rollback / preview 没有对象可挂。
reference implementation / reference implementation 对照
reference implementation preload 已有 snapshot.* 一组能力(create / file / list / get / diff / rollback / cleanup),并把 workspace diff/snapshot 从 transcript 中分离出来。
reference implementation 的 release notes 也反复强调 diff / preview / data table / terminal preview 的独立呈现。
可复制的是:artifact 作为第一等对象;不可照搬的是 reference implementation wide-open local API。
Contract / API
新增 core contract:
export type ArtifactKind =
| 'file'
| 'html'
| 'image'
| 'pdf'
| 'diff'
| 'terminal'
| 'json'
| 'markdown';
export interface ArtifactRecord {
id: string;
sessionId: string;
turnId?: string;
toolUseId?: string;
kind: ArtifactKind;
title: string;
createdAt: number;
updatedAt: number;
source: 'tool_result' | 'user_upload' | 'export' | 'snapshot';
ref: StorageRef;
mimeType?: string;
bytes?: number;
summary?: string;
status: 'ready' | 'streaming' | 'errored' | 'deleted';
errorReason?: string;
}
Storage:
artifacts.jsonlper session orartifacts/metadata.jsonlper workspace;- large payload 必须 file-backed,不进入
session.jsonl; - HTML preview 使用 sandboxed iframe,禁止 inline untrusted script 执行;
- deletion 先 soft-delete,避免 transcript 中引用断裂。
IPC:
artifacts:list(sessionId?)artifacts:get(id)artifacts:open(id)artifacts:delete(id)artifacts:export(id, format?)
Renderer:
- right pane 作为
--z-panel消费者; - Chat turn 内只显示 compact artifact card;
- pane 负责 full preview / copy / open / export。
Failure state
需要固定 reason:
artifact_missingartifact_deletedartifact_too_largeartifact_preview_unsupportedartifact_load_failedartifact_sandbox_blocked
Gate
- node:test:ArtifactStore append/list/get/delete;HTML artifact 必须 file-backed;
- fixture:新增
artifact-panescenario,包含 html + image + diff + errored artifact; - smoke.md:新增 "Artifact pane open / preview / export / error" path;
- screenshot:light/dark/narrow + missing artifact failure state。
2. Tool output streaming delta 协议
现状问题
Maka 已有 ToolProgressEvent,但当前 runtime tools 多数只在 tool 完成后返回完整 result。
Bash 使用 exec,只有完成后一次性拿 stdout/stderr。UI 的 terminal renderer 也只能显示 settled output。
用户路径上的不成熟感:
- 长测试 / build / install 没有实时 stdout;
- 用户以为 app 卡住;
- Stop 后看不到 partial output。
reference implementation / reference implementation 对照
reference implementation streaming docs 强调 tool output delta;reference implementation release notes 也多次修复 partial output / streaming error recovery。 可复制的是 "delta 先到 UI,final result 再落盘"。
Contract / API
扩展事件:
export interface ToolProgressEvent extends BaseEvent {
type: 'tool_progress';
toolUseId: string;
sequence: number;
stream: 'stdout' | 'stderr' | 'progress' | 'text';
text: string;
truncated?: boolean;
}
Runtime:
- Bash 从
exec改成spawn; - stdout/stderr chunk 经 redaction 后发
tool_progress; - final
tool_result保留 capped output + artifact ref(完整日志入 artifact); - abort 时落
tool_resultwithisError=true+reason='aborted'或独立 aborted event。
Failure state
tool_abortedtool_timeouttool_output_truncatedtool_spawn_failedtool_permission_denied
Gate
- node:test:fake streaming tool emits ordered progress → result;
- fixture:
turn-with-streaming-tool; - smoke:长 running command 能实时显示 stdout/stderr,Stop 后保留 partial output。
3. ModelCatalogEntry:模型目录不再只是 ModelInfo
现状问题
当前 ModelInfo 只有 id/contextWindow/maxOutputTokens/capabilities,capabilities 也只有 vision/reasoning/functionCalling。
不足:
- 没有
mode区分 chat/image/audio/embedding/rerank; - 没有 pricing/source/stale/unsupported;
- default model 校验只看 model id 是否在 enabled list;
- 无法阻止 image-only / embedding-only model 被设为 chat default;
- Health / first-run 无法解释 "模型存在但不能用于当前 chat"。
reference implementation / reference implementation 对照
reference implementation provider 层会根据 model id 补 capability;reference implementation 在 release notes 中也反复修 model resolution / Bedrock region / unsupported model 过滤。 可复制的是 backend-normalized catalog,而不是 UI 猜。
Contract / API
新增:
export type ModelCapability =
| 'chat'
| 'tool_use'
| 'vision'
| 'reasoning'
| 'image_generation'
| 'audio_input'
| 'audio_output'
| 'embedding';
export interface ModelCatalogEntry {
id: string;
displayName?: string;
providerType: ProviderType;
capabilities: ModelCapability[];
contextWindow?: number;
maxOutputTokens?: number;
pricing?: {
inputPerMtok?: number;
outputPerMtok?: number;
currency: 'USD' | 'CNY';
source: 'builtin' | 'provider' | 'user';
};
source: 'fetched' | 'fallback' | 'user_custom';
fetchedAt?: number;
stale?: boolean;
unsupportedReason?: 'not_chat_model' | 'missing_tool_use' | 'provider_deprecated' | 'unknown';
}
Readiness guard:
- chat default requires
capabilities.includes('chat'); - tool mode requires
tool_use; - image/audio model 不能设为 chat default。
Failure state
model_unsupportedmodel_stalemodel_not_chat_capablemodel_requires_refresh
Gate
- node:test:unsupported/image-only cannot become default;
- fixture:provider has mixed chat/image/embedding models;
- smoke:ModelTable shows unsupported row disabled + reason。
4. Session status / workstation shell
现状问题
SessionSummary 当前没有 status。运行态由 renderer 的 streamingBySession map 临时推断。
这对单窗口短聊天够用,但对工作台不够:
- session 正在 running / waiting permission / blocked / errored / review / done 无持久状态;
- app 重启后无法恢复 "上次卡在 permission" / "上次工具失败";
- sidebar 只能显示 unread / streaming dot,不知道工作流阶段;
- Health / automations / artifacts 都缺 workspace shell 可挂载的位置。
reference implementation / reference implementation 对照
reference implementation 有 thread/workspace/snapshot 体系;reference implementation 有 workspace、labels、sources、automations,release notes 里也提到 branch/session recovery。 可复制的是 session 状态机和 workspace metadata。
Contract / API
扩展 SessionHeader:
export type SessionStatus =
| 'active'
| 'running'
| 'waiting_permission'
| 'blocked'
| 'review'
| 'done'
| 'errored'
| 'archived';
export interface SessionHeader {
status: SessionStatus;
statusReason?: string;
workspace?: {
root: string;
branch?: string;
pr?: string;
dirty?: boolean;
};
}
Runtime:
- send start →
running - permission_request →
waiting_permission - permission deny →
blocked - complete →
doneorreview(由 turn control 决定) - error →
erroredwith reason - archive →
archived
Failure state
session_connection_missingsession_permission_blockedsession_tool_failedsession_abortedsession_recovery_needed
Gate
- node:test:status transitions;
- fixture:running / waiting_permission / errored / done sessions;
- smoke:sidebar row + header status match。
5. Turn control:retry / branch / regenerate / checkpoint
现状问题
Maka 有 turn grouping,但没有 turn-level controls:
- retry/regenerate 没有 contract;
- branch-from-turn 没有 lineage;
- cancel/abort 只是一条 system note,不是 turn status;
- tool 执行前没有 checkpoint/snapshot,因此 destructive 修改后无法 rollback;
- 旧输出不可覆盖这个原则没有被模型化。
reference implementation / reference implementation 对照
reference implementation 有 snapshots / branch / compact;reference implementation release notes 明确 session branching 和 branch cutoff 是长期复杂点。 这说明分支/重试必须从第一天就有 sidecar anchor 和 lineage,不要先做 UI 按钮。
Contract / API
新增 TurnRecord:
export interface TurnRecord {
id: string;
sessionId: string;
parentTurnId?: string;
branchId?: string;
status: 'running' | 'completed' | 'aborted' | 'errored' | 'superseded';
startedAt: number;
completedAt?: number;
modelId?: string;
snapshotIdBeforeTools?: string;
errorReason?: string;
}
IPC:
turns:retry(sessionId, turnId)turns:branch(sessionId, turnId)turns:cancel(sessionId, turnId)turns:createCheckpoint(sessionId, turnId)
Failure state
turn_not_foundturn_already_runningbranch_cutoff_invalidcheckpoint_failedretry_requires_model
Gate
- node:test:branch copies messages up to turn boundary only;
- fixture:branched session + aborted turn;
- smoke:branch from prior turn creates new sidebar session, original unchanged。
6. Health Center:分散状态收拢
现状问题
目前健康状态分散:
- provider credential 在 Account / Models;
- proxy 在 Network;
- bot 在 Bot Chat;
- model fetch source 在 ModelTable;
- storage / visual smoke / console gate 不在 UI;
- missing connection 只在 chat header。
用户路径上的不成熟感:
- 出错时不知道是 key、网络、proxy、provider、bot、model list、workspace 权限哪一个;
- bug report 不能一键 copy redacted diagnostics;
- release smoke 也没有一个综合状态页。
reference implementation / reference implementation 对照
reference implementation 有大量 /api/*/status 和 settings tree;reference implementation CLI 的 source test/validate、automation validate/lint 都是 health surface。
Contract / API
新增:
export type HealthComponent =
| 'provider'
| 'credential'
| 'model_catalog'
| 'proxy'
| 'bot'
| 'storage'
| 'skills'
| 'search'
| 'voice'
| 'open_gateway';
export interface HealthCheckResult {
component: HealthComponent;
id: string;
label: string;
status: 'ok' | 'warning' | 'error' | 'disabled' | 'unknown';
reason?: string;
message: string;
lastCheckedAt?: number;
details?: Record<string, unknown>; // redacted only
}
IPC:
health:list()health:run(component?, id?)health:copyDiagnostics()
Diagnostics must include:
- app version / OS / workspace schema;
- provider statuses without secrets;
- latest generalized errors;
- proxy enabled/type without credentials;
- storage file presence / JSON parse status;
- no raw paths unless user explicitly copies workspace path。
Failure state
Use same reason vocabulary as readiness / connection / proxy:
authtimeoutnetworkprovider_unavailableconnection_missingstorage_corruptunsupported
Gate
- node:test:diagnostics redaction;
- fixture:mixed ok/warning/error health;
- smoke:Health Center copy output contains no key/path secret。
7. Sources / Skills / Automations visible system
现状问题
Maka only lists installed skills from workspaceRoot/skills. There is no first-class source, no source-scoped permissions, no automations.
Current gaps:
- skill visibility does not mean invocability / permissions;
- no source auth/scope/status;
- no automation last-run/history;
- user cannot audit which capability can touch what。
reference implementation 对照
reference implementation CLI has first-class source, skill, automation, permission entities with validate/test/history commands.
This is a strong model for Maka because it keeps external capability visible and revocable.
Contract / API
Minimal first step:
export interface SourceRecord {
slug: string;
name: string;
type: 'mcp' | 'api' | 'local';
enabled: boolean;
authType: 'oauth' | 'bearer' | 'none';
scopeSummary: string[];
status: 'ready' | 'needs_auth' | 'error' | 'disabled';
lastTestAt?: number;
lastErrorReason?: string;
}
export interface AutomationRecord {
id: string;
name: string;
enabled: boolean;
trigger: 'manual' | 'schedule' | 'event';
permissionMode: 'explore' | 'ask' | 'execute';
lastRunAt?: number;
lastRunStatus?: 'ok' | 'error' | 'skipped';
}
Failure state
source_needs_authsource_scope_deniedautomation_disabledautomation_last_run_failedskill_missing_source
Gate
- node:test:skill cannot widen permission mode;
- fixture:source needs auth + disabled automation;
- smoke:Settings surface shows source/skill/automation enabled/disabled/test states。
8. First-run to value
现状问题
OnboardingHero exists and provider save auto-fetch works, but flow is still fragmented:
- Provider preset;
- paste key;
- save;
- auto-fetch;
- choose default;
- go back to chat;
- send prompt。
There is no explicit "you are ready" smoke prompt, no inline model fetch failure lane, and no first-run state machine.
reference implementation / reference implementation 对照
reference implementation validate-server auto-bootstraps temp workspace/connection for validation;reference implementation onboarding has permission timing and settings tree.
可复制的是 first-run guided state, not cinematic onboarding.
Contract / API
export type FirstRunStep =
| 'choose_provider'
| 'enter_secret'
| 'fetch_models'
| 'choose_default'
| 'send_smoke_prompt'
| 'done';
export interface FirstRunState {
current: FirstRunStep;
providerSlug?: string;
errorReason?: string;
completedAt?: number;
}
Failure state
secret_invalidmodel_fetch_failedno_chat_modelsdefault_model_missingsmoke_prompt_failed
Gate
- fixture:
first-run,first-run-auth-error,first-run-fetched-empty; - smoke:4 screens max from provider pick to first successful assistant answer;
- node:test:step transition reducer。
9. Memory MVP
现状问题
Maka has personalization prompt, but no memory object:
- no persistent facts;
- no retrieval;
- no memory source visibility;
- no user review/delete;
- no sleep/consolidation。
Do not jump directly to reference implementation's sqlite-vec + ONNX. The first missing piece is user-visible memory CRUD and retrieval contract.
reference implementation 对照
reference implementation has memory store, embeddings, sleep cycle, Recall tool, memory archive. Useful structure:
- memory rows have durability;
- retrieval is a tool / context source;
- sleep is previewable and cancelable。
Contract / API
MVP:
export interface MemoryRecord {
id: string;
content: string;
source: 'user_pinned' | 'assistant_suggested' | 'imported';
durability: 'temporary' | 'permanent';
createdAt: number;
updatedAt: number;
archivedAt?: number;
}
No embeddings in first PR. Use keyword search + explicit user pin/delete.
Failure state
memory_search_failedmemory_disabledmemory_import_invalid
Gate
- node:test:CRUD/search/archive;
- fixture:3 memories + archived item;
- smoke:Settings/Memory page can add/delete/search and chat can cite retrieved memory source。
10. Open Gateway / Voice / Search Coming Soon
现状问题
Settings has Coming Soon panels for search, voice, open gateway. The copy is better now, but capability is absent. This creates expectation debt.
Recommended order
- Open Gateway SSE bridge: easiest to contract and test locally.
- Search service: can start with provider abstraction + disabled health state.
- Voice input: needs macOS permissions / audio device UX, do later unless user prioritizes.
Open Gateway contract
Expose a local OpenAI-compatible endpoint only when explicitly enabled:
- bind
127.0.0.1by default; - per-workspace token generated locally;
- no plaintext secret in logs;
/v1/modelsreturns chat-capableModelCatalogEntryonly;/v1/chat/completionsroutes to selected connection;- health reason if default connection unavailable。
Failure reasons:
gateway_disabledgateway_token_invalidgateway_model_unsupportedgateway_connection_unavailable
Gate:
- node:test for token auth + disabled path;
- fixture for gateway enabled/unavailable;
- smoke with curl local endpoint。
11. Recommended PR order
Wave A: Workbench foundation
ArtifactRecordcore/storage contract + fixture seed (no UI pane yet).- Right artifact pane renderer + smoke path.
- Tool streaming delta for Bash + terminal artifact ref.
Why first: this changes Maka from "chat transcript" to "work product workspace".
Wave B: Decision quality
ModelCatalogEntry+ chat default gate.- Health Center core result type + provider/proxy/bot/storage checks.
- First-run state reducer + first-run fixture expansion.
Why second: user setup and provider/model trust become understandable.
Wave C: Workflow control
- Session status state machine.
- TurnRecord + cancel/abort persistence cleanup.
- Branch/regenerate/checkpoint API.
Why third: these are more invasive and should build on artifact/snapshot shape.
Wave D: Ecosystem
- Sources/Skills/Automations records.
- Memory MVP.
- Open Gateway.
- Search / Voice.
12. Do-not-copy list
From reference implementation/reference implementation, do not copy these patterns into Maka:
- wide-open local HTTP API without explicit enable/token;
- plaintext secret returns through IPC / API;
- auto-approval or subagent
--approve-alltrust shortcuts; - activity/screen recorder defaults;
- cinematic onboarding that delays first value;
- hidden skill permission widening;
- raw console logs for chat IDs, API responses, provider bodies。
Maka should copy structure and state models, not unsafe shortcuts.
13. Immediate next action
My recommendation for the next implementation PR:
PR-A1: ArtifactRecord core/storage/fixture contract only.
Deliverables:
packages/core/src/artifacts.tspackages/storage/src/artifact-store.tsapps/desktop/src/main/visual-smoke-fixture.tsaddsartifact-pane- node:test for append/list/get/soft-delete/file-backed invariant
- docs update:
docs/design-system.md§9.1 fleshed out - no renderer pane yet
This keeps the first step small, testable, and directly unlocks the right pane.