stackshift 1.8.0__py3-none-any.whl → 1.9.0__py3-none-any.whl
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.
- stackshift/__init__.py +2 -1
- stackshift/computers.py +55 -4
- {stackshift-1.8.0.dist-info → stackshift-1.9.0.dist-info}/METADATA +18 -1
- {stackshift-1.8.0.dist-info → stackshift-1.9.0.dist-info}/RECORD +6 -6
- {stackshift-1.8.0.dist-info → stackshift-1.9.0.dist-info}/WHEEL +0 -0
- {stackshift-1.8.0.dist-info → stackshift-1.9.0.dist-info}/top_level.txt +0 -0
stackshift/__init__.py
CHANGED
|
@@ -2,7 +2,7 @@ from .client import StackShift
|
|
|
2
2
|
from .agents import AgentConnectionOperationsClient, AgentConnectionsClient, AgentsClient
|
|
3
3
|
from .ai_credits import AICreditsClient
|
|
4
4
|
from .assets import ASSET_TRANSFORM_PRESETS, AssetsClient, asset_transform_options, asset_transform_spec, get_asset_transform_preset
|
|
5
|
-
from .computers import COMPUTER_CAPACITY_BUSY, COMPUTER_LIMIT_EXCEEDED, COMPUTER_SPEND_CAP_REACHED, Computer, ComputerActionError, ComputerCIClient, ComputerKeysClient, ComputersClient, ComputerSnapshotsClient, ComputerTransferError, ComputerWaitError, computer_public_pricing, exchange_computer_agent_claim, register_computer_agent, wait_for_computer_agent_key
|
|
5
|
+
from .computers import COMPUTER_AGENT_PROVIDERS, COMPUTER_CAPACITY_BUSY, COMPUTER_LIMIT_EXCEEDED, COMPUTER_SPEND_CAP_REACHED, Computer, ComputerActionError, ComputerCIClient, ComputerKeysClient, ComputersClient, ComputerSnapshotsClient, ComputerTransferError, ComputerWaitError, computer_public_pricing, exchange_computer_agent_claim, register_computer_agent, wait_for_computer_agent_key
|
|
6
6
|
from .computers_adapters import (
|
|
7
7
|
AnthropicComputerAdapter,
|
|
8
8
|
FunctionComputerAdapter,
|
|
@@ -59,6 +59,7 @@ from .workload_security import WorkloadSecurityClient
|
|
|
59
59
|
|
|
60
60
|
__all__ = [
|
|
61
61
|
"StackShift",
|
|
62
|
+
"COMPUTER_AGENT_PROVIDERS",
|
|
62
63
|
"COMPUTER_CAPACITY_BUSY",
|
|
63
64
|
"COMPUTER_LIMIT_EXCEEDED",
|
|
64
65
|
"COMPUTER_SPEND_CAP_REACHED",
|
stackshift/computers.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
3
|
import json
|
|
4
|
+
import os
|
|
4
5
|
import time
|
|
5
6
|
import uuid
|
|
6
7
|
from typing import Any, Iterator
|
|
@@ -16,6 +17,8 @@ COMPUTER_LIMIT_EXCEEDED = "limit_exceeded"
|
|
|
16
17
|
COMPUTER_CAPACITY_BUSY = "capacity_busy"
|
|
17
18
|
COMPUTER_SPEND_CAP_REACHED = "spend_cap_reached"
|
|
18
19
|
|
|
20
|
+
COMPUTER_AGENT_PROVIDERS = ("claude", "codex", "gemini", "opencode", "cursor", "copilot", "amp", "qwen")
|
|
21
|
+
|
|
19
22
|
|
|
20
23
|
class ComputerWaitError(RuntimeError):
|
|
21
24
|
def __init__(self, message: str, computer: dict[str, Any] | None = None) -> None:
|
|
@@ -193,6 +196,9 @@ class ComputersClient:
|
|
|
193
196
|
self.snapshots = ComputerSnapshotsClient(client)
|
|
194
197
|
self.ci = ComputerCIClient(client)
|
|
195
198
|
|
|
199
|
+
def ensure_project(self) -> dict[str, Any]:
|
|
200
|
+
return self._client.request("POST", "/computers/project")
|
|
201
|
+
|
|
196
202
|
def templates(self, project_id: str) -> list[dict[str, Any]]:
|
|
197
203
|
return self._client.request("GET", "/computers/templates", params={"project_id": project_id})
|
|
198
204
|
|
|
@@ -367,9 +373,33 @@ class ComputersClient:
|
|
|
367
373
|
def ssh_certificate(self, computer_id: str, public_key: str) -> dict[str, Any]:
|
|
368
374
|
return self._client.request("POST", "/computers/ssh/certificates", json={"computer_id": computer_id, "public_key": public_key})
|
|
369
375
|
|
|
370
|
-
def prompt_agent(self, computer_id: str, prompt: str, *, conversation_id: str | None = None, provider: str | None = None, model: str | None = None, cwd: str | None = None, env: dict[str, str] | None = None, secret_binding_ids: list[str] | None = None) -> dict[str, Any]:
|
|
371
|
-
|
|
372
|
-
|
|
376
|
+
def prompt_agent(self, computer_id: str, prompt: str | None = None, *, conversation_id: str | None = None, provider: str | None = None, model: str | None = None, cwd: str | None = None, env: dict[str, str] | None = None, secret_binding_ids: list[str] | None = None, attachments: list[str] | None = None, forks: int | None = None, prompts: list[str] | None = None) -> dict[str, Any]:
|
|
377
|
+
"""Send a prompt. Returns a conversation, or a fan-out when `forks` or `prompts` is set."""
|
|
378
|
+
optional = {"prompt": prompt, "conversation_id": conversation_id, "provider": provider, "model": model, "cwd": cwd, "env": env, "secret_binding_ids": secret_binding_ids, "attachments": attachments, "forks": forks, "prompts": prompts}
|
|
379
|
+
return self._client.request("POST", f"/computers/{_seg(computer_id)}/agent/prompt", json={key: value for key, value in optional.items() if value is not None})
|
|
380
|
+
|
|
381
|
+
def attach_agent_file(self, computer_id: str, local_path: str) -> str:
|
|
382
|
+
remote = f"/workspace/.stackshift/attachments/{uuid.uuid4().hex}/{os.path.basename(local_path)}"
|
|
383
|
+
self.upload(computer_id, local_path, remote)
|
|
384
|
+
return remote
|
|
385
|
+
|
|
386
|
+
def agent_providers(self, computer_id: str, *, refresh: bool = False) -> list[dict[str, Any]]:
|
|
387
|
+
return self._client.request("GET", f"/computers/{_seg(computer_id)}/agent/providers", params=_params(refresh="1" if refresh else None))["providers"]
|
|
388
|
+
|
|
389
|
+
def agent_result(self, computer_id: str, conversation_id: str, *, wait: bool = False) -> dict[str, Any]:
|
|
390
|
+
return self._client.request("GET", f"/computers/{_seg(computer_id)}/agent/conversations/{_seg(conversation_id)}/result", params=_params(wait="1" if wait else None))
|
|
391
|
+
|
|
392
|
+
def agent_turns(self, computer_id: str, *, limit: int | None = None) -> list[dict[str, Any]]:
|
|
393
|
+
return self._client.request("GET", f"/computers/{_seg(computer_id)}/agent/turns", params=_params(limit=limit))["turns"]
|
|
394
|
+
|
|
395
|
+
def agent_fanouts(self, computer_id: str) -> list[dict[str, Any]]:
|
|
396
|
+
return self._client.request("GET", f"/computers/{_seg(computer_id)}/agent/fanouts")["fanouts"]
|
|
397
|
+
|
|
398
|
+
def agent_fanout(self, computer_id: str, fanout_id: str) -> dict[str, Any]:
|
|
399
|
+
return self._client.request("GET", f"/computers/{_seg(computer_id)}/agent/fanouts/{_seg(fanout_id)}")
|
|
400
|
+
|
|
401
|
+
def keep_agent_fork(self, computer_id: str, fanout_id: str, fork_computer_id: str) -> dict[str, Any]:
|
|
402
|
+
return self._client.request("POST", f"/computers/{_seg(computer_id)}/agent/fanouts/{_seg(fanout_id)}/keep", json={"computer_id": fork_computer_id})
|
|
373
403
|
|
|
374
404
|
def agent_conversations(self, computer_id: str) -> list[dict[str, Any]]:
|
|
375
405
|
return self._client.request("GET", f"/computers/{_seg(computer_id)}/agent/conversations")["conversations"]
|
|
@@ -835,9 +865,30 @@ class Computer:
|
|
|
835
865
|
def revoke_ssh_tokens(self) -> None:
|
|
836
866
|
self._client.revoke_ssh_tokens(self.id)
|
|
837
867
|
|
|
838
|
-
def prompt_agent(self, prompt: str, **options: Any) -> dict[str, Any]:
|
|
868
|
+
def prompt_agent(self, prompt: str | None = None, **options: Any) -> dict[str, Any]:
|
|
839
869
|
return self._client.prompt_agent(self.id, prompt, **options)
|
|
840
870
|
|
|
871
|
+
def attach_agent_file(self, local_path: str) -> str:
|
|
872
|
+
return self._client.attach_agent_file(self.id, local_path)
|
|
873
|
+
|
|
874
|
+
def agent_providers(self, *, refresh: bool = False) -> list[dict[str, Any]]:
|
|
875
|
+
return self._client.agent_providers(self.id, refresh=refresh)
|
|
876
|
+
|
|
877
|
+
def agent_result(self, conversation_id: str, *, wait: bool = False) -> dict[str, Any]:
|
|
878
|
+
return self._client.agent_result(self.id, conversation_id, wait=wait)
|
|
879
|
+
|
|
880
|
+
def agent_turns(self, *, limit: int | None = None) -> list[dict[str, Any]]:
|
|
881
|
+
return self._client.agent_turns(self.id, limit=limit)
|
|
882
|
+
|
|
883
|
+
def agent_fanouts(self) -> list[dict[str, Any]]:
|
|
884
|
+
return self._client.agent_fanouts(self.id)
|
|
885
|
+
|
|
886
|
+
def agent_fanout(self, fanout_id: str) -> dict[str, Any]:
|
|
887
|
+
return self._client.agent_fanout(self.id, fanout_id)
|
|
888
|
+
|
|
889
|
+
def keep_agent_fork(self, fanout_id: str, fork_computer_id: str) -> dict[str, Any]:
|
|
890
|
+
return self._client.keep_agent_fork(self.id, fanout_id, fork_computer_id)
|
|
891
|
+
|
|
841
892
|
def agent_conversations(self) -> list[dict[str, Any]]:
|
|
842
893
|
return self._client.agent_conversations(self.id)
|
|
843
894
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: stackshift
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.9.0
|
|
4
4
|
Summary: Official Python SDK for StackShift.
|
|
5
5
|
Author-email: StackShift <support@stackshift.cloud>
|
|
6
6
|
Project-URL: Homepage, https://stackshift.cloud
|
|
@@ -51,6 +51,8 @@ computer.files.remove("app/tmp", recursive=True)
|
|
|
51
51
|
|
|
52
52
|
`upload_dir` skips `.gitignore`d files in a git folder unless you pass `include_ignored=True`, and keeps modes, symlinks and modification times.
|
|
53
53
|
|
|
54
|
+
`computers.ensure_project()` returns the project computers go in (`id`, `name`, `created`), making one named "Computers" if the account has none; it needs a user token.
|
|
55
|
+
|
|
54
56
|
Pick `vcpus` and `memory_gb` from the template's sizes (`templates()` lists them), for example 2 vCPU / 8 GB or 4 vCPU / 16 GB. `region` picks where it starts; `computers.regions(project_id)` lists the regions open now.
|
|
55
57
|
|
|
56
58
|
Tell people what an agent is doing. The dashboard shows the task and next step beside the screen, and `ask_owner` carries the next step on its card.
|
|
@@ -181,6 +183,21 @@ computer.agent_conversations()
|
|
|
181
183
|
computer.agent_events(conversation["id"], after_seq=10, limit=50)
|
|
182
184
|
```
|
|
183
185
|
|
|
186
|
+
Providers are `COMPUTER_AGENT_PROVIDERS` (`claude`, `codex`, `gemini`, `opencode`, `cursor`, `copilot`, `amp`, `qwen`). Attach files, read the result, and try one task several ways:
|
|
187
|
+
|
|
188
|
+
```python
|
|
189
|
+
computer.agent_providers()
|
|
190
|
+
spec = computer.attach_agent_file("./spec.md")
|
|
191
|
+
conversation = computer.prompt_agent("fix the failing tests", provider="claude", attachments=[spec])
|
|
192
|
+
computer.agent_result(conversation["id"], wait=True)
|
|
193
|
+
computer.agent_turns(limit=20)
|
|
194
|
+
|
|
195
|
+
fanout = computer.prompt_agent(prompts=["fix it with a retry", "fix it with a lock"], provider="codex")
|
|
196
|
+
done = computer.agent_fanout(fanout["id"])
|
|
197
|
+
computer.keep_agent_fork(fanout["id"], done["forks"][0]["computer_id"])
|
|
198
|
+
computer.agent_fanouts()
|
|
199
|
+
```
|
|
200
|
+
|
|
184
201
|
`computers.keys.create(project_id, name, scopes=["computers:read"])` limits a key to `computers:read`, `computers:write`, `computers:use` or `computers:delete`. A stuck large upload resumes with `computers.resume_upload(computer_id, transfer_id, upload_id, part_md5)`.
|
|
185
202
|
|
|
186
203
|
An agent can get its own key without any existing key. The functions below send no `Authorization` header:
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
stackshift/__init__.py,sha256=
|
|
1
|
+
stackshift/__init__.py,sha256=5BeG1eNWB4BJsmqWHP-WZdLuCWEw5RaqXxFWw9QhEPU,5714
|
|
2
2
|
stackshift/agents.py,sha256=8Pdp1ujQHTfAimmMun8RmzXNlmvsEX_WV65KjMiu-CU,4292
|
|
3
3
|
stackshift/ai_credits.py,sha256=2u5zGSBo_spHqgYJhtmChaEiBq9jUVaTjR1uprxMpNQ,1142
|
|
4
4
|
stackshift/assets.py,sha256=ElOFd7V6D2ceIprDnBcwXbqK4jnU9YXz63hWTtvnx9E,24127
|
|
@@ -8,7 +8,7 @@ stackshift/assets_platform.py,sha256=w2Eke0YFXinmtHt1oaZlaiP_J32VymfhVWWLOYrX93M
|
|
|
8
8
|
stackshift/assets_video.py,sha256=KBIOTsVspHcMltkELsbTmfu-VB6_36dpYQ7HKTqAa2E,2374
|
|
9
9
|
stackshift/assets_workflows.py,sha256=YDGVfzbMW-y5umPWqrHQ9Pp6tGjUC0fnIfNew73V7-c,7274
|
|
10
10
|
stackshift/client.py,sha256=Yz58lNuLhd6y5l1GDF5WXmdKlm2hTRpSjbEw_99ANRE,4646
|
|
11
|
-
stackshift/computers.py,sha256=
|
|
11
|
+
stackshift/computers.py,sha256=wcz8xQ2Dor5fHfoFr9C9N7CrWODK2W8HyZsnU8HgAw8,54531
|
|
12
12
|
stackshift/computers_adapters.py,sha256=AVdQjh3GSmD6Azi7DuoWaNMmwxsTVLlxm5GgxAqL-R0,17853
|
|
13
13
|
stackshift/computers_transfer.py,sha256=3YJV4Ld531C5k0teoL0x18qtD98pXpcjxtR_oZd-7ZU,23653
|
|
14
14
|
stackshift/databases.py,sha256=X7C8kaDUCTc8I8nPye9D8FOS3mOR1h62qPzrJB0iwvs,10916
|
|
@@ -39,7 +39,7 @@ stackshift/support_action_types.py,sha256=i7xADrXFSIHJaqwcS77LU4jvni5JKrRUzot5Wa
|
|
|
39
39
|
stackshift/support_actions.py,sha256=tZYlb8gdE875SKZdzfN01jfEfIQTyH08XThgCYQ820o,8744
|
|
40
40
|
stackshift/teams.py,sha256=SjTjmQY_X8cBZPb61k3N3Vv5qbNNkWhuBkLwmZjQK-Q,10608
|
|
41
41
|
stackshift/workload_security.py,sha256=5JtJH9fX1kqSY3ipXUa79JslUULWsN5_gyn9tTGfzlA,2941
|
|
42
|
-
stackshift-1.
|
|
43
|
-
stackshift-1.
|
|
44
|
-
stackshift-1.
|
|
45
|
-
stackshift-1.
|
|
42
|
+
stackshift-1.9.0.dist-info/METADATA,sha256=Lx6Tj0moU-jXBWzwW_gYsNvgQqkYjy1jdC1JQiWjBis,38902
|
|
43
|
+
stackshift-1.9.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
44
|
+
stackshift-1.9.0.dist-info/top_level.txt,sha256=qe3uWsu_O9mNtq7bIck9Y8rjTIMrH0kzgAlGFDoRGqs,11
|
|
45
|
+
stackshift-1.9.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|