hyperpocket 0.3.1__tar.gz → 0.3.2__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (169) hide show
  1. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/PKG-INFO +120 -47
  2. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/README.md +119 -46
  3. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/auth/provider.py +1 -0
  4. hyperpocket-0.3.2/hyperpocket/auth/x/context.py +13 -0
  5. hyperpocket-0.3.2/hyperpocket/auth/x/oauth2_context.py +29 -0
  6. hyperpocket-0.3.2/hyperpocket/auth/x/oauth2_handler.py +165 -0
  7. hyperpocket-0.3.2/hyperpocket/auth/x/oauth2_schema.py +18 -0
  8. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/cli/__main__.py +3 -0
  9. hyperpocket-0.3.2/hyperpocket/cli/codegen/tool/__init__.py +3 -0
  10. hyperpocket-0.3.2/hyperpocket/cli/codegen/tool/tool_main_template.py +48 -0
  11. hyperpocket-0.3.2/hyperpocket/cli/tool.py +121 -0
  12. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/config/auth.py +6 -0
  13. hyperpocket-0.3.2/hyperpocket/server/auth/x.py +16 -0
  14. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/tool/wasm/README.md +2 -2
  15. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/pyproject.toml +1 -1
  16. hyperpocket-0.3.2/tests/tool/__init__.py +0 -0
  17. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/.gitignore +0 -0
  18. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/__init__.py +0 -0
  19. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/__init__.py +0 -0
  20. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/auth/README.md +0 -0
  21. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/auth/__init__.py +0 -0
  22. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/auth/calendly/__init__.py +0 -0
  23. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/auth/calendly/context.py +0 -0
  24. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/auth/calendly/oauth2_context.py +0 -0
  25. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/auth/calendly/oauth2_handler.py +0 -0
  26. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/auth/calendly/oauth2_schema.py +0 -0
  27. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/auth/context.py +0 -0
  28. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/auth/github/__init__.py +0 -0
  29. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/auth/github/context.py +0 -0
  30. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/auth/github/oauth2_context.py +0 -0
  31. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/auth/github/oauth2_handler.py +0 -0
  32. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/auth/github/oauth2_schema.py +0 -0
  33. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/auth/github/token_context.py +0 -0
  34. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/auth/github/token_handler.py +0 -0
  35. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/auth/github/token_schema.py +0 -0
  36. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/auth/google/__init__.py +0 -0
  37. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/auth/google/context.py +0 -0
  38. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/auth/google/oauth2_context.py +0 -0
  39. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/auth/google/oauth2_handler.py +0 -0
  40. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/auth/google/oauth2_schema.py +0 -0
  41. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/auth/gumloop/__init__.py +0 -0
  42. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/auth/gumloop/context.py +0 -0
  43. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/auth/gumloop/token_context.py +0 -0
  44. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/auth/gumloop/token_handler.py +0 -0
  45. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/auth/gumloop/token_schema.py +0 -0
  46. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/auth/handler.py +0 -0
  47. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/auth/linear/__init__.py +0 -0
  48. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/auth/linear/context.py +0 -0
  49. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/auth/linear/token_context.py +0 -0
  50. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/auth/linear/token_handler.py +0 -0
  51. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/auth/linear/token_schema.py +0 -0
  52. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/auth/notion/README.md +0 -0
  53. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/auth/notion/__init__.py +0 -0
  54. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/auth/notion/context.py +0 -0
  55. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/auth/notion/token_context.py +0 -0
  56. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/auth/notion/token_handler.py +0 -0
  57. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/auth/notion/token_schema.py +0 -0
  58. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/auth/reddit/__init__.py +0 -0
  59. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/auth/reddit/context.py +0 -0
  60. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/auth/reddit/oauth2_context.py +0 -0
  61. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/auth/reddit/oauth2_handler.py +0 -0
  62. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/auth/reddit/oauth2_schema.py +0 -0
  63. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/auth/schema.py +0 -0
  64. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/auth/slack/__init__.py +0 -0
  65. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/auth/slack/context.py +0 -0
  66. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/auth/slack/oauth2_context.py +0 -0
  67. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/auth/slack/oauth2_handler.py +0 -0
  68. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/auth/slack/oauth2_schema.py +0 -0
  69. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/auth/slack/token_context.py +0 -0
  70. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/auth/slack/token_handler.py +0 -0
  71. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/auth/slack/token_schema.py +0 -0
  72. {hyperpocket-0.3.1/hyperpocket/cli → hyperpocket-0.3.2/hyperpocket/auth/x}/__init__.py +0 -0
  73. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/builtin.py +0 -0
  74. {hyperpocket-0.3.1/hyperpocket/cli/codegen → hyperpocket-0.3.2/hyperpocket/cli}/__init__.py +0 -0
  75. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/cli/auth_oauth2.py +0 -0
  76. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/cli/auth_token.py +0 -0
  77. {hyperpocket-0.3.1/hyperpocket/server/tool/dto → hyperpocket-0.3.2/hyperpocket/cli/codegen}/__init__.py +0 -0
  78. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/cli/codegen/auth/__init__.py +0 -0
  79. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/cli/codegen/auth/auth_context_template.py +0 -0
  80. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/cli/codegen/auth/auth_oauth2_context_template.py +0 -0
  81. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/cli/codegen/auth/auth_oauth2_handler_template.py +0 -0
  82. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/cli/codegen/auth/auth_oauth2_schema_template.py +0 -0
  83. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/cli/codegen/auth/auth_token_context_template.py +0 -0
  84. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/cli/codegen/auth/auth_token_handler_template.py +0 -0
  85. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/cli/codegen/auth/auth_token_schema_template.py +0 -0
  86. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/cli/codegen/auth/server_auth_template.py +0 -0
  87. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/cli/eject.py +0 -0
  88. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/cli/pull.py +0 -0
  89. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/cli/sync.py +0 -0
  90. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/config/__init__.py +0 -0
  91. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/config/git.py +0 -0
  92. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/config/logger.py +0 -0
  93. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/config/session.py +0 -0
  94. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/config/settings.py +0 -0
  95. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/constants.py +0 -0
  96. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/futures/__init__.py +0 -0
  97. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/futures/futurestore.py +0 -0
  98. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/pocket_auth.py +0 -0
  99. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/pocket_core.py +0 -0
  100. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/pocket_main.py +0 -0
  101. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/prompts.py +0 -0
  102. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/repository/__init__.py +0 -0
  103. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/repository/lock.py +0 -0
  104. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/repository/lockfile.py +0 -0
  105. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/repository/repository.py +0 -0
  106. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/server/__init__.py +0 -0
  107. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/server/auth/__init__.py +0 -0
  108. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/server/auth/calendly.py +0 -0
  109. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/server/auth/github.py +0 -0
  110. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/server/auth/google.py +0 -0
  111. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/server/auth/gumloop.py +0 -0
  112. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/server/auth/linear.py +0 -0
  113. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/server/auth/notion.py +0 -0
  114. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/server/auth/reddit.py +0 -0
  115. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/server/auth/slack.py +0 -0
  116. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/server/auth/token.py +0 -0
  117. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/server/proxy.py +0 -0
  118. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/server/server.py +0 -0
  119. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/server/tool/__init__.py +0 -0
  120. {hyperpocket-0.3.1/hyperpocket/tool/tests → hyperpocket-0.3.2/hyperpocket/server/tool/dto}/__init__.py +0 -0
  121. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/server/tool/dto/script.py +0 -0
  122. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/server/tool/wasm.py +0 -0
  123. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/session/README.md +0 -0
  124. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/session/__init__.py +0 -0
  125. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/session/in_memory.py +0 -0
  126. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/session/interface.py +0 -0
  127. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/session/redis.py +0 -0
  128. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/tool/README.md +0 -0
  129. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/tool/__init__.py +0 -0
  130. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/tool/function/README.md +0 -0
  131. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/tool/function/__init__.py +0 -0
  132. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/tool/function/annotation.py +0 -0
  133. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/tool/function/tool.py +0 -0
  134. {hyperpocket-0.3.1 → hyperpocket-0.3.2/hyperpocket/tool}/tests/__init__.py +0 -0
  135. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/tool/tool.py +0 -0
  136. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/tool/wasm/__init__.py +0 -0
  137. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/tool/wasm/browser.py +0 -0
  138. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/tool/wasm/invoker.py +0 -0
  139. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/tool/wasm/script.py +0 -0
  140. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/tool/wasm/templates/__init__.py +0 -0
  141. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/tool/wasm/templates/node.py +0 -0
  142. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/tool/wasm/templates/python.py +0 -0
  143. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/tool/wasm/tool.py +0 -0
  144. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/tool_like.py +0 -0
  145. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/util/__init__.py +0 -0
  146. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/util/extract_func_param_desc_from_docstring.py +0 -0
  147. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/util/find_all_leaf_class_in_package.py +0 -0
  148. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/util/find_all_subclass_in_package.py +0 -0
  149. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/util/flatten_json_schema.py +0 -0
  150. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/util/function_to_model.py +0 -0
  151. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/util/get_objects_from_subpackage.py +0 -0
  152. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/hyperpocket/util/json_schema_to_model.py +0 -0
  153. {hyperpocket-0.3.1/tests/auth → hyperpocket-0.3.2/tests}/__init__.py +0 -0
  154. {hyperpocket-0.3.1/tests/session → hyperpocket-0.3.2/tests/auth}/__init__.py +0 -0
  155. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/tests/auth/test_google_oauth2_handler.py +0 -0
  156. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/tests/auth/test_gumloop_token_handler.py +0 -0
  157. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/tests/auth/test_notion_token_handler.py +0 -0
  158. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/tests/auth/test_slack_oauth2_handler.py +0 -0
  159. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/tests/auth/test_slack_token_handler.py +0 -0
  160. {hyperpocket-0.3.1/tests/tool → hyperpocket-0.3.2/tests/session}/__init__.py +0 -0
  161. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/tests/session/test_in_memory.py +0 -0
  162. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/tests/session/test_redis.py +0 -0
  163. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/tests/test_pocket.py +0 -0
  164. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/tests/test_pocket_auth.py +0 -0
  165. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/tests/test_pocket_core.py +0 -0
  166. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/tests/tool/test_function_tool.py +0 -0
  167. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/tests/tool/test_wasm_tool.py +0 -0
  168. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/tests/utils/test_extract_func_param_desc_from_docstring.py +0 -0
  169. {hyperpocket-0.3.1 → hyperpocket-0.3.2}/uv.lock +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hyperpocket
3
- Version: 0.3.1
3
+ Version: 0.3.2
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
- - [x] OAuth
197
- - [x] Token
198
- - [ ] Basic Auth (Username, Password)
196
+ - [x] OAuth
197
+ - [x] Token
198
+ - [ ] Basic Auth (Username, Password)
199
199
 
200
200
  - Supported OAuth Providers
201
201
 
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
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
- - [x] Notion
218
- - [x] Slack
219
- - [x] Linear
220
- - [x] Gumloop
221
- - [x] Github
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
- - 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.
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
- - 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 `{WORKDIR}/settings.toml`
374
-
375
- ## Special thanks
376
-
377
- - [tott](https://x.com/tott____) for drawing the cute possum in a pocket.
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
- - [x] OAuth
172
- - [x] Token
173
- - [ ] Basic Auth (Username, Password)
171
+ - [x] OAuth
172
+ - [x] Token
173
+ - [ ] Basic Auth (Username, Password)
174
174
 
175
175
  - Supported OAuth Providers
176
176
 
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
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
- - [x] Notion
193
- - [x] Slack
194
- - [x] Linear
195
- - [x] Gumloop
196
- - [x] Github
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
- - 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.
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
- - 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 `{WORKDIR}/settings.toml`
349
-
350
- ## Special thanks
351
-
352
- - [tott](https://x.com/tott____) for drawing the cute possum in a pocket.
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
+ ```
@@ -10,6 +10,7 @@ class AuthProvider(Enum):
10
10
  NOTION = "notion"
11
11
  REDDIT = "reddit"
12
12
  GUMLOOP = "gumloop"
13
+ X = "x"
13
14
 
14
15
  @classmethod
15
16
  def get_auth_provider(cls, auth_provider_name: str) -> "AuthProvider":
@@ -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)
@@ -0,0 +1,3 @@
1
+ from .tool_main_template import get_tool_main_template
2
+
3
+ __all__ = ["get_tool_main_template"]