hyperpocket 0.1.8__tar.gz → 0.1.9__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (155) hide show
  1. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/PKG-INFO +9 -19
  2. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/README.md +7 -17
  3. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/config/settings.py +12 -8
  4. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/pocket_core.py +4 -2
  5. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/pocket_main.py +3 -1
  6. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/repository/lock.py +52 -1
  7. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/server/server.py +8 -8
  8. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/tool/function/tool.py +31 -37
  9. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/tool/tool.py +42 -33
  10. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/tool/wasm/browser.py +2 -7
  11. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/util/json_schema_to_model.py +2 -0
  12. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/pyproject.toml +7 -3
  13. {hyperpocket-0.1.8/hyperpocket/tool/tests → hyperpocket-0.1.9/tests/tool}/test_function_tool.py +4 -4
  14. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/uv.lock +80 -1
  15. hyperpocket-0.1.8/tests/tool/test_function_tool.py +0 -266
  16. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/.gitignore +0 -0
  17. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/__init__.py +0 -0
  18. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/__init__.py +0 -0
  19. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/auth/README.md +0 -0
  20. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/auth/__init__.py +0 -0
  21. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/auth/calendly/__init__.py +0 -0
  22. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/auth/calendly/context.py +0 -0
  23. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/auth/calendly/oauth2_context.py +0 -0
  24. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/auth/calendly/oauth2_handler.py +0 -0
  25. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/auth/calendly/oauth2_schema.py +0 -0
  26. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/auth/context.py +0 -0
  27. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/auth/github/__init__.py +0 -0
  28. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/auth/github/context.py +0 -0
  29. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/auth/github/oauth2_context.py +0 -0
  30. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/auth/github/oauth2_handler.py +0 -0
  31. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/auth/github/oauth2_schema.py +0 -0
  32. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/auth/github/token_context.py +0 -0
  33. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/auth/github/token_handler.py +0 -0
  34. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/auth/github/token_schema.py +0 -0
  35. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/auth/google/__init__.py +0 -0
  36. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/auth/google/context.py +0 -0
  37. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/auth/google/oauth2_context.py +0 -0
  38. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/auth/google/oauth2_handler.py +0 -0
  39. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/auth/google/oauth2_schema.py +0 -0
  40. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/auth/gumloop/__init__.py +0 -0
  41. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/auth/gumloop/context.py +0 -0
  42. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/auth/gumloop/token_context.py +0 -0
  43. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/auth/gumloop/token_handler.py +0 -0
  44. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/auth/gumloop/token_schema.py +0 -0
  45. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/auth/handler.py +0 -0
  46. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/auth/linear/__init__.py +0 -0
  47. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/auth/linear/context.py +0 -0
  48. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/auth/linear/token_context.py +0 -0
  49. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/auth/linear/token_handler.py +0 -0
  50. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/auth/linear/token_schema.py +0 -0
  51. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/auth/notion/README.md +0 -0
  52. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/auth/notion/__init__.py +0 -0
  53. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/auth/notion/context.py +0 -0
  54. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/auth/notion/token_context.py +0 -0
  55. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/auth/notion/token_handler.py +0 -0
  56. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/auth/notion/token_schema.py +0 -0
  57. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/auth/provider.py +0 -0
  58. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/auth/reddit/__init__.py +0 -0
  59. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/auth/reddit/context.py +0 -0
  60. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/auth/reddit/oauth2_context.py +0 -0
  61. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/auth/reddit/oauth2_handler.py +0 -0
  62. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/auth/reddit/oauth2_schema.py +0 -0
  63. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/auth/schema.py +0 -0
  64. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/auth/slack/__init__.py +0 -0
  65. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/auth/slack/context.py +0 -0
  66. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/auth/slack/oauth2_context.py +0 -0
  67. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/auth/slack/oauth2_handler.py +0 -0
  68. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/auth/slack/oauth2_schema.py +0 -0
  69. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/auth/slack/token_context.py +0 -0
  70. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/auth/slack/token_handler.py +0 -0
  71. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/auth/slack/token_schema.py +0 -0
  72. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/builtin.py +0 -0
  73. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/cli/__init__.py +0 -0
  74. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/cli/__main__.py +0 -0
  75. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/cli/auth.py +0 -0
  76. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/cli/codegen/__init__.py +0 -0
  77. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/cli/codegen/auth/__init__.py +0 -0
  78. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/cli/codegen/auth/auth_context_template.py +0 -0
  79. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/cli/codegen/auth/auth_token_context_template.py +0 -0
  80. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/cli/codegen/auth/auth_token_handler_template.py +0 -0
  81. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/cli/codegen/auth/auth_token_schema_template.py +0 -0
  82. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/cli/codegen/auth/server_auth_template.py +0 -0
  83. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/cli/eject.py +0 -0
  84. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/cli/pull.py +0 -0
  85. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/cli/sync.py +0 -0
  86. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/config/__init__.py +0 -0
  87. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/config/auth.py +0 -0
  88. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/config/git.py +0 -0
  89. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/config/logger.py +0 -0
  90. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/config/session.py +0 -0
  91. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/constants.py +0 -0
  92. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/futures/__init__.py +0 -0
  93. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/futures/futurestore.py +0 -0
  94. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/pocket_auth.py +0 -0
  95. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/prompts.py +0 -0
  96. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/repository/__init__.py +0 -0
  97. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/repository/lockfile.py +0 -0
  98. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/repository/repository.py +0 -0
  99. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/server/__init__.py +0 -0
  100. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/server/auth/__init__.py +0 -0
  101. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/server/auth/calendly.py +0 -0
  102. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/server/auth/github.py +0 -0
  103. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/server/auth/google.py +0 -0
  104. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/server/auth/gumloop.py +0 -0
  105. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/server/auth/linear.py +0 -0
  106. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/server/auth/notion.py +0 -0
  107. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/server/auth/reddit.py +0 -0
  108. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/server/auth/slack.py +0 -0
  109. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/server/auth/token.py +0 -0
  110. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/server/proxy.py +0 -0
  111. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/server/tool/__init__.py +0 -0
  112. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/server/tool/dto/__init__.py +0 -0
  113. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/server/tool/dto/script.py +0 -0
  114. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/server/tool/wasm.py +0 -0
  115. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/session/README.md +0 -0
  116. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/session/__init__.py +0 -0
  117. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/session/in_memory.py +0 -0
  118. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/session/interface.py +0 -0
  119. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/session/redis.py +0 -0
  120. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/tool/README.md +0 -0
  121. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/tool/__init__.py +0 -0
  122. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/tool/function/README.md +0 -0
  123. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/tool/function/__init__.py +0 -0
  124. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/tool/function/annotation.py +0 -0
  125. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/tool/tests/__init__.py +0 -0
  126. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/tool/wasm/README.md +0 -0
  127. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/tool/wasm/__init__.py +0 -0
  128. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/tool/wasm/invoker.py +0 -0
  129. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/tool/wasm/script.py +0 -0
  130. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/tool/wasm/templates/__init__.py +0 -0
  131. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/tool/wasm/templates/node.py +0 -0
  132. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/tool/wasm/templates/python.py +0 -0
  133. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/tool/wasm/tool.py +0 -0
  134. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/tool_like.py +0 -0
  135. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/util/__init__.py +0 -0
  136. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/util/extract_func_param_desc_from_docstring.py +0 -0
  137. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/util/find_all_leaf_class_in_package.py +0 -0
  138. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/util/find_all_subclass_in_package.py +0 -0
  139. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/util/flatten_json_schema.py +0 -0
  140. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/util/function_to_model.py +0 -0
  141. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/hyperpocket/util/get_objects_from_subpackage.py +0 -0
  142. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/tests/__init__.py +0 -0
  143. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/tests/auth/__init__.py +0 -0
  144. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/tests/auth/test_google_oauth2_handler.py +0 -0
  145. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/tests/auth/test_gumloop_token_handler.py +0 -0
  146. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/tests/auth/test_notion_token_handler.py +0 -0
  147. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/tests/auth/test_slack_oauth2_handler.py +0 -0
  148. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/tests/auth/test_slack_token_handler.py +0 -0
  149. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/tests/session/__init__.py +0 -0
  150. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/tests/session/test_in_memory.py +0 -0
  151. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/tests/session/test_redis.py +0 -0
  152. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/tests/test_pocket.py +0 -0
  153. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/tests/test_pocket_auth.py +0 -0
  154. {hyperpocket-0.1.8 → hyperpocket-0.1.9}/tests/tool/__init__.py +0 -0
  155. {hyperpocket-0.1.8/hyperpocket/tool/tests → hyperpocket-0.1.9/tests/tool}/test_wasm_tool.py +0 -0
@@ -1,10 +1,10 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hyperpocket
3
- Version: 0.1.8
3
+ Version: 0.1.9
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
7
- Author-email: VESSL AI Devs <dev@vessl.ai>
7
+ Author-email: Hyperpocket Team <hyperpocket@vessl.ai>
8
8
  Requires-Python: >=3.10
9
9
  Requires-Dist: click>=8.1.7
10
10
  Requires-Dist: dynaconf>=3.2.6
@@ -23,20 +23,19 @@ Requires-Dist: toml>=0.10.2
23
23
  Requires-Dist: uvicorn>=0.32.1
24
24
  Description-Content-Type: text/markdown
25
25
 
26
- # Pocket 👛
26
+ # Hyperpocket 👛
27
27
 
28
- Pocket is where tools belong. Power your agent up with a pocket of tools. 👛
28
+ Hyperpocket is where tools belong. Power your agent up with a pocket of tools. 👛
29
29
 
30
30
  <figure>
31
- <img src="image.png" alt="4d-pocket" width="200"/>
32
- <figcaption>© Doraemon</figcaption>
31
+ <img src="../../logo.png" alt="hyperpocket" width="200"/>
33
32
  </figure>
34
33
 
35
34
  ## Introduction
36
35
 
37
- Pocket is a tool that allows you to easily use tool and auth for agents on your machine.
36
+ Hyperpocket is a tool that allows you to easily use tool and auth for agents on your machine.
38
37
 
39
- **_Start fast._** Just install Pocket and use it. We know you don't have time to authenticate to our server.
38
+ **_Start fast._** Just install Hyperpocket and use it. We know you don't have time to authenticate to our server.
40
39
 
41
40
  **_Go securely._** Not like others, you are the only one who knows your secret tokens. We do NOT. All of your secret
42
41
  tokens belong to your infrastructure, not ours.
@@ -47,11 +46,6 @@ with the dependency spaghetti.
47
46
 
48
47
  **_Battery Included_** You can use popular tools and authentication providers out-of-the-box.
49
48
 
50
- <figure>
51
- <img src="pocket1.png" alt="pocket-flow" width="400"/>
52
- <figcaption></figcaption>
53
- </figure>
54
-
55
49
  ## Installation
56
50
 
57
51
  1. install hyperpocket
@@ -104,7 +98,7 @@ llm_tool_binding.invoke(...)
104
98
 
105
99
  There are two kinds of auth process, one is using system auth(developer api key) and the other is using end user auth.
106
100
 
107
- Pocket provides way to use end user auth easily.
101
+ Hyperpocket provides way to use end user auth easily.
108
102
  (Of course, you can also just set your STRIPE_API_KEY when using Stripe API related tools)
109
103
 
110
104
  - Supported methods
@@ -218,12 +212,8 @@ Assistance: Here are the recent 10 messages.
218
212
 
219
213
  ### Config
220
214
 
221
- Running `pocket config init` will create your config file in `$HOME/.pocket/settings.toml`
222
-
223
215
  The `settings.toml` looks as follows.
224
216
 
225
- TODO: Add `secrets.toml`.
226
-
227
217
  ```toml
228
218
  log_level = "debug"
229
219
  internal_server_port = "8000" # optional, default is 8000
@@ -265,7 +255,7 @@ client_secret = "" # your github client secret
265
255
  - While creating your github OAuth app, configuring your app's `Authorization callback URL` is different for your
266
256
  development environment and production environment.
267
257
  - For development environment, you can use `http://localhost:8000/auth/github/callback`
268
- - **Note**: Default port for pocket dev server is `8000`. If you are using a different port, make sure to
258
+ - **Note**: Default port for hyperpocket dev server is `8000`. If you are using a different port, make sure to
269
259
  replace `8000` with your actual port number.
270
260
  - For production environment, you can use `https://yourdomain.com/auth/github/callback`
271
261
  - **Note**: Make sure to replace `yourdomain.com` with your actual domain name that this app will be hosted on.
@@ -1,17 +1,16 @@
1
- # Pocket 👛
1
+ # Hyperpocket 👛
2
2
 
3
- Pocket is where tools belong. Power your agent up with a pocket of tools. 👛
3
+ Hyperpocket is where tools belong. Power your agent up with a pocket of tools. 👛
4
4
 
5
5
  <figure>
6
- <img src="image.png" alt="4d-pocket" width="200"/>
7
- <figcaption>© Doraemon</figcaption>
6
+ <img src="../../logo.png" alt="hyperpocket" width="200"/>
8
7
  </figure>
9
8
 
10
9
  ## Introduction
11
10
 
12
- Pocket is a tool that allows you to easily use tool and auth for agents on your machine.
11
+ Hyperpocket is a tool that allows you to easily use tool and auth for agents on your machine.
13
12
 
14
- **_Start fast._** Just install Pocket and use it. We know you don't have time to authenticate to our server.
13
+ **_Start fast._** Just install Hyperpocket and use it. We know you don't have time to authenticate to our server.
15
14
 
16
15
  **_Go securely._** Not like others, you are the only one who knows your secret tokens. We do NOT. All of your secret
17
16
  tokens belong to your infrastructure, not ours.
@@ -22,11 +21,6 @@ with the dependency spaghetti.
22
21
 
23
22
  **_Battery Included_** You can use popular tools and authentication providers out-of-the-box.
24
23
 
25
- <figure>
26
- <img src="pocket1.png" alt="pocket-flow" width="400"/>
27
- <figcaption></figcaption>
28
- </figure>
29
-
30
24
  ## Installation
31
25
 
32
26
  1. install hyperpocket
@@ -79,7 +73,7 @@ llm_tool_binding.invoke(...)
79
73
 
80
74
  There are two kinds of auth process, one is using system auth(developer api key) and the other is using end user auth.
81
75
 
82
- Pocket provides way to use end user auth easily.
76
+ Hyperpocket provides way to use end user auth easily.
83
77
  (Of course, you can also just set your STRIPE_API_KEY when using Stripe API related tools)
84
78
 
85
79
  - Supported methods
@@ -193,12 +187,8 @@ Assistance: Here are the recent 10 messages.
193
187
 
194
188
  ### Config
195
189
 
196
- Running `pocket config init` will create your config file in `$HOME/.pocket/settings.toml`
197
-
198
190
  The `settings.toml` looks as follows.
199
191
 
200
- TODO: Add `secrets.toml`.
201
-
202
192
  ```toml
203
193
  log_level = "debug"
204
194
  internal_server_port = "8000" # optional, default is 8000
@@ -240,7 +230,7 @@ client_secret = "" # your github client secret
240
230
  - While creating your github OAuth app, configuring your app's `Authorization callback URL` is different for your
241
231
  development environment and production environment.
242
232
  - For development environment, you can use `http://localhost:8000/auth/github/callback`
243
- - **Note**: Default port for pocket dev server is `8000`. If you are using a different port, make sure to
233
+ - **Note**: Default port for hyperpocket dev server is `8000`. If you are using a different port, make sure to
244
234
  replace `8000` with your actual port number.
245
235
  - For production environment, you can use `https://yourdomain.com/auth/github/callback`
246
236
  - **Note**: Make sure to replace `yourdomain.com` with your actual domain name that this app will be hosted on.
@@ -7,18 +7,22 @@ from pydantic import BaseModel, Field
7
7
  from hyperpocket.config.auth import AuthConfig, DefaultAuthConfig
8
8
  from hyperpocket.config.session import DefaultSessionConfig, SessionConfig
9
9
 
10
- pocket_root = Path.home() / ".pocket"
11
- if not pocket_root.exists():
12
- os.makedirs(pocket_root)
13
- settings_path = pocket_root / "settings.toml"
10
+ POCKET_ROOT = Path.home() / ".pocket"
11
+ SETTING_ROOT = Path.cwd()
12
+
13
+
14
+ settings_path = SETTING_ROOT / "settings.toml"
14
15
  if not settings_path.exists():
15
16
  with open(settings_path, "w"):
16
17
  pass
17
- secret_path = pocket_root / ".secrets.toml"
18
+
19
+ secret_path = SETTING_ROOT / ".secrets.toml"
18
20
  if not secret_path.exists():
19
21
  with open(secret_path, "w"):
20
22
  pass
21
- toolpkg_path = pocket_root / "toolpkg"
23
+
24
+
25
+ toolpkg_path = POCKET_ROOT / "toolpkg"
22
26
  if not toolpkg_path.exists():
23
27
  os.makedirs(toolpkg_path)
24
28
 
@@ -50,9 +54,9 @@ class Config(BaseModel):
50
54
 
51
55
  @property
52
56
  def public_base_url(self):
53
- if self.public_server_protocol == 'https' and self.public_server_port == 443:
57
+ if self.public_server_protocol == "https" and self.public_server_port == 443:
54
58
  return f"{self.public_server_protocol}://{self.public_hostname}"
55
- elif self.public_server_protocol == 'http' and self.public_server_port == 80:
59
+ elif self.public_server_protocol == "http" and self.public_server_port == 80:
56
60
  return f"{self.public_server_protocol}://{self.public_hostname}"
57
61
  return f"{self.public_server_protocol}://{self.public_hostname}:{self.public_server_port}"
58
62
 
@@ -38,8 +38,10 @@ class PocketCore:
38
38
  lock = LocalLock(tool_like)
39
39
  req = WasmToolRequest(lock, "")
40
40
  else:
41
- lock = GitLock(repository_url=tool_like, git_ref='HEAD')
42
- req = WasmToolRequest(lock, "")
41
+ base_repo_url, git_ref, rel_path = GitLock.parsing_repo_url(repo_url=tool_like)
42
+ lock = GitLock(repository_url=base_repo_url, git_ref=git_ref)
43
+ req = WasmToolRequest(lock=lock, rel_path=rel_path, tool_vars={})
44
+
43
45
  lockfile.add_lock(lock)
44
46
  tool_likes.append(req)
45
47
  elif isinstance(tool_like, WasmToolRequest):
@@ -16,7 +16,9 @@ class Pocket(object):
16
16
  tools: list[ToolLike],
17
17
  auth: PocketAuth = None,
18
18
  lockfile_path: Optional[str] = None,
19
- force_update: bool = False):
19
+ force_update: bool = False,
20
+ use_profile: bool = False):
21
+ self.use_profile = use_profile
20
22
 
21
23
  self.core = PocketCore(
22
24
  tools=tools,
@@ -1,7 +1,7 @@
1
1
  import abc
2
2
  import pathlib
3
3
  import shutil
4
- from typing import Optional
4
+ from typing import Optional, Tuple
5
5
 
6
6
  import git
7
7
  from pydantic import BaseModel, Field
@@ -159,6 +159,57 @@ class GitLock(Lock):
159
159
  break
160
160
  return new_sha
161
161
 
162
+ @classmethod
163
+ def get_git_branches(cls, repo_url):
164
+ ls_lists = git.cmd.Git().ls_remote(repo_url)
165
+
166
+ branches = {}
167
+ for line in ls_lists.split("\n"):
168
+ sha, ref = line.split("\t")
169
+ if ref.startswith("refs/heads/"):
170
+ branch_name = ref.replace("refs/heads/", "")
171
+ branches[branch_name] = sha
172
+
173
+ return branches
174
+
175
+ @classmethod
176
+ def parse_repo_url(cls, repo_url: str) -> Tuple[str, str, str]:
177
+ """
178
+ Parses a GitHub repository URL with optional branch and path information.
179
+
180
+ Returns:
181
+ Tuple[str, str, str]: base_repo, branch_name, directory_path
182
+ """
183
+ if not repo_url.startswith("https://github.com/"):
184
+ raise AttributeError("Only GitHub URLs are supported")
185
+
186
+ # Remove the base URL and split the path
187
+ repo_path = repo_url.removeprefix("https://github.com/")
188
+ repo_path_list = repo_path.split("/")
189
+
190
+ # Check if the URL contains 'tree' (indicating branch and sub-path information)
191
+ if "tree" not in repo_path_list:
192
+ # If no 'tree', return the full repository URL
193
+ return repo_url, "HEAD", ""
194
+
195
+ # Parse base repo URL and remaining path
196
+ tree_index = repo_path_list.index("tree")
197
+ base_repo = f"https://github.com/{'/'.join(repo_path_list[:tree_index])}"
198
+ sub_path = repo_path_list[tree_index + 1:]
199
+
200
+ # Fetch branch information
201
+ branches = cls.get_git_branches(base_repo)
202
+
203
+ # Find branch and sub-directory path
204
+ for idx in range(1, len(sub_path) + 1):
205
+ branch_name = "/".join(sub_path[:idx])
206
+ if branch_name in branches:
207
+ directory_path = "/".join(sub_path[idx:]) if idx < len(sub_path) else None
208
+ return base_repo, branch_name, directory_path
209
+
210
+ # If no valid branch is found, raise an error
211
+ raise ValueError("Branch not found in repository")
212
+
162
213
  def eject_to_path(self, dest_path: pathlib.Path, src_sub_path: str = None):
163
214
 
164
215
  # clone the git repository to the target path
@@ -136,11 +136,11 @@ class PocketServer(object):
136
136
  while True:
137
137
  if conn.poll():
138
138
  op, uid, result, error = conn.recv()
139
- if error:
140
- raise error
141
-
142
139
  future = self.future_store[uid]
143
- future.set_result(result)
140
+ if error:
141
+ future.set_exception(error)
142
+ else:
143
+ future.set_result(result)
144
144
  break
145
145
  else:
146
146
  await asyncio.sleep(0)
@@ -158,7 +158,7 @@ class PocketServer(object):
158
158
  self._set_mp_start_method()
159
159
 
160
160
  self.pipe = mp.Pipe()
161
- self.process = mp.Process(target=self._run, args=(pocket_core,), daemon=True)
161
+ self.process = mp.Process(target=self._run, args=(pocket_core,))
162
162
  self.process.start()
163
163
 
164
164
  def _run(self, pocket_core):
@@ -185,9 +185,9 @@ class PocketServer(object):
185
185
  from hyperpocket.server.proxy import _generate_ssl_certificates
186
186
  from hyperpocket.server.proxy import https_proxy_app
187
187
 
188
- from hyperpocket.config.settings import pocket_root
189
- ssl_keypath = pocket_root / "callback_server.key"
190
- ssl_certpath = pocket_root / "callback_server.crt"
188
+ from hyperpocket.config.settings import POCKET_ROOT
189
+ ssl_keypath = POCKET_ROOT / "callback_server.key"
190
+ ssl_certpath = POCKET_ROOT / "callback_server.crt"
191
191
 
192
192
  if not ssl_keypath.exists() or not ssl_certpath.exists():
193
193
  _generate_ssl_certificates(ssl_keypath, ssl_certpath)
@@ -1,11 +1,9 @@
1
1
  import asyncio
2
2
  import copy
3
3
  import inspect
4
- import pathlib
5
4
  from typing import Any, Coroutine
6
5
  from typing import Callable, Optional
7
6
 
8
- import toml
9
7
  from pydantic import BaseModel
10
8
 
11
9
  from hyperpocket.tool.tool import Tool, ToolAuth
@@ -47,32 +45,37 @@ class FunctionTool(Tool):
47
45
  _kwargs = copy.deepcopy(kwargs)
48
46
 
49
47
  # make body args to model
50
- schema_model = self.schema_model()
51
- model = schema_model(body=_kwargs["body"])
48
+ schema_model = self.schema_model(use_profile=False)
49
+ model = schema_model(**_kwargs["body"])
52
50
  _kwargs.pop("body")
53
51
 
54
52
  # body model to dict
55
- args = self.model_to_kwargs(model.body)
53
+ args = self.model_to_kwargs(model)
56
54
 
57
55
  # binding args
58
56
  binding_args = {}
59
- sig = inspect.signature(self.func)
60
- for param_name, param in sig.parameters.items():
61
- if param_name not in args:
62
- continue
57
+ if self.func.__dict__.get("__model__") is not None:
58
+ # when a function signature is not inferrable from the function itself
59
+ binding_args = args.copy()
60
+ binding_args |= _kwargs.get("envs", {}) | self.tool_vars
61
+ else:
62
+ sig = inspect.signature(self.func)
63
+ for param_name, param in sig.parameters.items():
64
+ if param_name not in args:
65
+ continue
63
66
 
64
- if param.kind == param.VAR_KEYWORD:
65
- # var keyword args should be passed by plain dict
66
- binding_args |= args[param_name]
67
- binding_args |= _kwargs.get("envs", {}) | self.tool_vars
67
+ if param.kind == param.VAR_KEYWORD:
68
+ # var keyword args should be passed by plain dict
69
+ binding_args |= args[param_name]
70
+ binding_args |= _kwargs.get("envs", {}) | self.tool_vars
68
71
 
69
- if "envs" in _kwargs:
70
- _kwargs.pop("envs")
72
+ if "envs" in _kwargs:
73
+ _kwargs.pop("envs")
71
74
 
72
- binding_args |= _kwargs # add other kwargs
73
- continue
75
+ binding_args |= _kwargs # add other kwargs
76
+ continue
74
77
 
75
- binding_args[param_name] = args[param_name]
78
+ binding_args[param_name] = args[param_name]
76
79
 
77
80
  return binding_args
78
81
 
@@ -113,7 +116,7 @@ class FunctionTool(Tool):
113
116
  func=func,
114
117
  afunc=afunc,
115
118
  name=func.__name__,
116
- description=model.__doc__,
119
+ description=func.__doc__ if func.__doc__ is not None else "",
117
120
  argument_json_schema=argument_json_schema,
118
121
  auth=auth,
119
122
  default_tool_vars=tool_vars
@@ -123,10 +126,16 @@ class FunctionTool(Tool):
123
126
  def from_dock(
124
127
  cls,
125
128
  dock: list[Callable[..., str]],
129
+ tool_vars: Optional[dict[str, str]] = None,
126
130
  ) -> list["FunctionTool"]:
131
+ if tool_vars is None:
132
+ tool_vars = dict()
127
133
  tools = []
128
134
  for func in dock:
129
- model = function_to_model(func)
135
+ if (_model := func.__dict__.get("__model__")) is not None:
136
+ model = _model
137
+ else:
138
+ model = function_to_model(func)
130
139
  argument_json_schema = flatten_json_schema(model.model_json_schema())
131
140
  if not callable(func):
132
141
  raise ValueError(f"Dock element should be a list of functions, but found {func}")
@@ -142,6 +151,7 @@ class FunctionTool(Tool):
142
151
  description=func.__doc__,
143
152
  argument_json_schema=argument_json_schema,
144
153
  auth=auth,
154
+ default_tool_vars=(tool_vars | func.__dict__.get("__vars__", {})),
145
155
  ))
146
156
  else:
147
157
  tools.append(cls(
@@ -151,22 +161,6 @@ class FunctionTool(Tool):
151
161
  description=func.__doc__,
152
162
  argument_json_schema=argument_json_schema,
153
163
  auth=auth,
164
+ default_tool_vars=(tool_vars | func.__dict__.get("__vars__", {})),
154
165
  ))
155
166
  return tools
156
-
157
- @classmethod
158
- def _get_tool_vars_from_config(cls, func: Callable) -> dict:
159
- print(func.__name__)
160
- tool_path = inspect.getfile(func)
161
- print(tool_path)
162
- tool_parent = "/".join(tool_path.split("/")[:-1])
163
- tool_config_path = pathlib.Path(tool_parent) / "config.toml"
164
- with tool_config_path.open("r") as f:
165
- tool_config = toml.load(f)
166
- tool_vars = tool_config.get("tool_var")
167
- if not tool_vars:
168
- return
169
- tool_vars_dict = {}
170
- for key, value in tool_vars.items():
171
- tool_vars_dict[key] = value
172
- return tool_vars_dict
@@ -1,13 +1,11 @@
1
1
  import abc
2
- import pathlib
3
-
4
- import toml
5
2
  from typing import Optional, Type, Callable
6
3
 
7
4
  from pydantic import BaseModel, Field
8
5
 
9
6
  from hyperpocket.auth.provider import AuthProvider
10
7
  from hyperpocket.config.logger import pocket_logger
8
+ from hyperpocket.prompts import pocket_extended_tool_description
11
9
  from hyperpocket.util.json_schema_to_model import json_schema_to_model
12
10
 
13
11
 
@@ -36,7 +34,7 @@ class ToolRequest(abc.ABC):
36
34
  @abc.abstractmethod
37
35
  def __str__(self):
38
36
  raise NotImplementedError
39
-
37
+
40
38
  def add_postprocessing(self, postprocessing: Callable):
41
39
  if self.postprocessings is None:
42
40
  self.postprocessings = [postprocessing]
@@ -67,9 +65,11 @@ class Tool(BaseModel, abc.ABC):
67
65
  description: str = Field(description="tool description")
68
66
  argument_json_schema: Optional[dict] = Field(default=None, description="tool argument json schema")
69
67
  auth: Optional[ToolAuth] = Field(default=None, description="authentication information to invoke tool")
70
- postprocessings: Optional[list[Callable]] = Field(default=None, description="postprocessing functions after tool is invoked")
68
+ postprocessings: Optional[list[Callable]] = Field(default=None,
69
+ description="postprocessing functions after tool is invoked")
71
70
  default_tool_vars: dict[str, str] = Field(default_factory=dict, description="default tool variables")
72
71
  overridden_tool_vars: dict[str, str] = Field(default_factory=dict, description="overridden tool variables")
72
+ use_profile: bool = False
73
73
 
74
74
  @abc.abstractmethod
75
75
  def invoke(self, **kwargs) -> str:
@@ -84,17 +84,23 @@ class Tool(BaseModel, abc.ABC):
84
84
  """
85
85
  raise NotImplementedError()
86
86
 
87
- def schema_model(self) -> Optional[Type[BaseModel]]:
87
+ def schema_model(self, use_profile: bool = False) -> Optional[Type[BaseModel]]:
88
88
  """
89
89
  Returns a schema_model that wraps the existing argument_json_schema
90
90
  to include profile and thread_id as arguments when the tool is invoked
91
91
  """
92
- return self._get_schema_model(self.name, self.argument_json_schema)
93
-
92
+ return self._get_schema_model(self.name, self.argument_json_schema, use_profile=use_profile)
93
+
94
+ def get_description(self, use_profile: bool = False) -> str:
95
+ if use_profile:
96
+ return pocket_extended_tool_description(self.description)
97
+ else:
98
+ return self.description
99
+
94
100
  def override_tool_variables(self, override_vars: dict[str, str]) -> 'Tool':
95
101
  self.overridden_tool_vars = override_vars
96
102
  return self
97
-
103
+
98
104
  @property
99
105
  def tool_vars(self) -> dict[str, str]:
100
106
  return self.default_tool_vars | self.overridden_tool_vars
@@ -107,37 +113,40 @@ class Tool(BaseModel, abc.ABC):
107
113
  raise ValueError('Unknown tool request type')
108
114
 
109
115
  @classmethod
110
- def _get_schema_model(cls, name: str, json_schema: Optional[dict]) -> Optional[Type[BaseModel]]:
116
+ def _get_schema_model(cls, name: str, json_schema: Optional[dict], use_profile: bool) -> Optional[Type[BaseModel]]:
111
117
  try:
112
118
  if not json_schema:
113
119
  pocket_logger.info(f"{name} tool's json_schema is none.")
114
120
  return None
115
121
  if 'description' not in json_schema:
116
122
  json_schema['description'] = 'The argument of the tool.'
117
- extended_schema = {
118
- 'title': name,
119
- 'type': 'object',
120
- 'properties': {
121
- 'thread_id': {
122
- 'type': 'string',
123
- 'default': 'default',
124
- 'description': 'The ID of the chat thread where the tool is invoked. Omitted when unknown.',
125
- },
126
- 'profile': {
127
- 'type': 'string',
128
- 'default': 'default',
129
- 'description': '''The profile of the user invoking the tool. Inferred from user's messages.
130
- Users can request tools to be invoked in specific personas, which is called a profile.
131
- If the user's profile name can be inferred from the query, pass it as a string in the 'profile'
132
- JSON property. Omitted when unknown.''',
123
+
124
+ if use_profile:
125
+ json_schema = {
126
+ 'title': name,
127
+ 'type': 'object',
128
+ 'properties': {
129
+ 'thread_id': {
130
+ 'type': 'string',
131
+ 'default': 'default',
132
+ 'description': 'The ID of the chat thread where the tool is invoked. Omitted when unknown.',
133
+ },
134
+ 'profile': {
135
+ 'type': 'string',
136
+ 'default': 'default',
137
+ 'description': '''The profile of the user invoking the tool. Inferred from user's messages.
138
+ Users can request tools to be invoked in specific personas, which is called a profile.
139
+ If the user's profile name can be inferred from the query, pass it as a string in the 'profile'
140
+ JSON property. Omitted when unknown.''',
141
+ },
142
+ 'body': json_schema
133
143
  },
134
- 'body': json_schema
135
- },
136
- 'required': [
137
- 'body',
138
- ]
139
- }
140
- model = json_schema_to_model(extended_schema, name)
144
+ 'required': [
145
+ 'body',
146
+ ]
147
+ }
148
+
149
+ model = json_schema_to_model(json_schema, name)
141
150
  return model
142
151
  except Exception as e:
143
152
  pocket_logger.warning(f"failed to get tool({name}) schema model. error : {e}")
@@ -1,4 +1,5 @@
1
1
  import asyncio
2
+ import os
2
3
 
3
4
  from playwright.async_api import async_playwright, Page, Playwright, BrowserContext, Route
4
5
 
@@ -13,15 +14,9 @@ class InvokerBrowser(object):
13
14
  raise RuntimeError("Use InvokerBrowser.get_instance() instead")
14
15
 
15
16
  async def _async_init(self):
16
- # false only in dev
17
- # TODO(moon.dev) : load from config by environment
18
- import os
19
- pocket_env = os.getenv("POCKET_ENV", "DEVELOPMENT")
20
- is_headless = False if pocket_env == "DEVELOPMENT" else True
21
-
22
17
  self.playwright = await async_playwright().start()
23
18
  self.browser_context = await self.playwright.chromium.launch_persistent_context(
24
- headless=is_headless,
19
+ headless=True,
25
20
  args=[
26
21
  '--disable-web-security=True',
27
22
  ],
@@ -70,6 +70,8 @@ def _convert_to_python_type(json_type, model_name, property_schema):
70
70
  field_type = str
71
71
  elif json_type == "boolean":
72
72
  field_type = bool
73
+ elif json_type == "number":
74
+ field_type = float
73
75
  elif json_type == "none":
74
76
  field_type = type(None)
75
77
  elif json_type == "object":
@@ -1,8 +1,8 @@
1
1
  [project]
2
2
  name = "hyperpocket"
3
- version = "0.1.8"
3
+ version = "0.1.9"
4
4
  description = "Building AI agent with hyperpocket tool in a flash"
5
- authors = [{ name = "VESSL AI Devs", email = "dev@vessl.ai" }]
5
+ authors = [{ name = "Hyperpocket Team", email = "hyperpocket@vessl.ai" }]
6
6
  requires-python = ">=3.10"
7
7
  readme = "README.md"
8
8
  dependencies = [
@@ -31,7 +31,11 @@ Repository = "https://github.com/vessl-ai/hyperpocket"
31
31
  hyperpocket = "hyperpocket.cli.__main__:cli"
32
32
 
33
33
  [dependency-groups]
34
- dev = ["pytest>=8.3.4", "ruff>=0.8.6"]
34
+ dev = [
35
+ "pytest>=8.3.4",
36
+ "pytest-cov>=6.0.0",
37
+ "ruff>=0.8.6",
38
+ ]
35
39
 
36
40
  [build-system]
37
41
  requires = ["hatchling"]