anthropic 1.32.0 → 1.40.0
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +114 -0
- data/README.md +1 -1
- data/lib/anthropic/client.rb +193 -24
- data/lib/anthropic/credentials/access_token.rb +40 -0
- data/lib/anthropic/credentials/config.rb +74 -0
- data/lib/anthropic/credentials/config_provider.rb +432 -0
- data/lib/anthropic/credentials/constants.rb +200 -0
- data/lib/anthropic/credentials/credentials_file.rb +123 -0
- data/lib/anthropic/credentials/identity_token_file.rb +65 -0
- data/lib/anthropic/credentials/in_memory_config.rb +115 -0
- data/lib/anthropic/credentials/static_token.rb +25 -0
- data/lib/anthropic/credentials/token_cache.rb +159 -0
- data/lib/anthropic/credentials/workload_identity.rb +213 -0
- data/lib/anthropic/credentials.rb +160 -0
- data/lib/anthropic/errors.rb +3 -0
- data/lib/anthropic/helpers/aws/client.rb +18 -5
- data/lib/anthropic/helpers/aws_auth.rb +80 -6
- data/lib/anthropic/helpers/bedrock/client.rb +11 -4
- data/lib/anthropic/helpers/bedrock/mantle_client.rb +12 -6
- data/lib/anthropic/helpers/vertex/client.rb +2 -0
- data/lib/anthropic/internal/stream.rb +1 -1
- data/lib/anthropic/internal/transport/base_client.rb +31 -3
- data/lib/anthropic/internal/util.rb +1 -1
- data/lib/anthropic/models/anthropic_beta.rb +6 -0
- data/lib/anthropic/models/beta/agent_create_params.rb +10 -1
- data/lib/anthropic/models/beta/agent_update_params.rb +10 -1
- data/lib/anthropic/models/beta/beta_citation_content_block_location.rb +24 -3
- data/lib/anthropic/models/beta/beta_citation_content_block_location_param.rb +24 -3
- data/lib/anthropic/models/beta/beta_citation_search_result_location.rb +31 -4
- data/lib/anthropic/models/beta/beta_citation_search_result_location_param.rb +32 -4
- data/lib/anthropic/models/beta/beta_compaction_block.rb +9 -1
- data/lib/anthropic/models/beta/beta_compaction_block_param.rb +9 -1
- data/lib/anthropic/models/beta/beta_compaction_content_block_delta.rb +10 -1
- data/lib/anthropic/models/beta/beta_effort_capability.rb +9 -1
- data/lib/anthropic/models/beta/beta_environment.rb +1 -1
- data/lib/anthropic/models/beta/beta_managed_agents_agent.rb +9 -1
- data/lib/anthropic/models/beta/beta_managed_agents_agent_reference.rb +43 -0
- data/lib/anthropic/models/beta/beta_managed_agents_deleted_memory_store.rb +44 -0
- data/lib/anthropic/models/beta/beta_managed_agents_memory_store.rb +100 -0
- data/lib/anthropic/models/beta/beta_managed_agents_memory_store_resource_param.rb +77 -0
- data/lib/anthropic/models/beta/beta_managed_agents_model.rb +5 -0
- data/lib/anthropic/models/beta/beta_managed_agents_multiagent.rb +44 -0
- data/lib/anthropic/models/beta/beta_managed_agents_multiagent_coordinator.rb +45 -0
- data/lib/anthropic/models/beta/beta_managed_agents_multiagent_coordinator_params.rb +50 -0
- data/lib/anthropic/models/beta/beta_managed_agents_multiagent_params.rb +49 -0
- data/lib/anthropic/models/beta/beta_managed_agents_multiagent_roster_entry_params.rb +26 -0
- data/lib/anthropic/models/beta/beta_managed_agents_multiagent_self_params.rb +32 -0
- data/lib/anthropic/models/beta/beta_managed_agents_outcome_evaluation_resource.rb +87 -0
- data/lib/anthropic/models/beta/beta_managed_agents_session.rb +13 -3
- data/lib/anthropic/models/beta/beta_managed_agents_session_agent.rb +17 -1
- data/lib/anthropic/models/beta/beta_managed_agents_session_multiagent_coordinator.rb +41 -0
- data/lib/anthropic/models/beta/beta_output_config.rb +10 -1
- data/lib/anthropic/models/beta/beta_token_task_budget.rb +42 -0
- data/lib/anthropic/models/beta/beta_user_profile.rb +122 -0
- data/lib/anthropic/models/beta/beta_user_profile_enrollment_url.rb +49 -0
- data/lib/anthropic/models/beta/beta_user_profile_trust_grant.rb +34 -0
- data/lib/anthropic/models/beta/beta_webhook_event.rb +43 -0
- data/lib/anthropic/models/beta/beta_webhook_event_data.rb +65 -0
- data/lib/anthropic/models/beta/beta_webhook_session_archived_event_data.rb +41 -0
- data/lib/anthropic/models/beta/beta_webhook_session_created_event_data.rb +41 -0
- data/lib/anthropic/models/beta/beta_webhook_session_deleted_event_data.rb +41 -0
- data/lib/anthropic/models/beta/beta_webhook_session_idled_event_data.rb +41 -0
- data/lib/anthropic/models/beta/beta_webhook_session_outcome_evaluation_ended_event_data.rb +42 -0
- data/lib/anthropic/models/beta/beta_webhook_session_pending_event_data.rb +41 -0
- data/lib/anthropic/models/beta/beta_webhook_session_requires_action_event_data.rb +41 -0
- data/lib/anthropic/models/beta/beta_webhook_session_running_event_data.rb +41 -0
- data/lib/anthropic/models/beta/beta_webhook_session_status_idled_event_data.rb +41 -0
- data/lib/anthropic/models/beta/beta_webhook_session_status_rescheduled_event_data.rb +41 -0
- data/lib/anthropic/models/beta/beta_webhook_session_status_run_started_event_data.rb +41 -0
- data/lib/anthropic/models/beta/beta_webhook_session_status_terminated_event_data.rb +41 -0
- data/lib/anthropic/models/beta/beta_webhook_session_thread_created_event_data.rb +41 -0
- data/lib/anthropic/models/beta/beta_webhook_session_thread_idled_event_data.rb +41 -0
- data/lib/anthropic/models/beta/beta_webhook_session_thread_terminated_event_data.rb +41 -0
- data/lib/anthropic/models/beta/beta_webhook_vault_archived_event_data.rb +41 -0
- data/lib/anthropic/models/beta/beta_webhook_vault_created_event_data.rb +41 -0
- data/lib/anthropic/models/beta/beta_webhook_vault_credential_archived_event_data.rb +49 -0
- data/lib/anthropic/models/beta/beta_webhook_vault_credential_created_event_data.rb +49 -0
- data/lib/anthropic/models/beta/beta_webhook_vault_credential_deleted_event_data.rb +49 -0
- data/lib/anthropic/models/beta/beta_webhook_vault_credential_refresh_failed_event_data.rb +49 -0
- data/lib/anthropic/models/beta/beta_webhook_vault_deleted_event_data.rb +41 -0
- data/lib/anthropic/models/beta/memory_store_archive_params.rb +31 -0
- data/lib/anthropic/models/beta/memory_store_create_params.rb +58 -0
- data/lib/anthropic/models/beta/memory_store_delete_params.rb +31 -0
- data/lib/anthropic/models/beta/memory_store_list_params.rb +72 -0
- data/lib/anthropic/models/beta/memory_store_retrieve_params.rb +31 -0
- data/lib/anthropic/models/beta/memory_store_update_params.rb +63 -0
- data/lib/anthropic/models/beta/memory_stores/beta_managed_agents_actor.rb +32 -0
- data/lib/anthropic/models/beta/memory_stores/beta_managed_agents_api_actor.rb +45 -0
- data/lib/anthropic/models/beta/memory_stores/beta_managed_agents_conflict_error.rb +35 -0
- data/lib/anthropic/models/beta/memory_stores/beta_managed_agents_content_sha256_precondition.rb +52 -0
- data/lib/anthropic/models/beta/memory_stores/beta_managed_agents_deleted_memory.rb +44 -0
- data/lib/anthropic/models/beta/memory_stores/beta_managed_agents_error.rb +44 -0
- data/lib/anthropic/models/beta/memory_stores/beta_managed_agents_memory.rb +125 -0
- data/lib/anthropic/models/beta/memory_stores/beta_managed_agents_memory_list_item.rb +29 -0
- data/lib/anthropic/models/beta/memory_stores/beta_managed_agents_memory_path_conflict_error.rb +47 -0
- data/lib/anthropic/models/beta/memory_stores/beta_managed_agents_memory_precondition_failed_error.rb +36 -0
- data/lib/anthropic/models/beta/memory_stores/beta_managed_agents_memory_prefix.rb +50 -0
- data/lib/anthropic/models/beta/memory_stores/beta_managed_agents_memory_version.rb +154 -0
- data/lib/anthropic/models/beta/memory_stores/beta_managed_agents_memory_version_operation.rb +22 -0
- data/lib/anthropic/models/beta/memory_stores/beta_managed_agents_memory_view.rb +24 -0
- data/lib/anthropic/models/beta/memory_stores/beta_managed_agents_precondition.rb +51 -0
- data/lib/anthropic/models/beta/memory_stores/beta_managed_agents_session_actor.rb +46 -0
- data/lib/anthropic/models/beta/memory_stores/beta_managed_agents_user_actor.rb +39 -0
- data/lib/anthropic/models/beta/memory_stores/memory_create_params.rb +64 -0
- data/lib/anthropic/models/beta/memory_stores/memory_delete_params.rb +48 -0
- data/lib/anthropic/models/beta/memory_stores/memory_list_params.rb +105 -0
- data/lib/anthropic/models/beta/memory_stores/memory_retrieve_params.rb +48 -0
- data/lib/anthropic/models/beta/memory_stores/memory_update_params.rb +85 -0
- data/lib/anthropic/models/beta/memory_stores/memory_version_list_params.rb +105 -0
- data/lib/anthropic/models/beta/memory_stores/memory_version_redact_params.rb +40 -0
- data/lib/anthropic/models/beta/memory_stores/memory_version_retrieve_params.rb +48 -0
- data/lib/anthropic/models/beta/message_create_params.rb +17 -7
- data/lib/anthropic/models/beta/messages/batch_create_params.rb +17 -7
- data/lib/anthropic/models/beta/session_create_params.rb +6 -3
- data/lib/anthropic/models/beta/session_list_params.rb +33 -1
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_agent_custom_tool_use_event.rb +15 -1
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_agent_mcp_tool_use_event.rb +16 -1
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_agent_thread_message_received_event.rb +98 -0
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_agent_thread_message_sent_event.rb +97 -0
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_agent_tool_use_event.rb +16 -1
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_event_params.rb +5 -1
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_file_rubric.rb +39 -0
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_file_rubric_params.rb +39 -0
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_memory_store_resource.rb +104 -0
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_send_session_events.rb +6 -3
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_session_event.rb +44 -1
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_session_resource.rb +6 -1
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_session_thread.rb +119 -0
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_session_thread_agent.rb +133 -0
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_session_thread_created_event.rb +64 -0
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_session_thread_stats.rb +45 -0
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_session_thread_status.rb +22 -0
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_session_thread_status_idle_event.rb +95 -0
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_session_thread_status_rescheduled_event.rb +66 -0
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_session_thread_status_running_event.rb +65 -0
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_session_thread_status_terminated_event.rb +65 -0
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_session_thread_usage.rb +46 -0
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_span_outcome_evaluation_end_event.rb +111 -0
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_span_outcome_evaluation_ongoing_event.rb +72 -0
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_span_outcome_evaluation_start_event.rb +69 -0
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_stream_session_events.rb +44 -1
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_stream_session_thread_events.rb +132 -0
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_text_rubric.rb +39 -0
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_text_rubric_params.rb +44 -0
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_user_custom_tool_result_event.rb +10 -1
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_user_define_outcome_event.rb +103 -0
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_user_define_outcome_event_params.rb +76 -0
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_user_interrupt_event.rb +15 -1
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_user_interrupt_event_params.rb +15 -1
- data/lib/anthropic/models/beta/sessions/beta_managed_agents_user_tool_confirmation_event.rb +11 -1
- data/lib/anthropic/models/beta/sessions/event_list_params.rb +42 -1
- data/lib/anthropic/models/beta/sessions/event_send_params.rb +2 -2
- data/lib/anthropic/models/beta/sessions/resource_retrieve_response.rb +4 -1
- data/lib/anthropic/models/beta/sessions/resource_update_response.rb +4 -1
- data/lib/anthropic/models/beta/sessions/thread_archive_params.rb +40 -0
- data/lib/anthropic/models/beta/sessions/thread_list_params.rb +49 -0
- data/lib/anthropic/models/beta/sessions/thread_retrieve_params.rb +40 -0
- data/lib/anthropic/models/beta/sessions/threads/event_list_params.rb +58 -0
- data/lib/anthropic/models/beta/sessions/threads/event_stream_params.rb +42 -0
- data/lib/anthropic/models/beta/unwrap_webhook_event.rb +41 -0
- data/lib/anthropic/models/beta/user_profile_create_enrollment_url_params.rb +31 -0
- data/lib/anthropic/models/beta/user_profile_create_params.rb +80 -0
- data/lib/anthropic/models/beta/user_profile_list_params.rb +59 -0
- data/lib/anthropic/models/beta/user_profile_retrieve_params.rb +31 -0
- data/lib/anthropic/models/beta/user_profile_update_params.rb +91 -0
- data/lib/anthropic/models/beta/vaults/beta_managed_agents_credential_validation.rb +88 -0
- data/lib/anthropic/models/beta/vaults/beta_managed_agents_credential_validation_status.rb +21 -0
- data/lib/anthropic/models/beta/vaults/beta_managed_agents_mcp_probe.rb +34 -0
- data/lib/anthropic/models/beta/vaults/beta_managed_agents_refresh_http_response.rb +46 -0
- data/lib/anthropic/models/beta/vaults/beta_managed_agents_refresh_object.rb +49 -0
- data/lib/anthropic/models/beta/vaults/credential_mcp_oauth_validate_params.rb +40 -0
- data/lib/anthropic/models/beta/webhook_unwrap_params.rb +16 -0
- data/lib/anthropic/models/citation_content_block_location.rb +24 -3
- data/lib/anthropic/models/citation_content_block_location_param.rb +23 -3
- data/lib/anthropic/models/citation_search_result_location_param.rb +31 -4
- data/lib/anthropic/models/citations_search_result_location.rb +31 -4
- data/lib/anthropic/models/completion_create_params.rb +14 -6
- data/lib/anthropic/models/effort_capability.rb +9 -1
- data/lib/anthropic/models/message_create_params.rb +7 -6
- data/lib/anthropic/models/messages/batch_create_params.rb +7 -6
- data/lib/anthropic/models/model.rb +17 -0
- data/lib/anthropic/models/output_config.rb +1 -0
- data/lib/anthropic/resources/beta/agents.rb +6 -2
- data/lib/anthropic/resources/beta/memory_stores/memories.rb +217 -0
- data/lib/anthropic/resources/beta/memory_stores/memory_versions.rb +151 -0
- data/lib/anthropic/resources/beta/memory_stores.rb +203 -0
- data/lib/anthropic/resources/beta/messages/batches.rb +7 -1
- data/lib/anthropic/resources/beta/messages.rb +7 -2
- data/lib/anthropic/resources/beta/sessions/events.rb +38 -7
- data/lib/anthropic/resources/beta/sessions/resources.rb +3 -3
- data/lib/anthropic/resources/beta/sessions/threads/events.rb +95 -0
- data/lib/anthropic/resources/beta/sessions/threads.rb +117 -0
- data/lib/anthropic/resources/beta/sessions.rb +13 -3
- data/lib/anthropic/resources/beta/user_profiles.rb +168 -0
- data/lib/anthropic/resources/beta/vaults/credentials.rb +30 -0
- data/lib/anthropic/resources/beta/webhooks.rb +34 -0
- data/lib/anthropic/resources/beta.rb +12 -0
- data/lib/anthropic/resources/completions.rb +4 -1
- data/lib/anthropic/resources/messages/batches.rb +1 -1
- data/lib/anthropic/resources/messages.rb +1 -1
- data/lib/anthropic/version.rb +1 -1
- data/lib/anthropic.rb +132 -0
- data/rbi/anthropic/client.rbi +9 -0
- data/rbi/anthropic/credentials.rbi +262 -0
- data/rbi/anthropic/helpers/bedrock/mantle_client.rbi +3 -2
- data/rbi/anthropic/internal/transport/base_client.rbi +9 -0
- data/rbi/anthropic/models/anthropic_beta.rbi +10 -0
- data/rbi/anthropic/models/beta/agent_create_params.rbi +26 -0
- data/rbi/anthropic/models/beta/agent_update_params.rbi +26 -0
- data/rbi/anthropic/models/beta/beta_citation_content_block_location.rbi +24 -0
- data/rbi/anthropic/models/beta/beta_citation_content_block_location_param.rbi +24 -0
- data/rbi/anthropic/models/beta/beta_citation_search_result_location.rbi +36 -0
- data/rbi/anthropic/models/beta/beta_citation_search_result_location_param.rbi +36 -0
- data/rbi/anthropic/models/beta/beta_compaction_block.rbi +20 -4
- data/rbi/anthropic/models/beta/beta_compaction_block_param.rbi +9 -1
- data/rbi/anthropic/models/beta/beta_compaction_content_block_delta.rbi +24 -5
- data/rbi/anthropic/models/beta/beta_effort_capability.rbi +18 -3
- data/rbi/anthropic/models/beta/beta_environment.rbi +1 -1
- data/rbi/anthropic/models/beta/beta_managed_agents_agent.rbi +18 -0
- data/rbi/anthropic/models/beta/beta_managed_agents_agent_reference.rbi +86 -0
- data/rbi/anthropic/models/beta/beta_managed_agents_deleted_memory_store.rbi +89 -0
- data/rbi/anthropic/models/beta/beta_managed_agents_memory_store.rbi +152 -0
- data/rbi/anthropic/models/beta/beta_managed_agents_memory_store_resource_param.rbi +154 -0
- data/rbi/anthropic/models/beta/beta_managed_agents_model.rbi +7 -0
- data/rbi/anthropic/models/beta/beta_managed_agents_multiagent.rbi +90 -0
- data/rbi/anthropic/models/beta/beta_managed_agents_multiagent_coordinator.rbi +95 -0
- data/rbi/anthropic/models/beta/beta_managed_agents_multiagent_coordinator_params.rbi +122 -0
- data/rbi/anthropic/models/beta/beta_managed_agents_multiagent_params.rbi +121 -0
- data/rbi/anthropic/models/beta/beta_managed_agents_multiagent_roster_entry_params.rbi +35 -0
- data/rbi/anthropic/models/beta/beta_managed_agents_multiagent_self_params.rbi +78 -0
- data/rbi/anthropic/models/beta/beta_managed_agents_outcome_evaluation_resource.rbi +135 -0
- data/rbi/anthropic/models/beta/beta_managed_agents_session.rbi +24 -1
- data/rbi/anthropic/models/beta/beta_managed_agents_session_agent.rbi +32 -0
- data/rbi/anthropic/models/beta/beta_managed_agents_session_multiagent_coordinator.rbi +100 -0
- data/rbi/anthropic/models/beta/beta_output_config.rbi +23 -3
- data/rbi/anthropic/models/beta/beta_token_task_budget.rbi +59 -0
- data/rbi/anthropic/models/beta/beta_user_profile.rbi +193 -0
- data/rbi/anthropic/models/beta/beta_user_profile_enrollment_url.rbi +92 -0
- data/rbi/anthropic/models/beta/beta_user_profile_trust_grant.rbi +86 -0
- data/rbi/anthropic/models/beta/beta_webhook_event.rbi +141 -0
- data/rbi/anthropic/models/beta/beta_webhook_event_data.rbi +49 -0
- data/rbi/anthropic/models/beta/beta_webhook_session_archived_event_data.rbi +63 -0
- data/rbi/anthropic/models/beta/beta_webhook_session_created_event_data.rbi +63 -0
- data/rbi/anthropic/models/beta/beta_webhook_session_deleted_event_data.rbi +63 -0
- data/rbi/anthropic/models/beta/beta_webhook_session_idled_event_data.rbi +62 -0
- data/rbi/anthropic/models/beta/beta_webhook_session_outcome_evaluation_ended_event_data.rbi +63 -0
- data/rbi/anthropic/models/beta/beta_webhook_session_pending_event_data.rbi +63 -0
- data/rbi/anthropic/models/beta/beta_webhook_session_requires_action_event_data.rbi +63 -0
- data/rbi/anthropic/models/beta/beta_webhook_session_running_event_data.rbi +63 -0
- data/rbi/anthropic/models/beta/beta_webhook_session_status_idled_event_data.rbi +63 -0
- data/rbi/anthropic/models/beta/beta_webhook_session_status_rescheduled_event_data.rbi +63 -0
- data/rbi/anthropic/models/beta/beta_webhook_session_status_run_started_event_data.rbi +63 -0
- data/rbi/anthropic/models/beta/beta_webhook_session_status_terminated_event_data.rbi +63 -0
- data/rbi/anthropic/models/beta/beta_webhook_session_thread_created_event_data.rbi +63 -0
- data/rbi/anthropic/models/beta/beta_webhook_session_thread_idled_event_data.rbi +63 -0
- data/rbi/anthropic/models/beta/beta_webhook_session_thread_terminated_event_data.rbi +63 -0
- data/rbi/anthropic/models/beta/beta_webhook_vault_archived_event_data.rbi +62 -0
- data/rbi/anthropic/models/beta/beta_webhook_vault_created_event_data.rbi +62 -0
- data/rbi/anthropic/models/beta/beta_webhook_vault_credential_archived_event_data.rbi +71 -0
- data/rbi/anthropic/models/beta/beta_webhook_vault_credential_created_event_data.rbi +71 -0
- data/rbi/anthropic/models/beta/beta_webhook_vault_credential_deleted_event_data.rbi +71 -0
- data/rbi/anthropic/models/beta/beta_webhook_vault_credential_refresh_failed_event_data.rbi +71 -0
- data/rbi/anthropic/models/beta/beta_webhook_vault_deleted_event_data.rbi +62 -0
- data/rbi/anthropic/models/beta/memory_store_archive_params.rbi +68 -0
- data/rbi/anthropic/models/beta/memory_store_create_params.rbi +106 -0
- data/rbi/anthropic/models/beta/memory_store_delete_params.rbi +68 -0
- data/rbi/anthropic/models/beta/memory_store_list_params.rbi +127 -0
- data/rbi/anthropic/models/beta/memory_store_retrieve_params.rbi +68 -0
- data/rbi/anthropic/models/beta/memory_store_update_params.rbi +102 -0
- data/rbi/anthropic/models/beta/memory_stores/beta_managed_agents_actor.rbi +37 -0
- data/rbi/anthropic/models/beta/memory_stores/beta_managed_agents_api_actor.rbi +89 -0
- data/rbi/anthropic/models/beta/memory_stores/beta_managed_agents_conflict_error.rbi +83 -0
- data/rbi/anthropic/models/beta/memory_stores/beta_managed_agents_content_sha256_precondition.rbi +100 -0
- data/rbi/anthropic/models/beta/memory_stores/beta_managed_agents_deleted_memory.rbi +90 -0
- data/rbi/anthropic/models/beta/memory_stores/beta_managed_agents_error.rbi +41 -0
- data/rbi/anthropic/models/beta/memory_stores/beta_managed_agents_memory.rbi +179 -0
- data/rbi/anthropic/models/beta/memory_stores/beta_managed_agents_memory_list_item.rbi +34 -0
- data/rbi/anthropic/models/beta/memory_stores/beta_managed_agents_memory_path_conflict_error.rbi +104 -0
- data/rbi/anthropic/models/beta/memory_stores/beta_managed_agents_memory_precondition_failed_error.rbi +83 -0
- data/rbi/anthropic/models/beta/memory_stores/beta_managed_agents_memory_prefix.rbi +95 -0
- data/rbi/anthropic/models/beta/memory_stores/beta_managed_agents_memory_version.rbi +267 -0
- data/rbi/anthropic/models/beta/memory_stores/beta_managed_agents_memory_version_operation.rbi +50 -0
- data/rbi/anthropic/models/beta/memory_stores/beta_managed_agents_memory_view.rbi +48 -0
- data/rbi/anthropic/models/beta/memory_stores/beta_managed_agents_precondition.rbi +100 -0
- data/rbi/anthropic/models/beta/memory_stores/beta_managed_agents_session_actor.rbi +91 -0
- data/rbi/anthropic/models/beta/memory_stores/beta_managed_agents_user_actor.rbi +86 -0
- data/rbi/anthropic/models/beta/memory_stores/memory_create_params.rbi +119 -0
- data/rbi/anthropic/models/beta/memory_stores/memory_delete_params.rbi +88 -0
- data/rbi/anthropic/models/beta/memory_stores/memory_list_params.rbi +213 -0
- data/rbi/anthropic/models/beta/memory_stores/memory_retrieve_params.rbi +101 -0
- data/rbi/anthropic/models/beta/memory_stores/memory_update_params.rbi +161 -0
- data/rbi/anthropic/models/beta/memory_stores/memory_version_list_params.rbi +196 -0
- data/rbi/anthropic/models/beta/memory_stores/memory_version_redact_params.rbi +77 -0
- data/rbi/anthropic/models/beta/memory_stores/memory_version_retrieve_params.rbi +101 -0
- data/rbi/anthropic/models/beta/message_create_params.rbi +24 -12
- data/rbi/anthropic/models/beta/messages/batch_create_params.rbi +27 -15
- data/rbi/anthropic/models/beta/session_create_params.rbi +10 -5
- data/rbi/anthropic/models/beta/session_list_params.rbi +79 -0
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_agent_custom_tool_use_event.rbi +15 -3
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_agent_mcp_tool_use_event.rbi +17 -3
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_agent_thread_message_received_event.rbi +161 -0
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_agent_thread_message_sent_event.rbi +161 -0
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_agent_tool_use_event.rbi +17 -3
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_event_params.rbi +2 -1
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_file_rubric.rbi +86 -0
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_file_rubric_params.rbi +86 -0
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_memory_store_resource.rbi +186 -0
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_send_session_events.rbi +6 -3
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_session_event.rbi +12 -1
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_session_resource.rbi +3 -1
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_session_thread.rbi +227 -0
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_session_thread_agent.rbi +231 -0
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_session_thread_created_event.rbi +111 -0
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_session_thread_stats.rbi +76 -0
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_session_thread_status.rbi +54 -0
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_session_thread_status_idle_event.rbi +153 -0
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_session_thread_status_rescheduled_event.rbi +112 -0
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_session_thread_status_running_event.rbi +111 -0
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_session_thread_status_terminated_event.rbi +111 -0
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_session_thread_usage.rbi +92 -0
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_span_outcome_evaluation_end_event.rbi +173 -0
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_span_outcome_evaluation_ongoing_event.rbi +115 -0
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_span_outcome_evaluation_start_event.rbi +112 -0
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_stream_session_events.rbi +12 -1
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_stream_session_thread_events.rbi +61 -0
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_text_rubric.rbi +86 -0
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_text_rubric_params.rbi +88 -0
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_user_custom_tool_result_event.rbi +13 -3
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_user_define_outcome_event.rbi +161 -0
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_user_define_outcome_event_params.rbi +141 -0
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_user_interrupt_event.rbi +15 -3
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_user_interrupt_event_params.rbi +17 -3
- data/rbi/anthropic/models/beta/sessions/beta_managed_agents_user_tool_confirmation_event.rbi +15 -3
- data/rbi/anthropic/models/beta/sessions/event_list_params.rbi +57 -0
- data/rbi/anthropic/models/beta/sessions/event_send_params.rbi +6 -3
- data/rbi/anthropic/models/beta/sessions/resource_retrieve_response.rbi +2 -1
- data/rbi/anthropic/models/beta/sessions/resource_update_response.rbi +2 -1
- data/rbi/anthropic/models/beta/sessions/thread_archive_params.rbi +77 -0
- data/rbi/anthropic/models/beta/sessions/thread_list_params.rbi +93 -0
- data/rbi/anthropic/models/beta/sessions/thread_retrieve_params.rbi +77 -0
- data/rbi/anthropic/models/beta/sessions/threads/event_list_params.rbi +102 -0
- data/rbi/anthropic/models/beta/sessions/threads/event_stream_params.rbi +80 -0
- data/rbi/anthropic/models/beta/unwrap_webhook_event.rbi +88 -0
- data/rbi/anthropic/models/beta/user_profile_create_enrollment_url_params.rbi +68 -0
- data/rbi/anthropic/models/beta/user_profile_create_params.rbi +169 -0
- data/rbi/anthropic/models/beta/user_profile_list_params.rbi +135 -0
- data/rbi/anthropic/models/beta/user_profile_retrieve_params.rbi +68 -0
- data/rbi/anthropic/models/beta/user_profile_update_params.rbi +171 -0
- data/rbi/anthropic/models/beta/vaults/beta_managed_agents_credential_validation.rbi +178 -0
- data/rbi/anthropic/models/beta/vaults/beta_managed_agents_credential_validation_status.rbi +49 -0
- data/rbi/anthropic/models/beta/vaults/beta_managed_agents_mcp_probe.rbi +75 -0
- data/rbi/anthropic/models/beta/vaults/beta_managed_agents_refresh_http_response.rbi +69 -0
- data/rbi/anthropic/models/beta/vaults/beta_managed_agents_refresh_object.rbi +126 -0
- data/rbi/anthropic/models/beta/vaults/credential_mcp_oauth_validate_params.rbi +77 -0
- data/rbi/anthropic/models/beta/webhook_unwrap_params.rbi +32 -0
- data/rbi/anthropic/models/citation_content_block_location.rbi +24 -0
- data/rbi/anthropic/models/citation_content_block_location_param.rbi +24 -0
- data/rbi/anthropic/models/citation_search_result_location_param.rbi +36 -0
- data/rbi/anthropic/models/citations_search_result_location.rbi +36 -0
- data/rbi/anthropic/models/completion_create_params.rbi +6 -12
- data/rbi/anthropic/models/effort_capability.rbi +16 -3
- data/rbi/anthropic/models/message_create_params.rbi +14 -12
- data/rbi/anthropic/models/messages/batch_create_params.rbi +14 -12
- data/rbi/anthropic/models/model.rbi +4 -0
- data/rbi/anthropic/models/output_config.rbi +1 -0
- data/rbi/anthropic/resources/beta/agents.rbi +16 -0
- data/rbi/anthropic/resources/beta/memory_stores/memories.rbi +191 -0
- data/rbi/anthropic/resources/beta/memory_stores/memory_versions.rbi +117 -0
- data/rbi/anthropic/resources/beta/memory_stores.rbi +172 -0
- data/rbi/anthropic/resources/beta/messages.rbi +22 -12
- data/rbi/anthropic/resources/beta/sessions/events.rbi +19 -1
- data/rbi/anthropic/resources/beta/sessions/threads/events.rbi +74 -0
- data/rbi/anthropic/resources/beta/sessions/threads.rbi +90 -0
- data/rbi/anthropic/resources/beta/sessions.rbi +14 -1
- data/rbi/anthropic/resources/beta/user_profiles.rbi +148 -0
- data/rbi/anthropic/resources/beta/vaults/credentials.rbi +23 -0
- data/rbi/anthropic/resources/beta/webhooks.rbi +31 -0
- data/rbi/anthropic/resources/beta.rbi +9 -0
- data/rbi/anthropic/resources/completions.rbi +6 -12
- data/rbi/anthropic/resources/messages.rbi +14 -12
- data/sig/anthropic/client.rbs +3 -0
- data/sig/anthropic/credentials.rbs +243 -0
- data/sig/anthropic/internal/transport/base_client.rbs +7 -1
- data/sig/anthropic/models/anthropic_beta.rbs +4 -0
- data/sig/anthropic/models/beta/agent_create_params.rbs +5 -0
- data/sig/anthropic/models/beta/agent_update_params.rbs +5 -0
- data/sig/anthropic/models/beta/beta_compaction_block.rbs +14 -3
- data/sig/anthropic/models/beta/beta_compaction_block_param.rbs +7 -2
- data/sig/anthropic/models/beta/beta_compaction_content_block_delta.rbs +17 -3
- data/sig/anthropic/models/beta/beta_effort_capability.rbs +8 -3
- data/sig/anthropic/models/beta/beta_managed_agents_agent.rbs +5 -0
- data/sig/anthropic/models/beta/beta_managed_agents_agent_reference.rbs +44 -0
- data/sig/anthropic/models/beta/beta_managed_agents_deleted_memory_store.rbs +39 -0
- data/sig/anthropic/models/beta/beta_managed_agents_memory_store.rbs +73 -0
- data/sig/anthropic/models/beta/beta_managed_agents_memory_store_resource_param.rbs +60 -0
- data/sig/anthropic/models/beta/beta_managed_agents_model.rbs +5 -1
- data/sig/anthropic/models/beta/beta_managed_agents_multiagent.rbs +39 -0
- data/sig/anthropic/models/beta/beta_managed_agents_multiagent_coordinator.rbs +39 -0
- data/sig/anthropic/models/beta/beta_managed_agents_multiagent_coordinator_params.rbs +39 -0
- data/sig/anthropic/models/beta/beta_managed_agents_multiagent_params.rbs +39 -0
- data/sig/anthropic/models/beta/beta_managed_agents_multiagent_roster_entry_params.rbs +18 -0
- data/sig/anthropic/models/beta/beta_managed_agents_multiagent_self_params.rbs +34 -0
- data/sig/anthropic/models/beta/beta_managed_agents_outcome_evaluation_resource.rbs +64 -0
- data/sig/anthropic/models/beta/beta_managed_agents_session.rbs +5 -0
- data/sig/anthropic/models/beta/beta_managed_agents_session_agent.rbs +5 -0
- data/sig/anthropic/models/beta/beta_managed_agents_session_multiagent_coordinator.rbs +39 -0
- data/sig/anthropic/models/beta/beta_output_config.rbs +10 -4
- data/sig/anthropic/models/beta/beta_token_task_budget.rbs +26 -0
- data/sig/anthropic/models/beta/beta_user_profile.rbs +86 -0
- data/sig/anthropic/models/beta/beta_user_profile_enrollment_url.rbs +44 -0
- data/sig/anthropic/models/beta/beta_user_profile_trust_grant.rbs +34 -0
- data/sig/anthropic/models/beta/beta_webhook_event.rbs +39 -0
- data/sig/anthropic/models/beta/beta_webhook_event_data.rbs +37 -0
- data/sig/anthropic/models/beta/beta_webhook_session_archived_event_data.rbs +39 -0
- data/sig/anthropic/models/beta/beta_webhook_session_created_event_data.rbs +39 -0
- data/sig/anthropic/models/beta/beta_webhook_session_deleted_event_data.rbs +39 -0
- data/sig/anthropic/models/beta/beta_webhook_session_idled_event_data.rbs +39 -0
- data/sig/anthropic/models/beta/beta_webhook_session_outcome_evaluation_ended_event_data.rbs +39 -0
- data/sig/anthropic/models/beta/beta_webhook_session_pending_event_data.rbs +39 -0
- data/sig/anthropic/models/beta/beta_webhook_session_requires_action_event_data.rbs +39 -0
- data/sig/anthropic/models/beta/beta_webhook_session_running_event_data.rbs +39 -0
- data/sig/anthropic/models/beta/beta_webhook_session_status_idled_event_data.rbs +39 -0
- data/sig/anthropic/models/beta/beta_webhook_session_status_rescheduled_event_data.rbs +39 -0
- data/sig/anthropic/models/beta/beta_webhook_session_status_run_started_event_data.rbs +39 -0
- data/sig/anthropic/models/beta/beta_webhook_session_status_terminated_event_data.rbs +39 -0
- data/sig/anthropic/models/beta/beta_webhook_session_thread_created_event_data.rbs +39 -0
- data/sig/anthropic/models/beta/beta_webhook_session_thread_idled_event_data.rbs +39 -0
- data/sig/anthropic/models/beta/beta_webhook_session_thread_terminated_event_data.rbs +39 -0
- data/sig/anthropic/models/beta/beta_webhook_vault_archived_event_data.rbs +39 -0
- data/sig/anthropic/models/beta/beta_webhook_vault_created_event_data.rbs +39 -0
- data/sig/anthropic/models/beta/beta_webhook_vault_credential_archived_event_data.rbs +44 -0
- data/sig/anthropic/models/beta/beta_webhook_vault_credential_created_event_data.rbs +44 -0
- data/sig/anthropic/models/beta/beta_webhook_vault_credential_deleted_event_data.rbs +44 -0
- data/sig/anthropic/models/beta/beta_webhook_vault_credential_refresh_failed_event_data.rbs +44 -0
- data/sig/anthropic/models/beta/beta_webhook_vault_deleted_event_data.rbs +39 -0
- data/sig/anthropic/models/beta/memory_store_archive_params.rbs +37 -0
- data/sig/anthropic/models/beta/memory_store_create_params.rbs +51 -0
- data/sig/anthropic/models/beta/memory_store_delete_params.rbs +37 -0
- data/sig/anthropic/models/beta/memory_store_list_params.rbs +67 -0
- data/sig/anthropic/models/beta/memory_store_retrieve_params.rbs +37 -0
- data/sig/anthropic/models/beta/memory_store_update_params.rbs +52 -0
- data/sig/anthropic/models/beta/memory_stores/beta_managed_agents_actor.rbs +18 -0
- data/sig/anthropic/models/beta/memory_stores/beta_managed_agents_api_actor.rbs +39 -0
- data/sig/anthropic/models/beta/memory_stores/beta_managed_agents_conflict_error.rbs +41 -0
- data/sig/anthropic/models/beta/memory_stores/beta_managed_agents_content_sha256_precondition.rbs +41 -0
- data/sig/anthropic/models/beta/memory_stores/beta_managed_agents_deleted_memory.rbs +39 -0
- data/sig/anthropic/models/beta/memory_stores/beta_managed_agents_error.rbs +27 -0
- data/sig/anthropic/models/beta/memory_stores/beta_managed_agents_memory.rbs +79 -0
- data/sig/anthropic/models/beta/memory_stores/beta_managed_agents_memory_list_item.rbs +17 -0
- data/sig/anthropic/models/beta/memory_stores/beta_managed_agents_memory_path_conflict_error.rbs +55 -0
- data/sig/anthropic/models/beta/memory_stores/beta_managed_agents_memory_precondition_failed_error.rbs +41 -0
- data/sig/anthropic/models/beta/memory_stores/beta_managed_agents_memory_prefix.rbs +39 -0
- data/sig/anthropic/models/beta/memory_stores/beta_managed_agents_memory_version.rbs +102 -0
- data/sig/anthropic/models/beta/memory_stores/beta_managed_agents_memory_version_operation.rbs +20 -0
- data/sig/anthropic/models/beta/memory_stores/beta_managed_agents_memory_view.rbs +18 -0
- data/sig/anthropic/models/beta/memory_stores/beta_managed_agents_precondition.rbs +41 -0
- data/sig/anthropic/models/beta/memory_stores/beta_managed_agents_session_actor.rbs +39 -0
- data/sig/anthropic/models/beta/memory_stores/beta_managed_agents_user_actor.rbs +39 -0
- data/sig/anthropic/models/beta/memory_stores/memory_create_params.rbs +58 -0
- data/sig/anthropic/models/beta/memory_stores/memory_delete_params.rbs +51 -0
- data/sig/anthropic/models/beta/memory_stores/memory_list_params.rbs +103 -0
- data/sig/anthropic/models/beta/memory_stores/memory_retrieve_params.rbs +53 -0
- data/sig/anthropic/models/beta/memory_stores/memory_update_params.rbs +72 -0
- data/sig/anthropic/models/beta/memory_stores/memory_version_list_params.rbs +106 -0
- data/sig/anthropic/models/beta/memory_stores/memory_version_redact_params.rbs +44 -0
- data/sig/anthropic/models/beta/memory_stores/memory_version_retrieve_params.rbs +53 -0
- data/sig/anthropic/models/beta/message_create_params.rbs +5 -0
- data/sig/anthropic/models/beta/messages/batch_create_params.rbs +8 -3
- data/sig/anthropic/models/beta/session_create_params.rbs +1 -0
- data/sig/anthropic/models/beta/session_list_params.rbs +29 -0
- data/sig/anthropic/models/beta/sessions/beta_managed_agents_agent_custom_tool_use_event.rbs +8 -3
- data/sig/anthropic/models/beta/sessions/beta_managed_agents_agent_mcp_tool_use_event.rbs +8 -3
- data/sig/anthropic/models/beta/sessions/beta_managed_agents_agent_thread_message_received_event.rbs +70 -0
- data/sig/anthropic/models/beta/sessions/beta_managed_agents_agent_thread_message_sent_event.rbs +70 -0
- data/sig/anthropic/models/beta/sessions/beta_managed_agents_agent_tool_use_event.rbs +8 -3
- data/sig/anthropic/models/beta/sessions/beta_managed_agents_event_params.rbs +1 -0
- data/sig/anthropic/models/beta/sessions/beta_managed_agents_file_rubric.rbs +39 -0
- data/sig/anthropic/models/beta/sessions/beta_managed_agents_file_rubric_params.rbs +39 -0
- data/sig/anthropic/models/beta/sessions/beta_managed_agents_memory_store_resource.rbs +77 -0
- data/sig/anthropic/models/beta/sessions/beta_managed_agents_send_session_events.rbs +1 -0
- data/sig/anthropic/models/beta/sessions/beta_managed_agents_session_event.rbs +11 -0
- data/sig/anthropic/models/beta/sessions/beta_managed_agents_session_resource.rbs +1 -0
- data/sig/anthropic/models/beta/sessions/beta_managed_agents_session_thread.rbs +84 -0
- data/sig/anthropic/models/beta/sessions/beta_managed_agents_session_thread_agent.rbs +100 -0
- data/sig/anthropic/models/beta/sessions/beta_managed_agents_session_thread_created_event.rbs +54 -0
- data/sig/anthropic/models/beta/sessions/beta_managed_agents_session_thread_stats.rbs +40 -0
- data/sig/anthropic/models/beta/sessions/beta_managed_agents_session_thread_status.rbs +21 -0
- data/sig/anthropic/models/beta/sessions/beta_managed_agents_session_thread_status_idle_event.rbs +70 -0
- data/sig/anthropic/models/beta/sessions/beta_managed_agents_session_thread_status_rescheduled_event.rbs +54 -0
- data/sig/anthropic/models/beta/sessions/beta_managed_agents_session_thread_status_running_event.rbs +54 -0
- data/sig/anthropic/models/beta/sessions/beta_managed_agents_session_thread_status_terminated_event.rbs +54 -0
- data/sig/anthropic/models/beta/sessions/beta_managed_agents_session_thread_usage.rbs +49 -0
- data/sig/anthropic/models/beta/sessions/beta_managed_agents_span_outcome_evaluation_end_event.rbs +74 -0
- data/sig/anthropic/models/beta/sessions/beta_managed_agents_span_outcome_evaluation_ongoing_event.rbs +54 -0
- data/sig/anthropic/models/beta/sessions/beta_managed_agents_span_outcome_evaluation_start_event.rbs +54 -0
- data/sig/anthropic/models/beta/sessions/beta_managed_agents_stream_session_events.rbs +11 -0
- data/sig/anthropic/models/beta/sessions/beta_managed_agents_stream_session_thread_events.rbs +46 -0
- data/sig/anthropic/models/beta/sessions/beta_managed_agents_text_rubric.rbs +39 -0
- data/sig/anthropic/models/beta/sessions/beta_managed_agents_text_rubric_params.rbs +39 -0
- data/sig/anthropic/models/beta/sessions/beta_managed_agents_user_custom_tool_result_event.rbs +8 -3
- data/sig/anthropic/models/beta/sessions/beta_managed_agents_user_define_outcome_event.rbs +74 -0
- data/sig/anthropic/models/beta/sessions/beta_managed_agents_user_define_outcome_event_params.rbs +59 -0
- data/sig/anthropic/models/beta/sessions/beta_managed_agents_user_interrupt_event.rbs +8 -3
- data/sig/anthropic/models/beta/sessions/beta_managed_agents_user_interrupt_event_params.rbs +8 -3
- data/sig/anthropic/models/beta/sessions/beta_managed_agents_user_tool_confirmation_event.rbs +8 -3
- data/sig/anthropic/models/beta/sessions/event_list_params.rbs +35 -0
- data/sig/anthropic/models/beta/sessions/resource_retrieve_response.rbs +1 -0
- data/sig/anthropic/models/beta/sessions/resource_update_response.rbs +1 -0
- data/sig/anthropic/models/beta/sessions/thread_archive_params.rbs +44 -0
- data/sig/anthropic/models/beta/sessions/thread_list_params.rbs +53 -0
- data/sig/anthropic/models/beta/sessions/thread_retrieve_params.rbs +44 -0
- data/sig/anthropic/models/beta/sessions/threads/event_list_params.rbs +60 -0
- data/sig/anthropic/models/beta/sessions/threads/event_stream_params.rbs +46 -0
- data/sig/anthropic/models/beta/unwrap_webhook_event.rbs +37 -0
- data/sig/anthropic/models/beta/user_profile_create_enrollment_url_params.rbs +37 -0
- data/sig/anthropic/models/beta/user_profile_create_params.rbs +70 -0
- data/sig/anthropic/models/beta/user_profile_list_params.rbs +66 -0
- data/sig/anthropic/models/beta/user_profile_retrieve_params.rbs +37 -0
- data/sig/anthropic/models/beta/user_profile_update_params.rbs +71 -0
- data/sig/anthropic/models/beta/vaults/beta_managed_agents_credential_validation.rbs +69 -0
- data/sig/anthropic/models/beta/vaults/beta_managed_agents_credential_validation_status.rbs +20 -0
- data/sig/anthropic/models/beta/vaults/beta_managed_agents_mcp_probe.rbs +29 -0
- data/sig/anthropic/models/beta/vaults/beta_managed_agents_refresh_http_response.rbs +39 -0
- data/sig/anthropic/models/beta/vaults/beta_managed_agents_refresh_object.rbs +43 -0
- data/sig/anthropic/models/beta/vaults/credential_mcp_oauth_validate_params.rbs +44 -0
- data/sig/anthropic/models/beta/webhook_unwrap_params.rbs +17 -0
- data/sig/anthropic/models/effort_capability.rbs +8 -3
- data/sig/anthropic/models/model.rbs +5 -1
- data/sig/anthropic/models/output_config.rbs +2 -1
- data/sig/anthropic/resources/beta/agents.rbs +2 -0
- data/sig/anthropic/resources/beta/memory_stores/memories.rbs +60 -0
- data/sig/anthropic/resources/beta/memory_stores/memory_versions.rbs +41 -0
- data/sig/anthropic/resources/beta/memory_stores.rbs +58 -0
- data/sig/anthropic/resources/beta/messages.rbs +2 -0
- data/sig/anthropic/resources/beta/sessions/events.rbs +5 -0
- data/sig/anthropic/resources/beta/sessions/threads/events.rbs +29 -0
- data/sig/anthropic/resources/beta/sessions/threads.rbs +35 -0
- data/sig/anthropic/resources/beta/sessions.rbs +4 -0
- data/sig/anthropic/resources/beta/user_profiles.rbs +48 -0
- data/sig/anthropic/resources/beta/vaults/credentials.rbs +7 -0
- data/sig/anthropic/resources/beta/webhooks.rbs +15 -0
- data/sig/anthropic/resources/beta.rbs +6 -0
- metadata +386 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b34378dd9395b126e18915a8ee15526d27d7e7002475e401d8c81bae601289fb
|
|
4
|
+
data.tar.gz: ed103f7d82d22f04cc7a0332a4a24648beaafcbafbf4e16fa19717ce59c9817c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6740871a358a65e3948a1381ba601ad342f4f1418c19af0e9c6badf1c91e7d4aec51650f5d202a3f31d44b39f4c951a85875d4208227281ceb0d7da0b7a9c0d8
|
|
7
|
+
data.tar.gz: b596807165dbd16f19fe9902451b0e6e9b346030265214d1c5eece6e1d4eb8ee7c3fd9cf650d06ca7695eac94103b4669f8b130970b0fe5ca61022ea4ba0630f
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,119 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.40.0 (2026-05-11)
|
|
4
|
+
|
|
5
|
+
Full Changelog: [v1.39.0...v1.40.0](https://github.com/anthropics/anthropic-sdk-ruby/compare/v1.39.0...v1.40.0)
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
* **aws:** Add AWS client for Claude Platform on AWS ([3c24797](https://github.com/anthropics/anthropic-sdk-ruby/commit/3c2479737666f61f1096b07c30412fffdfabe133))
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
* **aws,bedrock:** materialize streamed request body before SigV4 signing ([#927](https://github.com/anthropics/anthropic-sdk-ruby/issues/927)) ([5b6d9d4](https://github.com/anthropics/anthropic-sdk-ruby/commit/5b6d9d4bfcb2a9e3fcc14a5683f6e25a205791a2))
|
|
15
|
+
|
|
16
|
+
## 1.39.0 (2026-05-06)
|
|
17
|
+
|
|
18
|
+
Full Changelog: [v1.38.0...v1.39.0](https://github.com/anthropics/anthropic-sdk-ruby/compare/v1.38.0...v1.39.0)
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* **api:** add support for Managed Agents multiagents and outcomes, webhooks, vault validation ([21230ec](https://github.com/anthropics/anthropic-sdk-ruby/commit/21230ecd2fd7dac66600f984c7e34383cf122d7a))
|
|
23
|
+
* **client:** add aws sso config resolution ([#887](https://github.com/anthropics/anthropic-sdk-ruby/issues/887)) ([4a0476a](https://github.com/anthropics/anthropic-sdk-ruby/commit/4a0476ada4e1549965971fce3272a7a9dee8faaa))
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
### Bug Fixes
|
|
27
|
+
|
|
28
|
+
* **api:** Adjust webhook configuration ([e587f17](https://github.com/anthropics/anthropic-sdk-ruby/commit/e587f17eae68e656586f73a9a880e4f9ab8b94fe))
|
|
29
|
+
|
|
30
|
+
## 1.38.0 (2026-05-05)
|
|
31
|
+
|
|
32
|
+
Full Changelog: [v1.37.0...v1.38.0](https://github.com/anthropics/anthropic-sdk-ruby/compare/v1.37.0...v1.38.0)
|
|
33
|
+
|
|
34
|
+
### Features
|
|
35
|
+
|
|
36
|
+
* **client:** allow targeting a workspace for OIDC federation token exchange ([85f4668](https://github.com/anthropics/anthropic-sdk-ruby/commit/85f46687b798714bed259e6b78e07bc4df114046))
|
|
37
|
+
|
|
38
|
+
## 1.37.0 (2026-05-04)
|
|
39
|
+
|
|
40
|
+
Full Changelog: [v1.36.0...v1.37.0](https://github.com/anthropics/anthropic-sdk-ruby/compare/v1.36.0...v1.37.0)
|
|
41
|
+
|
|
42
|
+
### Features
|
|
43
|
+
|
|
44
|
+
* **api:** improve Managed Agents APIs ([34caf5b](https://github.com/anthropics/anthropic-sdk-ruby/commit/34caf5b0994bc818a7ee835832624853cc0a2abe))
|
|
45
|
+
* **client:** add Workload Identity Federation, interactive OAuth, and auth profiles ([4d394a4](https://github.com/anthropics/anthropic-sdk-ruby/commit/4d394a419f6219cf46ca459083510c89f44041a7))
|
|
46
|
+
* support setting headers via env ([08e8b38](https://github.com/anthropics/anthropic-sdk-ruby/commit/08e8b382e8795ebb008daea6769550374952b301))
|
|
47
|
+
|
|
48
|
+
## 1.36.0 (2026-04-23)
|
|
49
|
+
|
|
50
|
+
Full Changelog: [v1.35.0...v1.36.0](https://github.com/anthropics/anthropic-sdk-ruby/compare/v1.35.0...v1.36.0)
|
|
51
|
+
|
|
52
|
+
### Features
|
|
53
|
+
|
|
54
|
+
* **api:** CMA Memory public beta ([9fafd1a](https://github.com/anthropics/anthropic-sdk-ruby/commit/9fafd1abe16d0398c6e59be0717a9ef9cb014347))
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
### Bug Fixes
|
|
58
|
+
|
|
59
|
+
* **api:** fix errors in api spec ([074fa8d](https://github.com/anthropics/anthropic-sdk-ruby/commit/074fa8dac4cdebc8eababcac95ca4fe9dc7970d3))
|
|
60
|
+
* **api:** restore missing features ([4496fac](https://github.com/anthropics/anthropic-sdk-ruby/commit/4496facb8130e48340a2c4107d3aaf412b5cf4eb))
|
|
61
|
+
* avoid gzip buffering during streaming ([307c594](https://github.com/anthropics/anthropic-sdk-ruby/commit/307c5944e27dd3eab5aa3c6f6e7ed02ca5b7cece))
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
### Chores
|
|
65
|
+
|
|
66
|
+
* **internal:** more robust bootstrap script ([e8f157e](https://github.com/anthropics/anthropic-sdk-ruby/commit/e8f157e44e664c036c0b81584eee8919d55eb6db))
|
|
67
|
+
* **tests:** bump steady to v0.22.1 ([7f079ce](https://github.com/anthropics/anthropic-sdk-ruby/commit/7f079cee1a662245ce67c12b1b7790832dd931ad))
|
|
68
|
+
|
|
69
|
+
## 1.35.0 (2026-04-16)
|
|
70
|
+
|
|
71
|
+
Full Changelog: [v1.34.0...v1.35.0](https://github.com/anthropics/anthropic-sdk-ruby/compare/v1.34.0...v1.35.0)
|
|
72
|
+
|
|
73
|
+
### Features
|
|
74
|
+
|
|
75
|
+
* **api:** add claude-opus-4-7, token budgets and user_profiles ([026649a](https://github.com/anthropics/anthropic-sdk-ruby/commit/026649ae9a26108258ef8de6532eb02e429e87d9))
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
### Chores
|
|
79
|
+
|
|
80
|
+
* **ci:** remove release-doctor workflow ([0947aca](https://github.com/anthropics/anthropic-sdk-ruby/commit/0947acaf0af66d9918f6a6faea03ab8f129932af))
|
|
81
|
+
|
|
82
|
+
## 1.34.0 (2026-04-14)
|
|
83
|
+
|
|
84
|
+
Full Changelog: [v1.33.1...v1.34.0](https://github.com/anthropics/anthropic-sdk-ruby/compare/v1.33.1...v1.34.0)
|
|
85
|
+
|
|
86
|
+
### Features
|
|
87
|
+
|
|
88
|
+
* **api:** mark Sonnet and Opus 4 as deprecated ([287e6c4](https://github.com/anthropics/anthropic-sdk-ruby/commit/287e6c471b24ef580260224675dddd08218dcd68))
|
|
89
|
+
* **bedrock:** use auth header for mantle client ([#894](https://github.com/anthropics/anthropic-sdk-ruby/issues/894)) ([2ac3bba](https://github.com/anthropics/anthropic-sdk-ruby/commit/2ac3bbaa1a20f7af1069aa1ff4bcc2b3ef7123c6))
|
|
90
|
+
|
|
91
|
+
## 1.33.1 (2026-04-13)
|
|
92
|
+
|
|
93
|
+
Full Changelog: [v1.33.0...v1.33.1](https://github.com/anthropics/anthropic-sdk-ruby/compare/v1.33.0...v1.33.1)
|
|
94
|
+
|
|
95
|
+
### Bug Fixes
|
|
96
|
+
|
|
97
|
+
* **streaming:** add missing events ([cf312ed](https://github.com/anthropics/anthropic-sdk-ruby/commit/cf312edbafca255394ba7d446827fcd28cbbdb77))
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
### Documentation
|
|
101
|
+
|
|
102
|
+
* update examples ([05d1ab6](https://github.com/anthropics/anthropic-sdk-ruby/commit/05d1ab635b860db6eaa4179f3be98fb052800acd))
|
|
103
|
+
|
|
104
|
+
## 1.33.0 (2026-04-10)
|
|
105
|
+
|
|
106
|
+
Full Changelog: [v1.32.0...v1.33.0](https://github.com/anthropics/anthropic-sdk-ruby/compare/v1.32.0...v1.33.0)
|
|
107
|
+
|
|
108
|
+
### Features
|
|
109
|
+
|
|
110
|
+
* vertex eu region ([#897](https://github.com/anthropics/anthropic-sdk-ruby/issues/897)) ([11191ce](https://github.com/anthropics/anthropic-sdk-ruby/commit/11191ced086daff14ee7b352ac075db8a2c565cc))
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
### Documentation
|
|
114
|
+
|
|
115
|
+
* improve examples ([8405e94](https://github.com/anthropics/anthropic-sdk-ruby/commit/8405e9439ed806224f03b196e772d5046a6bd379))
|
|
116
|
+
|
|
3
117
|
## 1.32.0 (2026-04-09)
|
|
4
118
|
|
|
5
119
|
Full Changelog: [v1.31.0...v1.32.0](https://github.com/anthropics/anthropic-sdk-ruby/compare/v1.31.0...v1.32.0)
|
data/README.md
CHANGED
data/lib/anthropic/client.rb
CHANGED
|
@@ -1,6 +1,32 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
module Anthropic
|
|
4
|
+
@warned_explicit_shadow = false
|
|
5
|
+
@warned_env_shadow = false
|
|
6
|
+
|
|
7
|
+
class << self
|
|
8
|
+
def warn_explicit_static_shadows_credentials(param)
|
|
9
|
+
return if @warned_explicit_shadow
|
|
10
|
+
@warned_explicit_shadow = true
|
|
11
|
+
|
|
12
|
+
warn(
|
|
13
|
+
"[anthropic-ruby] `#{param}:` was passed alongside `credentials:`; the static credential " \
|
|
14
|
+
"takes precedence and the credentials provider is silently disabled. " \
|
|
15
|
+
"Pass only one."
|
|
16
|
+
)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def warn_env_static_shadows_auto_discovery(env_var)
|
|
20
|
+
return if @warned_env_shadow
|
|
21
|
+
@warned_env_shadow = true
|
|
22
|
+
|
|
23
|
+
warn(
|
|
24
|
+
"[anthropic-ruby] #{env_var} is set and takes precedence over the SDK's profile / federation " \
|
|
25
|
+
"auto-discovery; unset #{env_var} to use the auto-discovered credential."
|
|
26
|
+
)
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
4
30
|
class Client < Anthropic::Internal::Transport::BaseClient
|
|
5
31
|
# Default max number of retries to attempt after a failed retryable request.
|
|
6
32
|
DEFAULT_MAX_RETRIES = 2
|
|
@@ -33,6 +59,15 @@ module Anthropic
|
|
|
33
59
|
# @return [String, nil]
|
|
34
60
|
attr_reader :auth_token
|
|
35
61
|
|
|
62
|
+
# @return [String, nil]
|
|
63
|
+
attr_reader :webhook_key
|
|
64
|
+
|
|
65
|
+
# @return [Object, nil]
|
|
66
|
+
attr_reader :credentials
|
|
67
|
+
|
|
68
|
+
# @return [Anthropic::Credentials::TokenCache, nil]
|
|
69
|
+
attr_reader :token_cache
|
|
70
|
+
|
|
36
71
|
# @return [Anthropic::Resources::Completions]
|
|
37
72
|
attr_reader :completions
|
|
38
73
|
|
|
@@ -49,23 +84,19 @@ module Anthropic
|
|
|
49
84
|
#
|
|
50
85
|
# @return [Hash{String=>String}]
|
|
51
86
|
private def auth_headers
|
|
52
|
-
{
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
# @api private
|
|
56
|
-
#
|
|
57
|
-
# @return [Hash{String=>String}]
|
|
58
|
-
private def api_key_auth
|
|
59
|
-
{"x-api-key" => @api_key}
|
|
60
|
-
end
|
|
87
|
+
headers = {}
|
|
61
88
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
89
|
+
if @api_key
|
|
90
|
+
headers["x-api-key"] = @api_key
|
|
91
|
+
elsif @auth_token
|
|
92
|
+
headers["authorization"] = "Bearer #{@auth_token}"
|
|
93
|
+
elsif @token_cache
|
|
94
|
+
token = @token_cache.get_token
|
|
95
|
+
headers["authorization"] = "Bearer #{token}"
|
|
96
|
+
headers["anthropic-beta"] = Anthropic::Credentials::OAUTH_API_BETA_HEADER
|
|
97
|
+
end
|
|
67
98
|
|
|
68
|
-
|
|
99
|
+
headers
|
|
69
100
|
end
|
|
70
101
|
|
|
71
102
|
# Calculate the timeout for non-streaming requests based on token count
|
|
@@ -91,12 +122,51 @@ module Anthropic
|
|
|
91
122
|
|
|
92
123
|
# Creates and returns a new client for interacting with the API.
|
|
93
124
|
#
|
|
94
|
-
#
|
|
125
|
+
# Credential precedence, matching the credential-resolution spec and
|
|
126
|
+
# the Workload Identity Federation user guide:
|
|
127
|
+
#
|
|
128
|
+
# 1. Explicit constructor arguments — +api_key:+, +auth_token:+,
|
|
129
|
+
# +credentials:+, +config:+. If the caller passed any of these,
|
|
130
|
+
# the SDK uses it and does *not* read credential env vars.
|
|
131
|
+
# 2. +ANTHROPIC_API_KEY+ / +ANTHROPIC_AUTH_TOKEN+ env vars. Only
|
|
132
|
+
# consulted when no explicit credential argument was passed.
|
|
133
|
+
# 3. +ANTHROPIC_PROFILE+ — explicit profile selection.
|
|
134
|
+
# 4. Direct env-var federation (+ANTHROPIC_IDENTITY_TOKEN[_FILE]+ +
|
|
135
|
+
# +ANTHROPIC_FEDERATION_RULE_ID+ + +ANTHROPIC_ORGANIZATION_ID+).
|
|
136
|
+
# 5. Fallback active profile from disk (+active_config+ pointer or
|
|
137
|
+
# the literal +default+).
|
|
138
|
+
#
|
|
139
|
+
# A static env credential (step 2) *shadows* steps 3–5, silently
|
|
140
|
+
# disabling profile / federation auto-discovery.
|
|
95
141
|
#
|
|
96
|
-
#
|
|
142
|
+
# Passing an explicit +api_key:+ or +auth_token:+ *argument*
|
|
143
|
+
# alongside an explicit +credentials:+ is supported: the
|
|
144
|
+
# static credential takes precedence at the request-header level and
|
|
145
|
+
# the credentials provider is silently disabled.
|
|
146
|
+
#
|
|
147
|
+
# @param api_key [String, nil] Defaults to +ENV["ANTHROPIC_API_KEY"]+ when
|
|
148
|
+
# no explicit credential argument is passed.
|
|
149
|
+
#
|
|
150
|
+
# @param auth_token [String, nil] Defaults to +ENV["ANTHROPIC_AUTH_TOKEN"]+ when
|
|
151
|
+
# no explicit credential argument is passed.
|
|
152
|
+
#
|
|
153
|
+
# @param credentials [#call, nil] Credential provider — any callable returning
|
|
154
|
+
# +AccessToken.new(token:, expires_at:)+. The provider is wrapped in a
|
|
155
|
+
# +TokenCache+ for thread-safe caching and proactive refresh (120s advisory /
|
|
156
|
+
# 30s mandatory before expiry). Common providers: +WorkloadIdentity+,
|
|
157
|
+
# +CredentialsFile+, +StaticToken+, or a custom lambda.
|
|
158
|
+
#
|
|
159
|
+
# @param config [Hash, nil] In-memory configuration hash with the same shape
|
|
160
|
+
# as +configs/<profile>.json+. Must include an +authentication+ object with
|
|
161
|
+
# a +type+ field (+oidc_federation+ or +user_oauth+). Mutually exclusive
|
|
162
|
+
# with +credentials:+. For +user_oauth+, must also include
|
|
163
|
+
# +authentication.credentials_path+.
|
|
164
|
+
#
|
|
165
|
+
# @param webhook_key [String, nil] Defaults to `ENV["ANTHROPIC_WEBHOOK_SIGNING_KEY"]`
|
|
97
166
|
#
|
|
98
167
|
# @param base_url [String, nil] Override the default base URL for the API, e.g.,
|
|
99
|
-
#
|
|
168
|
+
# +"https://api.example.com/v2/"+. Defaults to +ENV["ANTHROPIC_BASE_URL"]+,
|
|
169
|
+
# then to the profile's +base_url+ if present, then to +https://api.anthropic.com+.
|
|
100
170
|
#
|
|
101
171
|
# @param max_retries [Integer] Max number of retries to attempt after a failed retryable request.
|
|
102
172
|
#
|
|
@@ -106,22 +176,88 @@ module Anthropic
|
|
|
106
176
|
#
|
|
107
177
|
# @param max_retry_delay [Float]
|
|
108
178
|
def initialize(
|
|
109
|
-
api_key:
|
|
110
|
-
auth_token:
|
|
111
|
-
|
|
179
|
+
api_key: nil,
|
|
180
|
+
auth_token: nil,
|
|
181
|
+
webhook_key: ENV["ANTHROPIC_WEBHOOK_SIGNING_KEY"],
|
|
182
|
+
credentials: nil,
|
|
183
|
+
config: nil,
|
|
184
|
+
base_url: nil,
|
|
112
185
|
max_retries: self.class::DEFAULT_MAX_RETRIES,
|
|
113
186
|
timeout: self.class::DEFAULT_TIMEOUT_IN_SECONDS,
|
|
114
187
|
initial_retry_delay: self.class::DEFAULT_INITIAL_RETRY_DELAY,
|
|
115
188
|
max_retry_delay: self.class::DEFAULT_MAX_RETRY_DELAY
|
|
116
189
|
)
|
|
190
|
+
if config && credentials
|
|
191
|
+
raise ArgumentError, "Pass at most one of `credentials:` or `config:`."
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
has_explicit_credential = api_key || auth_token || credentials || config
|
|
195
|
+
|
|
196
|
+
unless has_explicit_credential
|
|
197
|
+
api_key = ENV["ANTHROPIC_API_KEY"]
|
|
198
|
+
auth_token = ENV["ANTHROPIC_AUTH_TOKEN"]
|
|
199
|
+
end
|
|
200
|
+
|
|
201
|
+
@api_key = api_key&.to_s
|
|
202
|
+
@auth_token = auth_token&.to_s
|
|
203
|
+
@credentials = nil
|
|
204
|
+
@token_cache = nil
|
|
205
|
+
|
|
206
|
+
base_url_is_explicit = base_url && !base_url.empty?
|
|
207
|
+
base_url ||= ENV["ANTHROPIC_BASE_URL"]
|
|
208
|
+
|
|
209
|
+
credential_headers = {}
|
|
210
|
+
|
|
211
|
+
if config
|
|
212
|
+
in_memory = Anthropic::Credentials::InMemoryConfig.new(config)
|
|
213
|
+
@credentials = in_memory
|
|
214
|
+
credential_headers = in_memory.extra_headers
|
|
215
|
+
if !base_url_is_explicit && in_memory.resolved_base_url
|
|
216
|
+
base_url = in_memory.resolved_base_url
|
|
217
|
+
end
|
|
218
|
+
else
|
|
219
|
+
@credentials = credentials
|
|
220
|
+
end
|
|
221
|
+
|
|
222
|
+
if @credentials.nil? && @api_key.nil? && @auth_token.nil?
|
|
223
|
+
default_base_url = base_url || "https://api.anthropic.com"
|
|
224
|
+
result = Anthropic::Credentials.default_credentials(base_url: default_base_url)
|
|
225
|
+
if result
|
|
226
|
+
@credentials = result.provider
|
|
227
|
+
credential_headers = result.extra_headers
|
|
228
|
+
base_url = result.base_url if !base_url_is_explicit && result.base_url
|
|
229
|
+
end
|
|
230
|
+
end
|
|
231
|
+
|
|
232
|
+
warn_explicit_shadow(api_key: api_key, auth_token: auth_token, credentials: credentials || config)
|
|
233
|
+
warn_env_shadow(api_key: api_key, auth_token: auth_token)
|
|
234
|
+
|
|
235
|
+
if @credentials
|
|
236
|
+
@token_cache = Anthropic::Credentials::TokenCache.new(@credentials)
|
|
237
|
+
end
|
|
238
|
+
|
|
117
239
|
base_url ||= "https://api.anthropic.com"
|
|
118
240
|
|
|
241
|
+
if @credentials.respond_to?(:bind_base_url)
|
|
242
|
+
@credentials.bind_base_url(base_url)
|
|
243
|
+
end
|
|
244
|
+
|
|
119
245
|
headers = {
|
|
120
246
|
"anthropic-version" => "2023-06-01"
|
|
121
247
|
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
248
|
+
custom_headers_env = ENV["ANTHROPIC_CUSTOM_HEADERS"]
|
|
249
|
+
unless custom_headers_env.nil?
|
|
250
|
+
parsed = {}
|
|
251
|
+
custom_headers_env.split("\n").each do |line|
|
|
252
|
+
colon = line.index(":")
|
|
253
|
+
unless colon.nil?
|
|
254
|
+
parsed[line[0...colon].strip] = line[(colon + 1)..].strip
|
|
255
|
+
end
|
|
256
|
+
end
|
|
257
|
+
headers = parsed.merge(headers)
|
|
258
|
+
end
|
|
259
|
+
headers = headers.merge(credential_headers)
|
|
260
|
+
@webhook_key = webhook_key&.to_s
|
|
125
261
|
|
|
126
262
|
super(
|
|
127
263
|
base_url: base_url,
|
|
@@ -137,5 +273,38 @@ module Anthropic
|
|
|
137
273
|
@models = Anthropic::Resources::Models.new(client: self)
|
|
138
274
|
@beta = Anthropic::Resources::Beta.new(client: self)
|
|
139
275
|
end
|
|
276
|
+
|
|
277
|
+
# @api private
|
|
278
|
+
#
|
|
279
|
+
# @param status [Integer]
|
|
280
|
+
# @param headers [Hash{String=>String}]
|
|
281
|
+
#
|
|
282
|
+
# @return [Boolean]
|
|
283
|
+
def retry_request?(status, headers:)
|
|
284
|
+
if status == 401 && @token_cache
|
|
285
|
+
@token_cache.invalidate
|
|
286
|
+
return true
|
|
287
|
+
end
|
|
288
|
+
super
|
|
289
|
+
end
|
|
290
|
+
|
|
291
|
+
private
|
|
292
|
+
|
|
293
|
+
def warn_explicit_shadow(api_key:, auth_token:, credentials:)
|
|
294
|
+
return if credentials.nil?
|
|
295
|
+
|
|
296
|
+
Anthropic.warn_explicit_static_shadows_credentials("api_key") if api_key
|
|
297
|
+
Anthropic.warn_explicit_static_shadows_credentials("auth_token") if auth_token
|
|
298
|
+
end
|
|
299
|
+
|
|
300
|
+
def warn_env_shadow(api_key:, auth_token:)
|
|
301
|
+
return unless Anthropic::Credentials.auto_discoverable_credentials?
|
|
302
|
+
|
|
303
|
+
if api_key && ENV["ANTHROPIC_API_KEY"]
|
|
304
|
+
Anthropic.warn_env_static_shadows_auto_discovery("ANTHROPIC_API_KEY")
|
|
305
|
+
end
|
|
306
|
+
return unless auth_token && ENV["ANTHROPIC_AUTH_TOKEN"]
|
|
307
|
+
Anthropic.warn_env_static_shadows_auto_discovery("ANTHROPIC_AUTH_TOKEN")
|
|
308
|
+
end
|
|
140
309
|
end
|
|
141
310
|
end
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Anthropic
|
|
4
|
+
module Credentials
|
|
5
|
+
# An Anthropic API access token with optional expiry.
|
|
6
|
+
#
|
|
7
|
+
# This is a frozen value object representing an access token and its
|
|
8
|
+
# expiration time. The +expires_at+ is a Unix timestamp in seconds;
|
|
9
|
+
# +nil+ means no expiry information (the token will be treated as
|
|
10
|
+
# never-expires by {TokenCache}).
|
|
11
|
+
class AccessToken
|
|
12
|
+
# @return [String] the access token string
|
|
13
|
+
attr_reader :token
|
|
14
|
+
|
|
15
|
+
# @return [Integer, nil] Unix timestamp in seconds when the token expires,
|
|
16
|
+
# or +nil+ if the token never expires
|
|
17
|
+
attr_reader :expires_at
|
|
18
|
+
|
|
19
|
+
# @param token [String] the access token string
|
|
20
|
+
# @param expires_at [Integer, nil] Unix timestamp in seconds, or +nil+ for no expiry
|
|
21
|
+
def initialize(token:, expires_at: nil)
|
|
22
|
+
@token = token
|
|
23
|
+
@expires_at = expires_at
|
|
24
|
+
freeze
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# @return [Integer] hash code for the token
|
|
28
|
+
def hash
|
|
29
|
+
[token, expires_at].hash
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def ==(other)
|
|
33
|
+
return false unless other.is_a?(AccessToken)
|
|
34
|
+
token == other.token && expires_at == other.expires_at
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
alias_method :eql?, :==
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "pathname"
|
|
4
|
+
require "uri"
|
|
5
|
+
|
|
6
|
+
module Anthropic
|
|
7
|
+
module Config
|
|
8
|
+
class << self
|
|
9
|
+
def config_file_path(profile)
|
|
10
|
+
validate_profile_name!(profile)
|
|
11
|
+
Anthropic::Credentials.config_file_path(profile)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def credentials_file_path(profile)
|
|
15
|
+
validate_profile_name!(profile)
|
|
16
|
+
Anthropic::Credentials.config_dir.join("credentials", "#{profile}.json")
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def active_profile
|
|
20
|
+
profile = Anthropic::Credentials.active_profile
|
|
21
|
+
validate_profile_name!(profile)
|
|
22
|
+
profile
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def active_profile_config?
|
|
26
|
+
config_file_path(active_profile).file?
|
|
27
|
+
rescue Anthropic::Errors::ConfigurationError
|
|
28
|
+
false
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def validate_profile_name!(profile, source: "profile name")
|
|
32
|
+
if profile.nil? || profile.empty?
|
|
33
|
+
raise Anthropic::Errors::ConfigurationError,
|
|
34
|
+
"#{source} must not be empty"
|
|
35
|
+
end
|
|
36
|
+
if profile != profile.strip
|
|
37
|
+
raise Anthropic::Errors::ConfigurationError,
|
|
38
|
+
"#{source} '#{profile}' has leading/trailing whitespace"
|
|
39
|
+
end
|
|
40
|
+
if profile.start_with?(".")
|
|
41
|
+
raise Anthropic::Errors::ConfigurationError,
|
|
42
|
+
"#{source} '#{profile}' must not start with a dot"
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
["/", "\\", File::SEPARATOR].each do |sep|
|
|
46
|
+
next if sep.empty?
|
|
47
|
+
if profile.include?(sep)
|
|
48
|
+
raise Anthropic::Errors::ConfigurationError,
|
|
49
|
+
"#{source} '#{profile}' must not contain path separators"
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
return unless profile.include?("\x00")
|
|
54
|
+
raise Anthropic::Errors::ConfigurationError, "#{source} '#{profile}' must not contain null bytes"
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def require_https!(url, field:)
|
|
58
|
+
begin
|
|
59
|
+
uri = URI.parse(url.to_s)
|
|
60
|
+
rescue URI::InvalidURIError
|
|
61
|
+
raise Anthropic::Errors::ConfigurationError,
|
|
62
|
+
"#{field} is not a valid URL (got '#{url}')"
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
return if uri.scheme == "https"
|
|
66
|
+
return if uri.scheme == "http" && %w[localhost 127.0.0.1 ::1].include?(uri.hostname)
|
|
67
|
+
|
|
68
|
+
raise Anthropic::Errors::ConfigurationError,
|
|
69
|
+
"#{field} must use https (got '#{url}'); the token-exchange endpoint " \
|
|
70
|
+
"carries secret material and cannot be used over cleartext HTTP."
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
end
|