- add app/cron barrel re-exporting the cron task record, persistence contract/service, and dependency-free algorithm lib (cron-expr, jitter, clock, format)
- move cronTask persistence files from app/cronPersistence into app/cron and drop the old cronPersistence barrel
- register the cron config section (KIMI_CRON_* env bindings) via configSection
- repoint cron tests from #/agent/cron and #/app/cronPersistence to #/app/cron
Make built-in tool registration DI-native:
- each tool is now a DI class whose dependencies are injected via @IX
instead of hand-wired through a parent service constructor
- each domain registers its tools from an Eager Agent-scope *ToolsService
that builds them with IInstantiationService.createInstance
- split tool registration out of domain services that the tools call back
into (cron/background/goal/plan/swarm/skill) to avoid constructor cycles
- drop the manual force-pulls (rpc marker injections, the
initializeBuiltinTools callback, runChildAgent ensureAgentTool) now that
Eager registration runs at Agent scope creation
- defer IHostEnvironment reads in GlobTool/BashTool to getters so Eager
construction does not require environment readiness
Media tools (ReadMediaFile) are left as-is pending a capability-gated
registration design.
Replace the god-object `IKaos` interface and the `@moonshot-ai/kaos`
package dependency with atomic services:
- `IHostEnvironment` (App scope) — memoised OS / shell / path-style /
home probe; sync fields plus a `ready` promise the composition root
awaits before seeding Session scopes.
- `IExecContext` (Session scope) — immutable cwd + env-layers seed
value with `withCwd` / `withEnv` derivations; replaces
`IKaos.cwd/withCwd/withEnv` and `IKaosFactory`.
- `ISessionAgentFileSystem` / `ISessionProcessRunner` — inline
`node:fs/promises` and `child_process.spawn` directly; the
`IKaos.backend` leak that let `profile/context.ts`, `fileTools/glob`
and `agentFs/runRg` reach around the facades is gone.
Vendor the pure helpers into `src/_base/execEnv/` (`BufferedReadable`,
`decodeTextWithErrors`, `globPatternToRegex`, host-environment probe).
`src/app/kaos/` and `test/kaos/` are deleted; session-lifecycle awaits
`hostEnv.ready` and then seeds `IExecContext` into the child scope.
Rewrites every `@IKaos` consumer:
- `shellTools/bash`, `fileTools/{read,write,edit,glob,grep}`,
`media/read-media`, `_base/tools/policies/path-access`
- `permissionPolicy/git-cwd-write-approve` and
`permissionPolicy/git-control-path-access-ask`
- `agent/rpc`, `agent/agentTool`, `agent/profile/{context,profileService}`
- `session/{sessionWarning,workspaceContext}`
- `app/bootstrap` (drops `IBootstrapService.detect()`)
- `fileTools/glob` and `agentFs/runRg` now route rg through
`ISessionProcessRunner.exec` with per-call `{ cwd }` overrides
`test/tools/fixtures/fake-kaos.ts` is replaced by `fake-exec.ts` with
per-atom factories (`createFakeHostEnvironment`, `createFakeExecContext`,
`createFakeAgentFs`, `createFakeProcessRunner`). Domain-layer registry,
PUML diagram, tsdown externals and `package.json` deps are updated
accordingly.
`packages/kaos/` stays in the workspace — v1, node-sdk and acp-adapter
still depend on it. Only `agent-core-v2` has been detached.
Move src/{domain}/* to src/{scope}/{domain}/* (app/session/agent) so the
directory layout mirrors the DI LifecycleScope tree. Split the three
multi-scope domains so no domain spans two scopes:
- log -> app/log + session/sessionLog
- question -> session/question + agent/questionTools
- skill -> app/globalSkillCatalog + session/sessionSkillCatalog + agent/skill
Rewrite every #/ and relative import, module augmentation, vi.mock, and
source-path read; update the package barrel, registerScopedService domain
labels, the domain-layer checker, the dep-graph script, file headers, and
the di-scope-domains map.
- rename service interfaces and implementations to carry the Session/Agent
scope prefix and Service suffix (e.g. IApprovalService ->
ISessionApprovalService, ApprovalService -> SessionApprovalService)
- rename LifecycleScope.Core to App in the DI base
- update DI createDecorator keys to match the new identifiers
- propagate the renames through server-v2 routes/transport, examples, docs,
and the agent-core-dev skill