stacklink-sdk 0.6.4__tar.gz → 0.6.7__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.
Files changed (45) hide show
  1. {stacklink_sdk-0.6.4/stacklink_sdk.egg-info → stacklink_sdk-0.6.7}/PKG-INFO +22 -1
  2. {stacklink_sdk-0.6.4 → stacklink_sdk-0.6.7}/README.md +21 -0
  3. {stacklink_sdk-0.6.4 → stacklink_sdk-0.6.7}/pyproject.toml +1 -1
  4. {stacklink_sdk-0.6.4 → stacklink_sdk-0.6.7}/stacklink/__init__.py +2 -1
  5. {stacklink_sdk-0.6.4 → stacklink_sdk-0.6.7}/stacklink/bots.py +144 -0
  6. {stacklink_sdk-0.6.4 → stacklink_sdk-0.6.7}/stacklink/client.py +1 -1
  7. {stacklink_sdk-0.6.4 → stacklink_sdk-0.6.7/stacklink_sdk.egg-info}/PKG-INFO +22 -1
  8. {stacklink_sdk-0.6.4 → stacklink_sdk-0.6.7}/tests/test_client.py +18 -0
  9. {stacklink_sdk-0.6.4 → stacklink_sdk-0.6.7}/LICENSE +0 -0
  10. {stacklink_sdk-0.6.4 → stacklink_sdk-0.6.7}/setup.cfg +0 -0
  11. {stacklink_sdk-0.6.4 → stacklink_sdk-0.6.7}/stacklink/api_keys.py +0 -0
  12. {stacklink_sdk-0.6.4 → stacklink_sdk-0.6.7}/stacklink/approvals.py +0 -0
  13. {stacklink_sdk-0.6.4 → stacklink_sdk-0.6.7}/stacklink/artifacts.py +0 -0
  14. {stacklink_sdk-0.6.4 → stacklink_sdk-0.6.7}/stacklink/auth_configs.py +0 -0
  15. {stacklink_sdk-0.6.4 → stacklink_sdk-0.6.7}/stacklink/billing.py +0 -0
  16. {stacklink_sdk-0.6.4 → stacklink_sdk-0.6.7}/stacklink/claude_agent.py +0 -0
  17. {stacklink_sdk-0.6.4 → stacklink_sdk-0.6.7}/stacklink/connected_accounts.py +0 -0
  18. {stacklink_sdk-0.6.4 → stacklink_sdk-0.6.7}/stacklink/errors.py +0 -0
  19. {stacklink_sdk-0.6.4 → stacklink_sdk-0.6.7}/stacklink/executions.py +0 -0
  20. {stacklink_sdk-0.6.4 → stacklink_sdk-0.6.7}/stacklink/knowledge.py +0 -0
  21. {stacklink_sdk-0.6.4 → stacklink_sdk-0.6.7}/stacklink/logs.py +0 -0
  22. {stacklink_sdk-0.6.4 → stacklink_sdk-0.6.7}/stacklink/mcp.py +0 -0
  23. {stacklink_sdk-0.6.4 → stacklink_sdk-0.6.7}/stacklink/memory.py +0 -0
  24. {stacklink_sdk-0.6.4 → stacklink_sdk-0.6.7}/stacklink/openai_agents.py +0 -0
  25. {stacklink_sdk-0.6.4 → stacklink_sdk-0.6.7}/stacklink/openai_memory.py +0 -0
  26. {stacklink_sdk-0.6.4 → stacklink_sdk-0.6.7}/stacklink/projects.py +0 -0
  27. {stacklink_sdk-0.6.4 → stacklink_sdk-0.6.7}/stacklink/providers.py +0 -0
  28. {stacklink_sdk-0.6.4 → stacklink_sdk-0.6.7}/stacklink/sessions.py +0 -0
  29. {stacklink_sdk-0.6.4 → stacklink_sdk-0.6.7}/stacklink/tools.py +0 -0
  30. {stacklink_sdk-0.6.4 → stacklink_sdk-0.6.7}/stacklink/triggers.py +0 -0
  31. {stacklink_sdk-0.6.4 → stacklink_sdk-0.6.7}/stacklink/types.py +0 -0
  32. {stacklink_sdk-0.6.4 → stacklink_sdk-0.6.7}/stacklink/webhooks.py +0 -0
  33. {stacklink_sdk-0.6.4 → stacklink_sdk-0.6.7}/stacklink/workbench.py +0 -0
  34. {stacklink_sdk-0.6.4 → stacklink_sdk-0.6.7}/stacklink/workflows.py +0 -0
  35. {stacklink_sdk-0.6.4 → stacklink_sdk-0.6.7}/stacklink/x_chat.py +0 -0
  36. {stacklink_sdk-0.6.4 → stacklink_sdk-0.6.7}/stacklink_sdk.egg-info/SOURCES.txt +0 -0
  37. {stacklink_sdk-0.6.4 → stacklink_sdk-0.6.7}/stacklink_sdk.egg-info/dependency_links.txt +0 -0
  38. {stacklink_sdk-0.6.4 → stacklink_sdk-0.6.7}/stacklink_sdk.egg-info/requires.txt +0 -0
  39. {stacklink_sdk-0.6.4 → stacklink_sdk-0.6.7}/stacklink_sdk.egg-info/top_level.txt +0 -0
  40. {stacklink_sdk-0.6.4 → stacklink_sdk-0.6.7}/tests/test_amazon_seller_provider.py +0 -0
  41. {stacklink_sdk-0.6.4 → stacklink_sdk-0.6.7}/tests/test_google_docs_provider.py +0 -0
  42. {stacklink_sdk-0.6.4 → stacklink_sdk-0.6.7}/tests/test_google_drive_provider.py +0 -0
  43. {stacklink_sdk-0.6.4 → stacklink_sdk-0.6.7}/tests/test_google_sheets_provider.py +0 -0
  44. {stacklink_sdk-0.6.4 → stacklink_sdk-0.6.7}/tests/test_openai_memory.py +0 -0
  45. {stacklink_sdk-0.6.4 → stacklink_sdk-0.6.7}/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.4
3
+ Version: 0.6.7
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,24 @@ 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)
188
+
189
+
190
+ ## Issue Triage (0.6.6 staging candidate)
191
+
192
+ Use `bots.issues.report`, `list`, `get` and `action` on a Bot with a published Issue Triage Job. Report once with a stable `requestId`, then read the returned `issueId`. A receipt is not a completed investigation. Ticket actions use the existing approval flow; source connections do not change the Bot’s Slack or Teams author. Draft previews and job setup use the `bots.issues.preview`, `setup` and `save` methods. These additions require the staging candidate package until the matching public SDK is released.
@@ -148,3 +148,24 @@ 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)
167
+
168
+
169
+ ## Issue Triage (0.6.6 staging candidate)
170
+
171
+ Use `bots.issues.report`, `list`, `get` and `action` on a Bot with a published Issue Triage Job. Report once with a stable `requestId`, then read the returned `issueId`. A receipt is not a completed investigation. Ticket actions use the existing approval flow; source connections do not change the Bot’s Slack or Teams author. Draft previews and job setup use the `bots.issues.preview`, `setup` and `save` methods. These additions require the staging candidate package until the matching public SDK is released.
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "stacklink-sdk"
7
- version = "0.6.4"
7
+ version = "0.6.7"
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 TriageSourceProvider, TriageReport, IssueTriageSettings, TriageAction, 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
+ "TriageSourceProvider", "TriageReport", "IssueTriageSettings", "TriageAction", "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,160 @@ 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
+ TriageSourceProvider = Literal["sentry", "datadog", "aws", "google_cloud", "sonarcloud", "github"]
205
+
206
+
207
+ class TriageReport(TypedDict, total=False):
208
+ requestId: str
209
+ title: str
210
+ description: str
211
+ sourceId: str
212
+ resourceId: str
213
+ externalId: str
214
+ url: str
215
+ occurredAt: str
216
+
217
+
218
+ class IssueTriageSettings(TypedDict):
219
+ sources: list[dict[str, Any]]
220
+ triggerIds: list[str]
221
+ destinations: list[dict[str, str]]
222
+ tickets: list[dict[str, Any]]
223
+ instructions: str
224
+ services: list[dict[str, Any]]
225
+ github: dict[str, list[str]]
226
+ watch: dict[str, int]
227
+
228
+
229
+ class TriageAction(TypedDict, total=False):
230
+ requestId: str
231
+ action: Literal["continue", "retry_delivery", "ask", "watch", "stop_watch", "confirm_resolved", "reopen", "keep_together", "split", "prepare_ticket", "file_ticket"]
232
+ deliveryId: str
233
+ message: str
234
+ note: str
235
+ intervalMinutes: int
236
+ durationHours: int
237
+ relatedIssueId: str
238
+ receiptId: str
239
+ proposalId: str
240
+ destinationId: str
241
+ title: str
242
+ description: str
243
+ fields: dict[str, Any]
244
+
245
+
246
+ class BotJobs(TypedDict, total=False):
247
+ reviewCode: ReviewSettings | None
248
+ issueTriage: IssueTriageSettings | None
249
+
250
+
251
+ class ReviewRequest(TypedDict):
252
+ host: ReviewHost
253
+ repositoryId: str
254
+ pullNumber: int
255
+ revision: int
256
+
257
+
258
+ class ReviewPreviewRequest(ReviewRequest):
259
+ requestId: str
260
+
261
+
262
+ class BotReviews:
263
+ """Review code on any Bot. Configuration uses normal bots.update and bots.publish."""
264
+ def __init__(self, client):
265
+ self.client = client
266
+
267
+ def _path(self, bot_id: str) -> str:
268
+ return f"/v1/bots/{quote(bot_id, safe='')}"
269
+
270
+ def setup(self, bot_id: str):
271
+ return self.client.request("GET", self._path(bot_id) + "/code-reviewer")
272
+
273
+ def repositories(self, bot_id: str, *, host: ReviewHost, connected_account_id: str):
274
+ return self.client.request("GET", self._path(bot_id) + "/code-reviewer/repositories", query={"host": host, "connectedAccountId": connected_account_id})
275
+
276
+ def pull_requests(self, bot_id: str):
277
+ return self.client.request("GET", self._path(bot_id) + "/code-reviewer/pull-requests")
278
+
279
+ def preview(self, bot_id: str, input: ReviewPreviewRequest):
280
+ return self.client.request("POST", self._path(bot_id) + "/code-reviewer/preview", json_body=input)
281
+
282
+ def request(self, bot_id: str, input: ReviewRequest):
283
+ return self.client.request("POST", self._path(bot_id) + "/reviews", json_body=input)
284
+
285
+ def get(self, bot_id: str, review_id: str):
286
+ return self.client.request("GET", self._path(bot_id) + "/reviews/" + quote(review_id, safe=""))
287
+
288
+
289
+ class BotIssues:
290
+ """Issue Triage shares the Bot's publication, funding, connections and approvals."""
291
+ def __init__(self, client):
292
+ self.client = client
293
+
294
+ def _path(self, bot_id: str) -> str:
295
+ return f"/v1/bots/{quote(bot_id, safe='')}"
296
+
297
+ def setup(self, bot_id: str):
298
+ return self.client.request("GET", self._path(bot_id) + "/issue-triage")
299
+
300
+ def save(self, bot_id: str, revision: int, settings: IssueTriageSettings):
301
+ return self.client.request("PUT", self._path(bot_id) + "/issue-triage", json_body={"revision": revision, "settings": settings})
302
+
303
+ def resources(self, bot_id: str, provider_key: TriageSourceProvider, connected_account_id: str):
304
+ return self.client.request("GET", self._path(bot_id) + "/issue-triage/resources", query={"providerKey": provider_key, "connectedAccountId": connected_account_id})
305
+
306
+ def ticket_options(self, bot_id: str, connected_account_id: str, resource_id: str, issue_type_id: str | None = None):
307
+ return self.client.request("GET", self._path(bot_id) + "/issue-triage/ticket-options", query={"connectedAccountId": connected_account_id, "resourceId": resource_id, **({"issueTypeId": issue_type_id} if issue_type_id else {})})
308
+
309
+ def preview(self, bot_id: str, revision: int, report: TriageReport):
310
+ return self.client.request("POST", self._path(bot_id) + "/issue-triage/preview", json_body={**report, "revision": revision})
311
+
312
+ def report(self, bot_id: str, report: TriageReport):
313
+ return self.client.request("POST", self._path(bot_id) + "/issues", json_body=report)
314
+
315
+ def list(self, bot_id: str, *, mode: Literal["live", "preview"] = "live", status: str | None = None, cursor: str | None = None, limit: int = 30):
316
+ return self.client.request("GET", self._path(bot_id) + "/issues", query={"limit": limit, "mode": mode, **({"status": status} if status else {}), **({"cursor": cursor} if cursor else {})})
317
+
318
+ def get(self, bot_id: str, issue_id: str):
319
+ return self.client.request("GET", self._path(bot_id) + "/issues/" + quote(issue_id, safe=""))
320
+
321
+ def action(self, bot_id: str, issue_id: str, action: TriageAction):
322
+ return self.client.request("POST", self._path(bot_id) + "/issues/" + quote(issue_id, safe="") + "/actions", json_body=action)
323
+
324
+
189
325
  class BotsResource:
190
326
  def __init__(self, client, *, async_mode: bool = False):
191
327
  self.client = client
192
328
  self.files = BotFiles(client)
329
+ self.reviews = BotReviews(client)
330
+ self.issues = BotIssues(client)
193
331
  self.async_mode = async_mode
194
332
 
195
333
  def _path(self, bot_id: str, run_id: str | None = None) -> str:
196
334
  path = f"/v1/bots/{quote(bot_id, safe='')}"
197
335
  return f"{path}/runs/{quote(run_id, safe='')}" if run_id else path
198
336
 
337
+ def jobs(self):
338
+ return self.client.request("GET", "/v1/bots/jobs")
339
+
340
+ def install(self, key: Literal["code-reviewer", "issue-triage"], request_id: str):
341
+ return self.client.request("POST", "/v1/bots/library/" + quote(key, safe="") + "/install", json_body={"requestId": request_id})
342
+
199
343
  def apis(self):
200
344
  return self.client.request("GET", "/v1/bots/apis")
201
345
 
@@ -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.4"
41
+ STACKLINK_PYTHON_SDK_VERSION = "0.6.7"
42
42
  STACKLINK_PYTHON_USER_AGENT = f"stacklink-python/{STACKLINK_PYTHON_SDK_VERSION}"
43
43
 
44
44
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: stacklink-sdk
3
- Version: 0.6.4
3
+ Version: 0.6.7
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,24 @@ 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)
188
+
189
+
190
+ ## Issue Triage (0.6.6 staging candidate)
191
+
192
+ Use `bots.issues.report`, `list`, `get` and `action` on a Bot with a published Issue Triage Job. Report once with a stable `requestId`, then read the returned `issueId`. A receipt is not a completed investigation. Ticket actions use the existing approval flow; source connections do not change the Bot’s Slack or Teams author. Draft previews and job setup use the `bots.issues.preview`, `setup` and `save` methods. These additions require the staging candidate package until the matching public SDK is released.
@@ -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