fix: ensure mykey.py is always importable from llmcore

- Add sys.path.append for llmcore's own directory as fallback
- Remove dead variable _imp_err
- Distinguish missing mykey vs import failure with clear error messages
This commit is contained in:
Jiaqing Liang committed 2026-05-21 18:17:53 +08:00
1 parent 7e88373fea
commit 795d2d51a2
2 files changed
+11 -7

No files matched your search

+3 -5
View File
@@ -6,13 +6,11 @@ if sys.stderr is None: sys.stderr = open(os.devnull, "w")
elif hasattr(sys.stderr, 'reconfigure'): sys.stderr.reconfigure(errors='replace')
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
from llmcore import reload_mykeys, LLMSession, ToolClient, ClaudeSession, MixinSession, NativeToolClient, NativeClaudeSession, NativeOAISession, resolve_client
from llmcore import reload_mykeys, ToolClient, MixinSession, NativeToolClient, NativeClaudeSession, NativeOAISession, resolve_client
from agent_loop import agent_runner_loop
try:
from plugins.hooks import discover_and_load as _discover_plugins
_discover_plugins()
except Exception:
pass
from plugins.hooks import discover_and_load; discover_and_load()
except Exception: pass
from ga import GenericAgentHandler, smart_format, get_global_memory, format_error, consume_file
script_dir = os.path.dirname(os.path.abspath(__file__))