hyperpocket 0.3.1__tar.gz → 0.3.3__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/PKG-INFO +120 -47
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/README.md +119 -46
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/auth/provider.py +1 -0
- hyperpocket-0.3.3/hyperpocket/auth/x/context.py +13 -0
- hyperpocket-0.3.3/hyperpocket/auth/x/oauth2_context.py +29 -0
- hyperpocket-0.3.3/hyperpocket/auth/x/oauth2_handler.py +165 -0
- hyperpocket-0.3.3/hyperpocket/auth/x/oauth2_schema.py +18 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/cli/__main__.py +3 -0
- hyperpocket-0.3.3/hyperpocket/cli/codegen/tool/__init__.py +3 -0
- hyperpocket-0.3.3/hyperpocket/cli/codegen/tool/tool_main_template.py +48 -0
- hyperpocket-0.3.3/hyperpocket/cli/tool.py +121 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/config/auth.py +6 -0
- hyperpocket-0.3.3/hyperpocket/server/auth/x.py +16 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/tool/wasm/README.md +2 -2
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/pyproject.toml +1 -1
- hyperpocket-0.3.3/tests/tool/__init__.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/.gitignore +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/__init__.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/__init__.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/auth/README.md +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/auth/__init__.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/auth/calendly/__init__.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/auth/calendly/context.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/auth/calendly/oauth2_context.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/auth/calendly/oauth2_handler.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/auth/calendly/oauth2_schema.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/auth/context.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/auth/github/__init__.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/auth/github/context.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/auth/github/oauth2_context.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/auth/github/oauth2_handler.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/auth/github/oauth2_schema.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/auth/github/token_context.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/auth/github/token_handler.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/auth/github/token_schema.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/auth/google/__init__.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/auth/google/context.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/auth/google/oauth2_context.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/auth/google/oauth2_handler.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/auth/google/oauth2_schema.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/auth/gumloop/__init__.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/auth/gumloop/context.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/auth/gumloop/token_context.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/auth/gumloop/token_handler.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/auth/gumloop/token_schema.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/auth/handler.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/auth/linear/__init__.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/auth/linear/context.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/auth/linear/token_context.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/auth/linear/token_handler.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/auth/linear/token_schema.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/auth/notion/README.md +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/auth/notion/__init__.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/auth/notion/context.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/auth/notion/token_context.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/auth/notion/token_handler.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/auth/notion/token_schema.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/auth/reddit/__init__.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/auth/reddit/context.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/auth/reddit/oauth2_context.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/auth/reddit/oauth2_handler.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/auth/reddit/oauth2_schema.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/auth/schema.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/auth/slack/__init__.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/auth/slack/context.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/auth/slack/oauth2_context.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/auth/slack/oauth2_handler.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/auth/slack/oauth2_schema.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/auth/slack/token_context.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/auth/slack/token_handler.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/auth/slack/token_schema.py +0 -0
- {hyperpocket-0.3.1/hyperpocket/cli → hyperpocket-0.3.3/hyperpocket/auth/x}/__init__.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/builtin.py +0 -0
- {hyperpocket-0.3.1/hyperpocket/cli/codegen → hyperpocket-0.3.3/hyperpocket/cli}/__init__.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/cli/auth_oauth2.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/cli/auth_token.py +0 -0
- {hyperpocket-0.3.1/hyperpocket/server/tool/dto → hyperpocket-0.3.3/hyperpocket/cli/codegen}/__init__.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/cli/codegen/auth/__init__.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/cli/codegen/auth/auth_context_template.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/cli/codegen/auth/auth_oauth2_context_template.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/cli/codegen/auth/auth_oauth2_handler_template.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/cli/codegen/auth/auth_oauth2_schema_template.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/cli/codegen/auth/auth_token_context_template.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/cli/codegen/auth/auth_token_handler_template.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/cli/codegen/auth/auth_token_schema_template.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/cli/codegen/auth/server_auth_template.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/cli/eject.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/cli/pull.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/cli/sync.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/config/__init__.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/config/git.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/config/logger.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/config/session.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/config/settings.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/constants.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/futures/__init__.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/futures/futurestore.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/pocket_auth.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/pocket_core.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/pocket_main.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/prompts.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/repository/__init__.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/repository/lock.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/repository/lockfile.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/repository/repository.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/server/__init__.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/server/auth/__init__.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/server/auth/calendly.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/server/auth/github.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/server/auth/google.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/server/auth/gumloop.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/server/auth/linear.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/server/auth/notion.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/server/auth/reddit.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/server/auth/slack.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/server/auth/token.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/server/proxy.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/server/server.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/server/tool/__init__.py +0 -0
- {hyperpocket-0.3.1/hyperpocket/tool/tests → hyperpocket-0.3.3/hyperpocket/server/tool/dto}/__init__.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/server/tool/dto/script.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/server/tool/wasm.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/session/README.md +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/session/__init__.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/session/in_memory.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/session/interface.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/session/redis.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/tool/README.md +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/tool/__init__.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/tool/function/README.md +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/tool/function/__init__.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/tool/function/annotation.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/tool/function/tool.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3/hyperpocket/tool}/tests/__init__.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/tool/tool.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/tool/wasm/__init__.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/tool/wasm/browser.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/tool/wasm/invoker.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/tool/wasm/script.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/tool/wasm/templates/__init__.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/tool/wasm/templates/node.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/tool/wasm/templates/python.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/tool/wasm/tool.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/tool_like.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/util/__init__.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/util/extract_func_param_desc_from_docstring.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/util/find_all_leaf_class_in_package.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/util/find_all_subclass_in_package.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/util/flatten_json_schema.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/util/function_to_model.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/util/get_objects_from_subpackage.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/hyperpocket/util/json_schema_to_model.py +0 -0
- {hyperpocket-0.3.1/tests/auth → hyperpocket-0.3.3/tests}/__init__.py +0 -0
- {hyperpocket-0.3.1/tests/session → hyperpocket-0.3.3/tests/auth}/__init__.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/tests/auth/test_google_oauth2_handler.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/tests/auth/test_gumloop_token_handler.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/tests/auth/test_notion_token_handler.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/tests/auth/test_slack_oauth2_handler.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/tests/auth/test_slack_token_handler.py +0 -0
- {hyperpocket-0.3.1/tests/tool → hyperpocket-0.3.3/tests/session}/__init__.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/tests/session/test_in_memory.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/tests/session/test_redis.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/tests/test_pocket.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/tests/test_pocket_auth.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/tests/test_pocket_core.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/tests/tool/test_function_tool.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/tests/tool/test_wasm_tool.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/tests/utils/test_extract_func_param_desc_from_docstring.py +0 -0
- {hyperpocket-0.3.1 → hyperpocket-0.3.3}/uv.lock +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: hyperpocket
|
3
|
-
Version: 0.3.
|
3
|
+
Version: 0.3.3
|
4
4
|
Summary: Building AI agent with hyperpocket tool in a flash
|
5
5
|
Project-URL: Homepage, https://vessl-ai.github.io/hyperpocket
|
6
6
|
Project-URL: Repository, https://github.com/vessl-ai/hyperpocket
|
@@ -193,32 +193,32 @@ Pocket provides way to use end user auth easily.
|
|
193
193
|
|
194
194
|
- Supported methods
|
195
195
|
|
196
|
-
|
197
|
-
|
198
|
-
|
196
|
+
- [x] OAuth
|
197
|
+
- [x] Token
|
198
|
+
- [ ] Basic Auth (Username, Password)
|
199
199
|
|
200
200
|
- Supported OAuth Providers
|
201
201
|
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
202
|
+
- [x] Google
|
203
|
+
- [x] GitHub
|
204
|
+
- [x] Slack
|
205
|
+
- [x] Reddit
|
206
|
+
- [x] Calendly
|
207
|
+
- [ ] Facebook
|
208
|
+
- [ ] X (Previously Twitter)
|
209
|
+
- [ ] LinkedIn
|
210
|
+
- [ ] Discord
|
211
|
+
- [ ] Zoom
|
212
|
+
- [ ] Microsoft
|
213
|
+
- [ ] Spotify
|
214
|
+
- [ ] Twitch
|
215
215
|
|
216
216
|
- Supported Token Providers
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
217
|
+
- [x] Notion
|
218
|
+
- [x] Slack
|
219
|
+
- [x] Linear
|
220
|
+
- [x] Gumloop
|
221
|
+
- [x] Github
|
222
222
|
|
223
223
|
You can manage your auths in request-wise level. (e.g. you can use different auths for different requests)
|
224
224
|
|
@@ -340,15 +340,15 @@ client_secret = "" # your slack client secret
|
|
340
340
|
|
341
341
|
- While creating your github OAuth app, configuring your app's `Authorization callback URL` is different for your
|
342
342
|
development environment and production environment.
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
343
|
+
- For local testing environment, you can use `https://localhost:8001/proxy/auth/<provider>/callback` for TLS enabled
|
344
|
+
redirect url. (ex. `https://localhost:8001/proxy/auth/github/callback`)
|
345
|
+
- **Note**: Default port for hyperpocket dev server is `8000`. If you are using a different port, make sure to
|
346
|
+
replace `8000` with your actual port number.
|
347
|
+
- **Note**: But for easy dev experience, you can use TLS proxy on port `8001` provided out-of-the-box.
|
348
|
+
- You can change the `proxy` prefix in settings.toml to your desired prefix with
|
349
|
+
`callback_url_rewrite_prefix` key.
|
350
|
+
- For production environment, you can use `https://yourdomain.com/auth/github/callback`
|
351
|
+
- **Note**: Make sure to replace `yourdomain.com` with your actual domain name that this app will be hosted on.
|
352
352
|
|
353
353
|
#### How to integrate SLACK OAuth app
|
354
354
|
|
@@ -359,19 +359,92 @@ client_secret = "" # your slack client secret
|
|
359
359
|
- Redirect URLs :
|
360
360
|
`{public_server_protocol}://{public_hostname}:[{public_server_port}]/{callback_url_rewrite_prefix}/auth/slack/oauth2/callback`
|
361
361
|
- Scopes : What you want to request to user.
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
3. Set your Slack APP Client ID / Client Secret in
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
362
|
+
- Recommended scopes :
|
363
|
+
- channels:history,
|
364
|
+
- channels:read,
|
365
|
+
- chat:write,
|
366
|
+
- groups:history,
|
367
|
+
- groups:read,
|
368
|
+
- im:history,
|
369
|
+
- mpim:history,
|
370
|
+
- reactions:read,
|
371
|
+
- reactions:write,
|
372
|
+
|
373
|
+
3. Set your Slack APP Client ID / Client Secret in `$HOME/.pocket/settings.toml`
|
374
|
+
|
375
|
+
#### How to start adding a new token auth
|
376
|
+
|
377
|
+
1. Generate boilerplate codes for token-based auth services ?
|
378
|
+
|
379
|
+
```
|
380
|
+
# service_name should be lowercase including underscore
|
381
|
+
poetry run hyperpocket devtool create-token-auth-template {service_name}
|
382
|
+
```
|
383
|
+
|
384
|
+
It will generate boilerplate code lines for a new token-based auth service
|
385
|
+
|
386
|
+
2. Extend AuthProvider enum to add your new auth provider.
|
387
|
+
|
388
|
+
```python
|
389
|
+
class AuthProvider(Enum):
|
390
|
+
SERVICE = 'service'
|
391
|
+
```
|
392
|
+
|
393
|
+
3. Specify auth provider for tools
|
394
|
+
|
395
|
+
1) github repo or local
|
396
|
+
|
397
|
+
```toml
|
398
|
+
[auth]
|
399
|
+
auth_provider = "{service_name}"
|
400
|
+
auth_handler = "{service_name}-token"
|
401
|
+
scopes = []
|
402
|
+
```
|
403
|
+
|
404
|
+
2. function_tool
|
405
|
+
|
406
|
+
```python
|
407
|
+
@function_tool(
|
408
|
+
auth_provider=AuthProvider.SERVICE
|
409
|
+
)
|
410
|
+
def my_function(**kwargs):
|
411
|
+
```
|
412
|
+
|
413
|
+
#### How to Start Developing a New Tool
|
414
|
+
|
415
|
+
1. Generate Boilerplate Template for the Tool
|
416
|
+
|
417
|
+
```bash
|
418
|
+
# tool_name must be lowercase and can include underscores
|
419
|
+
poetry run hyperpocket devtool create-tool-template your_own_tool
|
420
|
+
```
|
421
|
+
|
422
|
+
This command will generate the boilerplate directory and files for a new tool.
|
423
|
+
|
424
|
+
2. Configure the `config.toml`
|
425
|
+
|
426
|
+
Define the language, `auth_provider`, scopes, and other required settings in the `config.toml` file.
|
427
|
+
|
428
|
+
```toml
|
429
|
+
# Example configuration
|
430
|
+
name = "google_delete_calendar_events"
|
431
|
+
description = "Delete Google Calendar events"
|
432
|
+
language = "python"
|
433
|
+
|
434
|
+
[auth]
|
435
|
+
auth_provider = "google"
|
436
|
+
scopes = ["https://www.googleapis.com/auth/calendar"]
|
437
|
+
```
|
438
|
+
|
439
|
+
3. Develop the Tool Logic
|
440
|
+
|
441
|
+
Implement the `request_model` and the necessary functions for your tool's logic in the `__main__.py` file.
|
442
|
+
|
443
|
+
4. Build Your Tool
|
444
|
+
|
445
|
+
Use the Hyperpocket CLI to build your tool.
|
446
|
+
|
447
|
+
```bash
|
448
|
+
# Specify the tool_path or run the command inside the tool's directory
|
449
|
+
poetry run hyperpocket devtool build-tool ./your-own-tool
|
450
|
+
```
|
@@ -168,32 +168,32 @@ Pocket provides way to use end user auth easily.
|
|
168
168
|
|
169
169
|
- Supported methods
|
170
170
|
|
171
|
-
|
172
|
-
|
173
|
-
|
171
|
+
- [x] OAuth
|
172
|
+
- [x] Token
|
173
|
+
- [ ] Basic Auth (Username, Password)
|
174
174
|
|
175
175
|
- Supported OAuth Providers
|
176
176
|
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
177
|
+
- [x] Google
|
178
|
+
- [x] GitHub
|
179
|
+
- [x] Slack
|
180
|
+
- [x] Reddit
|
181
|
+
- [x] Calendly
|
182
|
+
- [ ] Facebook
|
183
|
+
- [ ] X (Previously Twitter)
|
184
|
+
- [ ] LinkedIn
|
185
|
+
- [ ] Discord
|
186
|
+
- [ ] Zoom
|
187
|
+
- [ ] Microsoft
|
188
|
+
- [ ] Spotify
|
189
|
+
- [ ] Twitch
|
190
190
|
|
191
191
|
- Supported Token Providers
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
192
|
+
- [x] Notion
|
193
|
+
- [x] Slack
|
194
|
+
- [x] Linear
|
195
|
+
- [x] Gumloop
|
196
|
+
- [x] Github
|
197
197
|
|
198
198
|
You can manage your auths in request-wise level. (e.g. you can use different auths for different requests)
|
199
199
|
|
@@ -315,15 +315,15 @@ client_secret = "" # your slack client secret
|
|
315
315
|
|
316
316
|
- While creating your github OAuth app, configuring your app's `Authorization callback URL` is different for your
|
317
317
|
development environment and production environment.
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
318
|
+
- For local testing environment, you can use `https://localhost:8001/proxy/auth/<provider>/callback` for TLS enabled
|
319
|
+
redirect url. (ex. `https://localhost:8001/proxy/auth/github/callback`)
|
320
|
+
- **Note**: Default port for hyperpocket dev server is `8000`. If you are using a different port, make sure to
|
321
|
+
replace `8000` with your actual port number.
|
322
|
+
- **Note**: But for easy dev experience, you can use TLS proxy on port `8001` provided out-of-the-box.
|
323
|
+
- You can change the `proxy` prefix in settings.toml to your desired prefix with
|
324
|
+
`callback_url_rewrite_prefix` key.
|
325
|
+
- For production environment, you can use `https://yourdomain.com/auth/github/callback`
|
326
|
+
- **Note**: Make sure to replace `yourdomain.com` with your actual domain name that this app will be hosted on.
|
327
327
|
|
328
328
|
#### How to integrate SLACK OAuth app
|
329
329
|
|
@@ -334,19 +334,92 @@ client_secret = "" # your slack client secret
|
|
334
334
|
- Redirect URLs :
|
335
335
|
`{public_server_protocol}://{public_hostname}:[{public_server_port}]/{callback_url_rewrite_prefix}/auth/slack/oauth2/callback`
|
336
336
|
- Scopes : What you want to request to user.
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
3. Set your Slack APP Client ID / Client Secret in
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
337
|
+
- Recommended scopes :
|
338
|
+
- channels:history,
|
339
|
+
- channels:read,
|
340
|
+
- chat:write,
|
341
|
+
- groups:history,
|
342
|
+
- groups:read,
|
343
|
+
- im:history,
|
344
|
+
- mpim:history,
|
345
|
+
- reactions:read,
|
346
|
+
- reactions:write,
|
347
|
+
|
348
|
+
3. Set your Slack APP Client ID / Client Secret in `$HOME/.pocket/settings.toml`
|
349
|
+
|
350
|
+
#### How to start adding a new token auth
|
351
|
+
|
352
|
+
1. Generate boilerplate codes for token-based auth services ?
|
353
|
+
|
354
|
+
```
|
355
|
+
# service_name should be lowercase including underscore
|
356
|
+
poetry run hyperpocket devtool create-token-auth-template {service_name}
|
357
|
+
```
|
358
|
+
|
359
|
+
It will generate boilerplate code lines for a new token-based auth service
|
360
|
+
|
361
|
+
2. Extend AuthProvider enum to add your new auth provider.
|
362
|
+
|
363
|
+
```python
|
364
|
+
class AuthProvider(Enum):
|
365
|
+
SERVICE = 'service'
|
366
|
+
```
|
367
|
+
|
368
|
+
3. Specify auth provider for tools
|
369
|
+
|
370
|
+
1) github repo or local
|
371
|
+
|
372
|
+
```toml
|
373
|
+
[auth]
|
374
|
+
auth_provider = "{service_name}"
|
375
|
+
auth_handler = "{service_name}-token"
|
376
|
+
scopes = []
|
377
|
+
```
|
378
|
+
|
379
|
+
2. function_tool
|
380
|
+
|
381
|
+
```python
|
382
|
+
@function_tool(
|
383
|
+
auth_provider=AuthProvider.SERVICE
|
384
|
+
)
|
385
|
+
def my_function(**kwargs):
|
386
|
+
```
|
387
|
+
|
388
|
+
#### How to Start Developing a New Tool
|
389
|
+
|
390
|
+
1. Generate Boilerplate Template for the Tool
|
391
|
+
|
392
|
+
```bash
|
393
|
+
# tool_name must be lowercase and can include underscores
|
394
|
+
poetry run hyperpocket devtool create-tool-template your_own_tool
|
395
|
+
```
|
396
|
+
|
397
|
+
This command will generate the boilerplate directory and files for a new tool.
|
398
|
+
|
399
|
+
2. Configure the `config.toml`
|
400
|
+
|
401
|
+
Define the language, `auth_provider`, scopes, and other required settings in the `config.toml` file.
|
402
|
+
|
403
|
+
```toml
|
404
|
+
# Example configuration
|
405
|
+
name = "google_delete_calendar_events"
|
406
|
+
description = "Delete Google Calendar events"
|
407
|
+
language = "python"
|
408
|
+
|
409
|
+
[auth]
|
410
|
+
auth_provider = "google"
|
411
|
+
scopes = ["https://www.googleapis.com/auth/calendar"]
|
412
|
+
```
|
413
|
+
|
414
|
+
3. Develop the Tool Logic
|
415
|
+
|
416
|
+
Implement the `request_model` and the necessary functions for your tool's logic in the `__main__.py` file.
|
417
|
+
|
418
|
+
4. Build Your Tool
|
419
|
+
|
420
|
+
Use the Hyperpocket CLI to build your tool.
|
421
|
+
|
422
|
+
```bash
|
423
|
+
# Specify the tool_path or run the command inside the tool's directory
|
424
|
+
poetry run hyperpocket devtool build-tool ./your-own-tool
|
425
|
+
```
|
@@ -0,0 +1,13 @@
|
|
1
|
+
from hyperpocket.auth.context import AuthContext
|
2
|
+
|
3
|
+
|
4
|
+
class XAuthContext(AuthContext):
|
5
|
+
_ACCESS_TOKEN_KEY: str = "X_AUTH_TOKEN"
|
6
|
+
|
7
|
+
def to_dict(self) -> dict[str, str]:
|
8
|
+
return {self._ACCESS_TOKEN_KEY: self.access_token}
|
9
|
+
|
10
|
+
def to_profiled_dict(self, profile: str) -> dict[str, str]:
|
11
|
+
return {
|
12
|
+
f"{profile.upper()}_{self._ACCESS_TOKEN_KEY}": self.access_token,
|
13
|
+
}
|
@@ -0,0 +1,29 @@
|
|
1
|
+
from datetime import datetime, timedelta, timezone
|
2
|
+
from typing import Optional
|
3
|
+
|
4
|
+
from pydantic import Field
|
5
|
+
|
6
|
+
from hyperpocket.auth.x.context import XAuthContext
|
7
|
+
from hyperpocket.auth.x.oauth2_schema import XOAuth2Response
|
8
|
+
|
9
|
+
|
10
|
+
class XOAuth2AuthContext(XAuthContext):
|
11
|
+
refresh_token: Optional[str] = Field(default=None, description="Refresh token")
|
12
|
+
|
13
|
+
@classmethod
|
14
|
+
def from_x_oauth2_response(cls, response: XOAuth2Response) -> "XOAuth2AuthContext":
|
15
|
+
description = f"X OAuth2 Context logged in with {response.scope} scopes"
|
16
|
+
now = datetime.now(tz=timezone.utc)
|
17
|
+
|
18
|
+
if response.expires_in:
|
19
|
+
expires_at = now + timedelta(seconds=response.expires_in)
|
20
|
+
else:
|
21
|
+
expires_at = None
|
22
|
+
|
23
|
+
return cls(
|
24
|
+
access_token=response.access_token,
|
25
|
+
refresh_token=response.refresh_token,
|
26
|
+
description=description,
|
27
|
+
expires_at=expires_at,
|
28
|
+
detail=response,
|
29
|
+
)
|
@@ -0,0 +1,165 @@
|
|
1
|
+
import base64
|
2
|
+
import traceback
|
3
|
+
from typing import Optional
|
4
|
+
from urllib.parse import urlencode, urljoin, quote
|
5
|
+
from uuid import uuid4
|
6
|
+
|
7
|
+
import httpx
|
8
|
+
|
9
|
+
from hyperpocket.auth.context import AuthContext
|
10
|
+
from hyperpocket.auth.x.oauth2_context import XOAuth2AuthContext
|
11
|
+
from hyperpocket.auth.x.oauth2_schema import (
|
12
|
+
XOAuth2Request,
|
13
|
+
XOAuth2Response,
|
14
|
+
)
|
15
|
+
from hyperpocket.auth.handler import AuthHandlerInterface, AuthProvider
|
16
|
+
from hyperpocket.config import config
|
17
|
+
from hyperpocket.futures import FutureStore
|
18
|
+
|
19
|
+
|
20
|
+
class XOAuth2AuthHandler(AuthHandlerInterface):
|
21
|
+
_X_AUTH_URL = "https://x.com/i/oauth2/authorize"
|
22
|
+
_X_TOKEN_URL = "https://api.x.com/2/oauth2/token"
|
23
|
+
|
24
|
+
name: str = "x-oauth2"
|
25
|
+
description: str = "This handler is used to authenticate users using X OAuth."
|
26
|
+
scoped: bool = True
|
27
|
+
|
28
|
+
@staticmethod
|
29
|
+
def provider() -> AuthProvider:
|
30
|
+
return AuthProvider.X
|
31
|
+
|
32
|
+
@staticmethod
|
33
|
+
def provider_default() -> bool:
|
34
|
+
return True
|
35
|
+
|
36
|
+
@staticmethod
|
37
|
+
def recommended_scopes() -> set[str]:
|
38
|
+
return set()
|
39
|
+
|
40
|
+
def prepare(
|
41
|
+
self,
|
42
|
+
auth_req: XOAuth2Request,
|
43
|
+
thread_id: str,
|
44
|
+
profile: str,
|
45
|
+
future_uid: str,
|
46
|
+
*args,
|
47
|
+
**kwargs,
|
48
|
+
) -> str:
|
49
|
+
redirect_uri = urljoin(
|
50
|
+
config().public_base_url + "/",
|
51
|
+
f"{config().callback_url_rewrite_prefix}/auth/x/oauth2/callback",
|
52
|
+
)
|
53
|
+
code_verifier = "challenge" # TODO: implement code_verifier
|
54
|
+
code_challenge = code_verifier # TODO: implement code_challenge with sha256
|
55
|
+
auth_url = self._make_auth_url(
|
56
|
+
auth_req, redirect_uri, future_uid, code_challenge, "plain"
|
57
|
+
)
|
58
|
+
|
59
|
+
FutureStore.create_future(
|
60
|
+
future_uid,
|
61
|
+
data={
|
62
|
+
"redirect_uri": redirect_uri,
|
63
|
+
"thread_id": thread_id,
|
64
|
+
"profile": profile,
|
65
|
+
"code_verifier": code_verifier,
|
66
|
+
},
|
67
|
+
)
|
68
|
+
|
69
|
+
return f"User needs to authenticate using the following URL: {auth_url}"
|
70
|
+
|
71
|
+
async def authenticate(
|
72
|
+
self, auth_req: XOAuth2Request, future_uid: str, *args, **kwargs
|
73
|
+
) -> AuthContext:
|
74
|
+
future_data = FutureStore.get_future(future_uid)
|
75
|
+
auth_code = await future_data.future
|
76
|
+
|
77
|
+
async with httpx.AsyncClient() as client:
|
78
|
+
basic_token = f"{auth_req.client_id}:{auth_req.client_secret}"
|
79
|
+
basic_token_encoded = base64.b64encode(basic_token.encode()).decode()
|
80
|
+
resp = await client.post(
|
81
|
+
url=self._X_TOKEN_URL,
|
82
|
+
data={
|
83
|
+
"code": auth_code,
|
84
|
+
# "client_id": auth_req.client_id,
|
85
|
+
# "client_secret": auth_req.client_secret,
|
86
|
+
"redirect_uri": future_data.data["redirect_uri"],
|
87
|
+
"code_verifier": future_data.data["code_verifier"],
|
88
|
+
"grant_type": "authorization_code",
|
89
|
+
},
|
90
|
+
headers={
|
91
|
+
"Authorization": f"Basic {basic_token_encoded}",
|
92
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
93
|
+
},
|
94
|
+
)
|
95
|
+
|
96
|
+
if resp.status_code != 200:
|
97
|
+
raise Exception(
|
98
|
+
f"failed to authenticate. status_code : {resp.status_code}, {resp.json()}"
|
99
|
+
)
|
100
|
+
|
101
|
+
resp_json = resp.json()
|
102
|
+
auth_response = XOAuth2Response(**resp_json)
|
103
|
+
return XOAuth2AuthContext.from_x_oauth2_response(auth_response)
|
104
|
+
|
105
|
+
async def refresh(
|
106
|
+
self, auth_req: XOAuth2Request, context: AuthContext, *args, **kwargs
|
107
|
+
) -> AuthContext:
|
108
|
+
x_context: XOAuth2AuthContext = context
|
109
|
+
last_oauth2_resp: XOAuth2Response = x_context.detail
|
110
|
+
refresh_token = x_context.refresh_token
|
111
|
+
if refresh_token is None:
|
112
|
+
raise Exception(
|
113
|
+
f"refresh token is None. last_oauth2_resp: {last_oauth2_resp}"
|
114
|
+
)
|
115
|
+
|
116
|
+
async with httpx.AsyncClient() as client:
|
117
|
+
resp = await client.post(
|
118
|
+
url=self._X_TOKEN_URL,
|
119
|
+
data={
|
120
|
+
"client_id": auth_req.client_id,
|
121
|
+
"client_secret": auth_req.client_secret,
|
122
|
+
"refresh_token": refresh_token,
|
123
|
+
"grant_type": "refresh_token",
|
124
|
+
},
|
125
|
+
)
|
126
|
+
|
127
|
+
if resp.status_code != 200:
|
128
|
+
raise Exception(
|
129
|
+
f"failed to authenticate. status_code : {resp.status_code}"
|
130
|
+
)
|
131
|
+
|
132
|
+
resp_json = resp.json()
|
133
|
+
if "refresh_token" not in resp_json:
|
134
|
+
resp_json["refresh_token"] = refresh_token
|
135
|
+
|
136
|
+
response = XOAuth2Response(**resp_json)
|
137
|
+
return XOAuth2AuthContext.from_google_oauth2_response(response)
|
138
|
+
|
139
|
+
def _make_auth_url(
|
140
|
+
self,
|
141
|
+
auth_req: XOAuth2Request,
|
142
|
+
redirect_uri: str,
|
143
|
+
state: str,
|
144
|
+
code_challenge: str,
|
145
|
+
code_challenge_method: str,
|
146
|
+
) -> str:
|
147
|
+
params = {
|
148
|
+
"client_id": auth_req.client_id,
|
149
|
+
"redirect_uri": redirect_uri,
|
150
|
+
"response_type": "code",
|
151
|
+
"scope": " ".join(auth_req.auth_scopes),
|
152
|
+
"code_challenge": code_challenge,
|
153
|
+
"code_challenge_method": code_challenge_method,
|
154
|
+
"state": state,
|
155
|
+
}
|
156
|
+
return f"{self._X_AUTH_URL}?{urlencode(params)}"
|
157
|
+
|
158
|
+
def make_request(
|
159
|
+
self, auth_scopes: Optional[list[str]] = None, **kwargs
|
160
|
+
) -> XOAuth2Request:
|
161
|
+
return XOAuth2Request(
|
162
|
+
auth_scopes=auth_scopes,
|
163
|
+
client_id=config().auth.x.client_id,
|
164
|
+
client_secret=config().auth.x.client_secret,
|
165
|
+
)
|
@@ -0,0 +1,18 @@
|
|
1
|
+
from typing import Optional
|
2
|
+
|
3
|
+
from pydantic import Field
|
4
|
+
|
5
|
+
from hyperpocket.auth.schema import AuthenticateRequest, AuthenticateResponse
|
6
|
+
|
7
|
+
|
8
|
+
class XOAuth2Request(AuthenticateRequest):
|
9
|
+
client_id: str
|
10
|
+
client_secret: str
|
11
|
+
|
12
|
+
|
13
|
+
class XOAuth2Response(AuthenticateResponse):
|
14
|
+
access_token: str
|
15
|
+
expires_in: int
|
16
|
+
refresh_token: Optional[str] = Field(default=None)
|
17
|
+
scope: str
|
18
|
+
token_type: str
|
@@ -6,6 +6,7 @@ from hyperpocket.cli.sync import sync
|
|
6
6
|
from hyperpocket.cli.eject import eject
|
7
7
|
from hyperpocket.cli.auth_token import create_token_auth_template
|
8
8
|
from hyperpocket.cli.auth_oauth2 import create_oauth2_auth_template
|
9
|
+
from hyperpocket.cli.tool import create_tool_template, build_tool
|
9
10
|
|
10
11
|
@click.group()
|
11
12
|
def cli():
|
@@ -20,6 +21,8 @@ def devtool():
|
|
20
21
|
cli.add_command(devtool)
|
21
22
|
devtool.add_command(create_token_auth_template)
|
22
23
|
devtool.add_command(create_oauth2_auth_template)
|
24
|
+
devtool.add_command(create_tool_template)
|
25
|
+
devtool.add_command(build_tool)
|
23
26
|
|
24
27
|
cli.add_command(pull)
|
25
28
|
cli.add_command(sync)
|