fix(desktop): load conductor IM plugins from external core

This commit is contained in:
yanghang committed 2026-07-10 18:35:36 +08:00
1 parent 01cd579326
commit 409ad66551
2 files changed
+16 -2

No files matched your search

+11 -1
View File
@@ -431,7 +431,17 @@ API: {base};requests,GET /readme查用法,GET /chat读未读对话,GET /
conductor = Conductor() conductor = Conductor()
# ---- IM poller: 探测conductor_im_plugins/下各插件,信号变化→唤醒总管 ---- # ---- IM poller: 探测conductor_im_plugins/下各插件,信号变化→唤醒总管 ----
IM_DIR, IM_COOLDOWN = os.path.join(os.path.dirname(__file__), "conductor_im_plugins"), 300 def _resolve_im_dir() -> str:
# 方案三: conductor.py itself is bundle-owned, but IM plugins are user/environment
# integrations. Prefer the external core's plugins when GA_ROOT points at one; fall back
# to the bundle templates/examples when the external core has no plugin directory.
external = os.path.join(ROOT, "frontends", "conductor_im_plugins")
if os.path.isdir(external):
return external
return os.path.join(os.path.dirname(os.path.abspath(__file__)), "conductor_im_plugins")
IM_DIR, IM_COOLDOWN = _resolve_im_dir(), 300
IM_PROMPTS: Dict[str, str] = {} # source -> 采集prompt(派采集subagent时按需取) IM_PROMPTS: Dict[str, str] = {} # source -> 采集prompt(派采集subagent时按需取)
def im_poll_loop(): def im_poll_loop():
+5 -1
View File
@@ -3,11 +3,15 @@
Given a target ga_root, verify the external核 satisfies the symbol/signature contract that Given a target ga_root, verify the external核 satisfies the symbol/signature contract that
the desktop bridge + conductor + cost_tracker rely on — WITHOUT instantiating GenericAgent the desktop bridge + conductor + cost_tracker rely on — WITHOUT instantiating GenericAgent
(that would read mykey, build LLM clients, and mutate the核). We only: (that would read mykey and build LLM clients). We only:
- import the核 modules against `ga_root` (this doubles as a dependency check: if the bundle - import the核 modules against `ga_root` (this doubles as a dependency check: if the bundle
python can't import the核's deps, the import fails and we report incompatible), and python can't import the核's deps, the import fails and we report incompatible), and
- introspect the GenericAgent class + module-level functions via `inspect`. - introspect the GenericAgent class + module-level functions via `inspect`.
Note: importing agentmain/llmcore can still run module top-level create-if-missing
initializers in the target核 (for example seeding default memory/config files). The probe
does not intentionally overwrite existing files and never constructs a GenericAgent instance.
Runtime-only surface (instance attrs like llmclient.backend.history, llmclients, task_queue, Runtime-only surface (instance attrs like llmclient.backend.history, llmclients, task_queue,
handler.working, backend.current_name) cannot be checked statically and is intentionally not handler.working, backend.current_name) cannot be checked statically and is intentionally not
probed here; it is covered by the "核 ≈ upstream" compatibility and graceful degrade. probed here; it is covered by the "核 ≈ upstream" compatibility and graceful degrade.