Skip to content

refactor: converge extension ownership and runtime boundaries - #130

Open
M09Ic wants to merge 389 commits into
masterfrom
refactor/issue127-final
Open

refactor: converge extension ownership and runtime boundaries#130
M09Ic wants to merge 389 commits into
masterfrom
refactor/issue127-final

Conversation

@M09Ic

@M09Ic M09Ic commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Summary

  • converge product composition on one core/extension.Set per profile, with atomic load rollback, admission, cancellation, drain, retryable close, and reverse dependency shutdown
  • centralize concrete adapters under pkg/exts and remove the legacy runtime, registrar/registration, service-location, filetools/workspacefiles, toolgroup, Borrow/Handle, and duplicated observation paths
  • keep pkg/toolset.Registry and pkg/commands.Registry as separate executable domains backed by the shared core/registry.Store[T] lifecycle kernel
  • make pkg/profile.Profile a concrete host object that owns one Set and publishes only App, Sessions, and resource namespaces; remove Application, Assembly, IsNil, and aiscanProfile wrappers
  • split pkg/exts/agent into the admitted Agent Loop owner and pkg/exts/session into the Session/Run/Inbox/history/protocol owner, connected only by constructor injection and Set dependency order
  • update Issue 127 architecture documentation and add structural regression guards

Ownership model

The AIScan product graph now expresses the relevant lifetime chain as:

Agent Loop -> App and registries -> Session Runtime

Shutdown runs in reverse, so Session work drains before App resources and the Agent Loop are released. Extensions do not import or close one another.

Scope

This PR contains the complete Issue 127 migration chain rather than only the final Agent/Session split. Relative to master, it intentionally changes 463 files across 23 commits. The commits retain the staged boundary migrations to keep reviewable architectural checkpoints.

Validation

Passed:

  • go build -mod=readonly ./...
  • go test -mod=readonly -tags full ./... -run '^$'
  • architecture and affected package tests
  • race tests for extension/registry/hooks/events, Agent, Session, Profile, Node, ToolNode, Proxy, and command entry points
  • post-rebase tests for the architecture root, Agent, Session, Profile, and AIScan command

go test -mod=readonly -count=1 ./... passes except the environment-dependent Katana browser reuse E2E (TestE2EHeadlessReusesDiscoveredBrowser), where the local browser did not reach the authenticated workspace. No test was skipped or relaxed to hide it.

Closes #127

M09Ic and others added 30 commits July 28, 2026 16:13
fix(web): harden scan lifecycle and runtime integrity
…er-deps

refactor: enforce unidirectional layer deps (core ← pkg ← cmd)
…er-deps

refactor(config): centralize env and provider protocols
The engine already records the exchange on the operator result
(protocols/http/request.go sets Request/Response), and the SDK's own
TemplateResult copies both out. neutronResult dropped them, so every
consumer of the JSON output saw a bare matched=true/false with no
reviewable evidence of what was actually sent.

Cairn's reproduce flow is the visible casualty: it parses request and
response from this output and only stores an evidence exchange when one
of them is present, so reproduction traffic was always empty in the UI.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
M09Ic added 28 commits September 9, 2026 19:29
Move resource ownership into app, session and run execution into runtime, terminal lifecycle into console, and stdio/inline transport into host. Update entrypoints and add lifecycle and dependency checks.

Record remaining callback, duplicate execution, and queue debt in the architecture audit. Relevant race tests and AOP tests pass; full suite retains the known Katana browser E2E failure.
Document the concrete TUI to Console merge, single Runtime execution path, queue and cancellation semantics, event-driven output, and follow-up App ownership work. Relax the source/test mapping rule for intentional cross-cutting lifecycle tests.
…runtime

Separate lifecycle owners from borrowed capabilities, move the session host into exts, and consolidate registry and observation boundaries. Remove obsolete runtime/plugin/dependency facades and update composition sites, tests, CI, docs, and the AOP submodule.

Add guards against restoring the legacy session package or exposing host lifecycle methods through borrowed session and loop capabilities. Existing Agent state and derived-session execution remain outside this cleanup.
@M09Ic
M09Ic force-pushed the master branch 2 times, most recently from 992d94a to ad015e7 Compare September 14, 2026 13:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

架构:显式构造依赖的单一 Extension 体系(Root / Session)

3 participants