stacklink-sdk 0.6.3__tar.gz → 0.6.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {stacklink_sdk-0.6.3/stacklink_sdk.egg-info → stacklink_sdk-0.6.5}/PKG-INFO +17 -1
- {stacklink_sdk-0.6.3 → stacklink_sdk-0.6.5}/README.md +16 -0
- {stacklink_sdk-0.6.3 → stacklink_sdk-0.6.5}/pyproject.toml +1 -1
- {stacklink_sdk-0.6.3 → stacklink_sdk-0.6.5}/stacklink/__init__.py +2 -1
- {stacklink_sdk-0.6.3 → stacklink_sdk-0.6.5}/stacklink/bots.py +64 -0
- {stacklink_sdk-0.6.3 → stacklink_sdk-0.6.5}/stacklink/client.py +1 -1
- {stacklink_sdk-0.6.3 → stacklink_sdk-0.6.5}/stacklink/memory.py +9 -2
- {stacklink_sdk-0.6.3 → stacklink_sdk-0.6.5/stacklink_sdk.egg-info}/PKG-INFO +17 -1
- {stacklink_sdk-0.6.3 → stacklink_sdk-0.6.5}/tests/test_client.py +18 -0
- {stacklink_sdk-0.6.3 → stacklink_sdk-0.6.5}/LICENSE +0 -0
- {stacklink_sdk-0.6.3 → stacklink_sdk-0.6.5}/setup.cfg +0 -0
- {stacklink_sdk-0.6.3 → stacklink_sdk-0.6.5}/stacklink/api_keys.py +0 -0
- {stacklink_sdk-0.6.3 → stacklink_sdk-0.6.5}/stacklink/approvals.py +0 -0
- {stacklink_sdk-0.6.3 → stacklink_sdk-0.6.5}/stacklink/artifacts.py +0 -0
- {stacklink_sdk-0.6.3 → stacklink_sdk-0.6.5}/stacklink/auth_configs.py +0 -0
- {stacklink_sdk-0.6.3 → stacklink_sdk-0.6.5}/stacklink/billing.py +0 -0
- {stacklink_sdk-0.6.3 → stacklink_sdk-0.6.5}/stacklink/claude_agent.py +0 -0
- {stacklink_sdk-0.6.3 → stacklink_sdk-0.6.5}/stacklink/connected_accounts.py +0 -0
- {stacklink_sdk-0.6.3 → stacklink_sdk-0.6.5}/stacklink/errors.py +0 -0
- {stacklink_sdk-0.6.3 → stacklink_sdk-0.6.5}/stacklink/executions.py +0 -0
- {stacklink_sdk-0.6.3 → stacklink_sdk-0.6.5}/stacklink/knowledge.py +0 -0
- {stacklink_sdk-0.6.3 → stacklink_sdk-0.6.5}/stacklink/logs.py +0 -0
- {stacklink_sdk-0.6.3 → stacklink_sdk-0.6.5}/stacklink/mcp.py +0 -0
- {stacklink_sdk-0.6.3 → stacklink_sdk-0.6.5}/stacklink/openai_agents.py +0 -0
- {stacklink_sdk-0.6.3 → stacklink_sdk-0.6.5}/stacklink/openai_memory.py +0 -0
- {stacklink_sdk-0.6.3 → stacklink_sdk-0.6.5}/stacklink/projects.py +0 -0
- {stacklink_sdk-0.6.3 → stacklink_sdk-0.6.5}/stacklink/providers.py +0 -0
- {stacklink_sdk-0.6.3 → stacklink_sdk-0.6.5}/stacklink/sessions.py +0 -0
- {stacklink_sdk-0.6.3 → stacklink_sdk-0.6.5}/stacklink/tools.py +0 -0
- {stacklink_sdk-0.6.3 → stacklink_sdk-0.6.5}/stacklink/triggers.py +0 -0
- {stacklink_sdk-0.6.3 → stacklink_sdk-0.6.5}/stacklink/types.py +0 -0
- {stacklink_sdk-0.6.3 → stacklink_sdk-0.6.5}/stacklink/webhooks.py +0 -0
- {stacklink_sdk-0.6.3 → stacklink_sdk-0.6.5}/stacklink/workbench.py +0 -0
- {stacklink_sdk-0.6.3 → stacklink_sdk-0.6.5}/stacklink/workflows.py +0 -0
- {stacklink_sdk-0.6.3 → stacklink_sdk-0.6.5}/stacklink/x_chat.py +0 -0
- {stacklink_sdk-0.6.3 → stacklink_sdk-0.6.5}/stacklink_sdk.egg-info/SOURCES.txt +0 -0
- {stacklink_sdk-0.6.3 → stacklink_sdk-0.6.5}/stacklink_sdk.egg-info/dependency_links.txt +0 -0
- {stacklink_sdk-0.6.3 → stacklink_sdk-0.6.5}/stacklink_sdk.egg-info/requires.txt +0 -0
- {stacklink_sdk-0.6.3 → stacklink_sdk-0.6.5}/stacklink_sdk.egg-info/top_level.txt +0 -0
- {stacklink_sdk-0.6.3 → stacklink_sdk-0.6.5}/tests/test_amazon_seller_provider.py +0 -0
- {stacklink_sdk-0.6.3 → stacklink_sdk-0.6.5}/tests/test_google_docs_provider.py +0 -0
- {stacklink_sdk-0.6.3 → stacklink_sdk-0.6.5}/tests/test_google_drive_provider.py +0 -0
- {stacklink_sdk-0.6.3 → stacklink_sdk-0.6.5}/tests/test_google_sheets_provider.py +0 -0
- {stacklink_sdk-0.6.3 → stacklink_sdk-0.6.5}/tests/test_openai_memory.py +0 -0
- {stacklink_sdk-0.6.3 → stacklink_sdk-0.6.5}/tests/test_zoho_books_provider.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: stacklink-sdk
|
|
3
|
-
Version: 0.6.
|
|
3
|
+
Version: 0.6.5
|
|
4
4
|
Summary: Python SDK for Stacklink sessions, tools, MCP, auth, workbench, logs, knowledge, and billing.
|
|
5
5
|
Author: Stacklink
|
|
6
6
|
License-Expression: LicenseRef-Proprietary
|
|
@@ -169,3 +169,19 @@ All enabled notification channels use the same stored request. Decision, notific
|
|
|
169
169
|
When project settings require Workbench code approval, a foreground code/bash call returns `waiting_for_approval`, `approvalRequestId`, and its original execution ID immediately. No runtime sandbox is allocated for that wait. After the authorized person decides, observe the original execution; do not submit the code again.
|
|
170
170
|
|
|
171
171
|
Server-side customer grant management (0.3.5): `get_customer_grant`, `save_customer_grant`, and `remove_customer_grant` operate on an authenticated customer session. Save exact tool keys and resource restrictions with the returned settings revision. The server supplies identity from the session; callers cannot choose another customer in the request body. These methods never grant company approval or bypass connected-account access.
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
## Reusable Bot jobs (0.6.5)
|
|
175
|
+
|
|
176
|
+
A blank Bot and a Library Bot use the same `jobs.reviewCode` settings. Add Review
|
|
177
|
+
code through the normal Bot update, finish its native identity through the
|
|
178
|
+
returned authenticated setup link, and publish with the normal publish method.
|
|
179
|
+
|
|
180
|
+
Both clients expose `bots.jobs()`, `bots.install("code-reviewer", requestId)` and
|
|
181
|
+
`bots.reviews.setup`, `repositories`, `preview`, `request` and `get`.
|
|
182
|
+
Open request discovery is `pullRequests` in TypeScript and `pull_requests` in Python.
|
|
183
|
+
Preview never posts. A live request can post inline findings and returns a durable
|
|
184
|
+
review ID; read that ID rather than submitting another task. Repository permissions,
|
|
185
|
+
Bot budgets and the existing credit system apply to both entry paths.
|
|
186
|
+
|
|
187
|
+
[Bot job examples](https://docs.stacklink.in/docs/bots/sdk#add-review-code-to-any-bot)
|
|
@@ -148,3 +148,19 @@ All enabled notification channels use the same stored request. Decision, notific
|
|
|
148
148
|
When project settings require Workbench code approval, a foreground code/bash call returns `waiting_for_approval`, `approvalRequestId`, and its original execution ID immediately. No runtime sandbox is allocated for that wait. After the authorized person decides, observe the original execution; do not submit the code again.
|
|
149
149
|
|
|
150
150
|
Server-side customer grant management (0.3.5): `get_customer_grant`, `save_customer_grant`, and `remove_customer_grant` operate on an authenticated customer session. Save exact tool keys and resource restrictions with the returned settings revision. The server supplies identity from the session; callers cannot choose another customer in the request body. These methods never grant company approval or bypass connected-account access.
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
## Reusable Bot jobs (0.6.5)
|
|
154
|
+
|
|
155
|
+
A blank Bot and a Library Bot use the same `jobs.reviewCode` settings. Add Review
|
|
156
|
+
code through the normal Bot update, finish its native identity through the
|
|
157
|
+
returned authenticated setup link, and publish with the normal publish method.
|
|
158
|
+
|
|
159
|
+
Both clients expose `bots.jobs()`, `bots.install("code-reviewer", requestId)` and
|
|
160
|
+
`bots.reviews.setup`, `repositories`, `preview`, `request` and `get`.
|
|
161
|
+
Open request discovery is `pullRequests` in TypeScript and `pull_requests` in Python.
|
|
162
|
+
Preview never posts. A live request can post inline findings and returns a durable
|
|
163
|
+
review ID; read that ID rather than submitting another task. Repository permissions,
|
|
164
|
+
Bot budgets and the existing credit system apply to both entry paths.
|
|
165
|
+
|
|
166
|
+
[Bot job examples](https://docs.stacklink.in/docs/bots/sdk#add-review-code-to-any-bot)
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "stacklink-sdk"
|
|
7
|
-
version = "0.6.
|
|
7
|
+
version = "0.6.5"
|
|
8
8
|
description = "Python SDK for Stacklink sessions, tools, MCP, auth, workbench, logs, knowledge, and billing."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = "LicenseRef-Proprietary"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
-
from .bots import BotAvatar, verify_bot_api_request, sign_bot_trigger_request, BotRun, BotConnectionAction, BotExecutionWait, BotCapabilityFact, BotRequirement
|
|
3
|
+
from .bots import BotJobs, ReviewHost, ReviewRepository, ReviewSettings, ReviewRequest, ReviewPreviewRequest, BotAvatar, verify_bot_api_request, sign_bot_trigger_request, BotRun, BotConnectionAction, BotExecutionWait, BotCapabilityFact, BotRequirement
|
|
4
4
|
from .approvals import ApprovalDecision, ApprovalRecord, ApprovalEvent, ApprovalPermissions, CustomerApprovalGrantInput
|
|
5
5
|
from .webhooks import verify_webhook_signature
|
|
6
6
|
from .client import AsyncStacklink, STACKLINK_PYTHON_SDK_VERSION, Stacklink
|
|
@@ -27,6 +27,7 @@ from .types import (
|
|
|
27
27
|
)
|
|
28
28
|
|
|
29
29
|
__all__ = [
|
|
30
|
+
"BotJobs", "ReviewHost", "ReviewRepository", "ReviewSettings", "ReviewRequest", "ReviewPreviewRequest",
|
|
30
31
|
"BotAvatar", "BotRun", "BotConnectionAction", "BotExecutionWait", "BotCapabilityFact", "BotRequirement",
|
|
31
32
|
"ApprovalDecision", "ApprovalRecord", "ApprovalEvent", "ApprovalPermissions",
|
|
32
33
|
"CustomerApprovalGrantInput",
|
|
@@ -186,16 +186,80 @@ def verify_bot_api_request(*, method: str, url: str, body: str, headers: dict[st
|
|
|
186
186
|
return {"tenantId": tenant, "userId": user or None, "requestId": request_id}
|
|
187
187
|
|
|
188
188
|
|
|
189
|
+
ReviewHost = Literal["github", "gitlab", "bitbucket"]
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
class ReviewRepository(TypedDict):
|
|
193
|
+
host: ReviewHost
|
|
194
|
+
connectedAccountId: str
|
|
195
|
+
id: str
|
|
196
|
+
name: str
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
class ReviewSettings(TypedDict):
|
|
200
|
+
repositories: list[ReviewRepository]
|
|
201
|
+
reviewFocus: str
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
class BotJobs(TypedDict):
|
|
205
|
+
reviewCode: ReviewSettings | None
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
class ReviewRequest(TypedDict):
|
|
209
|
+
host: ReviewHost
|
|
210
|
+
repositoryId: str
|
|
211
|
+
pullNumber: int
|
|
212
|
+
revision: int
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
class ReviewPreviewRequest(ReviewRequest):
|
|
216
|
+
requestId: str
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
class BotReviews:
|
|
220
|
+
"""Review code on any Bot. Configuration uses normal bots.update and bots.publish."""
|
|
221
|
+
def __init__(self, client):
|
|
222
|
+
self.client = client
|
|
223
|
+
|
|
224
|
+
def _path(self, bot_id: str) -> str:
|
|
225
|
+
return f"/v1/bots/{quote(bot_id, safe='')}"
|
|
226
|
+
|
|
227
|
+
def setup(self, bot_id: str):
|
|
228
|
+
return self.client.request("GET", self._path(bot_id) + "/code-reviewer")
|
|
229
|
+
|
|
230
|
+
def repositories(self, bot_id: str, *, host: ReviewHost, connected_account_id: str):
|
|
231
|
+
return self.client.request("GET", self._path(bot_id) + "/code-reviewer/repositories", query={"host": host, "connectedAccountId": connected_account_id})
|
|
232
|
+
|
|
233
|
+
def pull_requests(self, bot_id: str):
|
|
234
|
+
return self.client.request("GET", self._path(bot_id) + "/code-reviewer/pull-requests")
|
|
235
|
+
|
|
236
|
+
def preview(self, bot_id: str, input: ReviewPreviewRequest):
|
|
237
|
+
return self.client.request("POST", self._path(bot_id) + "/code-reviewer/preview", json_body=input)
|
|
238
|
+
|
|
239
|
+
def request(self, bot_id: str, input: ReviewRequest):
|
|
240
|
+
return self.client.request("POST", self._path(bot_id) + "/reviews", json_body=input)
|
|
241
|
+
|
|
242
|
+
def get(self, bot_id: str, review_id: str):
|
|
243
|
+
return self.client.request("GET", self._path(bot_id) + "/reviews/" + quote(review_id, safe=""))
|
|
244
|
+
|
|
245
|
+
|
|
189
246
|
class BotsResource:
|
|
190
247
|
def __init__(self, client, *, async_mode: bool = False):
|
|
191
248
|
self.client = client
|
|
192
249
|
self.files = BotFiles(client)
|
|
250
|
+
self.reviews = BotReviews(client)
|
|
193
251
|
self.async_mode = async_mode
|
|
194
252
|
|
|
195
253
|
def _path(self, bot_id: str, run_id: str | None = None) -> str:
|
|
196
254
|
path = f"/v1/bots/{quote(bot_id, safe='')}"
|
|
197
255
|
return f"{path}/runs/{quote(run_id, safe='')}" if run_id else path
|
|
198
256
|
|
|
257
|
+
def jobs(self):
|
|
258
|
+
return self.client.request("GET", "/v1/bots/jobs")
|
|
259
|
+
|
|
260
|
+
def install(self, key: Literal["code-reviewer"], request_id: str):
|
|
261
|
+
return self.client.request("POST", "/v1/bots/library/" + quote(key, safe="") + "/install", json_body={"requestId": request_id})
|
|
262
|
+
|
|
199
263
|
def apis(self):
|
|
200
264
|
return self.client.request("GET", "/v1/bots/apis")
|
|
201
265
|
|
|
@@ -38,7 +38,7 @@ from .types import Json, Transport
|
|
|
38
38
|
from .webhooks import WebhooksResource
|
|
39
39
|
from .workbench import WorkbenchResource
|
|
40
40
|
|
|
41
|
-
STACKLINK_PYTHON_SDK_VERSION = "0.6.
|
|
41
|
+
STACKLINK_PYTHON_SDK_VERSION = "0.6.5"
|
|
42
42
|
STACKLINK_PYTHON_USER_AGENT = f"stacklink-python/{STACKLINK_PYTHON_SDK_VERSION}"
|
|
43
43
|
|
|
44
44
|
|
|
@@ -232,8 +232,15 @@ class SessionMemoryResource:
|
|
|
232
232
|
def history(self, memory_id: str):
|
|
233
233
|
return self.memory.history(memory_id, sessionId=self.session_id)
|
|
234
234
|
|
|
235
|
-
def update(self, memory_id: str, patch: dict[str, Any]):
|
|
236
|
-
|
|
235
|
+
def update(self, memory_id: str, patch: dict[str, Any], *, consent: dict[str, Any] | None = None, expected_version_id: str | None = None, idempotency_key: str | None = None):
|
|
236
|
+
body: dict[str, Any] = {"sessionId": self.session_id, "patch": patch}
|
|
237
|
+
if consent is not None:
|
|
238
|
+
body["consent"] = consent
|
|
239
|
+
if expected_version_id is not None:
|
|
240
|
+
body["expectedVersionId"] = expected_version_id
|
|
241
|
+
if idempotency_key is not None:
|
|
242
|
+
body["idempotencyKey"] = idempotency_key
|
|
243
|
+
return self.memory.update(memory_id, body)
|
|
237
244
|
|
|
238
245
|
def forget(self, memory_id: str, reason: str | None = None):
|
|
239
246
|
body: dict[str, Any] = {"sessionId": self.session_id}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: stacklink-sdk
|
|
3
|
-
Version: 0.6.
|
|
3
|
+
Version: 0.6.5
|
|
4
4
|
Summary: Python SDK for Stacklink sessions, tools, MCP, auth, workbench, logs, knowledge, and billing.
|
|
5
5
|
Author: Stacklink
|
|
6
6
|
License-Expression: LicenseRef-Proprietary
|
|
@@ -169,3 +169,19 @@ All enabled notification channels use the same stored request. Decision, notific
|
|
|
169
169
|
When project settings require Workbench code approval, a foreground code/bash call returns `waiting_for_approval`, `approvalRequestId`, and its original execution ID immediately. No runtime sandbox is allocated for that wait. After the authorized person decides, observe the original execution; do not submit the code again.
|
|
170
170
|
|
|
171
171
|
Server-side customer grant management (0.3.5): `get_customer_grant`, `save_customer_grant`, and `remove_customer_grant` operate on an authenticated customer session. Save exact tool keys and resource restrictions with the returned settings revision. The server supplies identity from the session; callers cannot choose another customer in the request body. These methods never grant company approval or bypass connected-account access.
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
## Reusable Bot jobs (0.6.5)
|
|
175
|
+
|
|
176
|
+
A blank Bot and a Library Bot use the same `jobs.reviewCode` settings. Add Review
|
|
177
|
+
code through the normal Bot update, finish its native identity through the
|
|
178
|
+
returned authenticated setup link, and publish with the normal publish method.
|
|
179
|
+
|
|
180
|
+
Both clients expose `bots.jobs()`, `bots.install("code-reviewer", requestId)` and
|
|
181
|
+
`bots.reviews.setup`, `repositories`, `preview`, `request` and `get`.
|
|
182
|
+
Open request discovery is `pullRequests` in TypeScript and `pull_requests` in Python.
|
|
183
|
+
Preview never posts. A live request can post inline findings and returns a durable
|
|
184
|
+
review ID; read that ID rather than submitting another task. Repository permissions,
|
|
185
|
+
Bot budgets and the existing credit system apply to both entry paths.
|
|
186
|
+
|
|
187
|
+
[Bot job examples](https://docs.stacklink.in/docs/bots/sdk#add-review-code-to-any-bot)
|
|
@@ -1951,3 +1951,21 @@ class BotStreamRecoveryTests(unittest.TestCase):
|
|
|
1951
1951
|
self.assertEqual([event async for event in client.bots.stream("bot-one", "run-one")], [delta, done])
|
|
1952
1952
|
self.assertEqual(len(calls), 2)
|
|
1953
1953
|
asyncio.run(proof())
|
|
1954
|
+
|
|
1955
|
+
|
|
1956
|
+
class BotJobsTests(unittest.TestCase):
|
|
1957
|
+
def test_review_uses_common_update_and_retained_status(self):
|
|
1958
|
+
calls = []
|
|
1959
|
+
def transport(method, path, headers, body, query, timeout):
|
|
1960
|
+
calls.append((method, path, body))
|
|
1961
|
+
return 200, {}, {"id": "review-one", "status": "queued", "runId": "run-one"}
|
|
1962
|
+
client = Stacklink(api_key="test", transport=transport)
|
|
1963
|
+
jobs = {"reviewCode": {"repositories": [], "reviewFocus": "Check retries"}}
|
|
1964
|
+
client.bots.update("bot-one", 2, {"jobs": jobs})
|
|
1965
|
+
review = client.bots.reviews.request("bot-one", {"host": "gitlab", "repositoryId": "123", "pullNumber": 4, "revision": 3})
|
|
1966
|
+
client.bots.reviews.get("bot-one", review["id"])
|
|
1967
|
+
self.assertEqual(calls, [
|
|
1968
|
+
("PATCH", "/v1/bots/bot-one", {"revision": 2, "patch": {"jobs": jobs}}),
|
|
1969
|
+
("POST", "/v1/bots/bot-one/reviews", {"host": "gitlab", "repositoryId": "123", "pullNumber": 4, "revision": 3}),
|
|
1970
|
+
("GET", "/v1/bots/bot-one/reviews/review-one", None),
|
|
1971
|
+
])
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|