- add ITerminalService (create/list/get/attach/write/resize/close) and
ITerminalBackend contract; Session-scoped so per-session sessionId
threading is dropped
- implement TerminalService with per-terminal output buffering, seq replay,
sink fan-out, and dispose-time process cleanup
- register a default NotImplementedTerminalBackend; the real PTY backend is
supplied by the composition root
- add the terminal.not_found error code (protocol + ErrorCodes) and register
the terminal layer in check-domain-layers
- cover the service with unit tests driven by a fake backend
- Add IBlobStorage role token for pluggable blob backends
- Make BlobStoreService depend on IBlobStorage instead of IHostFileSystem
- Remove host filesystem dependency from WireRecordService
- Seed IBlobStorage in local and server-v2 composition roots
- Add BlobStoreService tests
- add non-blocking `enqueue` and `onDidResolve` to the `IInteractionService` kernel
- add typed `enqueue` to `IApprovalService` and `IQuestionService`
- expose `interactions:request`, `approvals:request`, `questions:ask` actions
- stream pending set (`interactions`) and resolutions (`interactions:resolved`) over WS
- split session-metadata out of the untyped sessionMetaStore KV bag into a
typed SessionMeta service (title, timestamps, archived, forkedFrom)
- make session-context carry pure seeded facts (sessionId, workspaceId,
sessionDir, metaScope) instead of coupling identity to a persistence store
- slim ISessionService to session-level commands (archive); move fork to
session-lifecycle and drop agent ops (compact/undo) and read views
- seed the session scope and materialize the initial metadata document on
create; archive/close now dispose the scope tree
- add IScopeHandle.dispose so session and agent scopes tear down on close
- drop unused deps from agent-lifecycle and trim session error codes
- rename sessionIndex directory to session-index
Add `packages/server-v2`, a minimal Fastify server bootstrapped through the
`agent-core-v2` DI engine (`bootstrap()` -> Core `Scope`), speaking the same
`/api/v1` interface as the v1 server. Route handlers resolve Core services
via `core.accessor.get(IXxx)`.
- Serve healthz, meta, auth, oauth (login poll/start/cancel/logout) and
shutdown with the standard `{code, msg, data, request_id}` envelope.
- Re-point root `pnpm dev:server` to server-v2 and add a `src/main.ts`
foreground entry.
- Add `build/hash-imports-loader.mjs` so tsx resolves `agent-core-v2`'s `#/`
array-fallback subpath imports.
- `agent-core-v2` Phase 0 fixes so it compiles and boots: add the `event`
domain (`IEventService`), fix `gateway` `event.subscribe` -> `event.on`, fix
the `wireRecord` fallback `BlobStoreService` construction, export the
`provider` barrel, and fix a `tooldedup` test import casing.
- move ExecutableTool contract (ExecutableTool, ToolExecution,
ExecutableToolResult, ExecutableToolContext, ToolUpdate) from loop/types
to a new tool/toolContract domain
- move tool-access into the tool domain and add a tool barrel
- group per-domain tools under tools/ (plan, skill, swarm, todoList, mcp)
- extract createMcpTool from mcpService into mcp/tools/mcp
- update domain-layer exceptions to point at the new tool domain
- add `session-lifecycle` (Core) owning the live session scope tree
(create/get/list/close), extracted from `gateway`
- reshape `sessionIndex` into a backend-neutral query store
(list/get/countActive) keyed by opaque `workspaceId`; drop fs paths
- move `encodeWorkDirKey` to `_base/utils` as the single workspace-id
derivation, and align `workspaceRegistry` to use it
- `gateway` now injects `ISessionLifecycleService`; update dep map and tests
- rename IRecordStore → IAppendLogStore and IConfigStore → IAtomicDocumentStore (name Stores by access pattern, not business)
- add IAppendLogStorage / IAtomicDocumentStorage tokens — same IStorageService interface, distinct tokens so each access pattern can bind a different backend
- add Store.acquire(scope, key) → IDisposable for flush-on-dispose; add IStorageService.readStream for streaming reads
- delete WireRecordPersistence; WireRecordService now depends directly on IAppendLogStore (preparePersistentRecord inlined, onError per-append)
- BlobStoreService now depends on IHostFileSystem (new createExclusive primitive) instead of node:fs
- rename sessionStore → sessionIndex as a domain-specific Store over hostFs
- document the "business code never persists directly" rule in AGENTS.md and the new persistence subskill
- introduce storage domain (IStorageService/IRecordStore/IConfigStore) as the program-side persistence substrate over raw node fs
- add hostFs (local real-filesystem primitives reused by persistence and the local agent backend)
- add agentFs (IAgentFileSystem + IFileSystemBackend) and process (IProcessRunner + IProcessBackend) with local/ssh backends for the Agent execution environment
- add workspaceContext (session workspace root + path access), workspaceRegistry (process-wide catalog) and hostFolderBrowser (host-side folder picker)
- remove kaos/fs/terminal/filestore/workspace domains
- route persistence through storage (sessionMetaStore -> IConfigStore) and hostFs (sessionStore); route plan file IO through agentFs
- collect app paths in IEnvironmentService; register new domains in DOMAIN_LAYER and refresh the dependency map
- remove fictional IModelCatalogService / ILLMService stubs and the unused kosong config section
- add IProtocolHandlerRegistry (Core) to build protocol adapters by provider type, realizing provider != request handler
- promote ProviderManager to IProviderManager (Session, seeded) and move it into the kosong domain
- rewire IProfileService and ILLMRequester to inject IProviderManager (and IProtocolHandlerRegistry) instead of the options.modelProvider side-channel
- update DI scope docs, service-design notes, and tests
- add Session-scoped `interaction` domain, a unified blocking
request/response kernel (pending set + onDidChange) for
human-in-the-loop requests
- rebuild `approval` and `question` as typed facades over the kernel;
their public contracts are unchanged
- derive the full session phase (awaiting_approval / awaiting_question /
running / idle) in `session-activity` from the kernel's pending set and
each agent's active turn; move `SessionStatus` there
- implement `session` facade `archive()` (persist flag, remove agents,
publish event) and brand `ISessionContext` with `_serviceBrand`
- ConfigService now reads/writes real config.toml: snake_case↔camelCase
transforms, lossless raw round-trip, KIMI_MODEL_* env overlay, and
lenient load diagnostics.
- Add IConfigRegistry.onDidRegisterSection so late-registered sections are
validated, get defaults applied, and fire onDidChange.
- Move section schemas to their owner domains: providers→provider,
experimental→flag, thinking→profile, loopControl→loop,
McpServerConfig→mcp.
- profile/loop/llmRequester read config through IConfigService instead of
the dangling KimiConfig options.
- Add the agent-core-dev config topic (section ownership + TOML format).
- port IWorkspaceRegistry (Core) backed by <homeDir>/workspaces.json
- port IWorkspaceFsService (Core) host-fs folder-picker backend
- rename IWorkspaceService to ISessionWorkspaceService (Session)
- extend ISessionStore with sessionDir/workspaceIdFor/countActiveSessions
and drop the unused read/write stubs
- add workspace.not_found, fs.path_not_found, fs.permission_denied and
validation.failed to protocol KimiErrorCode
- update the DI scope map and allow the workspace>event layer exception
- rename TelemetryClient to ITelemetryAppender and noopTelemetryClient to nullTelemetryAppender (vscode-style); add addAppender/removeAppender/setAppender/setEnabled/flush/shutdown to ITelemetryService
- TelemetryService fans track out to all appenders with per-appender error isolation via onUnexpectedError; withContext shares appenders and inherits enabled state
- add ConsoleAppender (dev echo) and CloudAppender + CloudTransport: HTTP POST to telemetry-logs.kimi.com with Bearer auth, retry, and on-disk fallback, decoupled from @moonshot-ai/kimi-telemetry
- document telemetry usage (inject/track/context/appenders/bootstrap) in the agent-core-dev skill
- add provider domain with IProviderService CRUD over the providers config section
- refactor OAuthService and AuthSummaryService to read and write providers via provider
- add ConfigService.replace for whole-section writes used by provider delete
- move provider/OAuth schemas from auth/oauthSchemas into the provider domain
- update DI scope diagram and domain layer map; remove the Turn scope
Resolve merge conflicts by keeping the HEAD (kimi-code-v2) architecture
as the base and adopting compatible increments from before-rebase-v2:
- adopt auth OAuth flow, structured log domain, telemetry sinks,
workspace service, and the file-backed config service
- migrate IAgentConfigService to the Session-scoped ISessionConfigService
- keep HEAD's turn/agent-lifecycle/permission domains and the removed
tool/message/records domains, since before-rebase-v2's versions depend
on domains (context/injection/tool/records) that HEAD has removed
- repair auto-merge fallout: dedupe auth vs config schema exports,
restore cwd/chdir on AgentKaos, retarget records imports to
sessionMetaStore, and revert THEIRS test files that no longer match
HEAD's src
Note: agent-core-v2 typecheck already fails on HEAD (138 errors); this
merge introduces no new error types (132, a subset of HEAD).
- add logfmt formatter with redaction, truncation and ANSI coloring
- add rotating file writer plus a Session-scoped file writer service
- add env-driven logging config and ILogOptions seed
- add Session-scoped ISessionLogService and flush on ILogService
- rework createServices around ServiceRegistration groups (base + additionalServices) and add per-domain register*Services stubs
- extract loopRunner, toolCallExecutor and turnEvents out of turnService; switch turn lifecycle to typed events
- add AsyncEmitter / IWaitUntil / handleVetos to _base/event for interceptable onWill and veto events
- document DI x scope (docs/di.md, docs/service-design.md, scope-domain diagram) and refresh di-testing.md
- ignore plan/