oneshot-python 0.10.1__tar.gz → 0.12.0__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.
@@ -81,3 +81,12 @@ apps/video-service/out/
81
81
 
82
82
  # Simulate-players pool (auto-generated, contains player IDs)
83
83
  scripts/.simulate-pool.json
84
+
85
+ # x402 Bazaar seeder wallet (ephemeral, holds a private key during a partial run)
86
+ scripts/.seed-wallet.json
87
+
88
+ # Generated digest outputs from scripts/weekly-signal-digest.ts
89
+ output/
90
+
91
+ # Claude Code agent metadata (lockfile + local settings)
92
+ .claude/
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: oneshot-python
3
- Version: 0.10.1
3
+ Version: 0.12.0
4
4
  Summary: Core Python SDK for the OneShot API — HTTP client with x402 payment handling
5
5
  License-Expression: MIT
6
6
  Requires-Python: >=3.10
@@ -87,6 +87,37 @@ The SDK operates on **Base Mainnet** with real USDC. Fund your wallet before mak
87
87
  - `call_free_post(endpoint, payload=None)` / `acall_free_post(...)` — POST
88
88
  - `call_free_patch(endpoint, payload=None)` / `acall_free_patch(...)` — PATCH
89
89
 
90
+ ### Compute — autonomous goal orchestration
91
+
92
+ Launch a compute goal and let the orchestrator plan, execute, and iterate. Paid via x402 (same flow as other tools).
93
+
94
+ ```python
95
+ goal = client.compute(
96
+ objective="Research the top 10 AI startups and build a comparison website",
97
+ budget_usdc=5.00,
98
+ max_cost=10.00,
99
+ )
100
+ print(goal["goal_id"])
101
+
102
+ # Observe
103
+ status = client.get_compute_goal(goal["goal_id"])
104
+ tasks = client.get_compute_tasks(goal["goal_id"])
105
+ budget = client.get_compute_budget(goal["goal_id"])
106
+
107
+ # Top up a recurring goal (paid)
108
+ client.fund_compute_goal(goal["goal_id"], 10.00)
109
+
110
+ # Lifecycle
111
+ client.pause_compute_goal(goal["goal_id"])
112
+ client.resume_compute_goal(goal["goal_id"])
113
+ client.cancel_compute_goal(goal["goal_id"], reason="done")
114
+
115
+ # HITL — respond to an approval task
116
+ client.respond_to_compute_task(goal["goal_id"], "task_01H…", approved=True)
117
+ ```
118
+
119
+ Every method has an `a*` async mirror (`acompute`, `aget_compute_goal`, …).
120
+
90
121
  ## Requirements
91
122
 
92
123
  - Python 3.10+
@@ -0,0 +1,47 @@
1
+ """oneshot-python — Core Python SDK for the OneShot API."""
2
+
3
+ from oneshot._errors import (
4
+ ContentBlockedError,
5
+ EmergencyNumberError,
6
+ JobError,
7
+ JobTimeoutError,
8
+ OneShotError,
9
+ ToolError,
10
+ ValidationError,
11
+ )
12
+ from oneshot._types import (
13
+ ComputeBudgetStatus,
14
+ ComputeCancelResult,
15
+ ComputeFundResult,
16
+ ComputeGoalResult,
17
+ ComputeGoalStatus,
18
+ ComputePauseResult,
19
+ ComputeResumeResult,
20
+ ComputeSchedule,
21
+ ComputeTask,
22
+ ComputeTaskResponseResult,
23
+ )
24
+ from oneshot.client import OneShotClient
25
+ from oneshot.x402 import sign_payment_authorization
26
+
27
+ __all__ = [
28
+ "OneShotClient",
29
+ "OneShotError",
30
+ "ToolError",
31
+ "JobError",
32
+ "JobTimeoutError",
33
+ "ValidationError",
34
+ "ContentBlockedError",
35
+ "EmergencyNumberError",
36
+ "sign_payment_authorization",
37
+ "ComputeSchedule",
38
+ "ComputeGoalResult",
39
+ "ComputeGoalStatus",
40
+ "ComputeTask",
41
+ "ComputeBudgetStatus",
42
+ "ComputeCancelResult",
43
+ "ComputeTaskResponseResult",
44
+ "ComputePauseResult",
45
+ "ComputeResumeResult",
46
+ "ComputeFundResult",
47
+ ]
@@ -46,3 +46,11 @@ class ContentBlockedError(OneShotError):
46
46
  def __init__(self, message: str, categories: list[str]) -> None:
47
47
  super().__init__(message)
48
48
  self.categories = categories
49
+
50
+
51
+ class EmergencyNumberError(OneShotError):
52
+ """Voice call rejected because the target number is an emergency line."""
53
+
54
+ def __init__(self, message: str, blocked_number: str) -> None:
55
+ super().__init__(message)
56
+ self.blocked_number = blocked_number
@@ -0,0 +1,178 @@
1
+ """Type hints for the compute orchestration API.
2
+
3
+ These TypedDicts mirror libs/agent-sdk/src/types.ts field-for-field. They are
4
+ optional at runtime — `OneShotClient` continues to return raw dicts — but
5
+ expose the shape to IDEs and `mypy` so callers get auto-complete + type
6
+ checking when they want it.
7
+
8
+ Keep the field set IN SYNC with the TS interfaces. If you add a field here,
9
+ add it there (and vice versa).
10
+ """
11
+
12
+ from __future__ import annotations
13
+
14
+ from typing import Any, Optional, TypedDict
15
+
16
+
17
+ class ComputeSchedule(TypedDict, total=False):
18
+ """Recurring-goal schedule. Mirrors `ComputeSchedule` in TS."""
19
+
20
+ cron: str
21
+ budget_per_run: float
22
+ max_runs: int
23
+
24
+
25
+ class ComputeGoalInner(TypedDict, total=False):
26
+ objective: str
27
+ budget_usdc: str
28
+ deadline: str
29
+ schedule_cron: str
30
+ budget_per_run: float
31
+ max_runs: int
32
+ next_run_at: str
33
+
34
+
35
+ class ComputeGoalResult(TypedDict, total=False):
36
+ """Returned by `compute()` / `acompute()` after the goal is created."""
37
+
38
+ goal_id: str
39
+ request_id: str
40
+ receipt_id: str
41
+ status: str
42
+ message: str
43
+ memo: str
44
+ cost: float
45
+ goal: ComputeGoalInner
46
+
47
+
48
+ class ComputeBudgetInner(TypedDict, total=False):
49
+ total: str
50
+ spent: str
51
+ reserved: str
52
+ remaining: str
53
+
54
+
55
+ class ComputeGoalScheduleInner(TypedDict, total=False):
56
+ cron: str
57
+ budget_per_run: str
58
+ max_runs: Optional[int]
59
+ run_count: int
60
+ last_run_at: Optional[str]
61
+ next_run_at: Optional[str]
62
+
63
+
64
+ class ComputeGoalStatus(TypedDict, total=False):
65
+ """Returned by `get_compute_goal()` / `aget_compute_goal()`."""
66
+
67
+ id: str
68
+ status: str
69
+ name: str
70
+ objective: str
71
+ current_phase: Optional[int]
72
+ plan: Any
73
+ budget: Optional[ComputeBudgetInner]
74
+ soul_agent_id: Optional[str]
75
+ deadline: Optional[str]
76
+ started_at: Optional[str]
77
+ completed_at: Optional[str]
78
+ last_wake_at: Optional[str]
79
+ next_wake_at: Optional[str]
80
+ created_at: str
81
+ schedule: ComputeGoalScheduleInner
82
+
83
+
84
+ class ComputeTask(TypedDict, total=False):
85
+ """Single item from `get_compute_tasks()` / `aget_compute_tasks()`."""
86
+
87
+ id: str
88
+ task_type: str
89
+ tool: Optional[str]
90
+ description: str
91
+ status: str
92
+ phase: Optional[int]
93
+ sequence: Optional[int]
94
+ progress_pct: Optional[float]
95
+ progress_message: Optional[str]
96
+ result: Any
97
+ quoted_usdc: Optional[str]
98
+ actual_usdc: Optional[str]
99
+ run_number: Optional[int]
100
+ started_at: Optional[str]
101
+ completed_at: Optional[str]
102
+ created_at: str
103
+
104
+
105
+ class ComputeBudgetSpendEntry(TypedDict, total=False):
106
+ category: str
107
+ amount_usdc: str
108
+ description: str
109
+ created_at: str
110
+
111
+
112
+ class ComputeBudgetStatus(TypedDict, total=False):
113
+ """Returned by `get_compute_budget()` / `aget_compute_budget()`."""
114
+
115
+ budgetId: str
116
+ goalId: str
117
+ totalBudgetUsdc: str
118
+ spentUsdc: str
119
+ reservedUsdc: str
120
+ remainingUsdc: str
121
+ spend_entries: list[ComputeBudgetSpendEntry]
122
+
123
+
124
+ class ComputeCancelResult(TypedDict, total=False):
125
+ """Returned by `cancel_compute_goal()`."""
126
+
127
+ goal_id: str
128
+ status: str
129
+ remaining_budget: str
130
+
131
+
132
+ class ComputeTaskResponseResult(TypedDict, total=False):
133
+ """Returned by `respond_to_compute_task()`."""
134
+
135
+ task_id: str
136
+ goal_id: str
137
+ task_status: str
138
+ orchestrator_action: str
139
+
140
+
141
+ class ComputePauseResult(TypedDict, total=False):
142
+ """Returned by `pause_compute_goal()`."""
143
+
144
+ goal_id: str
145
+ status: str
146
+ run_count: int
147
+
148
+
149
+ class ComputeResumeResult(TypedDict, total=False):
150
+ """Returned by `resume_compute_goal()`."""
151
+
152
+ goal_id: str
153
+ status: str
154
+ next_run_at: str
155
+ run_count: int
156
+
157
+
158
+ class ComputeFundResult(TypedDict, total=False):
159
+ """Returned by `fund_compute_goal()`."""
160
+
161
+ goal_id: str
162
+ topped_up: float
163
+ total_budget: str
164
+ remaining: str
165
+
166
+
167
+ __all__ = [
168
+ "ComputeSchedule",
169
+ "ComputeGoalResult",
170
+ "ComputeGoalStatus",
171
+ "ComputeTask",
172
+ "ComputeBudgetStatus",
173
+ "ComputeCancelResult",
174
+ "ComputeTaskResponseResult",
175
+ "ComputePauseResult",
176
+ "ComputeResumeResult",
177
+ "ComputeFundResult",
178
+ ]