MCPcopy Create free account

hub / github.com/PeterLeeXX/Socrates / functions

Functions105 in github.com/PeterLeeXX/Socrates

↓ 25 callersMethodexecute
(self, command: str, timeout: int = 120, **kwargs)
socrates/tools/bash.py:71
↓ 19 callersMethodadd
(self, message: dict)
socrates/context.py:22
↓ 12 callersMethodresolve_model
Resolve a registry model key into runtime LiteLLM settings.
socrates/config.py:75
↓ 6 callersFunctionload_session
Load a session. Returns (messages, model) or None.
socrates/session.py:55
↓ 6 callersMethodrun
Process one user turn - may involve multiple LLM calls for tool use.
socrates/agent.py:47
↓ 5 callersFunctionsave_session
Save conversation to disk. Returns the session id.
socrates/session.py:34
↓ 4 callersMethodcompress
Snip tool outputs first, then summarize old turns if needed.
socrates/context.py:35
↓ 2 callersFunction_apply_cli_overrides
(config: Config, args: argparse.Namespace)
socrates/cli.py:68
↓ 2 callersFunction_handle_command
Handle slash commands. Returns True if command was recognized.
socrates/cli.py:173
↓ 2 callersFunction_new_session_id
()
socrates/session.py:22
↓ 2 callersFunction_normalize_session_id
(session_id: str | None)
socrates/session.py:13
↓ 2 callersMethod_print_tool_header
Show a compact header for the tool being executed.
socrates/agent.py:163
↓ 2 callersMethod_print_tool_result
Print tool output, truncated for display.
socrates/agent.py:181
↓ 2 callersMethod_search_file
(fpath: str, regex)
socrates/tools/grep_tool.py:97
↓ 2 callersFunction_session_path
(session_id: str)
socrates/session.py:26
↓ 2 callersMethod_snip_tool_outputs
Truncate long tool results, keeping head + tail.
socrates/context.py:41
↓ 2 callersMethodapply_config
Synchronize runtime objects with the current config.
socrates/agent.py:40
↓ 2 callersMethodfrom_env
Build config from environment variables.
socrates/config.py:69
↓ 2 callersMethodget_messages
(self)
socrates/context.py:25
↓ 2 callersFunctionget_tool_schemas
Get OpenAI-format tool schemas for all tools.
socrates/tools/__init__.py:22
↓ 2 callersFunctionlist_sessions
List saved sessions with metadata.
socrates/session.py:65
↓ 2 callersFunctionmain
()
socrates/cli.py:75
↓ 2 callersMethodneeds_compression
(self)
socrates/context.py:32
↓ 1 callersFunction_check_dangerous
Return a warning string if the command looks destructive.
socrates/tools/bash.py:27
↓ 1 callersMethod_execute_tool
Run a single tool call and add the result to context.
socrates/agent.py:112
↓ 1 callersMethod_execute_tools_parallel
Run multiple tool calls concurrently using threads.
socrates/agent.py:136
↓ 1 callersFunction_is_binary
Quick null-byte check.
socrates/tools/grep_tool.py:12
↓ 1 callersFunction_is_binary
Quick check: if the first 512 bytes contain null bytes, it's binary.
socrates/tools/read_file.py:7
↓ 1 callersMethod_non_streaming
Handle non-streaming responses.
socrates/llm.py:116
↓ 1 callersMethod_streaming
Handle streaming responses, assembling tool calls from deltas.
socrates/llm.py:62
↓ 1 callersMethod_summarize_old
Replace old messages with a compressed summary.
socrates/context.py:59
↓ 1 callersMethod_track_usage
Best-effort token tracking for streaming responses.
socrates/llm.py:153
↓ 1 callersFunction_unified_diff
Generate a compact unified diff.
socrates/tools/edit_file.py:11
↓ 1 callersFunction_update_cwd
Track directory changes from cd commands.
socrates/tools/bash.py:35
↓ 1 callersMethod_walk
Walk dir tree, skipping junk dirs and binary files.
socrates/tools/grep_tool.py:84
↓ 1 callersFunctionbuild_system_prompt
Generate system prompt with current environment context.
socrates/prompts/system.py:8
↓ 1 callersMethodchat
Send messages to the LLM and yield response chunks. Yields dicts with keys: - {"type": "text", "content": "..."} for text
socrates/llm.py:29
↓ 1 callersMethodcount_tokens
Count tokens in a message list.
socrates/llm.py:173
↓ 1 callersFunctionparse_args
()
socrates/cli.py:26
↓ 1 callersMethodreset
Clear everything except the system prompt.
socrates/context.py:89
↓ 1 callersMethodto_schema
Convert to OpenAI function-calling schema.
socrates/tools/base.py:18
Method__init__
(self, llm: LLMClient, max_tokens: int, compress_threshold: float = 0.7)
socrates/context.py:16
Method__init__
(self, model: str, api_base: str | None = None, api_key: str | None = None)
socrates/llm.py:19
Method__init__
(self, config: Config)
socrates/agent.py:22
Function_newline
(event)
socrates/cli.py:130
Method_run_one
(tc)
socrates/agent.py:142
Function_short_model
Strip the provider prefix for display.
socrates/cli.py:21
Function_submit
(event)
socrates/cli.py:126
Methodcount_tokens
(self, messages)
tests/test_core.py:373
Methodexecute
(self, file_path: str, content: str, **kwargs)
socrates/tools/write_file.py:29
Methodexecute
(self, pattern: str, path: str = ".", **kwargs)
socrates/tools/glob_tool.py:30
Methodexecute
( self, pattern: str, path: str = ".", include: str | None = None, **kwargs )
socrates/tools/grep_tool.py:47
Methodexecute
Run the tool and return a string result.
socrates/tools/base.py:14
Methodexecute
( self, file_path: str, old_string: str, new_string: str, replace_all: bool = False, **kwargs
socrates/tools/edit_file.py:57
Methodexecute
(self, file_path: str, offset: int = 0, limit: int = 2000, **kwargs)
socrates/tools/read_file.py:44
Functionfake_save_session
(messages, model, name=None)
tests/test_core.py:135
Functiontest_agent_apply_config_syncs_runtime
()
tests/test_core.py:108
Functiontest_agent_resolves_default_config
()
tests/test_core.py:124
Functiontest_all_tools_loaded
()
tests/test_core.py:155
Functiontest_bash_fork_bomb_blocked
()
tests/test_core.py:464
Functiontest_bash_mkfs_blocked
()
tests/test_core.py:459
Functiontest_bash_timeout
()
tests/test_core.py:246
Functiontest_bash_tool
()
tests/test_core.py:240
Functiontest_binary_file_rejected
(tmp_path)
tests/test_core.py:349
Functiontest_cd_tracking
(tmp_path)
tests/test_core.py:332
Functiontest_config_defaults
()
tests/test_core.py:62
Functiontest_config_rejects_unknown_model
()
tests/test_core.py:75
Functiontest_config_resolve_registry_key
()
tests/test_core.py:85
Functiontest_context_handles_none_content
Assistant messages with content=None should not crash compression.
tests/test_core.py:412
Functiontest_context_snip_tool_outputs
Tool outputs longer than threshold should be truncated.
tests/test_core.py:368
Functiontest_context_summarize_old
Old messages should be summarized when compress() is called.
tests/test_core.py:390
Functiontest_dangerous_command_blocked
()
tests/test_core.py:313
Functiontest_dangerous_curl_pipe_blocked
()
tests/test_core.py:319
Functiontest_default_session_ids_do_not_collide
(tmp_path, monkeypatch)
tests/test_session.py:5
Functiontest_edit_file
(tmp_path)
tests/test_core.py:191
Functiontest_edit_file_diff_output
(tmp_path)
tests/test_core.py:200
Functiontest_edit_file_not_found
()
tests/test_core.py:214
Functiontest_edit_file_unique_check
(tmp_path)
tests/test_core.py:220
Functiontest_edit_tracks_changes
(tmp_path)
tests/test_core.py:254
Functiontest_gemini_resolves_model_and_context
()
tests/test_core.py:100
Functiontest_glob_tool
()
tests/test_core.py:228
Functiontest_grep_skips_pycache
Grep should not search inside __pycache__ directories.
tests/test_core.py:448
Functiontest_grep_tool
()
tests/test_core.py:234
Functiontest_import_socrates_does_not_print_botocore_warning
()
tests/test_core.py:34
Functiontest_import_socrates_sets_quiet_litellm_default
()
tests/test_core.py:46
Functiontest_list_sessions
()
tests/test_core.py:306
Functiontest_model_registry_non_empty
()
tests/test_core.py:149
Functiontest_package_init_can_run_as_file
()
tests/test_core.py:23
Functiontest_public_api
()
tests/test_core.py:17
Functiontest_qwen_uses_dashscope_key_not_openai
(monkeypatch)
tests/test_core.py:92
Functiontest_read_file
(tmp_path)
tests/test_core.py:168
Functiontest_read_file_not_found
()
tests/test_core.py:177
Functiontest_read_file_with_offset_limit
(tmp_path)
tests/test_core.py:436
Functiontest_safe_command_not_blocked
()
tests/test_core.py:325
Functiontest_save_command_uses_model_key
(monkeypatch)
tests/test_core.py:130
Functiontest_session_name_is_sanitized
()
tests/test_core.py:289
Functiontest_session_not_found
()
tests/test_core.py:302
Functiontest_session_save_load
()
tests/test_core.py:277
Functiontest_text_file_not_rejected
(tmp_path)
tests/test_core.py:357
Functiontest_tool_schemas
()
tests/test_core.py:159
next →1–100 of 105, ranked by callers