noah-code 2.0.0__tar.gz → 2.1.0__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.
- noah_code-2.1.0/.github/workflows/ci.yml +60 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/.github/workflows/release.yml +12 -14
- {noah_code-2.0.0 → noah_code-2.1.0}/PKG-INFO +3 -2
- noah_code-2.1.0/docs/releases/v2.1.0.md +44 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/pyproject.toml +3 -2
- {noah_code-2.0.0 → noah_code-2.1.0}/scripts/eval_proxy.py +125 -10
- {noah_code-2.0.0 → noah_code-2.1.0}/scripts/evaluate_agents.py +353 -66
- {noah_code-2.0.0 → noah_code-2.1.0}/src/noah_code/__init__.py +1 -1
- {noah_code-2.0.0 → noah_code-2.1.0}/src/noah_code/acp.py +305 -54
- {noah_code-2.0.0 → noah_code-2.1.0}/src/noah_code/agent.py +87 -22
- {noah_code-2.0.0 → noah_code-2.1.0}/src/noah_code/budget.py +103 -27
- noah_code-2.1.0/src/noah_code/checkpoints.py +746 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/src/noah_code/cli.py +386 -14
- noah_code-2.1.0/src/noah_code/codex_client.py +466 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/src/noah_code/codex_rpc.py +76 -21
- {noah_code-2.0.0 → noah_code-2.1.0}/src/noah_code/composer.py +32 -1
- {noah_code-2.0.0 → noah_code-2.1.0}/src/noah_code/credentials.py +26 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/src/noah_code/event_bridge.py +13 -2
- {noah_code-2.0.0 → noah_code-2.1.0}/src/noah_code/hooks.py +3 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/src/noah_code/host.py +562 -1334
- noah_code-2.1.0/src/noah_code/host_commands.py +1247 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/src/noah_code/llm.py +99 -6
- {noah_code-2.0.0 → noah_code-2.1.0}/src/noah_code/llm_replies.py +67 -1
- {noah_code-2.0.0 → noah_code-2.1.0}/src/noah_code/macos_sandbox.py +127 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/src/noah_code/mcp_setup.py +279 -3
- noah_code-2.1.0/src/noah_code/model_streaming.py +536 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/src/noah_code/nooa_compat.py +64 -1
- {noah_code-2.0.0 → noah_code-2.1.0}/src/noah_code/permissions.py +235 -57
- {noah_code-2.0.0 → noah_code-2.1.0}/src/noah_code/runtime_state.py +111 -38
- {noah_code-2.0.0 → noah_code-2.1.0}/src/noah_code/service.py +124 -9
- {noah_code-2.0.0 → noah_code-2.1.0}/src/noah_code/sessions.py +55 -11
- {noah_code-2.0.0 → noah_code-2.1.0}/src/noah_code/skills_setup.py +202 -6
- {noah_code-2.0.0 → noah_code-2.1.0}/src/noah_code/snapshots.py +207 -43
- noah_code-2.1.0/src/noah_code/summarization.py +388 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/src/noah_code/telemetry.py +115 -9
- {noah_code-2.0.0 → noah_code-2.1.0}/src/noah_code/tool_contracts.py +15 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/src/noah_code/tools/lsp_tools.py +561 -30
- {noah_code-2.0.0 → noah_code-2.1.0}/src/noah_code/tools/process_tools.py +77 -39
- {noah_code-2.0.0 → noah_code-2.1.0}/src/noah_code/tools/task_tools.py +395 -43
- {noah_code-2.0.0 → noah_code-2.1.0}/src/noah_code/tools/workspace_tools.py +169 -25
- noah_code-2.1.0/src/noah_code/ui/clipboard.py +342 -0
- noah_code-2.1.0/src/noah_code/ui/diff_screen.py +558 -0
- noah_code-2.1.0/src/noah_code/ui/modals.py +1882 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/src/noah_code/ui/textual_app.py +379 -2451
- {noah_code-2.0.0 → noah_code-2.1.0}/src/noah_code/usage.py +17 -1
- {noah_code-2.0.0 → noah_code-2.1.0}/src/noah_code/verification.py +250 -25
- {noah_code-2.0.0 → noah_code-2.1.0}/src/noah_code/worktree.py +159 -7
- noah_code-2.1.0/tests/evals/fixtures/build-graph/buildgraph/__init__.py +10 -0
- noah_code-2.1.0/tests/evals/fixtures/build-graph/buildgraph/cache.py +30 -0
- noah_code-2.1.0/tests/evals/fixtures/build-graph/buildgraph/graph.py +65 -0
- noah_code-2.1.0/tests/evals/fixtures/build-graph/buildgraph/planner.py +42 -0
- noah_code-2.1.0/tests/evals/fixtures/build-graph/tests/acceptance.py +89 -0
- noah_code-2.1.0/tests/evals/fixtures/event-pipeline/pkg/__init__.py +3 -0
- noah_code-2.1.0/tests/evals/fixtures/event-pipeline/pkg/parser.py +28 -0
- noah_code-2.1.0/tests/evals/fixtures/event-pipeline/pkg/pipeline.py +38 -0
- noah_code-2.1.0/tests/evals/fixtures/event-pipeline/pkg/validator.py +41 -0
- noah_code-2.1.0/tests/evals/fixtures/event-pipeline/tests/acceptance.py +153 -0
- noah_code-2.1.0/tests/evals/tasks.json +85 -0
- noah_code-2.1.0/tests/evals/test_evaluate_agents.py +590 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/tests/test_agent_security.py +63 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/tests/test_budget.py +48 -9
- {noah_code-2.0.0 → noah_code-2.1.0}/tests/test_checkpoints.py +66 -3
- {noah_code-2.0.0 → noah_code-2.1.0}/tests/test_cli.py +134 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/tests/test_codex_client.py +149 -17
- {noah_code-2.0.0 → noah_code-2.1.0}/tests/test_compaction_eviction.py +28 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/tests/test_composer.py +61 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/tests/test_credentials.py +71 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/tests/test_eval_proxy.py +73 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/tests/test_event_bridge.py +21 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/tests/test_host.py +81 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/tests/test_lifecycle_hooks.py +39 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/tests/test_llm.py +79 -1
- {noah_code-2.0.0 → noah_code-2.1.0}/tests/test_lsp_tools.py +199 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/tests/test_mcp_setup.py +134 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/tests/test_model_streaming.py +228 -6
- {noah_code-2.0.0 → noah_code-2.1.0}/tests/test_permissions.py +107 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/tests/test_persistent_tasks.py +45 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/tests/test_process_tools.py +76 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/tests/test_runtime_state.py +54 -5
- {noah_code-2.0.0 → noah_code-2.1.0}/tests/test_service.py +53 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/tests/test_sessions.py +85 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/tests/test_skills_setup.py +56 -1
- {noah_code-2.0.0 → noah_code-2.1.0}/tests/test_snapshots.py +48 -0
- noah_code-2.1.0/tests/test_summarization.py +318 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/tests/test_textual_tui.py +154 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/tests/test_truncated_reply_recovery.py +29 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/tests/test_tui_review_receipt.py +47 -1
- {noah_code-2.0.0 → noah_code-2.1.0}/tests/test_verification.py +68 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/tests/test_verification_completion.py +35 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/tests/test_workspace_tools.py +150 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/tests/test_worktree.py +51 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/uv.lock +590 -2
- noah_code-2.0.0/.github/workflows/ci.yml +0 -160
- noah_code-2.0.0/src/noah_code/checkpoints.py +0 -369
- noah_code-2.0.0/src/noah_code/codex_client.py +0 -324
- noah_code-2.0.0/src/noah_code/model_streaming.py +0 -299
- noah_code-2.0.0/src/noah_code/summarization.py +0 -129
- noah_code-2.0.0/tests/evals/tasks.json +0 -43
- noah_code-2.0.0/tests/evals/test_evaluate_agents.py +0 -259
- noah_code-2.0.0/tests/test_summarization.py +0 -37
- {noah_code-2.0.0 → noah_code-2.1.0}/.gitignore +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/.pre-commit-config.yaml +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/README.md +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/docs/assets/noah-command-menu.svg +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/docs/assets/noah-in-action.svg +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/docs/assets/noah-logo.svg +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/docs/assets/noah-permissions.svg +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/docs/browser.md +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/docs/configuration.md +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/docs/development.md +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/docs/evaluation-results.json +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/docs/evaluation-results.md +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/docs/evaluation.md +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/docs/extensions.md +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/docs/interactive-reference.md +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/docs/lifecycle-hooks.md +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/docs/opencode-v2-comparison.md +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/docs/persistent-tasks.md +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/docs/releases/v0.1.0.md +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/docs/releases/v0.1.1.md +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/docs/releases/v0.2.0.md +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/docs/releases/v0.2.1.md +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/docs/releases/v0.2.2.md +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/docs/releases/v0.2.3.md +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/docs/releases/v0.2.4.md +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/docs/releases/v0.3.0.md +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/docs/releases/v0.4.0.md +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/docs/releases/v0.4.1.md +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/docs/releases/v0.5.0.md +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/docs/releases/v0.5.1.md +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/docs/releases/v0.6.0.md +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/docs/releases/v0.7.0.md +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/docs/releases/v0.8.0.md +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/docs/releases/v1.0.0.md +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/docs/releases/v2.0.0.md +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/docs/reliability.md +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/docs/security.md +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/docs/service.md +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/install.sh +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/scripts/capture_readme.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/src/noah_code/__main__.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/src/noah_code/agents.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/src/noah_code/approvals.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/src/noah_code/browser.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/src/noah_code/codex_account.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/src/noah_code/commands.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/src/noah_code/config.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/src/noah_code/custom_commands.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/src/noah_code/events.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/src/noah_code/github.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/src/noah_code/permission_modes.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/src/noah_code/predict.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/src/noah_code/project_notes.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/src/noah_code/provider_discovery.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/src/noah_code/providers.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/src/noah_code/redaction.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/src/noah_code/secure_files.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/src/noah_code/steer.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/src/noah_code/teams.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/src/noah_code/themes.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/src/noah_code/tool_output.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/src/noah_code/tools/__init__.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/src/noah_code/tools/diff_tools.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/src/noah_code/tools/git_tools.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/src/noah_code/tools/github_tools.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/src/noah_code/tools/media_tools.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/src/noah_code/tools/memory_tools.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/src/noah_code/tools/plan_tools.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/src/noah_code/tools/question_tools.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/src/noah_code/tools/web_tools.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/src/noah_code/ui/__init__.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/src/noah_code/ui/command_menu.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/src/noah_code/ui/console.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/src/noah_code/ui/protocol.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/src/noah_code/ui/team_screen.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/src/noah_code/ui/textual.css +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/src/noah_code/updates.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/src/noah_code/workspace.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/tests/conftest.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/tests/evals/fixtures/config-merge/config_merge.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/tests/evals/fixtures/config-merge/tests/acceptance.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/tests/evals/fixtures/page-ranges/pages.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/tests/evals/fixtures/page-ranges/tests/acceptance.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/tests/test_agents.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/tests/test_approvals.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/tests/test_browser.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/tests/test_cache_context.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/tests/test_cell_literal_preservation.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/tests/test_codex_account.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/tests/test_codex_onboarding_cli.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/tests/test_codex_onboarding_tui.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/tests/test_commands.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/tests/test_completion_verification.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/tests/test_config.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/tests/test_console_ui.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/tests/test_custom_commands.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/tests/test_diff_tools.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/tests/test_efficiency.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/tests/test_event_bridge_and_shell.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/tests/test_git_tools.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/tests/test_github.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/tests/test_hooks.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/tests/test_installer.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/tests/test_lean_reasoning.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/tests/test_llm_replies.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/tests/test_nooa_migration.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/tests/test_permission_modes.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/tests/test_permission_onboarding_cli.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/tests/test_permission_onboarding_tui.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/tests/test_plan_memory_tools.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/tests/test_project_notes.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/tests/test_prompt_scorecard.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/tests/test_provider_discovery.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/tests/test_providers.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/tests/test_python_edit_safety.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/tests/test_question_tools.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/tests/test_redaction.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/tests/test_run_exit.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/tests/test_steer.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/tests/test_task_tools.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/tests/test_teams.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/tests/test_telemetry.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/tests/test_tool_contracts.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/tests/test_tool_output.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/tests/test_transport_cli.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/tests/test_tui_approvals.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/tests/test_tui_command_menu.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/tests/test_tui_composer_queue.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/tests/test_tui_editing.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/tests/test_tui_history_dialogs.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/tests/test_tui_layout.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/tests/test_tui_teams.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/tests/test_updates.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/tests/test_verification_tools.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/tests/test_wave1_e2e.py +0 -0
- {noah_code-2.0.0 → noah_code-2.1.0}/tests/test_web_tools.py +0 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
push:
|
|
6
|
+
branches:
|
|
7
|
+
- main
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: read
|
|
11
|
+
|
|
12
|
+
concurrency:
|
|
13
|
+
group: ${{ github.workflow }}-${{ github.ref }}
|
|
14
|
+
cancel-in-progress: true
|
|
15
|
+
|
|
16
|
+
jobs:
|
|
17
|
+
check:
|
|
18
|
+
name: Check
|
|
19
|
+
runs-on: ubuntu-24.04
|
|
20
|
+
timeout-minutes: 20
|
|
21
|
+
steps:
|
|
22
|
+
- name: Check out source
|
|
23
|
+
uses: actions/checkout@v7
|
|
24
|
+
with:
|
|
25
|
+
persist-credentials: false
|
|
26
|
+
|
|
27
|
+
- name: Install uv and Python
|
|
28
|
+
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
|
|
29
|
+
with:
|
|
30
|
+
enable-cache: true
|
|
31
|
+
python-version: "3.12"
|
|
32
|
+
|
|
33
|
+
- name: Ensure ripgrep
|
|
34
|
+
run: |
|
|
35
|
+
if ! command -v rg >/dev/null 2>&1; then
|
|
36
|
+
sudo apt-get update && sudo apt-get install -y ripgrep
|
|
37
|
+
fi
|
|
38
|
+
rg --version
|
|
39
|
+
|
|
40
|
+
- name: Sync locked environment
|
|
41
|
+
run: uv sync --locked --all-extras --dev
|
|
42
|
+
|
|
43
|
+
- name: Lint and type check
|
|
44
|
+
run: |
|
|
45
|
+
uv run ruff check src tests scripts
|
|
46
|
+
uv run mypy src/noah_code
|
|
47
|
+
|
|
48
|
+
- name: Test with coverage
|
|
49
|
+
run: |
|
|
50
|
+
uv run pytest tests --cov=noah_code --cov-report=term-missing \
|
|
51
|
+
--cov-fail-under=70 -W error::pytest.PytestUnraisableExceptionWarning
|
|
52
|
+
|
|
53
|
+
- name: Build and smoke-test wheel install
|
|
54
|
+
env:
|
|
55
|
+
UV_TOOL_DIR: ${{ runner.temp }}/noah-tools
|
|
56
|
+
UV_TOOL_BIN_DIR: ${{ runner.temp }}/noah-bin
|
|
57
|
+
run: |
|
|
58
|
+
uv build --out-dir build-dist
|
|
59
|
+
uv tool install --python 3.12 --no-build --with 'nooa[mcp,tracing]' build-dist/*.whl
|
|
60
|
+
"${UV_TOOL_BIN_DIR}/noah" --version
|
|
@@ -11,7 +11,7 @@ permissions:
|
|
|
11
11
|
jobs:
|
|
12
12
|
build:
|
|
13
13
|
name: Build and verify distributions
|
|
14
|
-
runs-on: ubuntu-
|
|
14
|
+
runs-on: ubuntu-24.04
|
|
15
15
|
steps:
|
|
16
16
|
- name: Check out tagged source
|
|
17
17
|
uses: actions/checkout@v7
|
|
@@ -22,7 +22,7 @@ jobs:
|
|
|
22
22
|
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
|
|
23
23
|
with:
|
|
24
24
|
enable-cache: true
|
|
25
|
-
python-version: "3.
|
|
25
|
+
python-version: "3.12"
|
|
26
26
|
|
|
27
27
|
- name: Verify tag and package versions
|
|
28
28
|
env:
|
|
@@ -47,20 +47,18 @@ jobs:
|
|
|
47
47
|
- name: Install locked dependencies
|
|
48
48
|
run: uv sync --locked --all-extras --dev
|
|
49
49
|
|
|
50
|
-
- name:
|
|
50
|
+
- name: Ensure ripgrep
|
|
51
51
|
run: |
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
if ! command -v rg >/dev/null 2>&1; then
|
|
53
|
+
sudo apt-get update && sudo apt-get install -y ripgrep
|
|
54
|
+
fi
|
|
54
55
|
rg --version
|
|
55
56
|
|
|
56
|
-
- name:
|
|
57
|
-
run: uv run mypy src/noah_code
|
|
58
|
-
|
|
59
|
-
- name: Run release checks
|
|
57
|
+
- name: Lint, type check, and test
|
|
60
58
|
run: |
|
|
61
|
-
uv run ruff check src tests
|
|
59
|
+
uv run ruff check src tests scripts
|
|
60
|
+
uv run mypy src/noah_code
|
|
62
61
|
uv run pytest tests -W error::pytest.PytestUnraisableExceptionWarning
|
|
63
|
-
uv lock --check
|
|
64
62
|
|
|
65
63
|
- name: Build wheel and source distribution
|
|
66
64
|
run: uv build
|
|
@@ -73,7 +71,7 @@ jobs:
|
|
|
73
71
|
UV_TOOL_DIR: ${{ runner.temp }}/noah-tools
|
|
74
72
|
UV_TOOL_BIN_DIR: ${{ runner.temp }}/noah-bin
|
|
75
73
|
run: |
|
|
76
|
-
uv tool install --
|
|
74
|
+
uv tool install --python 3.12 --no-build --with 'nooa[mcp,tracing]' dist/*.whl
|
|
77
75
|
"${UV_TOOL_BIN_DIR}/noah" --version
|
|
78
76
|
|
|
79
77
|
- name: Upload release distributions
|
|
@@ -87,7 +85,7 @@ jobs:
|
|
|
87
85
|
publish-pypi:
|
|
88
86
|
name: Publish to PyPI
|
|
89
87
|
needs: build
|
|
90
|
-
runs-on: ubuntu-
|
|
88
|
+
runs-on: ubuntu-24.04
|
|
91
89
|
environment:
|
|
92
90
|
name: pypi
|
|
93
91
|
url: https://pypi.org/p/noah-code
|
|
@@ -108,7 +106,7 @@ jobs:
|
|
|
108
106
|
needs:
|
|
109
107
|
- build
|
|
110
108
|
- publish-pypi
|
|
111
|
-
runs-on: ubuntu-
|
|
109
|
+
runs-on: ubuntu-24.04
|
|
112
110
|
permissions:
|
|
113
111
|
contents: write
|
|
114
112
|
id-token: write
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: noah-code
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.1.0
|
|
4
4
|
Summary: Noah Code terminal coding agent, built on NVIDIA OO Agents (NOOA)
|
|
5
5
|
Project-URL: Homepage, https://github.com/skundu42/noah-code
|
|
6
6
|
Project-URL: Documentation, https://github.com/skundu42/noah-code#readme
|
|
@@ -17,8 +17,9 @@ Classifier: Operating System :: MacOS
|
|
|
17
17
|
Classifier: Operating System :: POSIX :: Linux
|
|
18
18
|
Classifier: Programming Language :: Python :: 3.12
|
|
19
19
|
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
20
21
|
Classifier: Topic :: Software Development
|
|
21
|
-
Requires-Python: <3.
|
|
22
|
+
Requires-Python: <3.15,>=3.12
|
|
22
23
|
Requires-Dist: click<9.0.0,>=8.1.0
|
|
23
24
|
Requires-Dist: httpx<1.0.0,>=0.28.1
|
|
24
25
|
Requires-Dist: litellm<1.106.0,>=1.97.0
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Noah Code v2.1.0
|
|
2
|
+
|
|
3
|
+
Noah Code `v2.1.0` fixes silent functional edge cases across automatic compaction, prompt caching, MCP session pooling, and ACP streaming, scales Git checkpoints and SQLite/undo persistence to large repositories, completes end-to-end isolated worktree workflows, and decomposes the TUI and host runtime.
|
|
4
|
+
|
|
5
|
+
## Compaction, prompt caching, streaming & MCP persistence
|
|
6
|
+
|
|
7
|
+
- Fixed `CodingSessionSummarizer` automatic background compaction on `nooa==0.0.12` by routing summary forks through `LeanPredictStrategy` (`ISOLATED_PREDICT_CONTEXT`) on `_lightweight_llm`, spilling/evicting oversized unspilled `PythonOutput` payloads, and keeping token-budget subscriptions active across turns.
|
|
8
|
+
- Added `CachedMarkdownBlockFormatter` for the default `"lean"` strategy to partition static system blocks ahead of `CacheBoundary()` and dynamic `<context>` tails, restored `prefix=True` static metadata across SQLite session snapshot restores, and updated `UsageTracker.observe_prefix` to measure cached-prefix stability up to `CacheBoundary`.
|
|
9
|
+
- Added live SSE streaming for OpenAI `ResponsesClient` routes (`with_model_streaming`) and explicit host truncation recovery notices on partial `finish_reason="length"` prose replies.
|
|
10
|
+
- Added persistent task-safe `stdio` MCP session pooling with automatic broken-pipe reconnection, mapped `oauth_scopes` / `oauth_callback_port` to `nooa` OAuth fields, filtered incompatible `nemo.*` built-in skills, and gated `self.skills.activate` fail-closed through the sandbox broker.
|
|
11
|
+
- Added live ACP `agent_thought_chunk` reasoning streaming with committed-event deduplication and non-fatal `replay_gap` handling (`ServiceUI` default replay buffer raised to `4096`).
|
|
12
|
+
|
|
13
|
+
## Security & sandboxing hardening
|
|
14
|
+
|
|
15
|
+
- Scrubbed `NOAH_CODE_SERVER_TOKEN`, hydrated credentials, and provider preset API keys from child shell sessions, background processes, LSP servers, and lifecycle/tool hooks while preserving in-process `os.environ` hydration; added `build_macos_workspace_command_profile` Seatbelt SBPL generation.
|
|
16
|
+
- Closed unquoted subshell `(...)` and brace-group `{ ...; }` parsing gaps in `PermissionEngine` across all deny, secret-token, env-dump, and interpreter rules; added `bun`, `deno`, `tsx`, `ts-node`, `lua`, and `luajit` interpreter guards; and permitted safe `python -m unittest` runs under `--auto`.
|
|
17
|
+
- Eliminated the runtime `os.umask(0)` race in `WorkspaceTools` via `/proc/self/status` and startup umask capture.
|
|
18
|
+
|
|
19
|
+
## Performance & large-repository scalability
|
|
20
|
+
|
|
21
|
+
- Upgraded `CheckpointManager.capture()` to `O(changed files)` via shadow-index + stat-sidecar + `git diff-index` delta staging (capping untracked blobs at 20 MB, keeping untracked files unstaged on `restore()`, and cleaning up checkpoint refs on session deletion).
|
|
22
|
+
- Switched `RuntimeStateStore` to a persistent thread-safe SQLite WAL connection (`synchronous=NORMAL`), moved file-journal undo pre/post bytes into content-addressed `<session>/blobs/<sha256>` storage, and buffered JSONL telemetry writes.
|
|
23
|
+
- Kept a persistent `CodexAppServer` per `CodexClient` with cached CLI binary verification, released `BudgetedLLM` locks across network `acall()` requests so parallel subagents (`run_many`, `/team`) execute concurrently, and added RFC 7231 HTTP-date `Retry-After` parsing plus `aclose()` cleanup.
|
|
24
|
+
|
|
25
|
+
## Verification, repo map, worktrees, service & TUI
|
|
26
|
+
|
|
27
|
+
- Switched foreground `ws.run` to `run_stream` for live output chunks, preserved file-journal `/undo` across clean verification commands, added `/undo --checkpoint`, ignored coverage/build cache artifacts in `CheckLedger` staleness checks, and allowed passing suite checks to supersede prior failed runs of the same `(label, cwd)`.
|
|
28
|
+
- Upgraded `RepositoryMap` with multi-language symbol extraction (Python `Class.method` + params, Rust `pub`/`pub(crate)`, Go receiver methods, TS/JS `export const`, Ruby, Java/C/C++) and cross-file reference centrality ranking.
|
|
29
|
+
- Completed isolated child worktree workflows with `include_dirty` seeding, `task.diff`, journaled `task.apply`, `task.cleanup`, and background subagent `WAIT` wakeups; added canonical Git-toplevel shared (`LOCK_SH`) `plan`-mode workspace leases, `--restrict-workspace` service scoping, lazy CLI startup, and `noah run --attach URL`.
|
|
30
|
+
- Extracted `ui/clipboard.py`, `ui/modals.py`, `ui/diff_screen.py`, and `host_commands.py`; added transcript row-count LRU caching, resize debouncing, wrapped-diff hunk navigation, native PNG clipboard image paste, multi-module evaluation benchmarks (`event-pipeline`, `build-graph`), Python `3.14` packaging metadata (`>=3.12,<3.15`), and streamlined single-job CI.
|
|
31
|
+
|
|
32
|
+
## Upgrade
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
noah update
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Or install directly:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
curl -LsSf https://github.com/skundu42/noah-code/releases/latest/download/install.sh | sh
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
**Full changelog:** https://github.com/skundu42/noah-code/compare/v2.0.0...v2.1.0
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "noah-code"
|
|
3
|
-
version = "2.
|
|
3
|
+
version = "2.1.0"
|
|
4
4
|
description = "Noah Code terminal coding agent, built on NVIDIA OO Agents (NOOA)"
|
|
5
5
|
readme = "README.md"
|
|
6
|
-
requires-python = ">=3.12,<3.
|
|
6
|
+
requires-python = ">=3.12,<3.15"
|
|
7
7
|
license = { text = "Apache-2.0" }
|
|
8
8
|
authors = [{ name = "noah-code contributors" }]
|
|
9
9
|
keywords = ["agents", "coding", "nooa", "terminal"]
|
|
@@ -15,6 +15,7 @@ classifiers = [
|
|
|
15
15
|
"Operating System :: POSIX :: Linux",
|
|
16
16
|
"Programming Language :: Python :: 3.12",
|
|
17
17
|
"Programming Language :: Python :: 3.13",
|
|
18
|
+
"Programming Language :: Python :: 3.14",
|
|
18
19
|
"Topic :: Software Development",
|
|
19
20
|
]
|
|
20
21
|
|
|
@@ -1,24 +1,30 @@
|
|
|
1
1
|
"""Loopback-only, conservatively metered OpenRouter relay for live evaluations.
|
|
2
2
|
|
|
3
|
-
Each request reserves its worst-case token cost before dispatch.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
Each request reserves its worst-case token cost before dispatch. Failed,
|
|
4
|
+
interrupted, or unknown-cost requests retain their full worst-case reservation.
|
|
5
|
+
Completed HTTP 200 responses with valid usage and known provider cost reconcile
|
|
6
|
+
their unused conservative delta while enforcing metered token floors. Provider
|
|
7
|
+
routing enforces the same price ceilings. Only text chat/function tools are
|
|
8
|
+
accepted; paid server tools, media, fallback models and alternate routes are
|
|
9
|
+
rejected.
|
|
7
10
|
"""
|
|
8
11
|
|
|
9
12
|
from __future__ import annotations
|
|
10
13
|
|
|
14
|
+
import argparse
|
|
11
15
|
import json
|
|
12
16
|
import math
|
|
17
|
+
import os
|
|
13
18
|
import secrets
|
|
14
19
|
import threading
|
|
20
|
+
import time
|
|
15
21
|
from decimal import Decimal
|
|
16
22
|
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
|
|
17
23
|
from typing import Any
|
|
18
24
|
|
|
19
25
|
import httpx
|
|
20
26
|
|
|
21
|
-
_MAX_BODY =
|
|
27
|
+
_MAX_BODY = 4_000_000
|
|
22
28
|
_FIELDS = frozenset(
|
|
23
29
|
{
|
|
24
30
|
"model",
|
|
@@ -55,6 +61,7 @@ class EvalProxy:
|
|
|
55
61
|
*,
|
|
56
62
|
budget_usd: float = 4,
|
|
57
63
|
max_output_tokens: int = 4096,
|
|
64
|
+
max_body_bytes: int = _MAX_BODY,
|
|
58
65
|
provider: str | None = None,
|
|
59
66
|
) -> None:
|
|
60
67
|
prices = (input_price_per_token, output_price_per_token, budget_usd)
|
|
@@ -67,6 +74,9 @@ class EvalProxy:
|
|
|
67
74
|
or not isinstance(max_output_tokens, int)
|
|
68
75
|
or isinstance(max_output_tokens, bool)
|
|
69
76
|
or not 1 <= max_output_tokens <= 8192
|
|
77
|
+
or not isinstance(max_body_bytes, int)
|
|
78
|
+
or isinstance(max_body_bytes, bool)
|
|
79
|
+
or not 1_024 <= max_body_bytes <= 16_000_000
|
|
70
80
|
):
|
|
71
81
|
raise ValueError("invalid evaluation model, key, budget, or output cap")
|
|
72
82
|
self.model = model
|
|
@@ -78,8 +88,10 @@ class EvalProxy:
|
|
|
78
88
|
self._budget = Decimal(str(budget_usd))
|
|
79
89
|
self._reserved = Decimal(0)
|
|
80
90
|
self.max_output_tokens = max_output_tokens
|
|
91
|
+
self.max_body_bytes = max_body_bytes
|
|
81
92
|
self._lock = threading.Lock()
|
|
82
93
|
self._requests: list[dict[str, Any]] = []
|
|
94
|
+
self._record_reservations: dict[int, Decimal] = {}
|
|
83
95
|
self._run: dict[str, Any] | None = None
|
|
84
96
|
self._server: ThreadingHTTPServer | None = None
|
|
85
97
|
self.base_url = ""
|
|
@@ -88,7 +100,7 @@ class EvalProxy:
|
|
|
88
100
|
"""Allocate the same request and spend limits to each sequential agent run."""
|
|
89
101
|
if not math.isfinite(budget_usd) or not 0 < budget_usd <= float(self._budget):
|
|
90
102
|
raise ValueError("invalid per-run budget")
|
|
91
|
-
if not label or not 1 <= max_requests <=
|
|
103
|
+
if not label or not 1 <= max_requests <= 48:
|
|
92
104
|
raise ValueError("invalid run label or request limit")
|
|
93
105
|
with self._lock:
|
|
94
106
|
self._run = {
|
|
@@ -156,7 +168,7 @@ class EvalProxy:
|
|
|
156
168
|
# Serialized UTF-8 bytes overcount text tokens. Extra per-message/tool
|
|
157
169
|
# allowance covers provider-added role/schema framing and reasoning fields.
|
|
158
170
|
size = len(json.dumps(request, ensure_ascii=False).encode())
|
|
159
|
-
if size >
|
|
171
|
+
if size > self.max_body_bytes:
|
|
160
172
|
raise ValueError("request exceeds evaluation size limit")
|
|
161
173
|
ceiling = (
|
|
162
174
|
2 * size
|
|
@@ -179,8 +191,9 @@ class EvalProxy:
|
|
|
179
191
|
self._run["reserved"] += reservation
|
|
180
192
|
elif len(self._requests) >= 24:
|
|
181
193
|
raise ValueError("evaluation request limit reached")
|
|
194
|
+
index = len(self._requests)
|
|
182
195
|
record: dict[str, Any] = {
|
|
183
|
-
"index":
|
|
196
|
+
"index": index,
|
|
184
197
|
"run": self._run["label"] if self._run else "",
|
|
185
198
|
"reserved_usd": float(reservation),
|
|
186
199
|
"input_token_ceiling": ceiling,
|
|
@@ -189,9 +202,64 @@ class EvalProxy:
|
|
|
189
202
|
"status": "reserved",
|
|
190
203
|
}
|
|
191
204
|
self._requests.append(record)
|
|
205
|
+
self._record_reservations[index] = reservation
|
|
192
206
|
self._reserved += reservation
|
|
193
207
|
return request, record
|
|
194
208
|
|
|
209
|
+
def _reconcile_reservation(self, record: dict[str, Any], *, http_status: int) -> None:
|
|
210
|
+
"""Refund unused conservative margin only on HTTP 200 with verified cost."""
|
|
211
|
+
if http_status != 200:
|
|
212
|
+
return
|
|
213
|
+
usage = record.get("usage")
|
|
214
|
+
if not isinstance(usage, dict):
|
|
215
|
+
return
|
|
216
|
+
raw_cost = usage.get("cost")
|
|
217
|
+
if (
|
|
218
|
+
isinstance(raw_cost, bool)
|
|
219
|
+
or not isinstance(raw_cost, (int, float))
|
|
220
|
+
or not math.isfinite(float(raw_cost))
|
|
221
|
+
or float(raw_cost) < 0
|
|
222
|
+
):
|
|
223
|
+
return
|
|
224
|
+
index = record.get("index")
|
|
225
|
+
if not isinstance(index, int) or index not in self._record_reservations:
|
|
226
|
+
return
|
|
227
|
+
initial = self._record_reservations[index]
|
|
228
|
+
settled = Decimal(str(raw_cost))
|
|
229
|
+
prompt_tokens = usage.get("prompt_tokens")
|
|
230
|
+
completion_tokens = usage.get("completion_tokens")
|
|
231
|
+
if (
|
|
232
|
+
isinstance(prompt_tokens, int)
|
|
233
|
+
and not isinstance(prompt_tokens, bool)
|
|
234
|
+
and prompt_tokens >= 0
|
|
235
|
+
and isinstance(completion_tokens, int)
|
|
236
|
+
and not isinstance(completion_tokens, bool)
|
|
237
|
+
and completion_tokens >= 0
|
|
238
|
+
):
|
|
239
|
+
token_floor = (
|
|
240
|
+
Decimal(prompt_tokens) * self._input_price
|
|
241
|
+
+ Decimal(completion_tokens) * self._output_price
|
|
242
|
+
)
|
|
243
|
+
settled = max(settled, token_floor)
|
|
244
|
+
if settled < initial:
|
|
245
|
+
refund = initial - settled
|
|
246
|
+
self._reserved = max(Decimal(0), self._reserved - refund)
|
|
247
|
+
if self._run is not None and self._run["label"] == record.get("run"):
|
|
248
|
+
self._run["reserved"] = max(Decimal(0), self._run["reserved"] - refund)
|
|
249
|
+
self._record_reservations[index] = settled
|
|
250
|
+
record["initial_reserved_usd"] = float(initial)
|
|
251
|
+
record["reserved_usd"] = float(settled)
|
|
252
|
+
record["refunded_usd"] = float(refund)
|
|
253
|
+
elif settled > initial:
|
|
254
|
+
extra = settled - initial
|
|
255
|
+
self._reserved += extra
|
|
256
|
+
if self._run is not None and self._run["label"] == record.get("run"):
|
|
257
|
+
self._run["reserved"] += extra
|
|
258
|
+
self._record_reservations[index] = settled
|
|
259
|
+
record["initial_reserved_usd"] = float(initial)
|
|
260
|
+
record["reserved_usd"] = float(settled)
|
|
261
|
+
record["refunded_usd"] = 0.0
|
|
262
|
+
|
|
195
263
|
def summary(self) -> dict[str, Any]:
|
|
196
264
|
with self._lock:
|
|
197
265
|
rows = [dict(row) for row in self._requests]
|
|
@@ -206,6 +274,7 @@ class EvalProxy:
|
|
|
206
274
|
"output_price_per_token": float(self._output_price),
|
|
207
275
|
"budget_usd": float(self._budget),
|
|
208
276
|
"reserved_usd": float(self._reserved),
|
|
277
|
+
"max_body_bytes": self.max_body_bytes,
|
|
209
278
|
"requests": rows,
|
|
210
279
|
"reported_cost_usd": sum(costs) if complete else None,
|
|
211
280
|
"cost_complete": complete,
|
|
@@ -244,8 +313,11 @@ class EvalProxy:
|
|
|
244
313
|
return
|
|
245
314
|
try:
|
|
246
315
|
size = int(self.headers.get("Content-Length", "0"))
|
|
247
|
-
if self.headers.get("Transfer-Encoding") or
|
|
316
|
+
if self.headers.get("Transfer-Encoding") or size <= 0:
|
|
248
317
|
raise ValueError("invalid request size")
|
|
318
|
+
if size > owner.max_body_bytes:
|
|
319
|
+
self.error(413, "request exceeds evaluation size limit")
|
|
320
|
+
return
|
|
249
321
|
payload = json.loads(self.rfile.read(size))
|
|
250
322
|
if not isinstance(payload, dict):
|
|
251
323
|
raise ValueError("invalid request")
|
|
@@ -268,7 +340,8 @@ class EvalProxy:
|
|
|
268
340
|
record["http_status"] = response.status_code
|
|
269
341
|
self.send_response(response.status_code)
|
|
270
342
|
self.send_header(
|
|
271
|
-
"Content-Type",
|
|
343
|
+
"Content-Type",
|
|
344
|
+
response.headers.get("Content-Type", "application/json"),
|
|
272
345
|
)
|
|
273
346
|
self.send_header("Connection", "close")
|
|
274
347
|
self.end_headers()
|
|
@@ -286,6 +359,9 @@ class EvalProxy:
|
|
|
286
359
|
buffer.extend(chunk)
|
|
287
360
|
with owner._lock:
|
|
288
361
|
owner._capture_usage(bytes(buffer), record)
|
|
362
|
+
owner._reconcile_reservation(
|
|
363
|
+
record, http_status=response.status_code
|
|
364
|
+
)
|
|
289
365
|
record["status"] = "finished"
|
|
290
366
|
except (OSError, httpx.HTTPError):
|
|
291
367
|
with owner._lock:
|
|
@@ -320,3 +396,42 @@ class EvalProxy:
|
|
|
320
396
|
self._server.shutdown()
|
|
321
397
|
self._server.server_close()
|
|
322
398
|
self._thread.join(timeout=2)
|
|
399
|
+
|
|
400
|
+
|
|
401
|
+
def build_arg_parser() -> argparse.ArgumentParser:
|
|
402
|
+
parser = argparse.ArgumentParser(description=__doc__)
|
|
403
|
+
parser.add_argument("--model", required=True)
|
|
404
|
+
parser.add_argument("--input-price-per-token", type=float, required=True)
|
|
405
|
+
parser.add_argument("--output-price-per-token", type=float, required=True)
|
|
406
|
+
parser.add_argument("--budget-usd", type=float, default=4.0)
|
|
407
|
+
parser.add_argument("--max-output-tokens", type=int, default=4096)
|
|
408
|
+
parser.add_argument("--max-body-bytes", type=int, default=_MAX_BODY)
|
|
409
|
+
parser.add_argument("--provider", default=None)
|
|
410
|
+
return parser
|
|
411
|
+
|
|
412
|
+
|
|
413
|
+
def main(argv: list[str] | None = None) -> int:
|
|
414
|
+
args = build_arg_parser().parse_args(argv)
|
|
415
|
+
api_key = os.environ.get("OPENROUTER_API_KEY", "")
|
|
416
|
+
if not api_key:
|
|
417
|
+
raise SystemExit("OPENROUTER_API_KEY is required")
|
|
418
|
+
with EvalProxy(
|
|
419
|
+
args.model,
|
|
420
|
+
api_key,
|
|
421
|
+
args.input_price_per_token,
|
|
422
|
+
args.output_price_per_token,
|
|
423
|
+
budget_usd=args.budget_usd,
|
|
424
|
+
max_output_tokens=args.max_output_tokens,
|
|
425
|
+
max_body_bytes=args.max_body_bytes,
|
|
426
|
+
provider=args.provider,
|
|
427
|
+
) as proxy:
|
|
428
|
+
print(json.dumps({"base_url": proxy.base_url, "max_body_bytes": proxy.max_body_bytes}))
|
|
429
|
+
try:
|
|
430
|
+
while True:
|
|
431
|
+
time.sleep(1)
|
|
432
|
+
except KeyboardInterrupt:
|
|
433
|
+
return 0
|
|
434
|
+
|
|
435
|
+
|
|
436
|
+
if __name__ == "__main__":
|
|
437
|
+
raise SystemExit(main())
|