Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions docs/architecture/agent-memory-system/spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -697,8 +697,8 @@ flowchart TD
- **`tape_context`** expands specific entry ids with a bounded window (before/after default 2, clamp ≤ 20),
an entry cap (default 50), and byte budgets (per-entry default 2048 / max 8192; total default 16384 / max
65536), UTF-8-safe truncated. Tape tools are DeepChat-agent-only and `tape_context` is advertised only when
the tool-runtime port exposes `getTapeContext` (wired to `AgentSessionPresenter`, not the memory kernel; in
practice always present).
the tool-runtime port exposes `getTapeContext` (wired directly to `SessionProjectionCoordinator`, not the
memory kernel; in practice always present).
- The whole projection/search layer is fail-open: any error degrades to a coarser search over the effective
tape rather than throwing (the one exception is an unparseable time boundary, which is reported).

Expand Down
14 changes: 7 additions & 7 deletions docs/architecture/agent-system-layered-runtime/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,12 @@ DeepChat loop + `AcpProvider` compatibility。

Memory runtime orchestration 已收敛到唯一 `MemoryRuntimeCoordinator`,通过 awaited
`MemoryPromptContributor` 与 background `MemoryIngestionObserver` 接入;Tape tool facts 已迁到 stable
per-fact `TapeRecorder` path,causal observation 只读联结现有 Tape/message/trace。`AgentSessionPresenter`
仅保留 compatibility forwarding;core lifecycle、turn、assignment 与 projection 已由四个
composition-owned session application coordinators 承担。typed routes 直接组合 history、translation、
export、usage、RTK 与 catalog owner,startup hooks 直接调用 migration/maintenance owner。
`AgentRuntimePresenter` 保留 DeepChat state/delegate 与 adapter wiring;两者不再构成 generic agent runtime。
per-fact `TapeRecorder` path,causal observation 只读联结现有 Tape/message/trace。core lifecycle、turn、
assignment 与 projection 已由四个 composition-owned session application coordinators 承担;
`AgentSessionPresenter` 与 main-process `IAgentSessionPresenter` 已退休。typed routes、Tool、MCP、Floating
与 hooks 直接使用分离的 coordinator ports;history、translation、export、usage、RTK 与 catalog owner
继续独立。startup hooks 直接调用 migration/maintenance owner。`AgentRuntimePresenter` 保留 DeepChat
state/delegate 与 adapter wiring,不再构成 generic agent runtime。
current docs、architecture guards 与 baseline generator
已在 `ASLR-091` 收敛;`ASLR-092` 已完成 canonical baseline write、全量
main/renderer/Memory/native/build/E2E gates 与最终契约 diff。
Expand Down Expand Up @@ -173,7 +174,7 @@ accept input / claim pending item
typed routes -> SessionService / ChatService -- narrow ports ─┐
remote -> RemoteConversationRunner -- four narrow ports ─────┤
cron -> Cron session starter -- Lifecycle / Turn ports ──────┤
AgentSessionPresenter compatibility façade -- forwarding ─────┘
Tool / MCP / Floating / hooks -- owner-specific ports ────────┘
Lifecycle / Turn / AgentAssignment / Projection
├─ AppSessionService ─ new_sessions / window binding / shared CRUD
Expand Down Expand Up @@ -275,7 +276,6 @@ src/main/agent/

src/main/presenter/
├── sessionApplication/ # lifecycle/turn/assignment/projection coordinators
├── agentSessionPresenter/ # retained compatibility façade
└── agentRuntimePresenter/ # retained DeepChat state/delegate + message/Tape/resource adapters
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ backend kind 每次由 `agent_id -> AgentDescriptor` 解析。backend 不能复

### ASLR-072 shared data ports

production switch 没有把 shared data methods 塞进 `AgentManager`。`AgentSessionPresenter` 与 direct ACP
backend 通过四个独立 facet 访问现有 owner:
production switch 没有把 shared data methods 塞进 `AgentManager`。session application coordinators 与
direct ACP backend 通过四个独立 facet 访问现有 owner:

```ts
interface AgentSharedDataPorts {
Expand Down
12 changes: 7 additions & 5 deletions docs/architecture/agent-system.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ flowchart TD
UI["Renderer / typed routes"] --> RouteOwners["Session route owners<br/>search / translation / export / usage / catalog"]
UI --> Services["SessionService / ChatService"]
Services --> App["Session application coordinators"]
Compat["AgentSessionPresenter<br/>compatibility forwarding"] --> App
UI --> RoutePorts["Main route runtime<br/>four separate session ports"]
RoutePorts --> App
App --> Sessions["AppSessionService"]
App --> Manager["AgentManager"]
Manager --> Catalog["strict executable catalog"]
Expand All @@ -58,8 +59,8 @@ flowchart TD
- `SessionLifecycleCoordinator`、`SessionTurnCoordinator`、`SessionAgentAssignmentCoordinator` 和
`SessionProjectionCoordinator` 分别拥有 core session application invariants;typed Session/Chat、Remote
和 Cron 通过 consumer-owned narrow ports 调用它们。
- `AgentSessionPresenter` 仅保留 compatibility public surface;core session methods 只转发到
composition-owned coordinators,不拥有 application policy、state 或 session-boundary capabilities
- `AgentSessionPresenter` 与 main-process `IAgentSessionPresenter` 已退休;main route runtime、Tool、MCP、
Floating 与 hooks 直接调用 composition-owned coordinators,不经过 aggregate façade
- typed session routes 直接组合 `SessionHistorySearch`、`SessionTranslation`、
`AgentSessionExportService`、`UsageStatsService`、RTK runtime service 与 available-agent catalog policy;
lifecycle hooks 直接调用 startup migration/maintenance owner。
Expand Down Expand Up @@ -173,14 +174,15 @@ DeepChat app projection;`acp_turns` 只是 protocol metadata。

仍保留:

- `AgentSessionPresenter` compatibility façade 和 `AgentRuntimePresenter` state/delegate façade;
- `AgentRuntimePresenter` state/delegate façade;
- `AcpProvider` 的 DeepChat + ACP-provider compatibility;
- `startupMigrations/LegacyChatImportService`、旧 conversations/messages、`SessionPresenter`
export/thread/data compatibility;current agent-session export 由 `AgentSessionExportService` 拥有;
- 现有 route/event/DTO/schema/table。

已经退休并由 guard 阻止回流:

- `AgentSessionPresenter` compatibility façade 与 main-process `IAgentSessionPresenter`;
- fake `AgentRegistry`;
- unified optional implementation interface;
- reflection-based legacy backend;
Expand All @@ -193,7 +195,7 @@ DeepChat app projection;`acp_turns` 只是 protocol metadata。

1. kind/session routing:`src/main/agent/manager/agentManager.ts`
2. core session application behavior:`src/main/presenter/sessionApplication/`
3. compatibility forwarding:`src/main/presenter/agentSessionPresenter/index.ts`
3. route composition:`src/main/routes/index.ts`
4. session search/translation:`src/main/routes/sessions/`
5. current session export:`src/main/presenter/exporter/agentSessionExporter.ts`
6. usage/startup/catalog:`src/main/presenter/{usageStatsService.ts,startupMigrations/}` 与
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"schemaVersion": 2,
"goal": "agent-system-layered-runtime",
"headCommit": "1122b240619afae1bd97c2395f0c820c41ecf048",
"headCommit": "30d57c3873cec94e342ce616d8ccafe9f71676b3",
"relevantWorkingTree": {
"dirty": false,
"files": []
Expand Down Expand Up @@ -95,9 +95,12 @@
"src/main/presenter/agentRuntimePresenter/messageStore.ts",
"src/main/presenter/agentRuntimePresenter/process.ts",
"src/main/presenter/agentRuntimePresenter/tapeService.ts",
"src/main/presenter/agentSessionPresenter/index.ts",
"src/main/presenter/index.ts",
"src/main/presenter/llmProviderPresenter/providers/acpProvider.ts"
"src/main/presenter/llmProviderPresenter/providers/acpProvider.ts",
"src/main/presenter/sessionApplication/agentAssignmentCoordinator.ts",
"src/main/presenter/sessionApplication/lifecycleCoordinator.ts",
"src/main/presenter/sessionApplication/projectionCoordinator.ts",
"src/main/presenter/sessionApplication/turnCoordinator.ts"
],
"expectedFiles": {
"src/main/agent/acp/instance/acpAgentInstance.ts": true,
Expand All @@ -121,9 +124,12 @@
"src/main/presenter/agentRuntimePresenter/messageStore.ts": true,
"src/main/presenter/agentRuntimePresenter/process.ts": true,
"src/main/presenter/agentRuntimePresenter/tapeService.ts": true,
"src/main/presenter/agentSessionPresenter/index.ts": true,
"src/main/presenter/index.ts": true,
"src/main/presenter/llmProviderPresenter/providers/acpProvider.ts": true
"src/main/presenter/llmProviderPresenter/providers/acpProvider.ts": true,
"src/main/presenter/sessionApplication/agentAssignmentCoordinator.ts": true,
"src/main/presenter/sessionApplication/lifecycleCoordinator.ts": true,
"src/main/presenter/sessionApplication/projectionCoordinator.ts": true,
"src/main/presenter/sessionApplication/turnCoordinator.ts": true
},
"ownerEvidence": {
"agentManager": {
Expand Down Expand Up @@ -186,8 +192,23 @@
"exists": true,
"declarationCount": 1
},
"retainedAgentSessionFacade": {
"file": "src/main/presenter/agentSessionPresenter/index.ts",
"sessionProjectionCoordinator": {
"file": "src/main/presenter/sessionApplication/projectionCoordinator.ts",
"exists": true,
"declarationCount": 1
},
"sessionAgentAssignmentCoordinator": {
"file": "src/main/presenter/sessionApplication/agentAssignmentCoordinator.ts",
"exists": true,
"declarationCount": 1
},
"sessionTurnCoordinator": {
"file": "src/main/presenter/sessionApplication/turnCoordinator.ts",
"exists": true,
"declarationCount": 1
},
"sessionLifecycleCoordinator": {
"file": "src/main/presenter/sessionApplication/lifecycleCoordinator.ts",
"exists": true,
"declarationCount": 1
},
Expand All @@ -201,10 +222,13 @@
"paths": {
"src/main/agent/manager/legacyAgentBackends.ts": 0,
"src/main/lib/agentRuntime": 0,
"src/main/presenter/agentSessionPresenter/agentRegistry.ts": 0
"src/main/presenter/agentSessionPresenter": 0,
"src/shared/types/presenters/agent-session.presenter.d.ts": 0
},
"symbols": {
"AgentRegistry": 0,
"AgentSessionPresenter": 0,
"IAgentSessionPresenter": 0,
"IAgentImplementation": 0,
"createLegacyAgentBackend": 0,
"LegacyDeepChatSessionBackend": 0,
Expand Down Expand Up @@ -238,9 +262,12 @@
"src/main/presenter/agentRuntimePresenter/messageStore.ts",
"src/main/presenter/agentRuntimePresenter/process.ts",
"src/main/presenter/agentRuntimePresenter/tapeService.ts",
"src/main/presenter/agentSessionPresenter/index.ts",
"src/main/presenter/index.ts",
"src/main/presenter/llmProviderPresenter/providers/acpProvider.ts"
"src/main/presenter/llmProviderPresenter/providers/acpProvider.ts",
"src/main/presenter/sessionApplication/agentAssignmentCoordinator.ts",
"src/main/presenter/sessionApplication/lifecycleCoordinator.ts",
"src/main/presenter/sessionApplication/projectionCoordinator.ts",
"src/main/presenter/sessionApplication/turnCoordinator.ts"
]
},
"contracts": {
Expand Down Expand Up @@ -407,7 +434,7 @@
"providers",
"settings_activity"
],
"sha256": "ca9306d19cb9066d6447268aac2e9485ca867fc65f89abda5a1e4b54d4f21974"
"sha256": "16882d6b4c22ec84e0e28c4eb7f5aeb7a867503648e67eeb42461f4f838fe198"
},
"memoryDuckDbSidecar": {
"files": [
Expand All @@ -428,7 +455,7 @@
"src/main/presenter/lifecyclePresenter/hooks/beforeQuit/presenterDestroyHook.ts",
"src/main/presenter/lifecyclePresenter/index.ts"
],
"sha256": "90836b4d0ef4078293ac7d001ef2992f572809a10c67d35fdd8a972e8a66fb86"
"sha256": "d42c0862ef9e41fa77cb9296dcb625f5559b5ae594bd1fbba3ba248b2a4e5203"
},
"dependencyMetrics": {
"loopFiles": [
Expand Down
2 changes: 1 addition & 1 deletion docs/architecture/baselines/archive-reference-report.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Archive Reference Baseline

Generated on 2026-07-13.
Generated on 2026-07-14.

- Total references: 0
14 changes: 7 additions & 7 deletions docs/architecture/baselines/dependency-report.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
# Dependency Baseline

Generated on 2026-07-13.
Generated on 2026-07-14.

## main

- Total files: 563
- Internal dependency edges: 1526
- Total files: 565
- Internal dependency edges: 1537
- Cycles detected: 36

### Top outgoing dependencies

- `presenter/index.ts`: 70
- `presenter/agentRuntimePresenter/index.ts`: 45
- `presenter/index.ts`: 69
- `presenter/agentRuntimePresenter/index.ts`: 48
- `presenter/sqlitePresenter/index.ts`: 40
- `presenter/sqlitePresenter/schemaCatalog.ts`: 37
- `routes/index.ts`: 34
- `routes/index.ts`: 36
- `presenter/configPresenter/index.ts`: 27
- `presenter/lifecyclePresenter/hooks/index.ts`: 23
- `presenter/toolPresenter/agentTools/agentToolManager.ts`: 22
Expand All @@ -40,7 +40,7 @@ Generated on 2026-07-13.
- `presenter/sqlitePresenter/index.ts`: 21
- `presenter/memoryPresenter/ports.ts`: 20
- `presenter/remoteControlPresenter/services/remoteConversationRunner.ts`: 16
- `presenter/memoryPresenter/domain/types.ts`: 14
- `presenter/memoryPresenter/domain/types.ts`: 15
- `presenter/filePresenter/BaseFileAdapter.ts`: 13
- `presenter/memoryPresenter/context.ts`: 12

Expand Down
13 changes: 6 additions & 7 deletions docs/architecture/baselines/main-kernel-boundary-baseline.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Main Kernel Boundary Baseline

Generated on 2026-07-13.
Generated on 2026-07-14.
Current phase: P5.

## Metric Snapshot
Expand All @@ -17,8 +17,8 @@ Current phase: P5.
| `renderer.business.windowApi.count` | 0 |
| `renderer.quarantine.windowApi.count` | 0 |
| `renderer.quarantine.sourceFile.count` | 0 |
| `hotpath.presenterEdge.count` | 9 |
| `runtime.rawTimer.count` | 206 |
| `hotpath.presenterEdge.count` | 8 |
| `runtime.rawTimer.count` | 211 |
| `migrated.rawChannel.count` | 0 |
| `bridge.active.count` | 0 |
| `bridge.expired.count` | 0 |
Expand Down Expand Up @@ -55,12 +55,11 @@ Current phase: P5.

## Hot Path Direct Dependencies

- Direct edge count: 9
- Direct edge count: 8

- `src/main/presenter/agentRuntimePresenter/index.ts -> src/main/eventbus.ts`
- `src/main/presenter/index.ts -> src/main/eventbus.ts`
- `src/main/presenter/index.ts -> src/main/presenter/agentRuntimePresenter/index.ts`
- `src/main/presenter/index.ts -> src/main/presenter/agentSessionPresenter/index.ts`
- `src/main/presenter/index.ts -> src/main/presenter/llmProviderPresenter/index.ts`
- `src/main/presenter/index.ts -> src/main/presenter/sessionPresenter/index.ts`
- `src/main/presenter/llmProviderPresenter/index.ts -> src/main/eventbus.ts`
Expand All @@ -87,20 +86,20 @@ Current phase: P5.

## Raw Timers

- Total count: 206
- Total count: 211

- `src/main/presenter/githubCopilotDeviceFlow.ts`: 6
- `src/main/presenter/browser/BrowserTab.ts`: 5
- `src/main/presenter/devicePresenter/index.ts`: 5
- `src/main/presenter/llmProviderPresenter/aiSdk/runtime.ts`: 5
- `src/main/presenter/remoteControlPresenter/index.ts`: 5
- `src/renderer/src/pages/ChatPage.vue`: 5
- `src/main/presenter/memoryPresenter/infra/vectorStoreManager.ts`: 4
- `src/main/presenter/memoryPresenter/services/maintenanceService.ts`: 4
- `src/renderer/src/components/message/MessageToolbar.vue`: 4
- `src/renderer/src/composables/message/useMessageScroll.ts`: 4
- `src/main/agent/acp/launch/acpInitHelper.ts`: 3
- `src/main/agent/shared/process/backgroundExecSessionManager.ts`: 3
- `src/main/lib/fileWatcher/watcherHost.ts`: 3

## Migrated Path Raw Channel Literals

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"program": "main-kernel-refactor",
"generatedOn": "2026-07-13",
"generatedOn": "2026-07-14",
"currentPhase": "P5",
"metrics": {
"renderer.usePresenter.count": 0,
Expand All @@ -13,8 +13,8 @@
"renderer.business.windowApi.count": 0,
"renderer.quarantine.windowApi.count": 0,
"renderer.quarantine.sourceFile.count": 0,
"hotpath.presenterEdge.count": 9,
"runtime.rawTimer.count": 206,
"hotpath.presenterEdge.count": 8,
"runtime.rawTimer.count": 211,
"migrated.rawChannel.count": 0,
"bridge.active.count": 0,
"bridge.expired.count": 0
Expand Down Expand Up @@ -61,7 +61,6 @@
"src/main/presenter/agentRuntimePresenter/index.ts -> src/main/eventbus.ts",
"src/main/presenter/index.ts -> src/main/eventbus.ts",
"src/main/presenter/index.ts -> src/main/presenter/agentRuntimePresenter/index.ts",
"src/main/presenter/index.ts -> src/main/presenter/agentSessionPresenter/index.ts",
"src/main/presenter/index.ts -> src/main/presenter/llmProviderPresenter/index.ts",
"src/main/presenter/index.ts -> src/main/presenter/sessionPresenter/index.ts",
"src/main/presenter/llmProviderPresenter/index.ts -> src/main/eventbus.ts",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Main Kernel Migration Scoreboard

Generated on 2026-07-13.
Generated on 2026-07-14.
Current phase: P5.

Phase 0 establishes the comparison baseline. Later phases should update this report and compare against this checkpoint.
Expand All @@ -17,8 +17,8 @@ Phase 0 establishes the comparison baseline. Later phases should update this rep
| `renderer.business.windowApi.count` | 0 | baseline |
| `renderer.quarantine.windowApi.count` | 0 | baseline |
| `renderer.quarantine.sourceFile.count` | 0 | baseline |
| `hotpath.presenterEdge.count` | 9 | baseline |
| `runtime.rawTimer.count` | 206 | baseline |
| `hotpath.presenterEdge.count` | 8 | baseline |
| `runtime.rawTimer.count` | 211 | baseline |
| `migrated.rawChannel.count` | 0 | baseline |
| `bridge.active.count` | 0 | baseline |
| `bridge.expired.count` | 0 | baseline |
Expand Down
2 changes: 1 addition & 1 deletion docs/architecture/baselines/zero-inbound-candidates.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Zero Inbound Candidates

Generated on 2026-07-13.
Generated on 2026-07-14.

These files have no in-repo importers inside their scope and need manual classification before deletion.

Expand Down
4 changes: 2 additions & 2 deletions docs/architecture/deepchat-vs-acp-agents/spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Flow:

```text
Renderer send
-> AgentSessionPresenter
-> SessionService / ChatService -> Lifecycle / Turn coordinator
-> AgentManager -> typed DeepChat handle
-> DeepChatAgentInstance preparation
-> create/register LoopRun
Expand Down Expand Up @@ -88,7 +88,7 @@ Flow:

```text
Renderer send
-> AgentSessionPresenter
-> SessionService / ChatService -> Lifecycle / Turn coordinator
-> AgentManager -> direct ACP handle
-> validate descriptor/config/workdir identity
-> AcpAgentRuntime hydrate/prepare AcpAgentInstance
Expand Down
2 changes: 1 addition & 1 deletion docs/architecture/event-system.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Current event families include:
| Family | Examples | Publisher owner |
| --- | --- | --- |
| `chat.*` | `chat.stream.updated`, `chat.stream.completed`, `chat.stream.failed`, `chat.plan.updated` | `agentRuntimePresenter`, `dispatch` |
| `sessions.*` | `sessions.updated`, `sessions.status.changed`, `sessions.pendingInputs.changed` | `agentSessionPresenter`, runtime services |
| `sessions.*` | `sessions.updated`, `sessions.status.changed`, `sessions.pendingInputs.changed` | session application coordinators, runtime services |
| `settings.*` | `settings.changed`, `settings.navigateRequested`, `settings.checkForUpdatesRequested` | config/settings/window flows |
| `config.*` | language, theme, system prompts, agents, shortcut keys | `configPresenter` helpers |
| `providers.*` and `models.*` | provider/model/rate-limit updates | provider runtime |
Expand Down
Loading
Loading