hyperpocket 0.3.3__py3-none-any.whl → 0.3.5__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- hyperpocket/auth/activeloop/README.md +8 -0
- hyperpocket/auth/activeloop/__init__.py +0 -0
- hyperpocket/auth/activeloop/context.py +15 -0
- hyperpocket/auth/activeloop/token_context.py +11 -0
- hyperpocket/auth/activeloop/token_handler.py +92 -0
- hyperpocket/auth/activeloop/token_schema.py +9 -0
- hyperpocket/auth/adobe/README.md +8 -0
- hyperpocket/auth/adobe/__init__.py +0 -0
- hyperpocket/auth/adobe/context.py +15 -0
- hyperpocket/auth/adobe/token_context.py +11 -0
- hyperpocket/auth/adobe/token_handler.py +89 -0
- hyperpocket/auth/adobe/token_schema.py +11 -0
- hyperpocket/auth/affinity/README.md +18 -0
- hyperpocket/auth/affinity/__init__.py +0 -0
- hyperpocket/auth/affinity/context.py +15 -0
- hyperpocket/auth/affinity/token_context.py +11 -0
- hyperpocket/auth/affinity/token_handler.py +92 -0
- hyperpocket/auth/affinity/token_schema.py +11 -0
- hyperpocket/auth/agentql/README.md +8 -0
- hyperpocket/auth/agentql/__init__.py +0 -0
- hyperpocket/auth/agentql/context.py +15 -0
- hyperpocket/auth/agentql/token_context.py +11 -0
- hyperpocket/auth/agentql/token_handler.py +92 -0
- hyperpocket/auth/agentql/token_schema.py +9 -0
- hyperpocket/auth/ahrefs/README.md +8 -0
- hyperpocket/auth/ahrefs/__init__.py +0 -0
- hyperpocket/auth/ahrefs/context.py +15 -0
- hyperpocket/auth/ahrefs/token_context.py +11 -0
- hyperpocket/auth/ahrefs/token_handler.py +89 -0
- hyperpocket/auth/ahrefs/token_schema.py +11 -0
- hyperpocket/auth/airtable/README.md +8 -0
- hyperpocket/auth/airtable/__init__.py +0 -0
- hyperpocket/auth/airtable/context.py +15 -0
- hyperpocket/auth/airtable/token_context.py +11 -0
- hyperpocket/auth/airtable/token_handler.py +92 -0
- hyperpocket/auth/airtable/token_schema.py +11 -0
- hyperpocket/auth/alchemy/README.md +8 -0
- hyperpocket/auth/alchemy/__init__.py +0 -0
- hyperpocket/auth/alchemy/context.py +15 -0
- hyperpocket/auth/alchemy/token_context.py +11 -0
- hyperpocket/auth/alchemy/token_handler.py +92 -0
- hyperpocket/auth/alchemy/token_schema.py +11 -0
- hyperpocket/auth/altoviz/README.md +8 -0
- hyperpocket/auth/altoviz/__init__.py +0 -0
- hyperpocket/auth/altoviz/context.py +15 -0
- hyperpocket/auth/altoviz/token_context.py +11 -0
- hyperpocket/auth/altoviz/token_handler.py +92 -0
- hyperpocket/auth/altoviz/token_schema.py +11 -0
- hyperpocket/auth/apitoken/README.md +28 -0
- hyperpocket/auth/apitoken/__init__.py +0 -0
- hyperpocket/auth/apitoken/context.py +15 -0
- hyperpocket/auth/apitoken/token_context.py +12 -0
- hyperpocket/auth/apitoken/token_handler.py +89 -0
- hyperpocket/auth/apitoken/token_schema.py +9 -0
- hyperpocket/auth/asana/README.md +13 -0
- hyperpocket/auth/asana/__init__.py +0 -0
- hyperpocket/auth/asana/context.py +15 -0
- hyperpocket/auth/asana/oauth2_context.py +36 -0
- hyperpocket/auth/asana/oauth2_handler.py +158 -0
- hyperpocket/auth/asana/oauth2_schema.py +18 -0
- hyperpocket/auth/bamboohr/README.md +9 -0
- hyperpocket/auth/bamboohr/__init__.py +0 -0
- hyperpocket/auth/bamboohr/context.py +15 -0
- hyperpocket/auth/bamboohr/token_context.py +11 -0
- hyperpocket/auth/bamboohr/token_handler.py +92 -0
- hyperpocket/auth/bamboohr/token_schema.py +11 -0
- hyperpocket/auth/bitbucket/README.md +13 -0
- hyperpocket/auth/bitbucket/__init__.py +0 -0
- hyperpocket/auth/bitbucket/context.py +15 -0
- hyperpocket/auth/bitbucket/oauth2_context.py +33 -0
- hyperpocket/auth/bitbucket/oauth2_handler.py +146 -0
- hyperpocket/auth/bitbucket/oauth2_schema.py +18 -0
- hyperpocket/auth/bitwarden/README.md +9 -0
- hyperpocket/auth/bitwarden/__init__.py +0 -0
- hyperpocket/auth/bitwarden/context.py +15 -0
- hyperpocket/auth/bitwarden/token_context.py +11 -0
- hyperpocket/auth/bitwarden/token_handler.py +92 -0
- hyperpocket/auth/bitwarden/token_schema.py +11 -0
- hyperpocket/auth/brevo/README.md +9 -0
- hyperpocket/auth/brevo/__init__.py +0 -0
- hyperpocket/auth/brevo/context.py +15 -0
- hyperpocket/auth/brevo/token_context.py +11 -0
- hyperpocket/auth/brevo/token_handler.py +89 -0
- hyperpocket/auth/brevo/token_schema.py +11 -0
- hyperpocket/auth/brex/README.md +9 -0
- hyperpocket/auth/brex/__init__.py +0 -0
- hyperpocket/auth/brex/context.py +15 -0
- hyperpocket/auth/brex/token_context.py +11 -0
- hyperpocket/auth/brex/token_handler.py +87 -0
- hyperpocket/auth/brex/token_schema.py +11 -0
- hyperpocket/auth/cal/README.md +9 -0
- hyperpocket/auth/cal/__init__.py +0 -0
- hyperpocket/auth/cal/context.py +15 -0
- hyperpocket/auth/cal/token_context.py +11 -0
- hyperpocket/auth/cal/token_handler.py +85 -0
- hyperpocket/auth/cal/token_schema.py +11 -0
- hyperpocket/auth/calendly/README.md +13 -0
- hyperpocket/auth/canvas/README.md +9 -0
- hyperpocket/auth/canvas/__init__.py +0 -0
- hyperpocket/auth/canvas/context.py +15 -0
- hyperpocket/auth/canvas/token_context.py +11 -0
- hyperpocket/auth/canvas/token_handler.py +89 -0
- hyperpocket/auth/canvas/token_schema.py +11 -0
- hyperpocket/auth/clickup/README.md +9 -0
- hyperpocket/auth/clickup/__init__.py +0 -0
- hyperpocket/auth/clickup/context.py +15 -0
- hyperpocket/auth/clickup/token_context.py +11 -0
- hyperpocket/auth/clickup/token_handler.py +92 -0
- hyperpocket/auth/clickup/token_schema.py +11 -0
- hyperpocket/auth/cloudflare/README.md +9 -0
- hyperpocket/auth/cloudflare/__init__.py +0 -0
- hyperpocket/auth/cloudflare/context.py +15 -0
- hyperpocket/auth/cloudflare/token_context.py +11 -0
- hyperpocket/auth/cloudflare/token_handler.py +92 -0
- hyperpocket/auth/cloudflare/token_schema.py +11 -0
- hyperpocket/auth/dailybot/README.md +9 -0
- hyperpocket/auth/dailybot/__init__.py +0 -0
- hyperpocket/auth/dailybot/context.py +15 -0
- hyperpocket/auth/dailybot/token_context.py +11 -0
- hyperpocket/auth/dailybot/token_handler.py +92 -0
- hyperpocket/auth/dailybot/token_schema.py +11 -0
- hyperpocket/auth/datadog/README.md +9 -0
- hyperpocket/auth/datadog/__init__.py +0 -0
- hyperpocket/auth/datadog/context.py +15 -0
- hyperpocket/auth/datadog/token_context.py +11 -0
- hyperpocket/auth/datadog/token_handler.py +92 -0
- hyperpocket/auth/datadog/token_schema.py +11 -0
- hyperpocket/auth/discord/README.md +14 -0
- hyperpocket/auth/discord/__init__.py +0 -0
- hyperpocket/auth/discord/context.py +15 -0
- hyperpocket/auth/discord/oauth2_context.py +35 -0
- hyperpocket/auth/discord/oauth2_handler.py +133 -0
- hyperpocket/auth/discord/oauth2_schema.py +18 -0
- hyperpocket/auth/discord/token_context.py +11 -0
- hyperpocket/auth/discord/token_handler.py +92 -0
- hyperpocket/auth/discord/token_schema.py +11 -0
- hyperpocket/auth/discordbot/README.md +14 -0
- hyperpocket/auth/discordbot/__init__.py +0 -0
- hyperpocket/auth/discordbot/context.py +15 -0
- hyperpocket/auth/discordbot/token_context.py +11 -0
- hyperpocket/auth/discordbot/token_handler.py +92 -0
- hyperpocket/auth/discordbot/token_schema.py +11 -0
- hyperpocket/auth/elevenlabs/README.md +9 -0
- hyperpocket/auth/elevenlabs/__init__.py +0 -0
- hyperpocket/auth/elevenlabs/context.py +15 -0
- hyperpocket/auth/elevenlabs/token_context.py +11 -0
- hyperpocket/auth/elevenlabs/token_handler.py +92 -0
- hyperpocket/auth/elevenlabs/token_schema.py +11 -0
- hyperpocket/auth/exa/README.md +9 -0
- hyperpocket/auth/exa/__init__.py +0 -0
- hyperpocket/auth/exa/context.py +15 -0
- hyperpocket/auth/exa/token_context.py +11 -0
- hyperpocket/auth/exa/token_handler.py +85 -0
- hyperpocket/auth/exa/token_schema.py +11 -0
- hyperpocket/auth/facebook/README.md +13 -0
- hyperpocket/auth/facebook/__init__.py +0 -0
- hyperpocket/auth/facebook/context.py +15 -0
- hyperpocket/auth/facebook/oauth2_context.py +33 -0
- hyperpocket/auth/facebook/oauth2_handler.py +134 -0
- hyperpocket/auth/facebook/oauth2_schema.py +17 -0
- hyperpocket/auth/finage/README.md +9 -0
- hyperpocket/auth/finage/__init__.py +0 -0
- hyperpocket/auth/finage/context.py +15 -0
- hyperpocket/auth/finage/token_context.py +11 -0
- hyperpocket/auth/finage/token_handler.py +89 -0
- hyperpocket/auth/finage/token_schema.py +11 -0
- hyperpocket/auth/github/README.md +14 -0
- hyperpocket/auth/google/README.md +13 -0
- hyperpocket/auth/gumloop/README.md +9 -0
- hyperpocket/auth/happyrobot/README.md +9 -0
- hyperpocket/auth/happyrobot/__init__.py +0 -0
- hyperpocket/auth/happyrobot/context.py +15 -0
- hyperpocket/auth/happyrobot/token_context.py +11 -0
- hyperpocket/auth/happyrobot/token_handler.py +92 -0
- hyperpocket/auth/happyrobot/token_schema.py +9 -0
- hyperpocket/auth/heygen/README.md +9 -0
- hyperpocket/auth/heygen/__init__.py +0 -0
- hyperpocket/auth/heygen/context.py +15 -0
- hyperpocket/auth/heygen/token_context.py +11 -0
- hyperpocket/auth/heygen/token_handler.py +89 -0
- hyperpocket/auth/heygen/token_schema.py +11 -0
- hyperpocket/auth/hubspot/README.md +14 -0
- hyperpocket/auth/hubspot/__init__.py +0 -0
- hyperpocket/auth/hubspot/context.py +15 -0
- hyperpocket/auth/hubspot/oauth2_context.py +35 -0
- hyperpocket/auth/hubspot/oauth2_handler.py +142 -0
- hyperpocket/auth/hubspot/oauth2_schema.py +17 -0
- hyperpocket/auth/hubspot/token_context.py +11 -0
- hyperpocket/auth/hubspot/token_handler.py +92 -0
- hyperpocket/auth/hubspot/token_schema.py +11 -0
- hyperpocket/auth/jira/README.md +14 -0
- hyperpocket/auth/jira/__init__.py +0 -0
- hyperpocket/auth/jira/context.py +15 -0
- hyperpocket/auth/jira/oauth2_context.py +35 -0
- hyperpocket/auth/jira/oauth2_handler.py +135 -0
- hyperpocket/auth/jira/oauth2_schema.py +17 -0
- hyperpocket/auth/jira/token_context.py +11 -0
- hyperpocket/auth/jira/token_handler.py +87 -0
- hyperpocket/auth/jira/token_schema.py +11 -0
- hyperpocket/auth/klaviyo/README.md +10 -0
- hyperpocket/auth/klaviyo/__init__.py +0 -0
- hyperpocket/auth/klaviyo/context.py +15 -0
- hyperpocket/auth/klaviyo/token_context.py +11 -0
- hyperpocket/auth/klaviyo/token_handler.py +92 -0
- hyperpocket/auth/klaviyo/token_schema.py +11 -0
- hyperpocket/auth/lever/README.md +9 -0
- hyperpocket/auth/lever/__init__.py +0 -0
- hyperpocket/auth/lever/context.py +15 -0
- hyperpocket/auth/lever/token_context.py +11 -0
- hyperpocket/auth/lever/token_handler.py +89 -0
- hyperpocket/auth/lever/token_schema.py +11 -0
- hyperpocket/auth/lever_sandbox/README.md +9 -0
- hyperpocket/auth/lever_sandbox/__init__.py +0 -0
- hyperpocket/auth/lever_sandbox/context.py +15 -0
- hyperpocket/auth/lever_sandbox/token_context.py +11 -0
- hyperpocket/auth/lever_sandbox/token_handler.py +94 -0
- hyperpocket/auth/lever_sandbox/token_schema.py +11 -0
- hyperpocket/auth/linear/README.md +17 -0
- hyperpocket/auth/linear/context.py +1 -1
- hyperpocket/auth/linear/oauth2_context.py +33 -0
- hyperpocket/auth/linear/oauth2_handler.py +155 -0
- hyperpocket/auth/linear/oauth2_schema.py +17 -0
- hyperpocket/auth/linkedin/README.md +16 -0
- hyperpocket/auth/linkedin/__init__.py +0 -0
- hyperpocket/auth/linkedin/context.py +15 -0
- hyperpocket/auth/linkedin/oauth2_context.py +33 -0
- hyperpocket/auth/linkedin/oauth2_handler.py +154 -0
- hyperpocket/auth/linkedin/oauth2_schema.py +18 -0
- hyperpocket/auth/listennotes/README.md +12 -0
- hyperpocket/auth/listennotes/__init__.py +0 -0
- hyperpocket/auth/listennotes/context.py +15 -0
- hyperpocket/auth/listennotes/token_context.py +11 -0
- hyperpocket/auth/listennotes/token_handler.py +92 -0
- hyperpocket/auth/listennotes/token_schema.py +11 -0
- hyperpocket/auth/mailchimp/README.md +16 -0
- hyperpocket/auth/mailchimp/__init__.py +0 -0
- hyperpocket/auth/mailchimp/context.py +15 -0
- hyperpocket/auth/mailchimp/oauth2_context.py +33 -0
- hyperpocket/auth/mailchimp/oauth2_handler.py +153 -0
- hyperpocket/auth/mailchimp/oauth2_schema.py +17 -0
- hyperpocket/auth/mem0/README.md +11 -0
- hyperpocket/auth/mem0/__init__.py +0 -0
- hyperpocket/auth/mem0/context.py +15 -0
- hyperpocket/auth/mem0/token_context.py +11 -0
- hyperpocket/auth/mem0/token_handler.py +87 -0
- hyperpocket/auth/mem0/token_schema.py +11 -0
- hyperpocket/auth/microsoft_clarity/README.md +12 -0
- hyperpocket/auth/microsoft_clarity/__init__.py +0 -0
- hyperpocket/auth/microsoft_clarity/context.py +15 -0
- hyperpocket/auth/microsoft_clarity/token_context.py +15 -0
- hyperpocket/auth/microsoft_clarity/token_handler.py +102 -0
- hyperpocket/auth/microsoft_clarity/token_schema.py +11 -0
- hyperpocket/auth/neon/README.md +11 -0
- hyperpocket/auth/neon/__init__.py +0 -0
- hyperpocket/auth/neon/context.py +15 -0
- hyperpocket/auth/neon/token_context.py +11 -0
- hyperpocket/auth/neon/token_handler.py +87 -0
- hyperpocket/auth/neon/token_schema.py +11 -0
- hyperpocket/auth/ngrok/README.md +12 -0
- hyperpocket/auth/ngrok/__init__.py +0 -0
- hyperpocket/auth/ngrok/context.py +15 -0
- hyperpocket/auth/ngrok/token_context.py +11 -0
- hyperpocket/auth/ngrok/token_handler.py +89 -0
- hyperpocket/auth/ngrok/token_schema.py +11 -0
- hyperpocket/auth/notion/README.md +10 -20
- hyperpocket/auth/notion/oauth2_context.py +33 -0
- hyperpocket/auth/notion/oauth2_handler.py +152 -0
- hyperpocket/auth/notion/oauth2_schema.py +22 -0
- hyperpocket/auth/oncehub/README.md +11 -0
- hyperpocket/auth/oncehub/__init__.py +0 -0
- hyperpocket/auth/oncehub/context.py +15 -0
- hyperpocket/auth/oncehub/token_context.py +11 -0
- hyperpocket/auth/oncehub/token_handler.py +92 -0
- hyperpocket/auth/oncehub/token_schema.py +11 -0
- hyperpocket/auth/pagerduty/README.md +12 -0
- hyperpocket/auth/pagerduty/__init__.py +0 -0
- hyperpocket/auth/pagerduty/context.py +15 -0
- hyperpocket/auth/pagerduty/token_context.py +11 -0
- hyperpocket/auth/pagerduty/token_handler.py +92 -0
- hyperpocket/auth/pagerduty/token_schema.py +11 -0
- hyperpocket/auth/pandadoc/README.md +12 -0
- hyperpocket/auth/pandadoc/__init__.py +0 -0
- hyperpocket/auth/pandadoc/context.py +15 -0
- hyperpocket/auth/pandadoc/token_context.py +11 -0
- hyperpocket/auth/pandadoc/token_handler.py +92 -0
- hyperpocket/auth/pandadoc/token_schema.py +11 -0
- hyperpocket/auth/pipedrive/README.md +12 -0
- hyperpocket/auth/pipedrive/__init__.py +0 -0
- hyperpocket/auth/pipedrive/context.py +15 -0
- hyperpocket/auth/pipedrive/token_context.py +11 -0
- hyperpocket/auth/pipedrive/token_handler.py +92 -0
- hyperpocket/auth/pipedrive/token_schema.py +11 -0
- hyperpocket/auth/posthog/README.md +12 -0
- hyperpocket/auth/posthog/__init__.py +0 -0
- hyperpocket/auth/posthog/context.py +15 -0
- hyperpocket/auth/posthog/token_context.py +11 -0
- hyperpocket/auth/posthog/token_handler.py +92 -0
- hyperpocket/auth/posthog/token_schema.py +11 -0
- hyperpocket/auth/provider.py +59 -0
- hyperpocket/auth/ravenseotools/README.md +12 -0
- hyperpocket/auth/ravenseotools/__init__.py +0 -0
- hyperpocket/auth/ravenseotools/context.py +15 -0
- hyperpocket/auth/ravenseotools/token_context.py +11 -0
- hyperpocket/auth/ravenseotools/token_handler.py +94 -0
- hyperpocket/auth/ravenseotools/token_schema.py +11 -0
- hyperpocket/auth/reddit/README.md +16 -0
- hyperpocket/auth/salesforce/README.md +16 -0
- hyperpocket/auth/salesforce/__init__.py +0 -0
- hyperpocket/auth/salesforce/context.py +15 -0
- hyperpocket/auth/salesforce/oauth2_context.py +33 -0
- hyperpocket/auth/salesforce/oauth2_handler.py +136 -0
- hyperpocket/auth/salesforce/oauth2_schema.py +21 -0
- hyperpocket/auth/sendgrid/README.md +12 -0
- hyperpocket/auth/sendgrid/__init__.py +0 -0
- hyperpocket/auth/sendgrid/context.py +15 -0
- hyperpocket/auth/sendgrid/token_context.py +11 -0
- hyperpocket/auth/sendgrid/token_handler.py +92 -0
- hyperpocket/auth/sendgrid/token_schema.py +11 -0
- hyperpocket/auth/serpapi/README.md +13 -0
- hyperpocket/auth/serpapi/__init__.py +0 -0
- hyperpocket/auth/serpapi/context.py +15 -0
- hyperpocket/auth/serpapi/token_context.py +11 -0
- hyperpocket/auth/serpapi/token_handler.py +96 -0
- hyperpocket/auth/serpapi/token_schema.py +11 -0
- hyperpocket/auth/slack/README.md +17 -0
- hyperpocket/auth/spotify/README.md +15 -0
- hyperpocket/auth/spotify/__init__.py +0 -0
- hyperpocket/auth/spotify/context.py +15 -0
- hyperpocket/auth/spotify/oauth2_context.py +33 -0
- hyperpocket/auth/spotify/oauth2_handler.py +163 -0
- hyperpocket/auth/spotify/oauth2_schema.py +18 -0
- hyperpocket/auth/stripe/README.md +12 -0
- hyperpocket/auth/stripe/__init__.py +0 -0
- hyperpocket/auth/stripe/context.py +15 -0
- hyperpocket/auth/stripe/token_context.py +11 -0
- hyperpocket/auth/stripe/token_handler.py +89 -0
- hyperpocket/auth/stripe/token_schema.py +11 -0
- hyperpocket/auth/supabase/README.md +11 -0
- hyperpocket/auth/supabase/__init__.py +0 -0
- hyperpocket/auth/supabase/context.py +15 -0
- hyperpocket/auth/supabase/token_context.py +11 -0
- hyperpocket/auth/supabase/token_handler.py +92 -0
- hyperpocket/auth/supabase/token_schema.py +11 -0
- hyperpocket/auth/tavily/README.md +11 -0
- hyperpocket/auth/tavily/__init__.py +0 -0
- hyperpocket/auth/tavily/context.py +15 -0
- hyperpocket/auth/tavily/token_context.py +11 -0
- hyperpocket/auth/tavily/token_handler.py +89 -0
- hyperpocket/auth/tavily/token_schema.py +11 -0
- hyperpocket/auth/timekit/README.md +11 -0
- hyperpocket/auth/timekit/__init__.py +0 -0
- hyperpocket/auth/timekit/context.py +15 -0
- hyperpocket/auth/timekit/token_context.py +11 -0
- hyperpocket/auth/timekit/token_handler.py +92 -0
- hyperpocket/auth/timekit/token_schema.py +11 -0
- hyperpocket/auth/trello/README.md +12 -0
- hyperpocket/auth/trello/__init__.py +0 -0
- hyperpocket/auth/trello/context.py +15 -0
- hyperpocket/auth/trello/token_context.py +11 -0
- hyperpocket/auth/trello/token_handler.py +89 -0
- hyperpocket/auth/trello/token_schema.py +11 -0
- hyperpocket/auth/wandb/README.md +11 -0
- hyperpocket/auth/wandb/__init__.py +0 -0
- hyperpocket/auth/wandb/context.py +15 -0
- hyperpocket/auth/wandb/token_context.py +11 -0
- hyperpocket/auth/wandb/token_handler.py +89 -0
- hyperpocket/auth/wandb/token_schema.py +9 -0
- hyperpocket/auth/workiom/README.md +12 -0
- hyperpocket/auth/workiom/__init__.py +0 -0
- hyperpocket/auth/workiom/context.py +15 -0
- hyperpocket/auth/workiom/token_context.py +11 -0
- hyperpocket/auth/workiom/token_handler.py +92 -0
- hyperpocket/auth/workiom/token_schema.py +11 -0
- hyperpocket/auth/x/README.md +15 -0
- hyperpocket/auth/zoom/README.md +16 -0
- hyperpocket/auth/zoom/__init__.py +0 -0
- hyperpocket/auth/zoom/context.py +15 -0
- hyperpocket/auth/zoom/oauth2_context.py +33 -0
- hyperpocket/auth/zoom/oauth2_handler.py +153 -0
- hyperpocket/auth/zoom/oauth2_schema.py +19 -0
- hyperpocket/cli/__main__.py +4 -1
- hyperpocket/cli/auth_oauth2.py +79 -38
- hyperpocket/cli/auth_token.py +28 -16
- hyperpocket/cli/codegen/auth/__init__.py +4 -1
- hyperpocket/cli/codegen/auth/auth_context_template.py +1 -1
- hyperpocket/cli/codegen/auth/auth_oauth2_context_template.py +5 -4
- hyperpocket/cli/codegen/auth/auth_oauth2_handler_template.py +20 -45
- hyperpocket/cli/codegen/auth/auth_oauth2_schema_template.py +4 -3
- hyperpocket/cli/codegen/auth/auth_token_context_template.py +6 -6
- hyperpocket/cli/codegen/auth/auth_token_handler_template.py +14 -14
- hyperpocket/cli/codegen/auth/auth_token_schema_template.py +3 -3
- hyperpocket/cli/codegen/auth/server_auth_template.py +20 -5
- hyperpocket/cli/codegen/tool/__init__.py +1 -1
- hyperpocket/cli/codegen/tool/tool_main_template.py +1 -0
- hyperpocket/cli/{tool.py → tool_create.py} +24 -19
- hyperpocket/cli/tool_export.py +240 -0
- hyperpocket/config/auth.py +78 -13
- hyperpocket/pocket_core.py +5 -3
- hyperpocket/server/auth/activeloop.py +25 -0
- hyperpocket/server/auth/adobe.py +14 -0
- hyperpocket/server/auth/affinity.py +14 -0
- hyperpocket/server/auth/agentql.py +25 -0
- hyperpocket/server/auth/ahrefs.py +14 -0
- hyperpocket/server/auth/airtable.py +14 -0
- hyperpocket/server/auth/alchemy.py +14 -0
- hyperpocket/server/auth/altoviz.py +14 -0
- hyperpocket/server/auth/apitoken.py +16 -0
- hyperpocket/server/auth/asana.py +25 -0
- hyperpocket/server/auth/bamboohr.py +14 -0
- hyperpocket/server/auth/bitbucket.py +25 -0
- hyperpocket/server/auth/bitwarden.py +14 -0
- hyperpocket/server/auth/brevo.py +14 -0
- hyperpocket/server/auth/brex.py +14 -0
- hyperpocket/server/auth/cal.py +14 -0
- hyperpocket/server/auth/canvas.py +14 -0
- hyperpocket/server/auth/clickup.py +14 -0
- hyperpocket/server/auth/cloudflare.py +14 -0
- hyperpocket/server/auth/dailybot.py +14 -0
- hyperpocket/server/auth/datadog.py +14 -0
- hyperpocket/server/auth/discord.py +25 -0
- hyperpocket/server/auth/discordbot.py +14 -0
- hyperpocket/server/auth/elevenlabs.py +14 -0
- hyperpocket/server/auth/exa.py +14 -0
- hyperpocket/server/auth/facebook.py +25 -0
- hyperpocket/server/auth/finage.py +14 -0
- hyperpocket/server/auth/happyrobot.py +26 -0
- hyperpocket/server/auth/heygen.py +14 -0
- hyperpocket/server/auth/hubspot.py +26 -0
- hyperpocket/server/auth/jira.py +25 -0
- hyperpocket/server/auth/klaviyo.py +14 -0
- hyperpocket/server/auth/lever.py +14 -0
- hyperpocket/server/auth/lever_sandbox.py +14 -0
- hyperpocket/server/auth/linear.py +21 -2
- hyperpocket/server/auth/linkedin.py +25 -0
- hyperpocket/server/auth/listennotes.py +14 -0
- hyperpocket/server/auth/mailchimp.py +25 -0
- hyperpocket/server/auth/mem0.py +14 -0
- hyperpocket/server/auth/microsoft_clarity.py +14 -0
- hyperpocket/server/auth/neon.py +14 -0
- hyperpocket/server/auth/ngrok.py +14 -0
- hyperpocket/server/auth/notion.py +20 -1
- hyperpocket/server/auth/oncehub.py +14 -0
- hyperpocket/server/auth/pagerduty.py +14 -0
- hyperpocket/server/auth/pandadoc.py +14 -0
- hyperpocket/server/auth/pipedrive.py +14 -0
- hyperpocket/server/auth/posthog.py +14 -0
- hyperpocket/server/auth/ravenseotools.py +14 -0
- hyperpocket/server/auth/salesforce.py +25 -0
- hyperpocket/server/auth/sendgrid.py +14 -0
- hyperpocket/server/auth/serpapi.py +14 -0
- hyperpocket/server/auth/spotify.py +25 -0
- hyperpocket/server/auth/stripe.py +14 -0
- hyperpocket/server/auth/supabase.py +14 -0
- hyperpocket/server/auth/tavily.py +14 -0
- hyperpocket/server/auth/timekit.py +14 -0
- hyperpocket/server/auth/trello.py +14 -0
- hyperpocket/server/auth/wandb.py +25 -0
- hyperpocket/server/auth/workiom.py +14 -0
- hyperpocket/server/auth/zoom.py +25 -0
- hyperpocket/server/server.py +9 -6
- {hyperpocket-0.3.3.dist-info → hyperpocket-0.3.5.dist-info}/METADATA +1 -1
- hyperpocket-0.3.5.dist-info/RECORD +587 -0
- hyperpocket-0.3.3.dist-info/RECORD +0 -150
- {hyperpocket-0.3.3.dist-info → hyperpocket-0.3.5.dist-info}/WHEEL +0 -0
- {hyperpocket-0.3.3.dist-info → hyperpocket-0.3.5.dist-info}/entry_points.txt +0 -0
@@ -2,13 +2,13 @@ from jinja2 import Template
|
|
2
2
|
|
3
3
|
|
4
4
|
def get_auth_token_context_template() -> Template:
|
5
|
-
return Template("""
|
6
|
-
from hyperpocket.auth.{{ service_name }}.context import {{
|
7
|
-
from hyperpocket.auth.{{ service_name }}.token_schema import {{
|
8
|
-
class {{
|
5
|
+
return Template("""\
|
6
|
+
from hyperpocket.auth.{{ service_name }}.context import {{ capitalized_service_name }}AuthContext
|
7
|
+
from hyperpocket.auth.{{ service_name }}.token_schema import {{ capitalized_service_name }}TokenResponse
|
8
|
+
class {{ capitalized_service_name }}TokenAuthContext({{ capitalized_service_name }}AuthContext):
|
9
9
|
@classmethod
|
10
|
-
def from_{{ service_name }}_token_response(cls, response: {{
|
11
|
-
description = f'{{
|
10
|
+
def from_{{ service_name }}_token_response(cls, response: {{ capitalized_service_name }}TokenResponse):
|
11
|
+
description = f'{{ capitalized_service_name }} Token Context logged in'
|
12
12
|
return cls(
|
13
13
|
access_token=response.access_token,
|
14
14
|
description=description,
|
@@ -2,22 +2,22 @@ from jinja2 import Template
|
|
2
2
|
|
3
3
|
|
4
4
|
def get_auth_token_handler_template() -> Template:
|
5
|
-
return Template("""
|
5
|
+
return Template("""\
|
6
6
|
from typing import Optional
|
7
7
|
from urllib.parse import urljoin, urlencode
|
8
8
|
|
9
9
|
from hyperpocket.auth import AuthProvider
|
10
10
|
from hyperpocket.auth.context import AuthContext
|
11
11
|
from hyperpocket.auth.handler import AuthHandlerInterface, AuthenticateRequest
|
12
|
-
from hyperpocket.auth.{{ service_name }}.token_context import {{
|
13
|
-
from hyperpocket.auth.{{ service_name }}.token_schema import {{
|
12
|
+
from hyperpocket.auth.{{ service_name }}.token_context import {{ capitalized_service_name }}TokenAuthContext
|
13
|
+
from hyperpocket.auth.{{ service_name }}.token_schema import {{ capitalized_service_name }}TokenResponse, {{ capitalized_service_name }}TokenRequest
|
14
14
|
from hyperpocket.config import config
|
15
15
|
from hyperpocket.futures import FutureStore
|
16
16
|
|
17
17
|
|
18
|
-
class {{
|
18
|
+
class {{ capitalized_service_name }}TokenAuthHandler(AuthHandlerInterface):
|
19
19
|
name: str = "{{ auth_handler_name }}-token"
|
20
|
-
description: str = "This handler is used to authenticate users using the {{
|
20
|
+
description: str = "This handler is used to authenticate users using the {{ capitalized_service_name }} token."
|
21
21
|
scoped: bool = False
|
22
22
|
|
23
23
|
_TOKEN_URL: str = urljoin(config().public_base_url + "/", f"{config().callback_url_rewrite_prefix}/auth/token")
|
@@ -30,7 +30,7 @@ class {{ caplitalized_service_name }}TokenAuthHandler(AuthHandlerInterface):
|
|
30
30
|
def recommended_scopes() -> set[str]:
|
31
31
|
return set()
|
32
32
|
|
33
|
-
def prepare(self, auth_req: {{
|
33
|
+
def prepare(self, auth_req: {{ capitalized_service_name }}TokenRequest, thread_id: str, profile: str,
|
34
34
|
future_uid: str, *args, **kwargs) -> str:
|
35
35
|
redirect_uri = urljoin(
|
36
36
|
config().public_base_url + "/",
|
@@ -45,19 +45,19 @@ class {{ caplitalized_service_name }}TokenAuthHandler(AuthHandlerInterface):
|
|
45
45
|
|
46
46
|
return f'User needs to authenticate using the following URL: {url}'
|
47
47
|
|
48
|
-
async def authenticate(self, auth_req: {{
|
48
|
+
async def authenticate(self, auth_req: {{ capitalized_service_name }}TokenRequest, future_uid: str, *args, **kwargs) -> AuthContext:
|
49
49
|
future_data = FutureStore.get_future(future_uid)
|
50
50
|
access_token = await future_data.future
|
51
51
|
|
52
|
-
response = {{
|
53
|
-
context = {{
|
52
|
+
response = {{ capitalized_service_name }}TokenResponse(access_token=access_token)
|
53
|
+
context = {{ capitalized_service_name }}TokenAuthContext.from_{{ service_name }}_token_response(response)
|
54
54
|
|
55
55
|
return context
|
56
56
|
|
57
|
-
async def refresh(self, auth_req: {{
|
58
|
-
raise Exception("{{
|
57
|
+
async def refresh(self, auth_req: {{ capitalized_service_name }}TokenRequest, context: AuthContext, *args, **kwargs) -> AuthContext:
|
58
|
+
raise Exception("{{ capitalized_service_name }} token doesn't support refresh")
|
59
59
|
|
60
|
-
def _make_auth_url(self, auth_req: {{
|
60
|
+
def _make_auth_url(self, auth_req: {{ capitalized_service_name }}TokenRequest, redirect_uri: str, state: str):
|
61
61
|
params = {
|
62
62
|
"redirect_uri": redirect_uri,
|
63
63
|
"state": state,
|
@@ -65,6 +65,6 @@ class {{ caplitalized_service_name }}TokenAuthHandler(AuthHandlerInterface):
|
|
65
65
|
auth_url = f"{self._TOKEN_URL}?{urlencode(params)}"
|
66
66
|
return auth_url
|
67
67
|
|
68
|
-
def make_request(self, auth_scopes: Optional[list[str]] = None, **kwargs) -> {{
|
69
|
-
return {{
|
68
|
+
def make_request(self, auth_scopes: Optional[list[str]] = None, **kwargs) -> {{ capitalized_service_name }}TokenRequest:
|
69
|
+
return {{ capitalized_service_name }}TokenRequest()
|
70
70
|
""")
|
@@ -2,12 +2,12 @@ from jinja2 import Template
|
|
2
2
|
|
3
3
|
|
4
4
|
def get_auth_token_schema_template() -> Template:
|
5
|
-
return Template("""
|
5
|
+
return Template("""\
|
6
6
|
from typing import List, Optional
|
7
7
|
from pydantic import BaseModel
|
8
8
|
from hyperpocket.auth.schema import AuthenticateRequest, AuthenticateResponse
|
9
|
-
class {{
|
9
|
+
class {{ capitalized_service_name }}TokenRequest(AuthenticateRequest):
|
10
10
|
pass
|
11
|
-
class {{
|
11
|
+
class {{ capitalized_service_name }}TokenResponse(AuthenticateResponse):
|
12
12
|
access_token: str
|
13
13
|
""")
|
@@ -2,24 +2,39 @@ from jinja2 import Template
|
|
2
2
|
|
3
3
|
|
4
4
|
def get_server_auth_token_template() -> Template:
|
5
|
-
return Template(
|
5
|
+
return Template("""\
|
6
6
|
from fastapi import APIRouter
|
7
7
|
from starlette.responses import HTMLResponse
|
8
8
|
from hyperpocket.futures import FutureStore
|
9
|
+
|
9
10
|
{{ service_name }}_auth_router = APIRouter(
|
10
11
|
prefix="/{{ service_name }}"
|
11
12
|
)
|
13
|
+
|
14
|
+
|
15
|
+
@{{ service_name }}_auth_router.get("/oauth2/callback")
|
16
|
+
async def {{ service_name }}_oauth2_callback(state: str, code: str):
|
17
|
+
try:
|
18
|
+
FutureStore.resolve_future(state, code)
|
19
|
+
except ValueError:
|
20
|
+
return HTMLResponse(content="failed")
|
21
|
+
|
22
|
+
return HTMLResponse(content="success")
|
23
|
+
|
24
|
+
|
12
25
|
@{{ service_name }}_auth_router.get("/token/callback")
|
13
26
|
async def {{ service_name }}_token_callback(state: str, token: str):
|
14
27
|
try:
|
15
28
|
FutureStore.resolve_future(state, token)
|
16
29
|
except ValueError:
|
17
30
|
return HTMLResponse(content="failed")
|
31
|
+
|
18
32
|
return HTMLResponse(content="success")
|
19
|
-
|
20
|
-
|
33
|
+
""")
|
34
|
+
|
35
|
+
|
21
36
|
def get_server_auth_oauth2_template() -> Template:
|
22
|
-
return Template(
|
37
|
+
return Template("""\
|
23
38
|
from fastapi import APIRouter
|
24
39
|
from starlette.responses import HTMLResponse
|
25
40
|
from hyperpocket.futures import FutureStore
|
@@ -47,4 +62,4 @@ async def {{ service_name }}_token_callback(state: str, token: str):
|
|
47
62
|
return HTMLResponse(content="failed")
|
48
63
|
|
49
64
|
return HTMLResponse(content="success")
|
50
|
-
|
65
|
+
""")
|
@@ -9,16 +9,20 @@ from hyperpocket.cli.codegen.tool import get_tool_main_template
|
|
9
9
|
|
10
10
|
|
11
11
|
@click.command()
|
12
|
-
@click.argument(
|
12
|
+
@click.argument("tool_name", type=str)
|
13
13
|
def create_tool_template(tool_name, language="python"):
|
14
14
|
"""Create a tool template with the specified tool name."""
|
15
15
|
|
16
16
|
# Validate tool_name
|
17
|
-
if not tool_name.islower() or not tool_name.replace(
|
18
|
-
raise ValueError(
|
17
|
+
if not tool_name.islower() or not tool_name.replace("_", "").isalpha():
|
18
|
+
raise ValueError(
|
19
|
+
"tool_name must be lowercase and contain only letters and underscores"
|
20
|
+
)
|
19
21
|
|
20
|
-
tool_directory_name = tool_name.replace(
|
21
|
-
capitalized_tool_name =
|
22
|
+
tool_directory_name = tool_name.replace("_", "-")
|
23
|
+
capitalized_tool_name = "".join(
|
24
|
+
[word.capitalize() for word in tool_name.split("_")]
|
25
|
+
)
|
22
26
|
|
23
27
|
# Create tool directory
|
24
28
|
print(f"Generating tool package directory for {tool_name}")
|
@@ -37,31 +41,32 @@ def create_tool_template(tool_name, language="python"):
|
|
37
41
|
subprocess.run(["uv", "init"], cwd=tool_path, check=True)
|
38
42
|
os.remove(tool_path / "hello.py")
|
39
43
|
elif shutil.which("poetry"):
|
40
|
-
subprocess.run(
|
44
|
+
subprocess.run(
|
45
|
+
["poetry", "init", "--no-interaction"], cwd=tool_path, check=True
|
46
|
+
)
|
41
47
|
else:
|
42
48
|
raise ValueError("uv or poetry must be installed to generate tool project")
|
43
49
|
|
44
50
|
# Create __init__.py file
|
45
|
-
init_file = tool_module_path /
|
51
|
+
init_file = tool_module_path / "__init__.py"
|
46
52
|
if not init_file.exists():
|
47
|
-
init_file.write_text(f
|
53
|
+
init_file.write_text(f"""from .__main__ import main
|
48
54
|
|
49
55
|
__all__ = ["main"]
|
50
|
-
|
56
|
+
""")
|
51
57
|
|
52
58
|
# Create __main__.py file
|
53
59
|
print(f"Generating tool main file for {tool_name}")
|
54
|
-
main_file = tool_module_path /
|
60
|
+
main_file = tool_module_path / "__main__.py"
|
55
61
|
if not main_file.exists():
|
56
62
|
main_content = get_tool_main_template().render(
|
57
|
-
capitalized_tool_name=capitalized_tool_name,
|
58
|
-
tool_name=tool_name
|
63
|
+
capitalized_tool_name=capitalized_tool_name, tool_name=tool_name
|
59
64
|
)
|
60
65
|
main_file.write_text(main_content)
|
61
66
|
|
62
67
|
# Create config.toml
|
63
68
|
print(f"Generating config.toml file for {tool_name}")
|
64
|
-
config_file = tool_path /
|
69
|
+
config_file = tool_path / "config.toml"
|
65
70
|
if not config_file.exists():
|
66
71
|
config_file.write_text(f'''name = "{tool_name}"
|
67
72
|
description = ""
|
@@ -75,23 +80,23 @@ scopes = []
|
|
75
80
|
|
76
81
|
# Create .gitignore
|
77
82
|
print(f"Generating .gitignore file for {tool_name}")
|
78
|
-
gitignore_file = tool_path /
|
83
|
+
gitignore_file = tool_path / ".gitignore"
|
79
84
|
gitignore_file.touch()
|
80
85
|
|
81
86
|
# Create README.md
|
82
87
|
print(f"Generating README.md file for {tool_name}")
|
83
|
-
readme_file = tool_path /
|
88
|
+
readme_file = tool_path / "README.md"
|
84
89
|
if not readme_file.exists():
|
85
|
-
readme_file.write_text(f
|
90
|
+
readme_file.write_text(f"# {tool_name}\n\n")
|
86
91
|
|
87
92
|
# Create schema.json
|
88
93
|
print(f"Generating schema.json file for {tool_name}")
|
89
|
-
schema_file = tool_path /
|
94
|
+
schema_file = tool_path / "schema.json"
|
90
95
|
schema_file.touch()
|
91
96
|
|
92
97
|
|
93
98
|
@click.command()
|
94
|
-
@click.argument(
|
99
|
+
@click.argument("tool_path", type=str, required=False)
|
95
100
|
def build_tool(tool_path):
|
96
101
|
"""Build the tool at the specified path or current directory."""
|
97
102
|
|
@@ -99,7 +104,7 @@ def build_tool(tool_path):
|
|
99
104
|
|
100
105
|
# Determine the tool directory
|
101
106
|
if tool_path is None:
|
102
|
-
if not (cwd /
|
107
|
+
if not (cwd / "config.toml").exists():
|
103
108
|
raise ValueError("Current working directory must be a tool directory")
|
104
109
|
else:
|
105
110
|
potential_path = Path(tool_path)
|
@@ -0,0 +1,240 @@
|
|
1
|
+
import os
|
2
|
+
import re
|
3
|
+
import ast
|
4
|
+
import json
|
5
|
+
import toml
|
6
|
+
import importlib
|
7
|
+
import inspect
|
8
|
+
import shutil
|
9
|
+
from typing import Callable
|
10
|
+
from pathlib import Path
|
11
|
+
import click
|
12
|
+
|
13
|
+
from hyperpocket.cli.tool_create import create_tool_template
|
14
|
+
|
15
|
+
|
16
|
+
@click.command()
|
17
|
+
@click.argument("target", type=str, required=False)
|
18
|
+
def export_tool(target, language="python"):
|
19
|
+
"""Convert the specified tool to a local tool."""
|
20
|
+
|
21
|
+
target_path = Path.cwd() / target if target else Path.cwd()
|
22
|
+
|
23
|
+
if target_path.is_file():
|
24
|
+
process_tool_file(target_path, language)
|
25
|
+
elif target_path.is_dir():
|
26
|
+
process_tool_directory(target_path, language)
|
27
|
+
else:
|
28
|
+
raise ValueError("Invalid target path")
|
29
|
+
|
30
|
+
|
31
|
+
def process_tool_file(target_path: Path, language: str):
|
32
|
+
"""Process a single Python file containing function_tool decorated functions."""
|
33
|
+
decorated_functions = find_function_tool_decorated_functions(target_path)
|
34
|
+
|
35
|
+
if not decorated_functions:
|
36
|
+
raise ValueError("No function_tool decorated functions found in target file")
|
37
|
+
if len(decorated_functions) > 1:
|
38
|
+
raise ValueError(
|
39
|
+
"Multiple function_tool decorated functions found in target file"
|
40
|
+
)
|
41
|
+
|
42
|
+
func = load_functions_as_callable(decorated_functions, target_path)
|
43
|
+
tool_name = func.func.__name__.replace("-", "_")
|
44
|
+
cleaned_code = clean_tool_source_code(target_path.read_text())
|
45
|
+
tool_main_code = transform_function_to_pydantic(cleaned_code, func)
|
46
|
+
|
47
|
+
generate_tool_template(tool_name)
|
48
|
+
generate_tool_files(target_path, tool_name, tool_main_code, func, language)
|
49
|
+
|
50
|
+
|
51
|
+
def process_tool_directory(target_path: Path, language: str):
|
52
|
+
"""Process a directory containing function_tool decorated functions."""
|
53
|
+
decorated_function_file = None
|
54
|
+
|
55
|
+
for file in target_path.glob("*.py"):
|
56
|
+
decorated_functions = find_function_tool_decorated_functions(file)
|
57
|
+
if len(decorated_functions) == 1:
|
58
|
+
decorated_function_file = file
|
59
|
+
break
|
60
|
+
elif len(decorated_functions) > 1:
|
61
|
+
raise ValueError(
|
62
|
+
"Multiple function_tool decorated functions found in target file"
|
63
|
+
)
|
64
|
+
|
65
|
+
if not decorated_function_file:
|
66
|
+
raise ValueError(
|
67
|
+
"No function_tool decorated functions found in target directory"
|
68
|
+
)
|
69
|
+
|
70
|
+
func = load_functions_as_callable(decorated_functions, decorated_function_file)
|
71
|
+
tool_name = func.func.__name__.replace("-", "_")
|
72
|
+
cleaned_code = clean_tool_source_code(decorated_function_file.read_text())
|
73
|
+
tool_main_code = transform_function_to_pydantic(cleaned_code, func)
|
74
|
+
|
75
|
+
if tool_name != decorated_function_file.stem:
|
76
|
+
raise ValueError("Tool name must match the file name")
|
77
|
+
|
78
|
+
generate_tool_template(tool_name)
|
79
|
+
copy_tool_directory(target_path, tool_name)
|
80
|
+
generate_tool_files(target_path, tool_name, tool_main_code, func, language)
|
81
|
+
|
82
|
+
|
83
|
+
def find_function_tool_decorated_functions(file_path: Path):
|
84
|
+
"""Find all functions decorated with @function_tool in a given Python file."""
|
85
|
+
with open(file_path, "r", encoding="utf-8") as f:
|
86
|
+
source_code = f.read()
|
87
|
+
|
88
|
+
tree = ast.parse(source_code)
|
89
|
+
decorated_functions = [
|
90
|
+
node.name
|
91
|
+
for node in ast.walk(tree)
|
92
|
+
if isinstance(node, ast.FunctionDef)
|
93
|
+
and any(
|
94
|
+
isinstance(decorator, ast.Call) and decorator.func.id == "function_tool"
|
95
|
+
for decorator in node.decorator_list
|
96
|
+
)
|
97
|
+
]
|
98
|
+
|
99
|
+
return decorated_functions
|
100
|
+
|
101
|
+
|
102
|
+
def load_functions_as_callable(decorated_functions, file_path: Path):
|
103
|
+
"""Load function_tool decorated function as a callable object."""
|
104
|
+
module_name = file_path.stem
|
105
|
+
spec = importlib.util.spec_from_file_location(module_name, str(file_path))
|
106
|
+
module = importlib.util.module_from_spec(spec)
|
107
|
+
spec.loader.exec_module(module)
|
108
|
+
|
109
|
+
return getattr(module, decorated_functions[0])
|
110
|
+
|
111
|
+
|
112
|
+
def clean_tool_source_code(source_code: str) -> str:
|
113
|
+
"""Remove hyperpocket import, function_tool decorator, and main execution block."""
|
114
|
+
source_code = re.sub(
|
115
|
+
r"^from hyperpocket\.tool .*?\n", "", source_code, flags=re.MULTILINE
|
116
|
+
)
|
117
|
+
source_code = re.sub(
|
118
|
+
r"@function_tool\([\s\S]*?\)\n", "", source_code, flags=re.MULTILINE
|
119
|
+
)
|
120
|
+
source_code = re.sub(
|
121
|
+
r"\nif __name__ == [\"']__main__[\"']:[\s\S]*",
|
122
|
+
"",
|
123
|
+
source_code,
|
124
|
+
flags=re.MULTILINE,
|
125
|
+
)
|
126
|
+
return source_code.strip()
|
127
|
+
|
128
|
+
|
129
|
+
def transform_function_to_pydantic(tool_source_code: str, func: Callable):
|
130
|
+
"""Transform function into a Pydantic-based CLI tool."""
|
131
|
+
function_code = extract_function_code(func)
|
132
|
+
|
133
|
+
tree = ast.parse(function_code)
|
134
|
+
function_name = func.func.__name__
|
135
|
+
|
136
|
+
for node in tree.body:
|
137
|
+
if isinstance(node, ast.FunctionDef) and node.name == function_name:
|
138
|
+
params = {
|
139
|
+
arg.arg: arg.annotation.id
|
140
|
+
for arg in node.args.args
|
141
|
+
if isinstance(arg.annotation, ast.Name)
|
142
|
+
}
|
143
|
+
properties = func.argument_json_schema["properties"]
|
144
|
+
|
145
|
+
model_name = function_name.title().replace("_", "") + "Request"
|
146
|
+
model_fields = [
|
147
|
+
f' {name}: {type_} = Field(..., description="{properties[name]["description"]}")'
|
148
|
+
for name, type_ in params.items()
|
149
|
+
]
|
150
|
+
model_code = (
|
151
|
+
f"class {model_name}(BaseModel):\n" + "\n".join(model_fields) + "\n"
|
152
|
+
)
|
153
|
+
|
154
|
+
main_code = f"""def main():
|
155
|
+
req = json.load(sys.stdin.buffer)
|
156
|
+
req_typed = {model_name}.model_validate(req)
|
157
|
+
response = {function_name}(**req_typed.model_dump())
|
158
|
+
|
159
|
+
print(json.dumps(response))
|
160
|
+
|
161
|
+
|
162
|
+
if __name__ == "__main__":
|
163
|
+
main()
|
164
|
+
"""
|
165
|
+
import_code = """import json
|
166
|
+
import os
|
167
|
+
import sys
|
168
|
+
|
169
|
+
from pydantic import BaseModel, Field
|
170
|
+
"""
|
171
|
+
return (
|
172
|
+
import_code
|
173
|
+
+ "\n"
|
174
|
+
+ tool_source_code
|
175
|
+
+ "\n\n"
|
176
|
+
+ model_code
|
177
|
+
+ "\n"
|
178
|
+
+ main_code
|
179
|
+
)
|
180
|
+
|
181
|
+
return None
|
182
|
+
|
183
|
+
|
184
|
+
def extract_function_code(func: Callable) -> str:
|
185
|
+
"""Extract function definition as a string."""
|
186
|
+
tool_source_code = inspect.getsource(func.func.__code__)
|
187
|
+
match = re.search(r"def\s+\w+\(.*\):[\s\S]*", tool_source_code)
|
188
|
+
return match.group(0) if match else ""
|
189
|
+
|
190
|
+
|
191
|
+
def generate_tool_template(tool_name: str):
|
192
|
+
"""Generate tool template using Click context forwarding."""
|
193
|
+
ctx = click.Context(create_tool_template)
|
194
|
+
ctx.forward(create_tool_template, tool_name=tool_name)
|
195
|
+
|
196
|
+
|
197
|
+
def copy_tool_directory(src_path: Path, tool_name: str):
|
198
|
+
"""Copy the tool directory to the new tool directory."""
|
199
|
+
tool_directory_name = tool_name.replace("_", "-")
|
200
|
+
dst_path = src_path.parent / tool_directory_name / tool_name
|
201
|
+
|
202
|
+
if dst_path.exists():
|
203
|
+
shutil.rmtree(dst_path)
|
204
|
+
|
205
|
+
shutil.copytree(src_path, dst_path)
|
206
|
+
os.remove(dst_path / f"{tool_name}.py")
|
207
|
+
|
208
|
+
init_file = src_path.parent / tool_directory_name / tool_name / "__init__.py"
|
209
|
+
init_file.write_text(f"from .__main__ import main\n\n__all__ = ['main']")
|
210
|
+
|
211
|
+
|
212
|
+
def generate_tool_files(
|
213
|
+
target_path: Path,
|
214
|
+
tool_name: str,
|
215
|
+
tool_main_code: str,
|
216
|
+
func: Callable,
|
217
|
+
language: str,
|
218
|
+
):
|
219
|
+
"""Generate config.toml, __main__.py, and schema.json for the tool."""
|
220
|
+
tool_directory_name = tool_name.replace("_", "-")
|
221
|
+
|
222
|
+
config_file = target_path.parent / tool_directory_name / "config.toml"
|
223
|
+
config_data = {
|
224
|
+
"name": func.name,
|
225
|
+
"description": func.description,
|
226
|
+
"language": language,
|
227
|
+
"auth": json.loads(func.auth.model_dump_json()),
|
228
|
+
"tool_vars": func.default_tool_vars,
|
229
|
+
}
|
230
|
+
|
231
|
+
with open(config_file, "w", encoding="utf-8") as f:
|
232
|
+
f.write(toml.dumps(config_data))
|
233
|
+
|
234
|
+
main_file = target_path.parent / tool_directory_name / tool_name / "__main__.py"
|
235
|
+
with open(main_file, "w", encoding="utf-8") as f:
|
236
|
+
f.write(tool_main_code)
|
237
|
+
|
238
|
+
schema_file = target_path.parent / tool_directory_name / "schema.json"
|
239
|
+
with open(schema_file, "w", encoding="utf-8") as f:
|
240
|
+
f.write(json.dumps(func.argument_json_schema, indent=4))
|
hyperpocket/config/auth.py
CHANGED
@@ -7,29 +7,81 @@ class BaseAuthConfig(BaseModel):
|
|
7
7
|
use_recommended_scope: bool = Field(default=True)
|
8
8
|
|
9
9
|
|
10
|
-
class
|
10
|
+
class OAuth2AuthConfig(BaseAuthConfig):
|
11
11
|
client_id: str
|
12
12
|
client_secret: str
|
13
13
|
|
14
14
|
|
15
|
-
class
|
16
|
-
|
17
|
-
client_secret: str
|
15
|
+
class SlackAuthConfig(OAuth2AuthConfig):
|
16
|
+
pass
|
18
17
|
|
19
18
|
|
20
|
-
class
|
21
|
-
|
22
|
-
client_secret: str
|
19
|
+
class GoogleAuthConfig(OAuth2AuthConfig):
|
20
|
+
pass
|
23
21
|
|
24
22
|
|
25
|
-
class
|
26
|
-
|
27
|
-
client_secret: str
|
23
|
+
class GithubAuthConfig(OAuth2AuthConfig):
|
24
|
+
pass
|
28
25
|
|
29
26
|
|
30
|
-
class
|
31
|
-
|
32
|
-
|
27
|
+
class CalendlyAuthConfig(OAuth2AuthConfig):
|
28
|
+
pass
|
29
|
+
|
30
|
+
|
31
|
+
class XAuthConfig(OAuth2AuthConfig):
|
32
|
+
pass
|
33
|
+
|
34
|
+
|
35
|
+
class JiraAuthConfig(OAuth2AuthConfig):
|
36
|
+
pass
|
37
|
+
|
38
|
+
|
39
|
+
class HubspotAuthConfig(OAuth2AuthConfig):
|
40
|
+
pass
|
41
|
+
|
42
|
+
|
43
|
+
class DiscordAuthConfig(OAuth2AuthConfig):
|
44
|
+
pass
|
45
|
+
|
46
|
+
|
47
|
+
class ZoomAuthConfig(OAuth2AuthConfig):
|
48
|
+
pass
|
49
|
+
|
50
|
+
|
51
|
+
class AsanaAuthConfig(OAuth2AuthConfig):
|
52
|
+
pass
|
53
|
+
|
54
|
+
|
55
|
+
class MailchimpAuthConfig(OAuth2AuthConfig):
|
56
|
+
pass
|
57
|
+
|
58
|
+
|
59
|
+
class BitbucketAuthConfig(OAuth2AuthConfig):
|
60
|
+
pass
|
61
|
+
|
62
|
+
|
63
|
+
class NotionAuthConfig(OAuth2AuthConfig):
|
64
|
+
pass
|
65
|
+
|
66
|
+
|
67
|
+
class LinkedinAuthConfig(OAuth2AuthConfig):
|
68
|
+
pass
|
69
|
+
|
70
|
+
|
71
|
+
class LinearAuthConfig(OAuth2AuthConfig):
|
72
|
+
pass
|
73
|
+
|
74
|
+
|
75
|
+
class SalesForceAuthConfig(OAuth2AuthConfig):
|
76
|
+
domain_url: str
|
77
|
+
|
78
|
+
|
79
|
+
class SpotifyAuthConfig(OAuth2AuthConfig):
|
80
|
+
pass
|
81
|
+
|
82
|
+
|
83
|
+
class FacebookAuthConfig(OAuth2AuthConfig):
|
84
|
+
pass
|
33
85
|
|
34
86
|
|
35
87
|
class AuthConfig(BaseModel):
|
@@ -38,6 +90,19 @@ class AuthConfig(BaseModel):
|
|
38
90
|
github: Optional[GithubAuthConfig] = None
|
39
91
|
calendly: Optional[CalendlyAuthConfig] = None
|
40
92
|
x: Optional[XAuthConfig] = None
|
93
|
+
jira: Optional[JiraAuthConfig] = None
|
94
|
+
hubspot: Optional[HubspotAuthConfig] = None
|
95
|
+
discord: Optional[DiscordAuthConfig] = None
|
96
|
+
zoom: Optional[ZoomAuthConfig] = None
|
97
|
+
asana: Optional[AsanaAuthConfig] = None
|
98
|
+
mailchimp: Optional[MailchimpAuthConfig] = None
|
99
|
+
bitbucket: Optional[BitbucketAuthConfig] = None
|
100
|
+
notion: Optional[NotionAuthConfig] = None
|
101
|
+
salesforce: Optional[SalesForceAuthConfig] = None
|
102
|
+
spotify: Optional[SpotifyAuthConfig] = None
|
103
|
+
linkedin: Optional[LinkedinAuthConfig] = None
|
104
|
+
linear: Optional[LinearAuthConfig] = None
|
105
|
+
facebook: Optional[FacebookAuthConfig] = None
|
41
106
|
use_prebuilt_auth: bool = Field(default=True)
|
42
107
|
|
43
108
|
|
hyperpocket/pocket_core.py
CHANGED
@@ -298,11 +298,13 @@ class PocketCore:
|
|
298
298
|
repo_url=tool_like
|
299
299
|
)
|
300
300
|
lock = GitLock(repository_url=base_repo_url, git_ref=git_ref)
|
301
|
-
parsed_tool_like = WasmToolRequest(
|
301
|
+
parsed_tool_like = WasmToolRequest(
|
302
|
+
lock=lock, rel_path=rel_path, tool_vars={}
|
303
|
+
)
|
302
304
|
else:
|
303
305
|
parsed_tool_like = None
|
304
306
|
RuntimeError(
|
305
|
-
f"Can't convert to ToolRequest. it might be wrong github url or local path. path: {tool_like}"
|
307
|
+
f"Can't convert to ToolRequest. it might be wrong github url or local path. path: {tool_like}"
|
308
|
+
)
|
306
309
|
|
307
310
|
return parsed_tool_like
|
308
|
-
|
@@ -0,0 +1,25 @@
|
|
1
|
+
from fastapi import APIRouter
|
2
|
+
from starlette.responses import HTMLResponse
|
3
|
+
from hyperpocket.futures import FutureStore
|
4
|
+
|
5
|
+
activeloop_auth_router = APIRouter(prefix="/activeloop")
|
6
|
+
|
7
|
+
|
8
|
+
@activeloop_auth_router.get("/oauth2/callback")
|
9
|
+
async def activeloop_oauth2_callback(state: str, code: str):
|
10
|
+
try:
|
11
|
+
FutureStore.resolve_future(state, code)
|
12
|
+
except ValueError:
|
13
|
+
return HTMLResponse(content="failed")
|
14
|
+
|
15
|
+
return HTMLResponse(content="success")
|
16
|
+
|
17
|
+
|
18
|
+
@activeloop_auth_router.get("/token/callback")
|
19
|
+
async def activeloop_token_callback(state: str, token: str):
|
20
|
+
try:
|
21
|
+
FutureStore.resolve_future(state, token)
|
22
|
+
except ValueError:
|
23
|
+
return HTMLResponse(content="failed")
|
24
|
+
|
25
|
+
return HTMLResponse(content="success")
|