Commit Graph

12 Commits

Author SHA1 Message Date
kshitijk4poor ab2f4602de refactor: MessageEvent to gateway/platforms/event.py; ElicitationHandler takes a call_context thunk
Breaks the two import cycles that forced Protocol stand-ins in the F821 sweep, so the two
sites now name the real types.

gateway/platforms/event.py (new leaf): MessageType, ProcessingOutcome, MessageEvent moved
out of base.py verbatim. Their only dependency is gateway.session.SessionSource; base.py
imported helpers.py at module level, so helpers could not name MessageEvent. Now
TextBatchAggregator is typed by the real MessageEvent. 249 importers repointed
(`from gateway.platforms.base import` -> `.event`, preserving each import's layout);
gateway.platforms.__init__ re-exports from .event. The three revert-scheduled PLUGIN-COMPAT
pointers that named these symbols (gateway.slash_commands → MessageType, dingtalk → MessageType,
photon → ProcessingOutcome) and their COMPAT_MANIFEST rows now target gateway.platforms.event.
Docs updated: ADDING_A_PLATFORM.md, adding-platform-adapters.md (en + zh-Hans).

tools/mcp_tool_sampling.py: ElicitationHandler no longer holds a back-reference to its
MCPServerTask (mcp_tool imports sampling, so the task type cannot be named there). It only
ever read owner._pending_call_context, so it takes `call_context: Callable[[], Context | None]`
and MCPServerTask passes `lambda: self._pending_call_context`. The consent call is one
`functools.partial`, run directly or inside the captured Context.

ty on the 11 touched production files vs origin/main: 0 new diagnostics, 14 resolved.
(The one `source: SessionSource = None` diagnostic moves with the class; typing it Optional
exposes ~60 unguarded call sites — separate follow-up.)

Tests: tests/gateway + tests/plugins + tests/tools + touched files, 18,235 passed; the 31
failures reproduce identically on origin/main (macOS /private/tmp, systemd socket,
long-path fixtures, live-service tests).
2026-09-07 22:47:33 +05:30
Teknium f4d4831e70 simplify(compat): tools/mcp_tool facade — drop 13 re-export blocks (127 names) + shutil re-import; siblings read sibling-defined names directly (_core kept for facade state) 2026-09-03 13:28:47 -07:00
Teknium e83816a4d1 review-fix(comments): restore lost #NNNN rationale comments across non-test source (mechanical sweep, condensed, code unchanged)
For each issue anchor present in BASE 63279301bc non-test .py and absent on HEAD, the BASE comment/docstring block was re-attached at the HEAD location of the code it explained (matched by the distinctive code line / enclosing def). Sentences already covered by an existing HEAD comment were deduped; the issue number always survives. Insert-only: no code lines changed.
2026-09-03 09:44:26 -07:00
Teknium da18bcd338 refactor(tools): MCP run/discovery/registration log-call folding, _publish_error helper 2026-09-02 23:40:12 -07:00
Teknium 49c38ef10f refactor(tools): MCP docstring/comment compaction, status predicate, renderer tidy 2026-09-02 23:36:18 -07:00
Teknium 7f7fd4a533 refactor(tools): MCP discovery/run/handlers defensive collapse, shared helpers, blank squeeze 2026-09-02 23:07:18 -07:00
Teknium 47be9a3629 refactor(tools): MCP SDK type-family table, drop identity capability map, layout compaction 2026-09-02 22:39:46 -07:00
Teknium 5e4f30bc9d refactor(tools): compact MCP facade/discovery/handlers/run/registration/schema/cache modules 2026-09-02 22:28:12 -07:00
Teknium d18b136417 refactor(mcp): one fail-fast branch for URL validation + content-type preflight 2026-09-02 17:00:43 -07:00
Teknium 3016bb9020 refactor(mcp): fold duplicate recycle check into _recycle_if_due; drop probe wrapper closure 2026-09-02 16:57:39 -07:00
Teknium 5f48aad2d8 refactor(mcp): _wait_for_lazy_reconnect -> _wait_for_reconnect_or_shutdown (same wait shape) 2026-09-02 16:02:55 -07:00
Teknium cbecd7d0c6 refactor(mcp): lift MCPServerTask lifecycle into MCPServerRunMixin; split run() into branch helpers 2026-09-02 15:46:06 -07:00