sycommon-python-lib 0.2.10a18__tar.gz → 0.2.10a19__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/PKG-INFO +1 -1
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/pyproject.toml +1 -1
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/pi/coding/mcpserver.py +62 -1
- sycommon_python_lib-0.2.10a19/src/sycommon/pi/core/usage.py +264 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/pi/mcp/transport.py +7 -2
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/pi/providers/anthropic_client.py +50 -12
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/pi/providers/bedrock_client.py +44 -18
- sycommon_python_lib-0.2.10a19/src/sycommon/pi/providers/faux.py +446 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/pi/providers/google_client.py +27 -11
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/pi/providers/openai_client.py +10 -1
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon_python_lib.egg-info/PKG-INFO +1 -1
- sycommon_python_lib-0.2.10a18/src/sycommon/pi/core/usage.py +0 -105
- sycommon_python_lib-0.2.10a18/src/sycommon/pi/providers/faux.py +0 -247
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/README.md +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/setup.cfg +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/command/__init__.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/command/cli.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/command/core/__init__.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/command/core/console.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/command/core/models.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/command/core/project.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/command/core/utils.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/command/templates/__init__.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/command/templates/agent/README.md.tpl +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/command/templates/agent/__init__.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/command/templates/agent/agent/__init__.py.tpl +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/command/templates/agent/agent/main_agent.py.tpl +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/command/templates/agent/agent/nodes/__init__.py.tpl +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/command/templates/agent/agent/nodes/example_node.py.tpl +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/command/templates/agent/agent/states/__init__.py.tpl +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/command/templates/agent/agent/states/agent_state.py.tpl +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/command/templates/agent/api/__init__.py.tpl +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/command/templates/agent/api/query.py.tpl +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/command/templates/agent/api/sse/__init__.py.tpl +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/command/templates/agent/api/sse/agent.py.tpl +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/command/templates/agent/app.py.tpl +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/command/templates/agent/client/__init__.py.tpl +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/command/templates/agent/db/__init__.py.tpl +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/command/templates/agent/db/model/__init__.py.tpl +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/command/templates/agent/db/model/entity.py.tpl +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/command/templates/agent/db/service.py.tpl +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/command/templates/agent/model/__init__.py.tpl +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/command/templates/agent/model/parse.py.tpl +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/command/templates/agent/tools/__init__.py.tpl +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/command/templates/agent/tools/mq.py.tpl +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/command/templates/base/.env.tpl +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/command/templates/base/.gitignore.tpl +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/command/templates/base/Dockerfile.tpl +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/command/templates/base/README.md.tpl +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/command/templates/base/__init__.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/command/templates/base/app.py.tpl +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/command/templates/base/app.yaml.tpl +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/command/templates/base/client/FileServiceClient.py.tpl +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/command/templates/base/client/__init__.py.tpl +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/command/templates/base/model/__init__.py.tpl +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/command/templates/base/model/file_info.py.tpl +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/command/templates/base/requirements.txt.tpl +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/command/templates/cli/README.md.tpl +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/command/templates/cli/__init__.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/command/templates/cli/app.py.tpl +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/command/templates/cli/commands/__init__.py.tpl +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/command/templates/cli/commands/hello.py.tpl +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/command/templates/cli/pyproject.toml.tpl +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/command/templates/cli/tools/__init__.py.tpl +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/command/templates/web/README.md.tpl +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/command/templates/web/__init__.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/command/templates/web/api/__init__.py.tpl +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/command/templates/web/api/echo.py.tpl +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/command/templates/web/api/sse/__init__.py.tpl +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/command/templates/web/api/sse/echo.py.tpl +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/command/templates/web/app.py.tpl +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/command/templates/web/client/__init__.py.tpl +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/command/templates/web/model/__init__.py.tpl +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/command/templates/web/tools/__init__.py.tpl +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/command/templates/web/tools/mq.py.tpl +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/nexus/__init__.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycli/__init__.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycli/__main__.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycli/acp/__init__.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycli/acp/config.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycli/acp/executor.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycli/acp/registry.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycli/acp/server.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycli/agents/__init__.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycli/agents/factory.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycli/agents/prompts.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycli/cdp/__init__.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycli/cdp/browser.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycli/cdp/capabilities/__init__.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycli/cdp/capabilities/console.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycli/cdp/capabilities/dom.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycli/cdp/capabilities/network.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycli/cdp/capabilities/page_errors.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycli/cdp/capabilities/performance.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycli/cdp/capabilities/screenshot.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycli/cdp/client.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycli/cdp/protocol.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycli/cdp/repl.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycli/cli.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycli/commands/__init__.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycli/commands/acp_cmd.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycli/commands/acp_serve_cmd.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycli/commands/cdp_cmd.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycli/commands/chat_cmd.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycli/commands/create_cmd.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycli/commands/evaluate_cmd.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycli/commands/init_cmd.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycli/commands/memory_cmd.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycli/commands/resume_cmd.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycli/commands/rollback_cmd.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycli/commands/run_cmd.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycli/core/__init__.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycli/core/backend.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycli/core/config.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycli/core/display.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycli/core/git_integration.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycli/core/llm.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycli/core/state.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycli/evaluate/__init__.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycli/evaluate/api_evaluator.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycli/memory/__init__.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycli/memory/compressor.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycli/memory/full.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycli/memory/hot.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycli/memory/manager.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycli/memory/warm.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycli/mode/__init__.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycli/mode/create.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycli/mode/optimize.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycli/models/__init__.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycli/models/config_models.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycli/rl/__init__.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycli/rl/baseline_tests.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycli/rl/checkpoint.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycli/rl/convergence.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycli/rl/diagnosis.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycli/rl/engine.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycli/rl/environment.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycli/rl/experience.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycli/rl/harness_prompts.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycli/rl/history.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycli/rl/optimization_logger.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycli/rl/pre_validation.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycli/rl/reward.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycli/rl/strategy_bandit.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycli/rl/strategy_generator.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycli/rl/strategy_prompts.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycli/simple_chat_agent.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycli/skills/__init__.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/__init__.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/agent/__init__.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/agent/acp/__init__.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/agent/acp/client.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/agent/acp/fetch.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/agent/acp/server_adapter.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/agent/acp/ssh_init.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/agent/acp/tool.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/agent/agent_manager.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/agent/chat_events.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/agent/deep_agent.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/agent/mcp/__init__.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/agent/mcp/models.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/agent/mcp/tool_loader.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/agent/middleware/model_request_prep.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/agent/middleware/sandbox_path_guard.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/agent/middleware/sensitive_guard.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/agent/middleware/skill_write_guard.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/agent/multi_agent_team.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/agent/reasoning_content_patch.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/agent/resume_compactor.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/agent/sandbox/__init__.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/agent/sandbox/consistent_hash.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/agent/sandbox/file_ops.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/agent/sandbox/http_sandbox_backend.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/agent/sandbox/minio_sync.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/agent/sandbox/sandbox_pool.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/agent/sandbox/sandbox_recovery.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/agent/sandbox/session.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/agent/skills_retry_patch.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/agent/summarization_utils.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/alert/__init__.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/alert/alert_sdk.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/alert/ao.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/alert/api.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/alert/bridge.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/alert/env.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/alert/guard.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/alert/monitor.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/alert/queue.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/alert/ratelimit.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/alert/sdk.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/alert/sdk_selfcheck.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/auth/__init__.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/auth/ldap_service.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/auth/oa_cache.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/auth/oa_crypto.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/auth/oa_service.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/auth/wecom_ldap_service.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/config/ACPAgentConfig.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/config/Config.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/config/DatabaseConfig.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/config/EgressPolicyConfig.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/config/ElasticsearchConfig.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/config/EmbeddingConfig.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/config/LLMConfig.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/config/LangfuseConfig.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/config/MQConfig.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/config/PgConfig.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/config/RedisConfig.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/config/RerankerConfig.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/config/SentryConfig.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/config/XxlJobConfig.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/config/__init__.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/config/config_change_notifier.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/database/async_base_db_service.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/database/async_database_service.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/database/base_db_service.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/database/database_service.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/database/elasticsearch_service.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/database/pg_checkpoint_service.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/database/redis_service.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/database/resilient_pg_saver.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/database/token_usage_db_service.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/health/__init__.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/health/health_check.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/health/metrics.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/health/ping.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/health/readiness.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/heartbeat_process/__init__.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/heartbeat_process/heartbeat_config.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/heartbeat_process/heartbeat_process_manager.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/heartbeat_process/heartbeat_process_worker.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/llm/__init__.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/llm/embedding.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/llm/get_llm.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/llm/llm_logger.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/llm/llm_tokens.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/llm/llm_with_token_tracking.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/llm/native_with_fallback_runnable.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/llm/output_fixing_runnable.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/llm/struct_token.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/llm/sy_langfuse.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/llm/tiktoken_cache/9b5ad71b2ce5302211f9c61530b329a4922fc6a4 +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/llm/tiktoken_cache/fb374d419588a4632f3f557e76b4b70aebbca790 +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/llm/token_usage_es_service.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/llm/token_usage_mysql_service.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/llm/token_utils.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/llm/usage_token.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/logging/__init__.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/logging/async_sql_logger.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/logging/bounded_kafka_sink.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/logging/bounded_stdout_sink.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/logging/kafka_log.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/logging/log_masker.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/logging/logger_levels.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/logging/logger_wrapper.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/logging/process_logger.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/logging/sql_logger.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/mcp_server/__init__.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/mcp_server/server.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/middleware/__init__.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/middleware/context.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/middleware/cors.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/middleware/docs.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/middleware/egress_wall.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/middleware/exception.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/middleware/middleware.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/middleware/monitor_memory.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/middleware/mq.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/middleware/sandbox.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/middleware/sandbox_gateway.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/middleware/timeout.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/middleware/token_tracking.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/middleware/tool_result_truncation.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/middleware/traceid.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/models/__init__.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/models/base_http.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/models/log.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/models/mcp_server_config.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/models/mqlistener_config.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/models/mqmsg_model.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/models/mqsend_config.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/models/sandbox.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/models/sso_user.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/models/token_usage.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/models/token_usage_mysql.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/models/xxljob_handler_config.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/notice/__init__.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/notice/uvicorn_monitor.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/notice/wecom_message.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/pi/agent/loop.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/pi/agent/types.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/pi/coding/__init__.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/pi/core/json_parse.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/pi/core/message.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/pi/core/model.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/pi/core/retry.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/pi/core/transcript.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/pi/core/transform.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/pi/core/validation.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/pi/mcp/__init__.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/pi/mcp/client.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/pi/mcp/jsonrpc.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/pi/providers/__init__.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/pi/providers/kimi_client.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/rabbitmq/delay_queue.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/rabbitmq/mq_store.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/rabbitmq/process_pool_consumer.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/rabbitmq/rabbit_management_client.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/rabbitmq/rabbitmq_client.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/rabbitmq/rabbitmq_pool.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/rabbitmq/rabbitmq_service.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/rabbitmq/rabbitmq_service_client_manager.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/rabbitmq/rabbitmq_service_connection_monitor.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/rabbitmq/rabbitmq_service_consumer_manager.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/rabbitmq/rabbitmq_service_core.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/rabbitmq/rabbitmq_service_producer_manager.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/rabbitmq/topic_registry.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/sentry/__init__.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/sentry/sy_sentry.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/services.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/sse/__init__.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/sse/event.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/sse/sse.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/synacos/__init__.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/synacos/example.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/synacos/example2.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/synacos/feign.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/synacos/feign_client.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/synacos/nacos_client_base.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/synacos/nacos_config_manager.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/synacos/nacos_heartbeat_manager.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/synacos/nacos_service.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/synacos/nacos_service_discovery.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/synacos/nacos_service_registration.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/synacos/param.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/tests/deep_agent_server.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/tests/test_backend_factory_compat.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/tests/test_consistent_hash.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/tests/test_consume_dedup.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/tests/test_consumer_broker_health.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/tests/test_consumer_loss_rootcause.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/tests/test_consumer_recovery.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/tests/test_consumer_recovery_fix.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/tests/test_consumer_tags_sync.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/tests/test_db_keepalive.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/tests/test_deep_agent.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/tests/test_dynamic_max_tokens.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/tests/test_email.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/tests/test_encoding_cache.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/tests/test_env_tenant_helper.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/tests/test_exp_concurrent_migrate.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/tests/test_exp_delete_queue_with_consumers.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/tests/test_fault_injection_real.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/tests/test_fix_verification.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/tests/test_heartbeat_timeout.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/tests/test_integration_real_broker.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/tests/test_mcp_server.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/tests/test_minimax_reasoning.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/tests/test_mq.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/tests/test_mq_config_driven.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/tests/test_nacos_llm_real.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/tests/test_oa_login.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/tests/test_queue_priority_fallback.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/tests/test_queue_priority_upgrade_timing.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/tests/test_real_summarization.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/tests/test_reconnect_scenarios.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/tests/test_sandbox_glob_hardening.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/tests/test_services_plugin_defaults.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/tests/test_summarization_config.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/tests/test_summarization_real.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/tests/test_summary_leak_e2e.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/tests/test_upgrade_aio_pika.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/tests/test_upgrade_langgraph_stream.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/tests/test_upgrade_verification.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/tools/__init__.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/tools/async_utils.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/tools/docs.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/tools/env.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/tools/merge_headers.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/tools/snowflake.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/tools/sso_token.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/tools/syemail.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/tools/time_utils.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/tools/timing.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/tools/user_id.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/xxljob/__init__.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/xxljob/xxljob_service.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon_python_lib.egg-info/SOURCES.txt +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon_python_lib.egg-info/dependency_links.txt +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon_python_lib.egg-info/entry_points.txt +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon_python_lib.egg-info/requires.txt +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon_python_lib.egg-info/top_level.txt +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/tests/test_acp_tool.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/tests/test_asyncio_logging.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/tests/test_config_change_notifier.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/tests/test_frame_alignment.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/tests/test_hotreload_snapshot.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/tests/test_kafka_upie_fix.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/tests/test_llm_apikey_contextvar.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/tests/test_log_masker.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/tests/test_print_capture.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/tests/test_resilient_pg_saver.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/tests/test_sandbox_path_guard.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/tests/test_sensitive_guard.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/tests/test_simple_chat_agent.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/tests/test_skill_regex_upgrade.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/tests/test_skill_write_guard.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/tests/test_sql_params_full.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/tests/test_streaming_e2e.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/tests/test_summary_echo_break_loop.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/tests/test_sycli.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/tests/test_sylogger_fixes.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/tests/test_sync_skills_to_sandbox.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/tests/test_time_utils.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/tests/test_traceid_omit_base64.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/tests/test_unicode_decode_regress.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/tests/test_upload_concurrency.py +0 -0
- {sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/tests/test_upload_e2e_http.py +0 -0
{sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/pi/coding/mcpserver.py
RENAMED
|
@@ -6,6 +6,7 @@ from __future__ import annotations
|
|
|
6
6
|
|
|
7
7
|
import json
|
|
8
8
|
import os
|
|
9
|
+
import tempfile
|
|
9
10
|
from dataclasses import dataclass, field
|
|
10
11
|
from typing import Any, Callable, Optional
|
|
11
12
|
|
|
@@ -98,6 +99,60 @@ def _to_pi_content(block: Any) -> ContentPart:
|
|
|
98
99
|
return block
|
|
99
100
|
|
|
100
101
|
|
|
102
|
+
MCP_OUTPUT_MAX_BYTES = 20 * 1024
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
def _truncate_middle(s: str, max_bytes: int) -> str:
|
|
106
|
+
"""Keep the start and end of s (half the cap each) with a
|
|
107
|
+
"…N chars truncated…" marker between, cutting only at character
|
|
108
|
+
boundaries (truncateMiddle, truncate.ts / the Go twin)."""
|
|
109
|
+
if len(s) <= max_bytes:
|
|
110
|
+
return s
|
|
111
|
+
head_end = max_bytes // 2
|
|
112
|
+
tail_start = len(s) - (max_bytes - max_bytes // 2)
|
|
113
|
+
head, tail = s[:head_end], s[tail_start:]
|
|
114
|
+
removed = len(s[head_end:tail_start])
|
|
115
|
+
return f"{head}…{removed} chars truncated…{tail}"
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
def _save_full_output(text: str) -> tuple[str, str]:
|
|
119
|
+
"""Write the untruncated text to a temp file (saveToTempFile) and
|
|
120
|
+
return (path, footer); on failure the footer says so instead."""
|
|
121
|
+
try:
|
|
122
|
+
with tempfile.NamedTemporaryFile(
|
|
123
|
+
prefix="mcp-output-", suffix=".txt", delete=False, mode="w", encoding="utf-8"
|
|
124
|
+
) as f:
|
|
125
|
+
f.write(text)
|
|
126
|
+
path = f.name
|
|
127
|
+
return path, f"[Full output: {path} (read it with offset/limit)]"
|
|
128
|
+
except OSError as exc:
|
|
129
|
+
return "", f"[Could not save the full output: {exc}]"
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
def limit_mcp_content(content: list[ContentPart]) -> tuple[list[ContentPart], str]:
|
|
133
|
+
"""Keep model-facing text within MCP_OUTPUT_MAX_BYTES (limitMcpContent,
|
|
134
|
+
tools.ts / the Go twin): when the combined text overruns the cap, ALL
|
|
135
|
+
text blocks collapse into ONE middle-truncated block and images
|
|
136
|
+
follow untouched."""
|
|
137
|
+
combined = "\n".join(
|
|
138
|
+
b.text for b in content if isinstance(b, TextContent)
|
|
139
|
+
)
|
|
140
|
+
if len(combined) <= MCP_OUTPUT_MAX_BYTES:
|
|
141
|
+
return content, ""
|
|
142
|
+
images = [b for b in content if isinstance(b, ImageContent)]
|
|
143
|
+
truncated = _truncate_middle(combined, MCP_OUTPUT_MAX_BYTES)
|
|
144
|
+
full_output_path, where = _save_full_output(combined)
|
|
145
|
+
tokens = (len(combined) + 3) // 4
|
|
146
|
+
lines = combined.count("\n")
|
|
147
|
+
if not combined.endswith("\n"):
|
|
148
|
+
lines += 1 # splitLinesForCounting pops one trailing newline
|
|
149
|
+
text = (
|
|
150
|
+
f"Warning: truncated output (original token count: {tokens})\n"
|
|
151
|
+
f"Total output lines: {lines}\n\n{truncated}\n\n{where}"
|
|
152
|
+
)
|
|
153
|
+
return [TextContent(text=text), *images], full_output_path
|
|
154
|
+
|
|
155
|
+
|
|
101
156
|
def _normalize_schema(schema) -> dict[str, Any]:
|
|
102
157
|
"""Schemas missing type/properties (but with other keys, e.g. a
|
|
103
158
|
lone description) get them added — providers reject object schemas
|
|
@@ -213,6 +268,12 @@ class Registry:
|
|
|
213
268
|
parts: list[ContentPart] = [
|
|
214
269
|
_to_pi_content(block) for block in to_llm_content(result)
|
|
215
270
|
]
|
|
271
|
+
# limitMcpContent caps the model-facing text (20KiB) with a
|
|
272
|
+
# middle truncation + temp-file pointer; images survive.
|
|
273
|
+
parts, full_output_path = limit_mcp_content(parts)
|
|
274
|
+
details: dict[str, Any] = {"mcpServer": server, "isError": result.is_error}
|
|
275
|
+
if full_output_path:
|
|
276
|
+
details["fullOutputPath"] = full_output_path
|
|
216
277
|
if result.is_error and not content_text(parts):
|
|
217
278
|
# The model must see WHY the tool failed
|
|
218
279
|
# (convertMcpResult appends the fallback when isError
|
|
@@ -225,7 +286,7 @@ class Registry:
|
|
|
225
286
|
return (
|
|
226
287
|
AgentToolResult(
|
|
227
288
|
content=parts,
|
|
228
|
-
details=
|
|
289
|
+
details=details,
|
|
229
290
|
structured_content=result.structured_content,
|
|
230
291
|
is_error=result.is_error,
|
|
231
292
|
),
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
"""Usage and cost accounting: ports pi-ai usage.ts / models.ts
|
|
2
|
+
calculateCost, mirroring the Go port (piai/usage.go)."""
|
|
3
|
+
|
|
4
|
+
from __future__ import annotations
|
|
5
|
+
|
|
6
|
+
import json
|
|
7
|
+
import math
|
|
8
|
+
from dataclasses import dataclass, field
|
|
9
|
+
from typing import TYPE_CHECKING, Optional
|
|
10
|
+
|
|
11
|
+
if TYPE_CHECKING: # runtime imports stay lazy: message.py imports usage.py
|
|
12
|
+
from sycommon.pi.core.message import (
|
|
13
|
+
AssistantMessage,
|
|
14
|
+
ImageContent,
|
|
15
|
+
SystemMessage,
|
|
16
|
+
TextContent,
|
|
17
|
+
ThinkingContent,
|
|
18
|
+
ToolCall,
|
|
19
|
+
ToolResultMessage,
|
|
20
|
+
UserMessage,
|
|
21
|
+
get_system_message_text,
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
@dataclass
|
|
26
|
+
class Cost:
|
|
27
|
+
"""The USD cost breakdown of a Usage."""
|
|
28
|
+
|
|
29
|
+
input: float = 0.0
|
|
30
|
+
output: float = 0.0
|
|
31
|
+
cache_read: float = 0.0
|
|
32
|
+
cache_write: float = 0.0
|
|
33
|
+
total: float = 0.0
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
@dataclass
|
|
37
|
+
class Usage:
|
|
38
|
+
"""Token accounting for one assistant response, with the cache split
|
|
39
|
+
pi tracks (types.ts Usage)."""
|
|
40
|
+
|
|
41
|
+
input: int = 0
|
|
42
|
+
output: int = 0
|
|
43
|
+
cache_read: int = 0
|
|
44
|
+
cache_write: int = 0
|
|
45
|
+
cache_write_1h: Optional[int] = None # subset of cache_write; Anthropic only
|
|
46
|
+
reasoning: Optional[int] = None # subset of output; None = not reported
|
|
47
|
+
total_tokens: int = 0
|
|
48
|
+
cost: Cost = field(default_factory=Cost)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
@dataclass
|
|
52
|
+
class ModelCostRates:
|
|
53
|
+
"""Per-million-token rates for one pricing tier."""
|
|
54
|
+
|
|
55
|
+
input: float = 0.0
|
|
56
|
+
output: float = 0.0
|
|
57
|
+
cache_read: float = 0.0
|
|
58
|
+
cache_write: float = 0.0
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
@dataclass
|
|
62
|
+
class ModelCostTier:
|
|
63
|
+
"""A request-wide pricing tier: rates apply above a token threshold."""
|
|
64
|
+
|
|
65
|
+
input_tokens_above: float = 0.0
|
|
66
|
+
rates: ModelCostRates = field(default_factory=ModelCostRates)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
@dataclass
|
|
70
|
+
class ModelCost:
|
|
71
|
+
"""Cost schedule for one model (base rates plus tiers)."""
|
|
72
|
+
|
|
73
|
+
input: float = 0.0
|
|
74
|
+
output: float = 0.0
|
|
75
|
+
cache_read: float = 0.0
|
|
76
|
+
cache_write: float = 0.0
|
|
77
|
+
tiers: list[ModelCostTier] = field(default_factory=list)
|
|
78
|
+
|
|
79
|
+
@property
|
|
80
|
+
def model_cost_rates(self) -> ModelCostRates:
|
|
81
|
+
return ModelCostRates(self.input, self.output, self.cache_read, self.cache_write)
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
def calculate_cost(model, usage: Usage) -> Cost:
|
|
85
|
+
"""Fill usage.cost from the model's catalog rates (models.ts
|
|
86
|
+
calculateCost). Request-wide pricing tiers pick the highest matching
|
|
87
|
+
input threshold; 1h cache writes bill at 2x base input."""
|
|
88
|
+
input_tokens = usage.input + usage.cache_read + usage.cache_write
|
|
89
|
+
rates = model.cost.model_cost_rates
|
|
90
|
+
matched_threshold = -1.0
|
|
91
|
+
for tier in model.cost.tiers:
|
|
92
|
+
if input_tokens > tier.input_tokens_above and tier.input_tokens_above > matched_threshold:
|
|
93
|
+
rates = tier.rates
|
|
94
|
+
matched_threshold = tier.input_tokens_above
|
|
95
|
+
|
|
96
|
+
long_write = usage.cache_write_1h or 0
|
|
97
|
+
short_write = usage.cache_write - long_write
|
|
98
|
+
|
|
99
|
+
usage.cost.input = rates.input / 1_000_000 * usage.input
|
|
100
|
+
usage.cost.output = rates.output / 1_000_000 * usage.output
|
|
101
|
+
usage.cost.cache_read = rates.cache_read / 1_000_000 * usage.cache_read
|
|
102
|
+
usage.cost.cache_write = (
|
|
103
|
+
rates.cache_write * short_write + rates.input * 2 * long_write
|
|
104
|
+
) / 1_000_000
|
|
105
|
+
usage.cost.total = (
|
|
106
|
+
usage.cost.input + usage.cost.output + usage.cost.cache_read + usage.cost.cache_write
|
|
107
|
+
)
|
|
108
|
+
return usage.cost
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
def empty_usage() -> Usage:
|
|
112
|
+
"""The zero-cost usage faux and error paths start from."""
|
|
113
|
+
return Usage()
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
def calculate_context_tokens(u: Usage) -> int:
|
|
117
|
+
"""The context size a usage block describes (utils/estimate.ts)."""
|
|
118
|
+
if u.total_tokens != 0:
|
|
119
|
+
return u.total_tokens
|
|
120
|
+
return u.input + u.output + u.cache_read + u.cache_write
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
# --- context token estimation (utils/estimate.ts, twins piai/estimate.go) ---
|
|
124
|
+
|
|
125
|
+
_CHARS_PER_TOKEN = 3.5
|
|
126
|
+
_ESTIMATED_IMAGE_CHARS = 4800
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
def _utf16_len(text: str) -> int:
|
|
130
|
+
"""JS .length counts UTF-16 code units; astral chars count 2."""
|
|
131
|
+
return sum(2 if ord(ch) > 0xFFFF else 1 for ch in text)
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
def estimate_text_tokens(text: str) -> int:
|
|
135
|
+
"""Estimate tokens for a plain string (chars ÷ 3.5, rounded up)."""
|
|
136
|
+
return math.ceil(_utf16_len(text) / _CHARS_PER_TOKEN)
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
def _estimate_text_image_tokens(parts: list) -> int:
|
|
140
|
+
from sycommon.pi.core.message import ImageContent, TextContent
|
|
141
|
+
|
|
142
|
+
chars = 0
|
|
143
|
+
for p in parts:
|
|
144
|
+
if isinstance(p, ImageContent):
|
|
145
|
+
chars += _ESTIMATED_IMAGE_CHARS
|
|
146
|
+
elif isinstance(p, TextContent):
|
|
147
|
+
chars += _utf16_len(p.text)
|
|
148
|
+
return math.ceil(chars / _CHARS_PER_TOKEN)
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
def estimate_message_tokens(message) -> int:
|
|
152
|
+
"""Estimate tokens for one message (estimate.ts by role)."""
|
|
153
|
+
from sycommon.pi.core.message import (
|
|
154
|
+
AssistantMessage,
|
|
155
|
+
SystemMessage,
|
|
156
|
+
TextContent,
|
|
157
|
+
ThinkingContent,
|
|
158
|
+
ToolCall,
|
|
159
|
+
ToolResultMessage,
|
|
160
|
+
UserMessage,
|
|
161
|
+
get_system_message_text,
|
|
162
|
+
)
|
|
163
|
+
|
|
164
|
+
if isinstance(message, SystemMessage):
|
|
165
|
+
return estimate_text_tokens(get_system_message_text(message)) + _estimate_tools_tokens(
|
|
166
|
+
message.tools_added
|
|
167
|
+
) + _estimate_tools_tokens(message.tools_removed)
|
|
168
|
+
if isinstance(message, (UserMessage, ToolResultMessage)):
|
|
169
|
+
return _estimate_text_image_tokens(message.content)
|
|
170
|
+
if isinstance(message, AssistantMessage):
|
|
171
|
+
chars = 0
|
|
172
|
+
for block in message.content:
|
|
173
|
+
if isinstance(block, TextContent):
|
|
174
|
+
chars += _utf16_len(block.text)
|
|
175
|
+
elif isinstance(block, ThinkingContent):
|
|
176
|
+
chars += _utf16_len(block.thinking)
|
|
177
|
+
elif isinstance(block, ToolCall):
|
|
178
|
+
chars += _utf16_len(block.name) + _utf16_len(_safe_json(block.arguments))
|
|
179
|
+
return math.ceil(chars / _CHARS_PER_TOKEN)
|
|
180
|
+
# Custom roles: serialize as JSON and estimate.
|
|
181
|
+
return estimate_text_tokens(_safe_json(message))
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
def _estimate_tools_tokens(tools: list) -> int:
|
|
185
|
+
if not tools:
|
|
186
|
+
return 0
|
|
187
|
+
s = _safe_json(tools)
|
|
188
|
+
if not s:
|
|
189
|
+
return 0
|
|
190
|
+
return estimate_text_tokens(s)
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
def _jsonable(value):
|
|
194
|
+
"""Tool/ToolReference render like TS JSON.stringify (name/
|
|
195
|
+
description/parameters[/constrainedSampling] — never the dataclass
|
|
196
|
+
repr); lists walk element-wise."""
|
|
197
|
+
name = getattr(value, "name", None)
|
|
198
|
+
if isinstance(name, str) and hasattr(value, "parameters"):
|
|
199
|
+
out = {"name": value.name, "description": getattr(value, "description", ""), "parameters": getattr(value, "parameters", {})}
|
|
200
|
+
cs = getattr(value, "constrained_sampling", None)
|
|
201
|
+
if cs is not None:
|
|
202
|
+
# ConstrainedSamplingConfig wire form (types.ts:744-752):
|
|
203
|
+
# type + strict / variants — never the dataclass repr.
|
|
204
|
+
cs_out: dict = {"type": getattr(cs, "type", "")}
|
|
205
|
+
strict = getattr(cs, "strict", "")
|
|
206
|
+
if strict:
|
|
207
|
+
cs_out["strict"] = strict
|
|
208
|
+
variants = getattr(cs, "variants", None)
|
|
209
|
+
if variants:
|
|
210
|
+
cs_out["variants"] = variants
|
|
211
|
+
out["constrainedSampling"] = cs_out
|
|
212
|
+
return out
|
|
213
|
+
if isinstance(name, str) and not hasattr(value, "parameters") and value.__class__.__name__ == "ToolReference":
|
|
214
|
+
return {"name": value.name}
|
|
215
|
+
if isinstance(value, list):
|
|
216
|
+
return [_jsonable(v) for v in value]
|
|
217
|
+
if isinstance(value, dict):
|
|
218
|
+
return {k: _jsonable(v) for k, v in value.items()}
|
|
219
|
+
return value
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
def _safe_json(value) -> str:
|
|
223
|
+
try:
|
|
224
|
+
return json.dumps(_jsonable(value), separators=(",", ":"), default=str)
|
|
225
|
+
except (TypeError, ValueError):
|
|
226
|
+
return "[unserializable]"
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
def estimate_context_tokens(messages: list) -> int:
|
|
230
|
+
"""Estimate total context tokens: the most recent applicable
|
|
231
|
+
assistant usage block plus an estimate of everything after it, or a
|
|
232
|
+
full estimate when no usage applies (estimate.ts)."""
|
|
233
|
+
from sycommon.pi.core.message import AssistantMessage, StopReason
|
|
234
|
+
|
|
235
|
+
latest_prefix_ts = -(2**63)
|
|
236
|
+
usage: Optional[Usage] = None
|
|
237
|
+
idx = -1
|
|
238
|
+
for i, m in enumerate(messages):
|
|
239
|
+
if isinstance(m, AssistantMessage):
|
|
240
|
+
applies = m.timestamp_ms >= latest_prefix_ts
|
|
241
|
+
if (
|
|
242
|
+
applies
|
|
243
|
+
and m.stop_reason not in (StopReason.ABORTED, StopReason.ERROR)
|
|
244
|
+
and calculate_context_tokens(m.usage) > 0
|
|
245
|
+
):
|
|
246
|
+
usage, idx = m.usage, i
|
|
247
|
+
ts = m.timestamp()
|
|
248
|
+
if ts > latest_prefix_ts:
|
|
249
|
+
latest_prefix_ts = ts
|
|
250
|
+
if idx >= 0 and usage is not None:
|
|
251
|
+
usage_tokens = calculate_context_tokens(usage)
|
|
252
|
+
trailing = sum(estimate_message_tokens(messages[i]) for i in range(idx + 1, len(messages)))
|
|
253
|
+
return usage_tokens + trailing
|
|
254
|
+
return sum(estimate_message_tokens(m) for m in messages)
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
def clamp_max_tokens_to_context(model, messages: list, max_tokens: int) -> int:
|
|
258
|
+
"""simple-options.ts clampMaxTokensToContext: keep the output cap
|
|
259
|
+
inside the context window minus the estimated context and a 4096
|
|
260
|
+
safety margin (floor 1). A non-positive window disables the clamp."""
|
|
261
|
+
if getattr(model, "context_window", 0) <= 0:
|
|
262
|
+
return max(max_tokens, 1)
|
|
263
|
+
available = model.context_window - estimate_context_tokens(messages) - 4096
|
|
264
|
+
return min(max_tokens, max(available, 1))
|
{sycommon_python_lib-0.2.10a18 → sycommon_python_lib-0.2.10a19}/src/sycommon/pi/mcp/transport.py
RENAMED
|
@@ -425,7 +425,10 @@ class HTTPTransport:
|
|
|
425
425
|
# so trailing server messages after the answer are delivered.
|
|
426
426
|
answered = False
|
|
427
427
|
try:
|
|
428
|
-
|
|
428
|
+
# chunk_size=1: http.client read(n) blocks until n bytes
|
|
429
|
+
# arrive, so any larger quantum would hold a complete short
|
|
430
|
+
# SSE event hostage until the next one starts arriving.
|
|
431
|
+
for chunk in resp.iter_content(chunk_size=1):
|
|
429
432
|
if not chunk:
|
|
430
433
|
continue
|
|
431
434
|
if self._drain_event(parser.feed(chunk), related_to):
|
|
@@ -493,7 +496,9 @@ class HTTPTransport:
|
|
|
493
496
|
self._live.add(resp)
|
|
494
497
|
parser = _SseParser()
|
|
495
498
|
try:
|
|
496
|
-
|
|
499
|
+
# chunk_size=1 (see the POST scan above): a byte at a time
|
|
500
|
+
# keeps held-open server streams deliverable.
|
|
501
|
+
for chunk in resp.iter_content(chunk_size=1):
|
|
497
502
|
if not chunk or self._closed.is_set():
|
|
498
503
|
return
|
|
499
504
|
for event in parser.feed(chunk):
|
|
@@ -204,6 +204,15 @@ class AnthropicClient:
|
|
|
204
204
|
cache = {"type": "ephemeral", **({"ttl": "1h"} if retention == "long" else {})}
|
|
205
205
|
|
|
206
206
|
max_tokens = (options.max_tokens if options and options.max_tokens else model.max_tokens) or 4096
|
|
207
|
+
# clampMaxTokensToContext (simple-options.ts, via buildBaseOptions):
|
|
208
|
+
# keep max_tokens inside the context window minus the estimated
|
|
209
|
+
# context and a 4096 safety margin, so long sessions clamp
|
|
210
|
+
# instead of 400ing. The estimate uses the FULL context (system
|
|
211
|
+
# head included — upstream reads context.messages before the
|
|
212
|
+
# head is split off).
|
|
213
|
+
from sycommon.pi.core.usage import clamp_max_tokens_to_context
|
|
214
|
+
|
|
215
|
+
max_tokens = clamp_max_tokens_to_context(model, messages, max_tokens)
|
|
207
216
|
converted = _convert_messages(model, transformed)
|
|
208
217
|
# Cache the conversation history: cache_control lands on the LAST
|
|
209
218
|
# user message's last block (anthropic-messages.ts).
|
|
@@ -242,7 +251,7 @@ class AnthropicClient:
|
|
|
242
251
|
# streamSimple's first branch: adaptive models never take the
|
|
243
252
|
# budget ladder — XOR, never both (forceAdaptiveThinking pick).
|
|
244
253
|
if model.reasoning and model.force_adaptive_thinking and wants_thinking:
|
|
245
|
-
effort = _effort_of(options.reasoning) if options else ""
|
|
254
|
+
effort = _effort_of(model, options.reasoning) if options else ""
|
|
246
255
|
params["thinking"] = {"type": "adaptive", "display": "summarized"}
|
|
247
256
|
if effort:
|
|
248
257
|
params["output_config"] = {"effort": effort}
|
|
@@ -260,10 +269,17 @@ class AnthropicClient:
|
|
|
260
269
|
elif self.opts.thinking_budget_tokens:
|
|
261
270
|
budget = self.opts.thinking_budget_tokens
|
|
262
271
|
# adjustMaxTokensForThinking: an explicit caller cap widens
|
|
263
|
-
# to fit the budget under the model ceiling; the
|
|
264
|
-
#
|
|
272
|
+
# to fit the budget under the model ceiling; the widened
|
|
273
|
+
# value then goes through a SECOND context clamp
|
|
274
|
+
# (anthropic-messages.ts:1003-1012: maxTokens =
|
|
275
|
+
# clampMaxTokensToContext(adjusted.maxTokens)) — a cap that
|
|
276
|
+
# widens past the context-derived ceiling must come back
|
|
277
|
+
# down, and the budget rides the clamped room.
|
|
265
278
|
if options and options.max_tokens:
|
|
266
279
|
max_tokens = min(max_tokens + budget, model.max_tokens or max_tokens)
|
|
280
|
+
from sycommon.pi.core.usage import clamp_max_tokens_to_context
|
|
281
|
+
|
|
282
|
+
max_tokens = clamp_max_tokens_to_context(model, messages, max_tokens)
|
|
267
283
|
budget = min(budget, max(0, max_tokens - 1024))
|
|
268
284
|
params["max_tokens"] = max_tokens
|
|
269
285
|
params["thinking"] = {"type": "enabled", "budget_tokens": budget, "display": "summarized"}
|
|
@@ -280,10 +296,14 @@ class AnthropicClient:
|
|
|
280
296
|
# its default thinking level.
|
|
281
297
|
params["thinking"] = {"type": "disabled"}
|
|
282
298
|
|
|
283
|
-
# getBetaFeatures
|
|
284
|
-
#
|
|
285
|
-
#
|
|
286
|
-
#
|
|
299
|
+
# getBetaFeatures: the configured anthropic-beta header is
|
|
300
|
+
# authoritative when present (configuredFeatures short-circuits
|
|
301
|
+
# before any computed feature); with NO header, budget thinking
|
|
302
|
+
# on a reasoning model rides the interleaved-thinking beta
|
|
303
|
+
# (interleavedThinking defaults true; adaptive-thinking models
|
|
304
|
+
# are excluded — they never take the budget ladder). This port
|
|
305
|
+
# has no OAuth/fine-grained-tool-streaming/server-fallback
|
|
306
|
+
# betas, so the computed path is exactly this one feature.
|
|
287
307
|
configured = None
|
|
288
308
|
for hdrs in (model.headers, options.headers if options else {}):
|
|
289
309
|
for name, value in (hdrs or {}).items():
|
|
@@ -297,10 +317,18 @@ class AnthropicClient:
|
|
|
297
317
|
features.append(feature)
|
|
298
318
|
if features:
|
|
299
319
|
params["betas"] = features
|
|
320
|
+
elif "thinking" in params and params["thinking"].get("type") == "enabled":
|
|
321
|
+
params["betas"] = ["interleaved-thinking-2025-05-14"]
|
|
300
322
|
|
|
301
323
|
if options:
|
|
302
|
-
#
|
|
303
|
-
|
|
324
|
+
# Temperature is incompatible with thinking and keyed on the
|
|
325
|
+
# thinking OPTION (anthropic-messages.ts:1256:
|
|
326
|
+
# !options?.thinkingEnabled): streamSimple sets it true for
|
|
327
|
+
# any truthy reasoning on ANY model — a non-reasoning model
|
|
328
|
+
# with reasoning requested suppresses temperature even
|
|
329
|
+
# though no thinking block is emitted. The client flag
|
|
330
|
+
# (explicit construction) suppresses too.
|
|
331
|
+
if options.temperature is not None and not wants_thinking:
|
|
304
332
|
params["temperature"] = options.temperature
|
|
305
333
|
# tool_choice is sent UNCONDITIONALLY when set
|
|
306
334
|
# (anthropic-messages.ts:1318-1324 has no tools gate).
|
|
@@ -336,8 +364,15 @@ def _retry_delay(
|
|
|
336
364
|
return _openai_retry_delay(resp, retry_index, max_delay_ms=max_delay_ms)
|
|
337
365
|
|
|
338
366
|
|
|
339
|
-
def _effort_of(level: str) -> str:
|
|
340
|
-
|
|
367
|
+
def _effort_of(model: Model, level: str) -> str:
|
|
368
|
+
"""mapThinkingLevelToEffort: the model's thinkingLevelMap entry wins
|
|
369
|
+
when mapped to a string; otherwise the ladder — and the switch
|
|
370
|
+
DEFAULT is high (max/xhigh both map to high, never ride raw)."""
|
|
371
|
+
if level:
|
|
372
|
+
mapped = (model.thinking_level_map or {}).get(level)
|
|
373
|
+
if isinstance(mapped, str) and mapped:
|
|
374
|
+
return mapped
|
|
375
|
+
return {"low": "low", "minimal": "low", "medium": "medium", "high": "high", "xhigh": "high", "max": "high"}.get(level, "high")
|
|
341
376
|
|
|
342
377
|
|
|
343
378
|
def _render_system_update(m: SystemMessage) -> str:
|
|
@@ -585,7 +620,10 @@ def _consume_anthropic_sse(stream: AssistantMessageEventStream, model: Model, re
|
|
|
585
620
|
|
|
586
621
|
parser = _SseParser()
|
|
587
622
|
try:
|
|
588
|
-
|
|
623
|
+
# chunk_size=1: http.client read(n) blocks until n bytes arrive,
|
|
624
|
+
# so any larger quantum would hold a complete short SSE event
|
|
625
|
+
# hostage until the next one starts arriving.
|
|
626
|
+
for chunk in resp.iter_content(chunk_size=1):
|
|
589
627
|
if not chunk:
|
|
590
628
|
continue
|
|
591
629
|
for parsed in parser.feed(chunk):
|
|
@@ -243,19 +243,27 @@ class BedrockClient:
|
|
|
243
243
|
else:
|
|
244
244
|
tool_config["toolChoice"] = {"auto": {}}
|
|
245
245
|
params["toolConfig"] = tool_config
|
|
246
|
-
# inferenceConfig:
|
|
247
|
-
# (
|
|
246
|
+
# inferenceConfig: buildBaseOptions ALWAYS sets a clamped
|
|
247
|
+
# maxTokens (simple-options.ts:46), and upstream bedrock emits
|
|
248
|
+
# it for every model on the streamSimple path
|
|
249
|
+
# (inferenceMaxTokens = options.maxTokens ?? (isClaude ?
|
|
250
|
+
# model.maxTokens : undefined) — never undefined here because
|
|
251
|
+
# the base options already carry options?.maxTokens ??
|
|
252
|
+
# model.maxTokens); temperature when set.
|
|
248
253
|
inference: dict[str, Any] = {}
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
254
|
+
from sycommon.pi.core.usage import clamp_max_tokens_to_context
|
|
255
|
+
|
|
256
|
+
base_cap = options.max_tokens if options and options.max_tokens else 0
|
|
257
|
+
if not base_cap:
|
|
258
|
+
base_cap = model.max_tokens
|
|
259
|
+
max_tokens = clamp_max_tokens_to_context(model, messages, base_cap) if base_cap else 0
|
|
252
260
|
if max_tokens:
|
|
253
261
|
inference["maxTokens"] = max_tokens
|
|
254
262
|
if options and options.temperature is not None:
|
|
255
263
|
inference["temperature"] = options.temperature
|
|
256
264
|
if inference:
|
|
257
265
|
params["inferenceConfig"] = inference
|
|
258
|
-
extra = _additional_model_request_fields(model, options, max_tokens)
|
|
266
|
+
extra = _additional_model_request_fields(model, options, max_tokens, messages)
|
|
259
267
|
if extra:
|
|
260
268
|
params["additionalModelRequestFields"] = extra
|
|
261
269
|
widened = extra.get("_widened_max_tokens")
|
|
@@ -331,7 +339,7 @@ _OPENAI_GPT_OSS_EFFORT = {
|
|
|
331
339
|
|
|
332
340
|
|
|
333
341
|
def _additional_model_request_fields(
|
|
334
|
-
model: Model, options: Optional[StreamOptions], max_tokens: int
|
|
342
|
+
model: Model, options: Optional[StreamOptions], max_tokens: int, context_messages: list
|
|
335
343
|
) -> Optional[dict[str, Any]]:
|
|
336
344
|
"""Claude thinking rides additionalModelRequestFields (upstream
|
|
337
345
|
buildAdditionalModelRequestFields): adaptive families get
|
|
@@ -350,29 +358,44 @@ def _additional_model_request_fields(
|
|
|
350
358
|
"output_config": {"effort": _map_thinking_level_to_effort(model, options.reasoning)},
|
|
351
359
|
}
|
|
352
360
|
level = options.reasoning
|
|
353
|
-
budget =
|
|
361
|
+
budget = None
|
|
354
362
|
if options.thinking_budgets:
|
|
355
363
|
# custom budgets only cover token-based levels through high
|
|
356
364
|
if level in ("xhigh", "max"):
|
|
357
365
|
level = "high"
|
|
358
|
-
|
|
359
|
-
|
|
366
|
+
if level in options.thinking_budgets:
|
|
367
|
+
# a configured 0 stays 0 (upstream ?? — 0 is not nullish)
|
|
368
|
+
budget = int(options.thinking_budgets[level])
|
|
369
|
+
if budget is None:
|
|
360
370
|
budget = _DEFAULT_THINKING_BUDGETS.get(options.reasoning, 0)
|
|
361
|
-
# adjustMaxTokensForThinking
|
|
362
|
-
#
|
|
363
|
-
# maxTokens
|
|
364
|
-
#
|
|
371
|
+
# adjustMaxTokensForThinking (simple-options.ts) over the
|
|
372
|
+
# clamp#1 value, then clamp#2 (bedrock-converse-stream.ts:554-
|
|
373
|
+
# 566): maxTokens = clampMaxTokensToContext(adjusted.maxTokens)
|
|
374
|
+
# and the budget rides the POST-clamp#2 room — the widened
|
|
375
|
+
# number never escapes the context clamp.
|
|
376
|
+
from sycommon.pi.core.usage import clamp_max_tokens_to_context
|
|
377
|
+
|
|
365
378
|
widened = 0
|
|
366
379
|
if max_tokens:
|
|
367
380
|
ceiling = model.max_tokens or max_tokens
|
|
368
381
|
widened = min(max_tokens + budget, ceiling)
|
|
369
|
-
|
|
382
|
+
else:
|
|
383
|
+
# No explicit cap: maxTokens defaults to model.max_tokens
|
|
384
|
+
# (a 0-cap model has no ceiling — upstream Case E collapses
|
|
385
|
+
# the budget to 0).
|
|
386
|
+
widened = model.max_tokens
|
|
387
|
+
final = clamp_max_tokens_to_context(model, context_messages, widened) if widened else 0
|
|
388
|
+
if final <= budget:
|
|
389
|
+
budget = min(budget, max(0, final - 1024))
|
|
370
390
|
out = {
|
|
371
391
|
"thinking": {"type": "enabled", "budget_tokens": budget, "display": "summarized"},
|
|
372
392
|
"anthropic_beta": ["interleaved-thinking-2025-05-14"],
|
|
373
393
|
}
|
|
374
|
-
|
|
375
|
-
|
|
394
|
+
# The widened value that actually rewrites inferenceConfig is
|
|
395
|
+
# the POST-clamp#2 one, whenever it differs from the clamped
|
|
396
|
+
# cap the caller path already emitted (or a cap was absent).
|
|
397
|
+
if final and final != max_tokens:
|
|
398
|
+
out["_widened_max_tokens"] = final
|
|
376
399
|
return out
|
|
377
400
|
cands = _match_candidates(model)
|
|
378
401
|
if any("gpt-oss" in c for c in cands):
|
|
@@ -657,7 +680,10 @@ def _consume_bedrock_sse(stream: AssistantMessageEventStream, model: Model, resp
|
|
|
657
680
|
return [e["data"] for e in parser.feed(chunk)]
|
|
658
681
|
|
|
659
682
|
try:
|
|
660
|
-
|
|
683
|
+
# chunk_size=1: http.client read(n) blocks until n bytes arrive,
|
|
684
|
+
# so any larger quantum would hold a complete short SSE event
|
|
685
|
+
# hostage until the next one starts arriving.
|
|
686
|
+
for chunk in resp.iter_content(chunk_size=1):
|
|
661
687
|
if not chunk:
|
|
662
688
|
continue
|
|
663
689
|
for data in _events_of(chunk):
|