pulse-agent-sdk 0.1.1__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.
- pulse_agent_sdk/__init__.py +137 -0
- pulse_agent_sdk/_generated.py +180 -0
- pulse_agent_sdk/_generated_api.py +928 -0
- pulse_agent_sdk/client.py +404 -0
- pulse_agent_sdk/errors.py +62 -0
- pulse_agent_sdk/handler.py +199 -0
- pulse_agent_sdk/oauth.py +381 -0
- pulse_agent_sdk/py.typed +1 -0
- pulse_agent_sdk/stop.py +82 -0
- pulse_agent_sdk/webhooks.py +295 -0
- pulse_agent_sdk-0.1.1.dist-info/METADATA +67 -0
- pulse_agent_sdk-0.1.1.dist-info/RECORD +14 -0
- pulse_agent_sdk-0.1.1.dist-info/WHEEL +4 -0
- pulse_agent_sdk-0.1.1.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
"""Python SDK for Pulse Agent Apps."""
|
|
2
|
+
|
|
3
|
+
from ._generated import (
|
|
4
|
+
ActionContent,
|
|
5
|
+
AgentActivity,
|
|
6
|
+
AgentActivityAuthor,
|
|
7
|
+
AgentActivityCreate,
|
|
8
|
+
AgentActivityPage,
|
|
9
|
+
AgentSession,
|
|
10
|
+
AgentSessionCreate,
|
|
11
|
+
AgentSessionEndReason,
|
|
12
|
+
AgentSessionPage,
|
|
13
|
+
AgentSessionState,
|
|
14
|
+
AuthSignal,
|
|
15
|
+
ElicitationContent,
|
|
16
|
+
ErrorContent,
|
|
17
|
+
ExternalUrl,
|
|
18
|
+
PlanItem,
|
|
19
|
+
PromptContent,
|
|
20
|
+
ResponseContent,
|
|
21
|
+
SelectOption,
|
|
22
|
+
SelectSignalMetadata,
|
|
23
|
+
SessionUpdate,
|
|
24
|
+
ThoughtContent,
|
|
25
|
+
)
|
|
26
|
+
from ._generated_api import (
|
|
27
|
+
AgentAppScope,
|
|
28
|
+
AgentSessionEventCreatedData,
|
|
29
|
+
AgentSessionEventPromptedData,
|
|
30
|
+
ApiErrorBody,
|
|
31
|
+
AppWebhookAction,
|
|
32
|
+
AppWebhookEnvelope,
|
|
33
|
+
AppWebhookEventType,
|
|
34
|
+
AppWebhookPingData,
|
|
35
|
+
Issue,
|
|
36
|
+
MeResponse,
|
|
37
|
+
OAuthAppRevokedData,
|
|
38
|
+
OAuthErrorBody,
|
|
39
|
+
OAuthTokenResponse,
|
|
40
|
+
PermissionChangeData,
|
|
41
|
+
)
|
|
42
|
+
from .client import MAX_IDEMPOTENCY_KEY_LENGTH, AppIssueStatus, PulseAgentClient
|
|
43
|
+
from .errors import (
|
|
44
|
+
InstallationRevokedError,
|
|
45
|
+
InstallSecretError,
|
|
46
|
+
OAuthError,
|
|
47
|
+
PulseApiError,
|
|
48
|
+
PulseTransportError,
|
|
49
|
+
SessionEndedError,
|
|
50
|
+
WebhookError,
|
|
51
|
+
)
|
|
52
|
+
from .handler import (
|
|
53
|
+
DedupeStore,
|
|
54
|
+
MemoryDedupeStore,
|
|
55
|
+
SessionContext,
|
|
56
|
+
WebhookHandler,
|
|
57
|
+
WebhookReply,
|
|
58
|
+
)
|
|
59
|
+
from .oauth import (
|
|
60
|
+
DEFAULT_APP_SCOPES,
|
|
61
|
+
DEFAULT_BASE_URL,
|
|
62
|
+
AgentAppAuth,
|
|
63
|
+
AuthStore,
|
|
64
|
+
InstallationTokens,
|
|
65
|
+
MemoryAuthStore,
|
|
66
|
+
OAuthConfig,
|
|
67
|
+
PendingInstall,
|
|
68
|
+
)
|
|
69
|
+
from .stop import SessionStops, StopCause, StopSignal
|
|
70
|
+
from .webhooks import WebhookEvent, WebhookReceiver, verify_webhook
|
|
71
|
+
|
|
72
|
+
__all__ = [
|
|
73
|
+
"DEFAULT_APP_SCOPES",
|
|
74
|
+
"DEFAULT_BASE_URL",
|
|
75
|
+
"MAX_IDEMPOTENCY_KEY_LENGTH",
|
|
76
|
+
"ActionContent",
|
|
77
|
+
"AgentActivity",
|
|
78
|
+
"AgentActivityAuthor",
|
|
79
|
+
"AgentActivityCreate",
|
|
80
|
+
"AgentActivityPage",
|
|
81
|
+
"AgentAppAuth",
|
|
82
|
+
"AgentAppScope",
|
|
83
|
+
"AgentSession",
|
|
84
|
+
"AgentSessionCreate",
|
|
85
|
+
"AgentSessionEndReason",
|
|
86
|
+
"AgentSessionEventCreatedData",
|
|
87
|
+
"AgentSessionEventPromptedData",
|
|
88
|
+
"AgentSessionPage",
|
|
89
|
+
"AgentSessionState",
|
|
90
|
+
"ApiErrorBody",
|
|
91
|
+
"AppIssueStatus",
|
|
92
|
+
"AppWebhookAction",
|
|
93
|
+
"AppWebhookEnvelope",
|
|
94
|
+
"AppWebhookEventType",
|
|
95
|
+
"AppWebhookPingData",
|
|
96
|
+
"AuthSignal",
|
|
97
|
+
"AuthStore",
|
|
98
|
+
"DedupeStore",
|
|
99
|
+
"ElicitationContent",
|
|
100
|
+
"ErrorContent",
|
|
101
|
+
"ExternalUrl",
|
|
102
|
+
"InstallationRevokedError",
|
|
103
|
+
"InstallationTokens",
|
|
104
|
+
"InstallSecretError",
|
|
105
|
+
"Issue",
|
|
106
|
+
"MeResponse",
|
|
107
|
+
"MemoryAuthStore",
|
|
108
|
+
"MemoryDedupeStore",
|
|
109
|
+
"OAuthAppRevokedData",
|
|
110
|
+
"OAuthConfig",
|
|
111
|
+
"OAuthError",
|
|
112
|
+
"OAuthErrorBody",
|
|
113
|
+
"OAuthTokenResponse",
|
|
114
|
+
"PendingInstall",
|
|
115
|
+
"PermissionChangeData",
|
|
116
|
+
"PlanItem",
|
|
117
|
+
"PromptContent",
|
|
118
|
+
"PulseAgentClient",
|
|
119
|
+
"PulseApiError",
|
|
120
|
+
"PulseTransportError",
|
|
121
|
+
"ResponseContent",
|
|
122
|
+
"SelectOption",
|
|
123
|
+
"SelectSignalMetadata",
|
|
124
|
+
"SessionContext",
|
|
125
|
+
"SessionEndedError",
|
|
126
|
+
"SessionStops",
|
|
127
|
+
"SessionUpdate",
|
|
128
|
+
"StopCause",
|
|
129
|
+
"StopSignal",
|
|
130
|
+
"ThoughtContent",
|
|
131
|
+
"WebhookError",
|
|
132
|
+
"WebhookEvent",
|
|
133
|
+
"WebhookHandler",
|
|
134
|
+
"WebhookReceiver",
|
|
135
|
+
"WebhookReply",
|
|
136
|
+
"verify_webhook",
|
|
137
|
+
]
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
"""Generated from specs/agent-sessions.yaml by scripts/generate_types.py."""
|
|
2
|
+
|
|
3
|
+
from typing import Literal, NotRequired, TypeAlias, TypedDict
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class Error(TypedDict):
|
|
7
|
+
code: str
|
|
8
|
+
message: str
|
|
9
|
+
details: NotRequired[dict[str, object]]
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
AgentSessionState: TypeAlias = Literal['pending', 'active', 'awaitingInput', 'error', 'complete', 'stale', 'stopping']
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
AgentSessionEndReason: TypeAlias = Literal['stopped', 'undelegated', 'uninstalled', 'team_removed', 'issue_deleted'] | None
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class PlanItem(TypedDict):
|
|
19
|
+
content: str
|
|
20
|
+
status: Literal['pending', 'inProgress', 'completed', 'canceled']
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class ExternalUrl(TypedDict):
|
|
24
|
+
label: str
|
|
25
|
+
url: str
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class Person(TypedDict):
|
|
29
|
+
id: str
|
|
30
|
+
name: str
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class AgentSessionIssueTeam(TypedDict):
|
|
34
|
+
id: str
|
|
35
|
+
key: str
|
|
36
|
+
name: str
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
class AgentSessionIssue(TypedDict):
|
|
40
|
+
id: str
|
|
41
|
+
identifier: str
|
|
42
|
+
title: str
|
|
43
|
+
url: str
|
|
44
|
+
team: AgentSessionIssueTeam
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
class AgentSessionComment(TypedDict):
|
|
48
|
+
id: str
|
|
49
|
+
body: str
|
|
50
|
+
url: str
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
class AgentSession(TypedDict):
|
|
54
|
+
id: str
|
|
55
|
+
state: AgentSessionState
|
|
56
|
+
unresponsive_since: str | None
|
|
57
|
+
issue: AgentSessionIssue | None
|
|
58
|
+
comment: AgentSessionComment | None
|
|
59
|
+
creator: Person
|
|
60
|
+
app_user_id: str
|
|
61
|
+
plan: list[PlanItem]
|
|
62
|
+
external_urls: list[ExternalUrl]
|
|
63
|
+
created_at: str
|
|
64
|
+
updated_at: str
|
|
65
|
+
ended_at: str | None
|
|
66
|
+
end_reason: AgentSessionEndReason
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
class AgentSessionPage(TypedDict):
|
|
70
|
+
data: list[AgentSession]
|
|
71
|
+
next_cursor: str | None
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
class AgentSessionCreateVariant1(TypedDict):
|
|
75
|
+
issue_id: str
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
class AgentSessionCreateVariant2(TypedDict):
|
|
79
|
+
comment_id: str
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
AgentSessionCreate: TypeAlias = AgentSessionCreateVariant1 | AgentSessionCreateVariant2
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
class SessionUpdate(TypedDict):
|
|
86
|
+
plan: NotRequired[list[PlanItem]]
|
|
87
|
+
external_urls: NotRequired[list[ExternalUrl]]
|
|
88
|
+
added_external_urls: NotRequired[list[ExternalUrl]]
|
|
89
|
+
removed_external_urls: NotRequired[list[str]]
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
class ThoughtContent(TypedDict):
|
|
93
|
+
type: Literal['thought']
|
|
94
|
+
body: str
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
class ActionContent(TypedDict):
|
|
98
|
+
type: Literal['action']
|
|
99
|
+
action: str
|
|
100
|
+
parameter: str | None
|
|
101
|
+
result: NotRequired[str]
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
class ElicitationContent(TypedDict):
|
|
105
|
+
type: Literal['elicitation']
|
|
106
|
+
body: str
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
class ResponseContent(TypedDict):
|
|
110
|
+
type: Literal['response']
|
|
111
|
+
body: str
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
class ErrorContent(TypedDict):
|
|
115
|
+
type: Literal['error']
|
|
116
|
+
body: str
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
class PromptContent(TypedDict):
|
|
120
|
+
type: Literal['prompt']
|
|
121
|
+
body: str
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
class SelectOption(TypedDict):
|
|
125
|
+
value: str
|
|
126
|
+
label: NotRequired[str]
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
class SelectSignalMetadata(TypedDict):
|
|
130
|
+
options: list[SelectOption]
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
class AuthSignal(TypedDict):
|
|
134
|
+
url: str
|
|
135
|
+
user_id: NotRequired[str]
|
|
136
|
+
provider_name: NotRequired[str]
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
class AgentActivityCreate(TypedDict):
|
|
140
|
+
content: ThoughtContent | ActionContent | ElicitationContent | ResponseContent | ErrorContent
|
|
141
|
+
ephemeral: NotRequired[bool]
|
|
142
|
+
signal: NotRequired[Literal['select', 'auth']]
|
|
143
|
+
signal_metadata: NotRequired[SelectSignalMetadata | AuthSignal]
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
class AgentActivityAuthor(TypedDict):
|
|
147
|
+
kind: Literal['app', 'user']
|
|
148
|
+
id: str
|
|
149
|
+
name: str
|
|
150
|
+
avatar_url: str | None
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
class AgentActivity(TypedDict):
|
|
154
|
+
id: str
|
|
155
|
+
seq: int
|
|
156
|
+
type: Literal['thought', 'action', 'elicitation', 'response', 'error', 'prompt']
|
|
157
|
+
content: ThoughtContent | ActionContent | ElicitationContent | ResponseContent | ErrorContent | PromptContent
|
|
158
|
+
ephemeral: bool
|
|
159
|
+
superseded_by_seq: int | None
|
|
160
|
+
signal: Literal['stop', 'select', 'auth'] | None
|
|
161
|
+
signal_metadata: SelectSignalMetadata | AuthSignal | None
|
|
162
|
+
author: AgentActivityAuthor
|
|
163
|
+
created_at: str
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
class AgentActivityPage(TypedDict):
|
|
167
|
+
data: list[AgentActivity]
|
|
168
|
+
has_more: bool
|
|
169
|
+
last_seq: int
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
class PromptedActivity(TypedDict):
|
|
173
|
+
id: str
|
|
174
|
+
content: PromptContent
|
|
175
|
+
signal: NotRequired[Literal['stop']]
|
|
176
|
+
author: Person
|
|
177
|
+
created_at: str
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
PromptContext: TypeAlias = str
|