hyperpocket 0.2.1__py3-none-any.whl → 0.3.1__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- hyperpocket/auth/reddit/oauth2_handler.py +1 -1
- hyperpocket/auth/slack/oauth2_handler.py +1 -1
- hyperpocket/cli/__main__.py +4 -2
- hyperpocket/cli/auth_oauth2.py +90 -0
- hyperpocket/cli/{auth.py → auth_token.py} +32 -25
- hyperpocket/cli/codegen/auth/__init__.py +8 -1
- hyperpocket/cli/codegen/auth/auth_oauth2_context_template.py +38 -0
- hyperpocket/cli/codegen/auth/auth_oauth2_handler_template.py +158 -0
- hyperpocket/cli/codegen/auth/auth_oauth2_schema_template.py +20 -0
- hyperpocket/cli/codegen/auth/server_auth_template.py +34 -3
- hyperpocket/pocket_core.py +58 -32
- hyperpocket/pocket_main.py +1 -1
- hyperpocket-0.3.1.dist-info/METADATA +377 -0
- {hyperpocket-0.2.1.dist-info → hyperpocket-0.3.1.dist-info}/RECORD +16 -12
- hyperpocket-0.2.1.dist-info/METADATA +0 -326
- {hyperpocket-0.2.1.dist-info → hyperpocket-0.3.1.dist-info}/WHEEL +0 -0
- {hyperpocket-0.2.1.dist-info → hyperpocket-0.3.1.dist-info}/entry_points.txt +0 -0
hyperpocket/pocket_core.py
CHANGED
@@ -17,6 +17,7 @@ from hyperpocket.tool_like import ToolLike
|
|
17
17
|
class PocketCore:
|
18
18
|
auth: PocketAuth
|
19
19
|
tools: dict[str, Tool]
|
20
|
+
lockfile: Lockfile
|
20
21
|
|
21
22
|
def __init__(
|
22
23
|
self,
|
@@ -29,48 +30,30 @@ class PocketCore:
|
|
29
30
|
auth = PocketAuth()
|
30
31
|
self.auth = auth
|
31
32
|
|
33
|
+
# init lockfile
|
32
34
|
if lockfile_path is None:
|
33
35
|
lockfile_path = "./pocket.lock"
|
34
36
|
lockfile_pathlib_path = pathlib.Path(lockfile_path)
|
35
|
-
lockfile = Lockfile(lockfile_pathlib_path)
|
37
|
+
self.lockfile = Lockfile(lockfile_pathlib_path)
|
38
|
+
|
39
|
+
# parse tool_likes and add lock of the tool like to the lockfile
|
36
40
|
tool_likes = []
|
37
41
|
for tool_like in tools:
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
elif tool_like.startswith("https://github.com"):
|
43
|
-
base_repo_url, git_ref, rel_path = GitLock.parse_repo_url(
|
44
|
-
repo_url=tool_like
|
45
|
-
)
|
46
|
-
lock = GitLock(repository_url=base_repo_url, git_ref=git_ref)
|
47
|
-
req = WasmToolRequest(lock=lock, rel_path=rel_path, tool_vars={})
|
48
|
-
|
49
|
-
lockfile.add_lock(lock)
|
50
|
-
tool_likes.append(req)
|
51
|
-
elif isinstance(tool_like, WasmToolRequest):
|
52
|
-
lockfile.add_lock(tool_like.lock)
|
53
|
-
tool_likes.append(tool_like)
|
54
|
-
elif isinstance(tool_like, ToolRequest):
|
55
|
-
raise ValueError(f"unreachable. tool_like:{tool_like}")
|
56
|
-
elif isinstance(tool_like, WasmTool):
|
57
|
-
raise ValueError("WasmTool should pass ToolRequest instance instead.")
|
58
|
-
else:
|
59
|
-
tool_likes.append(tool_like)
|
60
|
-
lockfile.sync(force_update=force_update, referenced_only=True)
|
42
|
+
parsed_tool_like = self._parse_tool_like(tool_like)
|
43
|
+
tool_likes.append(parsed_tool_like)
|
44
|
+
self._add_tool_like_lock_to_lockfile(parsed_tool_like)
|
45
|
+
self.lockfile.sync(force_update=force_update, referenced_only=True)
|
61
46
|
|
47
|
+
# load tool from tool_like
|
62
48
|
self.tools = dict()
|
63
49
|
for tool_like in tool_likes:
|
64
|
-
|
65
|
-
if tool.name in self.tools:
|
66
|
-
pocket_logger.error(f"Duplicate tool name: {tool.name}.")
|
67
|
-
raise ValueError(f"Duplicate tool name: {tool.name}")
|
68
|
-
self.tools[tool.name] = tool
|
50
|
+
self._load_tool(tool_like)
|
69
51
|
|
70
52
|
pocket_logger.info(
|
71
53
|
f"All Registered Tools Loaded successfully. total registered tools : {len(self.tools)}"
|
72
54
|
)
|
73
55
|
|
56
|
+
# load builtin tool
|
74
57
|
builtin_tools = get_builtin_tools(self.auth)
|
75
58
|
for tool in builtin_tools:
|
76
59
|
self.tools[tool.name] = tool
|
@@ -266,17 +249,60 @@ class PocketCore:
|
|
266
249
|
def _tool_instance(self, tool_name: str) -> Tool:
|
267
250
|
return self.tools[tool_name]
|
268
251
|
|
269
|
-
|
270
|
-
def _load_tool(tool_like: ToolLike, lockfile: Lockfile) -> Tool:
|
252
|
+
def _load_tool(self, tool_like: ToolLike) -> Tool:
|
271
253
|
pocket_logger.info(f"Loading Tool {tool_like}")
|
272
254
|
if isinstance(tool_like, Tool):
|
273
255
|
tool = tool_like
|
274
256
|
elif isinstance(tool_like, ToolRequest):
|
275
|
-
tool = Tool.from_tool_request(tool_like, lockfile=lockfile)
|
257
|
+
tool = Tool.from_tool_request(tool_like, lockfile=self.lockfile)
|
276
258
|
elif isinstance(tool_like, Callable):
|
277
259
|
tool = from_func(tool_like)
|
278
260
|
else:
|
279
261
|
raise ValueError(f"Invalid tool type: {type(tool_like)}")
|
280
262
|
|
263
|
+
if tool.name in self.tools:
|
264
|
+
pocket_logger.error(f"Duplicate tool name: {tool.name}.")
|
265
|
+
raise ValueError(f"Duplicate tool name: {tool.name}")
|
266
|
+
self.tools[tool.name] = tool
|
267
|
+
|
281
268
|
pocket_logger.info(f"Complete Loading Tool {tool.name}")
|
282
269
|
return tool
|
270
|
+
|
271
|
+
def _add_tool_like_lock_to_lockfile(self, tool_like: ToolLike):
|
272
|
+
if isinstance(tool_like, WasmToolRequest): # lock is only in WasmToolRequest
|
273
|
+
self.lockfile.add_lock(tool_like.lock)
|
274
|
+
return
|
275
|
+
|
276
|
+
@classmethod
|
277
|
+
def _parse_tool_like(cls, tool_like: ToolLike) -> ToolLike:
|
278
|
+
if isinstance(tool_like, str):
|
279
|
+
return cls._parse_str_tool_like(tool_like)
|
280
|
+
|
281
|
+
elif isinstance(tool_like, WasmToolRequest):
|
282
|
+
return tool_like
|
283
|
+
|
284
|
+
elif isinstance(tool_like, ToolRequest):
|
285
|
+
raise ValueError(f"unreachable. tool_like:{tool_like}")
|
286
|
+
elif isinstance(tool_like, WasmTool):
|
287
|
+
raise ValueError("WasmTool should pass ToolRequest instance instead.")
|
288
|
+
else: # Callable, Tool
|
289
|
+
return tool_like
|
290
|
+
|
291
|
+
@classmethod
|
292
|
+
def _parse_str_tool_like(cls, tool_like: str) -> ToolLike:
|
293
|
+
if pathlib.Path(tool_like).exists():
|
294
|
+
lock = LocalLock(tool_like)
|
295
|
+
parsed_tool_like = WasmToolRequest(lock=lock, rel_path="", tool_vars={})
|
296
|
+
elif tool_like.startswith("https://github.com"):
|
297
|
+
base_repo_url, git_ref, rel_path = GitLock.parse_repo_url(
|
298
|
+
repo_url=tool_like
|
299
|
+
)
|
300
|
+
lock = GitLock(repository_url=base_repo_url, git_ref=git_ref)
|
301
|
+
parsed_tool_like = WasmToolRequest(lock=lock, rel_path=rel_path, tool_vars={})
|
302
|
+
else:
|
303
|
+
parsed_tool_like = None
|
304
|
+
RuntimeError(
|
305
|
+
f"Can't convert to ToolRequest. it might be wrong github url or local path. path: {tool_like}")
|
306
|
+
|
307
|
+
return parsed_tool_like
|
308
|
+
|
hyperpocket/pocket_main.py
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
import asyncio
|
2
|
-
from concurrent.futures import ThreadPoolExecutor
|
3
2
|
from typing import Any, List, Optional, Union
|
4
3
|
|
5
4
|
from hyperpocket.config import pocket_logger
|
@@ -90,6 +89,7 @@ class Pocket(object):
|
|
90
89
|
*args,
|
91
90
|
**kwargs,
|
92
91
|
)
|
92
|
+
pocket_logger.debug(f"{tool_name} result: {result}")
|
93
93
|
return result
|
94
94
|
|
95
95
|
def invoke_with_state(
|
@@ -0,0 +1,377 @@
|
|
1
|
+
Metadata-Version: 2.4
|
2
|
+
Name: hyperpocket
|
3
|
+
Version: 0.3.1
|
4
|
+
Summary: Building AI agent with hyperpocket tool in a flash
|
5
|
+
Project-URL: Homepage, https://vessl-ai.github.io/hyperpocket
|
6
|
+
Project-URL: Repository, https://github.com/vessl-ai/hyperpocket
|
7
|
+
Author-email: Hyperpocket Team <hyperpocket@vessl.ai>
|
8
|
+
Requires-Python: >=3.10
|
9
|
+
Requires-Dist: click>=8.1.7
|
10
|
+
Requires-Dist: dynaconf>=3.2.6
|
11
|
+
Requires-Dist: fastapi>=0.115.5
|
12
|
+
Requires-Dist: gitpython>=3.1.43
|
13
|
+
Requires-Dist: httpx==0.27
|
14
|
+
Requires-Dist: jinja2>=3.1.4
|
15
|
+
Requires-Dist: multiprocess>=0.70.17
|
16
|
+
Requires-Dist: playwright>=1.49.0
|
17
|
+
Requires-Dist: pydantic>=2.10.2
|
18
|
+
Requires-Dist: pygithub>=2.5.0
|
19
|
+
Requires-Dist: python-multipart>=0.0.19
|
20
|
+
Requires-Dist: redis>=5.2.1
|
21
|
+
Requires-Dist: requests>=2.32.3
|
22
|
+
Requires-Dist: toml>=0.10.2
|
23
|
+
Requires-Dist: uvicorn>=0.32.1
|
24
|
+
Description-Content-Type: text/markdown
|
25
|
+
|
26
|
+
<p align="center">
|
27
|
+
<img src="logo.png" alt="hyperpocket" width="570"/>
|
28
|
+
</p>
|
29
|
+
|
30
|
+
# Hyperpocket 👛
|
31
|
+
|
32
|
+
Hyperpocket is where tools belong. Power your agent up with a pocket of tools. 👛
|
33
|
+
|
34
|
+
## Introduction
|
35
|
+
|
36
|
+
Hyperpocket is a tool that allows you to easily use tool and auth for agents on your machine.
|
37
|
+
|
38
|
+
**_Start fast._** Just install Hyperpocket and use it. We know you don't have time to authenticate to our server.
|
39
|
+
|
40
|
+
**_Go securely._** Not like others, you are the only one who knows your secret tokens. We do NOT. All of your secret
|
41
|
+
tokens belong to your infrastructure, not ours.
|
42
|
+
|
43
|
+
**_Power up with public tools._** Without worries for tool integration, use others' tools just with copy-and-paste the
|
44
|
+
link to the tool. Your tool will run on isolated environment based on WebAssembly technology, and you don't have to deal
|
45
|
+
with the dependency spaghetti.
|
46
|
+
|
47
|
+
**_Battery Included_** You can use popular tools and authentication providers out-of-the-box.
|
48
|
+
|
49
|
+
## Getting Started
|
50
|
+
|
51
|
+
getting started langchain tool-calling-agent example with hyperpocket
|
52
|
+
|
53
|
+
### 1. Prerequisite
|
54
|
+
|
55
|
+
install hyperpocket package
|
56
|
+
|
57
|
+
```shell
|
58
|
+
pip install hyperpocket_langchain
|
59
|
+
pip install langchain_openai
|
60
|
+
```
|
61
|
+
|
62
|
+
install playwright
|
63
|
+
|
64
|
+
```shell
|
65
|
+
playwright install
|
66
|
+
```
|
67
|
+
|
68
|
+
### 2. Configuration
|
69
|
+
|
70
|
+
setting hyperpocket config in your current working directory
|
71
|
+
|
72
|
+
`${WORKDIR}/.secret.toml`
|
73
|
+
|
74
|
+
```toml
|
75
|
+
[auth.slack]
|
76
|
+
client_id = "<SLACK_CLIENT_ID>"
|
77
|
+
client_secret = "<SLACK_CLIENT_SECRET>"
|
78
|
+
```
|
79
|
+
|
80
|
+
setting openai api key env for this example.
|
81
|
+
|
82
|
+
```shell
|
83
|
+
export OPENAI_API_KEY=<OPENAI_API_KEY>
|
84
|
+
```
|
85
|
+
|
86
|
+
### 3. Writing code
|
87
|
+
|
88
|
+
`langchain_example.py`
|
89
|
+
|
90
|
+
```python
|
91
|
+
import os
|
92
|
+
|
93
|
+
from langchain.agents import AgentExecutor, create_tool_calling_agent
|
94
|
+
from langchain.memory import ConversationBufferMemory
|
95
|
+
from langchain_core.prompts import ChatPromptTemplate, MessagesPlaceholder
|
96
|
+
from langchain_openai import ChatOpenAI
|
97
|
+
|
98
|
+
from hyperpocket_langchain import PocketLangchain
|
99
|
+
|
100
|
+
if __name__ == '__main__':
|
101
|
+
pocket = PocketLangchain(
|
102
|
+
tools=[
|
103
|
+
"https://github.com/vessl-ai/hyperpocket/tree/main/tools/slack/get-message",
|
104
|
+
"https://github.com/vessl-ai/hyperpocket/tree/main/tools/slack/post-message",
|
105
|
+
],
|
106
|
+
)
|
107
|
+
tools = pocket.get_tools()
|
108
|
+
llm = ChatOpenAI(model="gpt-4o", api_key=os.getenv("OPENAI_API_KEY"))
|
109
|
+
prompt = ChatPromptTemplate.from_messages(
|
110
|
+
[
|
111
|
+
(
|
112
|
+
"system",
|
113
|
+
"You are a tool calling assistant. You can help the user by calling proper tools",
|
114
|
+
),
|
115
|
+
("placeholder", "{chat_history}"),
|
116
|
+
("user", "{input}"),
|
117
|
+
MessagesPlaceholder(variable_name="agent_scratchpad"),
|
118
|
+
]
|
119
|
+
)
|
120
|
+
|
121
|
+
memory = ConversationBufferMemory(memory_key="chat_history", return_messages=True)
|
122
|
+
agent = create_tool_calling_agent(llm, tools, prompt)
|
123
|
+
agent_executor = AgentExecutor(
|
124
|
+
agent=agent,
|
125
|
+
tools=tools,
|
126
|
+
memory=memory,
|
127
|
+
verbose=True,
|
128
|
+
handle_parsing_errors=True,
|
129
|
+
)
|
130
|
+
|
131
|
+
print("Hello, This is simple slack agent using hyperpocket.")
|
132
|
+
while True:
|
133
|
+
print("user(q to quit) : ", end="")
|
134
|
+
user_input = input()
|
135
|
+
|
136
|
+
if user_input is None or user_input == "":
|
137
|
+
continue
|
138
|
+
elif user_input == "q":
|
139
|
+
print("Good bye!")
|
140
|
+
break
|
141
|
+
|
142
|
+
response = agent_executor.invoke({"input": user_input})
|
143
|
+
print("agent : ", response["output"])
|
144
|
+
print()
|
145
|
+
```
|
146
|
+
|
147
|
+
### 4. Done !
|
148
|
+
|
149
|
+
```shell
|
150
|
+
python langchain_example.py
|
151
|
+
```
|
152
|
+
|
153
|
+
## Usage
|
154
|
+
|
155
|
+
Supported agent frameworks
|
156
|
+
|
157
|
+
- [x] Langgraph [link](https://www.langchain.com/langgraph)
|
158
|
+
- [x] Langchain [link](https://www.langchain.com/)
|
159
|
+
- [x] Llamaindex [link](https://www.llamaindex.ai/)
|
160
|
+
|
161
|
+
Or just use LLM API Clients out of the box.
|
162
|
+
|
163
|
+
- [x] OpenAI [link](https://openai.com/)
|
164
|
+
- [x] Anthropic [link](https://www.anthropic.com/)
|
165
|
+
|
166
|
+
### Using out-of-the-box tools
|
167
|
+
|
168
|
+
```python
|
169
|
+
|
170
|
+
from langchain_openai import ChatOpenAI
|
171
|
+
|
172
|
+
from hyperpocket_langchain import PocketLangchain
|
173
|
+
|
174
|
+
pklc = PocketLangchain(
|
175
|
+
tools=[
|
176
|
+
"https://github.com/vessl-ai/hyperpocket/tree/main/tools/slack/get-message",
|
177
|
+
"https://github.com/vessl-ai/hyperpocket/tree/main/tools/slack/post-message",
|
178
|
+
]
|
179
|
+
)
|
180
|
+
tools = pklc.get_tools()
|
181
|
+
|
182
|
+
llm = ChatOpenAI()
|
183
|
+
llm_tool_binding = llm.bind_tools(tools)
|
184
|
+
llm_tool_binding.invoke(...)
|
185
|
+
```
|
186
|
+
|
187
|
+
### Using out-of-the-box auth for various tools
|
188
|
+
|
189
|
+
There are two kinds of auth process, one is using system auth(developer api key) and the other is using end user auth.
|
190
|
+
|
191
|
+
Pocket provides way to use end user auth easily.
|
192
|
+
(Of course, you can also just set your STRIPE_API_KEY when using Stripe API related tools)
|
193
|
+
|
194
|
+
- Supported methods
|
195
|
+
|
196
|
+
- [x] OAuth
|
197
|
+
- [x] Token
|
198
|
+
- [ ] Basic Auth (Username, Password)
|
199
|
+
|
200
|
+
- Supported OAuth Providers
|
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
|
215
|
+
|
216
|
+
- Supported Token Providers
|
217
|
+
- [x] Notion
|
218
|
+
- [x] Slack
|
219
|
+
- [x] Linear
|
220
|
+
- [x] Gumloop
|
221
|
+
- [x] Github
|
222
|
+
|
223
|
+
You can manage your auths in request-wise level. (e.g. you can use different auths for different requests)
|
224
|
+
|
225
|
+
```python
|
226
|
+
|
227
|
+
from langchain_openai import ChatOpenAI
|
228
|
+
from langgraph.graph import StateGraph, START, MessagesState
|
229
|
+
from langgraph.prebuilt import tools_condition
|
230
|
+
|
231
|
+
from hyperpocket_langgraph import PocketLanggraph
|
232
|
+
|
233
|
+
pklg = PocketLanggraph(
|
234
|
+
tools=[
|
235
|
+
"https://github.com/vessl-ai/hyperpocket/tree/main/tools/slack/get-message",
|
236
|
+
"https://github.com/vessl-ai/hyperpocket/tree/main/tools/slack/post-message",
|
237
|
+
],
|
238
|
+
)
|
239
|
+
llm = ChatOpenAI()
|
240
|
+
|
241
|
+
# Langgraph
|
242
|
+
pk_tool_node = pklg.get_tool_node()
|
243
|
+
llm_tool_binding = llm.bind_tools(pklg.get_tools())
|
244
|
+
|
245
|
+
# ...
|
246
|
+
|
247
|
+
graph_builder = StateGraph(MessagesState)
|
248
|
+
|
249
|
+
graph_builder.add_node('llm', llm)
|
250
|
+
graph_builder.add_node('tools', pk_tool_node)
|
251
|
+
graph_builder.add_edge(START, llm)
|
252
|
+
graph_builder.add_conditional_edges("llm", tools_condition)
|
253
|
+
graph_builder.add_edge(pk_tool_node, llm)
|
254
|
+
|
255
|
+
# ...
|
256
|
+
|
257
|
+
graph_builder.compile()
|
258
|
+
|
259
|
+
```
|
260
|
+
|
261
|
+
```python
|
262
|
+
import os
|
263
|
+
|
264
|
+
from llama_index.core.agent import FunctionCallingAgent
|
265
|
+
from llama_index.llms.openai import OpenAI
|
266
|
+
|
267
|
+
from hyperpocket_llamaindex import PocketLlamaindex
|
268
|
+
|
269
|
+
llm = OpenAI(api_key=os.getenv("OPENAI_API_KEY"))
|
270
|
+
pocket = PocketLlamaindex(
|
271
|
+
tools=[
|
272
|
+
"https://github.com/vessl-ai/hyperpocket/tree/main/tools/slack/get-message",
|
273
|
+
"https://github.com/vessl-ai/hyperpocket/tree/main/tools/slack/post-message",
|
274
|
+
"https://github.com/vessl-ai/hyperpocket/tree/main/tools/linear/get-issues",
|
275
|
+
"https://github.com/vessl-ai/hyperpocket/tree/main/tools/google/get-calendar-events",
|
276
|
+
"https://github.com/vessl-ai/hyperpocket/tree/main/tools/google/get-calendar-list",
|
277
|
+
]
|
278
|
+
)
|
279
|
+
tools = pocket.get_tools()
|
280
|
+
|
281
|
+
agent = FunctionCallingAgent.from_tools(tools=tools, llm=llm)
|
282
|
+
```
|
283
|
+
|
284
|
+
### Auth flow included
|
285
|
+
|
286
|
+
```text
|
287
|
+
Human: List my slack messages in 'general' channel
|
288
|
+
|
289
|
+
Assistance: It looks like you need to authenticate to access the Slack messages. Please use [this link](https://slack.com/oauth/v2/authorize?user_scope=SCOPES&client_id=CLIENT_ID&redirect_uri=REDIRECT_URL) to authenticate your Slack account, and then let me know when you're done!
|
290
|
+
|
291
|
+
Human: done.
|
292
|
+
|
293
|
+
Assistance: Here are the recent 10 messages.
|
294
|
+
(...)
|
295
|
+
```
|
296
|
+
|
297
|
+
### Config
|
298
|
+
|
299
|
+
Running `hyperpocket config init` will create your config file in `${WORKDIR}/settings.toml` and
|
300
|
+
`${WORKDIR}/.secrets.toml`
|
301
|
+
|
302
|
+
The `settings.toml` looks as follows.
|
303
|
+
|
304
|
+
```toml
|
305
|
+
log_level = "debug"
|
306
|
+
internal_server_port = "8000" # optional, default is 8000
|
307
|
+
public_hostname = "localhost" # optional, default is localhost
|
308
|
+
public_server_protocol = "https" # optional, default is https
|
309
|
+
public_server_port = "8001" # optional, default is 8001
|
310
|
+
enable_local_callback_proxy = "true" # optional, default is true, can be turned off when running in production behind TLS termination
|
311
|
+
callback_url_rewrite_prefix = "proxy" # optional, default is proxy, auth callback url prefix
|
312
|
+
|
313
|
+
[session]
|
314
|
+
session_type = "redis" # optional, default is in-memory
|
315
|
+
[session.redis]
|
316
|
+
host = "localhost"
|
317
|
+
port = 6379
|
318
|
+
db = 0
|
319
|
+
|
320
|
+
[auth.slack] # add your slack app's client id and secret for slack auth
|
321
|
+
client_id = "" # your slack client id
|
322
|
+
client_secret = "" # your slack client secret
|
323
|
+
```
|
324
|
+
|
325
|
+
Or you put some sensitive data on `{WORKDIR}/.secrets.toml`
|
326
|
+
|
327
|
+
```toml
|
328
|
+
[auth.slack] # add your slack app's client id and secret for slack auth
|
329
|
+
client_id = "" # your slack client id
|
330
|
+
client_secret = "" # your slack client secret
|
331
|
+
```
|
332
|
+
|
333
|
+
- in this case, by putting your slack app client_id and client_secret on `.secrets.toml`, you can manage your sensitive
|
334
|
+
data more safely.
|
335
|
+
|
336
|
+
#### How to integrate github OAuth app
|
337
|
+
|
338
|
+
1. Follow the github documentation to create a new OAuth
|
339
|
+
app. https://docs.github.com/en/apps/oauth-apps/building-oauth-apps/creating-an-oauth-app
|
340
|
+
|
341
|
+
- While creating your github OAuth app, configuring your app's `Authorization callback URL` is different for your
|
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.
|
352
|
+
|
353
|
+
#### How to integrate SLACK OAuth app
|
354
|
+
|
355
|
+
1. Follow the slack documentation to create a new Oauth APP. https://api.slack.com/quickstart
|
356
|
+
|
357
|
+
2. Setting Redirect URLs, Scopes at OAuth & Permissions tap in slack APP page
|
358
|
+
|
359
|
+
- Redirect URLs :
|
360
|
+
`{public_server_protocol}://{public_hostname}:[{public_server_port}]/{callback_url_rewrite_prefix}/auth/slack/oauth2/callback`
|
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.
|
@@ -2,8 +2,8 @@ hyperpocket/__init__.py,sha256=VVLbApRTiULqEVQp6lCNOcuXKx9V62O_7C9VNKBQ0G0,137
|
|
2
2
|
hyperpocket/builtin.py,sha256=SOrVrNjoKadDMksfB1rt6pKreJFzHG2YGBsLGVsg72c,2385
|
3
3
|
hyperpocket/constants.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
4
4
|
hyperpocket/pocket_auth.py,sha256=VzpGpHOOQIiEgrk1sYg5DYa5WYV6gRQmFlm8Kb2C9V0,17611
|
5
|
-
hyperpocket/pocket_core.py,sha256=
|
6
|
-
hyperpocket/pocket_main.py,sha256=
|
5
|
+
hyperpocket/pocket_core.py,sha256=URghKdbgAhPWyN-n9hAWmst_bB4J08YVlDQPDBz0R0g,11039
|
6
|
+
hyperpocket/pocket_main.py,sha256=ZSj0107pBBXx_pFKzggjEpm68Y1tQpDyYc2O_QDb4qQ,9628
|
7
7
|
hyperpocket/prompts.py,sha256=N1bCzCLZvGUVhH1Vn_cgeBPsdY3MdIU7ZGqVgexoj5E,472
|
8
8
|
hyperpocket/tool_like.py,sha256=5JgHZFEFu-GcZZl5pwkUqHeABUpN3nyJdtKJHtEjpHU,135
|
9
9
|
hyperpocket/auth/README.md,sha256=zn4QqnFZCA_4X3x8Wb6lE3OP5otYxpByZaCiUkBvaNs,11562
|
@@ -49,29 +49,33 @@ hyperpocket/auth/notion/token_schema.py,sha256=ksBNQa2KCyjXZ3z9NB1Sgp0VBRR6nrddM
|
|
49
49
|
hyperpocket/auth/reddit/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
50
50
|
hyperpocket/auth/reddit/context.py,sha256=WlOvIb4u1PvfrbkYbEq5cSRnXxmIEFuHa4LlKjLEtMc,431
|
51
51
|
hyperpocket/auth/reddit/oauth2_context.py,sha256=v1u_uy6O52REp2anteTPNgvb_nX-hI6bM7jNngBZXq4,1015
|
52
|
-
hyperpocket/auth/reddit/oauth2_handler.py,sha256=
|
52
|
+
hyperpocket/auth/reddit/oauth2_handler.py,sha256=X_lzoyhYnjEFriBuorGdn977uD5GjphPiXi8W9SYdy0,5166
|
53
53
|
hyperpocket/auth/reddit/oauth2_schema.py,sha256=MOcA8VTvjjwewxhyIn_-DRNf6H_5GjsN6C7gV8sDyiI,436
|
54
54
|
hyperpocket/auth/slack/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
55
55
|
hyperpocket/auth/slack/context.py,sha256=f8dMs7QtSSyissOlPGw8rCZXsVUckFnZWjZ_LAmNXpA,429
|
56
56
|
hyperpocket/auth/slack/oauth2_context.py,sha256=kwahsgxtDo5Wg_nrF8mFv16ijIu6biiGe_qz2JlEKjM,1398
|
57
|
-
hyperpocket/auth/slack/oauth2_handler.py,sha256=
|
57
|
+
hyperpocket/auth/slack/oauth2_handler.py,sha256=Mm9aSZoXFz8_Ua37JI9uJQrKgBXRo_1tJ1AGwtSQ0ZQ,6099
|
58
58
|
hyperpocket/auth/slack/oauth2_schema.py,sha256=eu2jF2thmaz66AKcnivTvIBLTbeF-a-xQFMkR4RQYX8,1056
|
59
59
|
hyperpocket/auth/slack/token_context.py,sha256=GUqMcPUleo8O9YRNMjOrMiSlHb-OOKwlrO_syCow55w,437
|
60
60
|
hyperpocket/auth/slack/token_handler.py,sha256=6L_HiDQ2wpz9x65QUB9t-d5KOpADeG-zZVgEMHu3MUE,2765
|
61
61
|
hyperpocket/auth/slack/token_schema.py,sha256=mAwOtRO2tW5OtDzbllDJtR_uhLD8ShQAjezkAZnAgd0,207
|
62
62
|
hyperpocket/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
63
|
-
hyperpocket/cli/__main__.py,sha256=
|
64
|
-
hyperpocket/cli/
|
63
|
+
hyperpocket/cli/__main__.py,sha256=68fOHIx2zw_k_ncR6PR8S9iZG_yQkPG7yAOj428Op_M,580
|
64
|
+
hyperpocket/cli/auth_oauth2.py,sha256=gGQCS8AvaVHvs4Oe6fS7tw2ks_N67-8newinaDlywbw,4680
|
65
|
+
hyperpocket/cli/auth_token.py,sha256=gmT-jVMvZ1Ck-1F_yFUChcd9HMtFHNTaUvj_332usjE,4809
|
65
66
|
hyperpocket/cli/eject.py,sha256=Te1YhDONk_VCgZ6l2HjLqONJrn04EfPk19sD6D5SOyY,636
|
66
67
|
hyperpocket/cli/pull.py,sha256=3xCyTmdbP77l7awNyCY63_ZmUhIlX1PE3apwReXNYco,549
|
67
68
|
hyperpocket/cli/sync.py,sha256=OO5zFrLOMXk7TSAFEew04ZzW4HLoQ1uVb80UKvIJha0,517
|
68
69
|
hyperpocket/cli/codegen/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
69
|
-
hyperpocket/cli/codegen/auth/__init__.py,sha256=
|
70
|
+
hyperpocket/cli/codegen/auth/__init__.py,sha256=wtm3vX2Kk79tyFkguV5oV82_YoJ3w-Clqu2izwE65Vg,959
|
70
71
|
hyperpocket/cli/codegen/auth/auth_context_template.py,sha256=89HHp5byHhLazkwtR8bsymg7IBKfp2ltdGikcD5aplY,570
|
72
|
+
hyperpocket/cli/codegen/auth/auth_oauth2_context_template.py,sha256=IW7zevhpR9W4ghUhjfRrzhxMBKLdVuzUHn6E6kB2gVU,1391
|
73
|
+
hyperpocket/cli/codegen/auth/auth_oauth2_handler_template.py,sha256=Aed6_zt5aa0aAjhrfvuspGK_4GtcsT3McoWeIGIBmKo,6761
|
74
|
+
hyperpocket/cli/codegen/auth/auth_oauth2_schema_template.py,sha256=GEp0jHNJnQZ6okyofxKBdaOIyeR8-qu_1OY1wAav9Mo,535
|
71
75
|
hyperpocket/cli/codegen/auth/auth_token_context_template.py,sha256=GzpsCY6DlGXu-YxMaJ1vtesHfJxRvQ6hEb4Xodl8EB0,764
|
72
76
|
hyperpocket/cli/codegen/auth/auth_token_handler_template.py,sha256=t30JZFTCYCcXWFop4CVEABEtttjJn-F6tcS-ZOQCh-Y,3158
|
73
77
|
hyperpocket/cli/codegen/auth/auth_token_schema_template.py,sha256=ZJRcT-0QIIxltkDCgVz7zKl3aObX__bMi33s7_ZxI5k,429
|
74
|
-
hyperpocket/cli/codegen/auth/server_auth_template.py,sha256
|
78
|
+
hyperpocket/cli/codegen/auth/server_auth_template.py,sha256=-S3bqlqsXMytOdrIG68_np3LfU5_Ydy7z-Z0fqfCE8I,1478
|
75
79
|
hyperpocket/config/__init__.py,sha256=gYMHdExdPYScBB8mihSp1yJ9H-RJ8FdNz5mEFubFNAo,138
|
76
80
|
hyperpocket/config/auth.py,sha256=IsHQHiwPmO5afbmwkA1lA1P7zF7W6LmXpM4ZmUZ4c-E,795
|
77
81
|
hyperpocket/config/git.py,sha256=CGbY7J1LyN4ccZr9CFGAQwwhjC9kvdU0On_nsAsZ1FQ,362
|
@@ -131,7 +135,7 @@ hyperpocket/util/flatten_json_schema.py,sha256=iuNBEmMSKFtPi-uqo6fb3RWN0koHOAihW
|
|
131
135
|
hyperpocket/util/function_to_model.py,sha256=TXUs-qPbzL8C9-qqpz4Ad4D9MOPP61n_p0iPU6SoBeM,2318
|
132
136
|
hyperpocket/util/get_objects_from_subpackage.py,sha256=4mR_S8eaJSdU68YfCkiXeIcXxb6q7LjFGsY_IHeNIZw,929
|
133
137
|
hyperpocket/util/json_schema_to_model.py,sha256=PqI87pU5dWwcrQWB8eQxRdfgAEvvC1x_DKZnhcsRV-o,3586
|
134
|
-
hyperpocket-0.
|
135
|
-
hyperpocket-0.
|
136
|
-
hyperpocket-0.
|
137
|
-
hyperpocket-0.
|
138
|
+
hyperpocket-0.3.1.dist-info/METADATA,sha256=UEJCp-ThPh9eJOzGYyOulcb7QD7shB14LvzMm9tLnL4,11430
|
139
|
+
hyperpocket-0.3.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
140
|
+
hyperpocket-0.3.1.dist-info/entry_points.txt,sha256=KpBleaYr0SaENXOa-dFvJ_cvFCHYFEQ4LMl11ShAcBI,61
|
141
|
+
hyperpocket-0.3.1.dist-info/RECORD,,
|