Promotes approvals to the default tier with a public API (requestApproval + registerApprovalHandler) that other modules consume. Self-modification (install_packages / request_rebuild / add_mcp_server) moves into a new optional module that registers delivery actions + matching approval handlers via the new API. ## Approvals (default tier) - Adds `src/modules/approvals/primitive.ts` exporting `requestApproval`, `registerApprovalHandler`, `notifyAgent`. Absorbs `pickApprover` / `pickApprovalDelivery` / `channelTypeOf` from the deleted `src/access.ts`. - Rewrites `response-handler.ts` to dispatch to registered approval handlers on approve (action-keyed Map). Reject path is centralized. - Drops the three self-mod-specific delivery-action registrations from `approvals/index.ts`; they belong to self-mod now. - `onecli-approvals.ts` now imports picks from the primitive instead of `src/access.ts`. ## Self-mod (optional tier) - New `src/modules/self-mod/` with request handlers (validate input + call requestApproval) and apply handlers (orchestration on approve). - `apply.ts` owns updateContainerConfig + buildAgentGroupImage + killContainer calls. Self-mod depends on approvals (via registerApprovalHandler + requestApproval + notifyAgent) and on core (container-runner, container-config). - Registers 3 delivery actions + 3 approval handlers at import time. ## Other changes - `src/access.ts` and `src/access.test.ts` deleted. Tests split across `src/modules/approvals/picks.test.ts` (approver selection) and `src/modules/permissions/permissions.test.ts` (access + roles + DM). - `src/modules/index.ts` barrel: approvals loads before self-mod so registerApprovalHandler is bound when self-mod registers at import time. ## Validation - `pnpm run build` clean - `pnpm test` — 137 host tests pass - `bun test` in container/agent-runner — 17 tests pass - Service starts; boot log shows `OneCLI approval handler started`, `NanoClaw running`; clean SIGTERM shutdown Resolves the transitional tier violation flagged in PR #5 where core imported from the permissions optional module via `src/access.ts`. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
26 lines
1.0 KiB
TypeScript
26 lines
1.0 KiB
TypeScript
/**
|
|
* Modules barrel.
|
|
*
|
|
* Each module self-registers at import time. This barrel is imported by
|
|
* src/index.ts for side effects (registry registrations, typing impl setup,
|
|
* etc.). Core runs with an empty barrel — the registries have inline
|
|
* fallbacks and `sqlite_master` guards.
|
|
*
|
|
* Default modules (ship with main, direct core import):
|
|
* - src/modules/typing/ → imported directly by router/delivery/container-runner
|
|
* - src/modules/mount-security/ → imported directly by container-runner
|
|
*
|
|
* Registry-based modules (installed via /add-<name> skills, pulled from the
|
|
* `modules` branch): append imports below.
|
|
*/
|
|
// Approvals (default tier) must load before self-mod (optional) so the
|
|
// registerApprovalHandler / requestApproval symbols are bound when self-mod
|
|
// registers its handlers at import time.
|
|
import './approvals/index.js';
|
|
import './interactive/index.js';
|
|
import './scheduling/index.js';
|
|
import './permissions/index.js';
|
|
import './agent-to-agent/index.js';
|
|
import './self-mod/index.js';
|
|
|