@notionhq/client 5.26.0 → 5.27.0
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.
- package/README.md +130 -129
- package/build/package.json +4 -3
- package/build/src/Client.d.ts +1869 -130
- package/build/src/Client.d.ts.map +1 -1
- package/build/src/Client.js +86 -571
- package/build/src/Client.js.map +1 -1
- package/build/src/api-endpoint-methods.d.ts +920 -0
- package/build/src/api-endpoint-methods.d.ts.map +1 -0
- package/build/src/api-endpoint-methods.js +171 -0
- package/build/src/api-endpoint-methods.js.map +1 -0
- package/build/src/api-endpoints/agent-skills.d.ts +68 -0
- package/build/src/api-endpoints/agent-skills.d.ts.map +1 -0
- package/build/src/api-endpoints/agent-skills.js +36 -0
- package/build/src/api-endpoints/agent-skills.js.map +1 -0
- package/build/src/api-endpoints/agents.d.ts +173 -146
- package/build/src/api-endpoints/agents.d.ts.map +1 -1
- package/build/src/api-endpoints/agents.js.map +1 -1
- package/build/src/api-endpoints/data-sources.d.ts +1 -0
- package/build/src/api-endpoints/data-sources.d.ts.map +1 -1
- package/build/src/api-endpoints/data-sources.js.map +1 -1
- package/build/src/api-endpoints/databases.d.ts +3 -1
- package/build/src/api-endpoints/databases.d.ts.map +1 -1
- package/build/src/api-endpoints/databases.js +1 -0
- package/build/src/api-endpoints/databases.js.map +1 -1
- package/build/src/api-endpoints/file-uploads.d.ts.map +1 -1
- package/build/src/api-endpoints/file-uploads.js.map +1 -1
- package/build/src/api-endpoints/pages.d.ts.map +1 -1
- package/build/src/api-endpoints/pages.js.map +1 -1
- package/build/src/api-endpoints/users.d.ts.map +1 -1
- package/build/src/api-endpoints/users.js.map +1 -1
- package/build/src/api-endpoints.d.ts +1 -0
- package/build/src/api-endpoints.d.ts.map +1 -1
- package/build/src/api-endpoints.js +1 -0
- package/build/src/api-endpoints.js.map +1 -1
- package/build/src/errors.d.ts +11 -0
- package/build/src/errors.d.ts.map +1 -1
- package/build/src/errors.js +20 -1
- package/build/src/errors.js.map +1 -1
- package/build/src/helpers.d.ts +4 -4
- package/build/src/helpers.d.ts.map +1 -1
- package/build/src/helpers.js.map +1 -1
- package/build/src/index.d.ts +2 -2
- package/build/src/index.d.ts.map +1 -1
- package/build/src/index.js +2 -1
- package/build/src/index.js.map +1 -1
- package/build/src/webhooks.d.ts +12 -19
- package/build/src/webhooks.d.ts.map +1 -1
- package/build/src/webhooks.js +27 -35
- package/build/src/webhooks.js.map +1 -1
- package/package.json +4 -3
|
@@ -35,132 +35,6 @@ export type UpdateSessionStreamParameters = {
|
|
|
35
35
|
/**
|
|
36
36
|
* An event emitted by a session stream.
|
|
37
37
|
*/
|
|
38
|
-
type SessionStreamEventBase = {
|
|
39
|
-
/**
|
|
40
|
-
* Always `session_event`
|
|
41
|
-
*/
|
|
42
|
-
object: "session_event";
|
|
43
|
-
id: string;
|
|
44
|
-
session_id: string;
|
|
45
|
-
sequence: number;
|
|
46
|
-
created_at: string;
|
|
47
|
-
};
|
|
48
|
-
type SessionStreamTextContent = {
|
|
49
|
-
/**
|
|
50
|
-
* Always `text`
|
|
51
|
-
*/
|
|
52
|
-
type: "text";
|
|
53
|
-
text: string;
|
|
54
|
-
};
|
|
55
|
-
type SessionStreamFileContent = {
|
|
56
|
-
/**
|
|
57
|
-
* Always `file`
|
|
58
|
-
*/
|
|
59
|
-
type: "file";
|
|
60
|
-
file_id: string;
|
|
61
|
-
};
|
|
62
|
-
type SessionStreamContentBlock = SessionStreamTextContent | SessionStreamFileContent;
|
|
63
|
-
type SessionStreamRequiredAction = {
|
|
64
|
-
action_id: string;
|
|
65
|
-
title: string;
|
|
66
|
-
options: Array<{
|
|
67
|
-
/**
|
|
68
|
-
* One of: `approve`, `reject`
|
|
69
|
-
*/
|
|
70
|
-
id: "approve" | "reject";
|
|
71
|
-
label: string;
|
|
72
|
-
}>;
|
|
73
|
-
};
|
|
74
|
-
type SessionStreamError = {
|
|
75
|
-
code: string;
|
|
76
|
-
message: string;
|
|
77
|
-
retryable: boolean;
|
|
78
|
-
};
|
|
79
|
-
type SessionStreamUsage = {
|
|
80
|
-
input_tokens?: number;
|
|
81
|
-
output_tokens?: number;
|
|
82
|
-
total_tokens: number;
|
|
83
|
-
};
|
|
84
|
-
type SessionStreamArtifact = {
|
|
85
|
-
/**
|
|
86
|
-
* Always `page`
|
|
87
|
-
*/
|
|
88
|
-
type: "page";
|
|
89
|
-
url: string;
|
|
90
|
-
title: string;
|
|
91
|
-
} | {
|
|
92
|
-
/**
|
|
93
|
-
* Always `html_artifact`
|
|
94
|
-
*/
|
|
95
|
-
type: "html_artifact";
|
|
96
|
-
url: string;
|
|
97
|
-
page_url: string;
|
|
98
|
-
};
|
|
99
|
-
type SessionStreamCommittedEvent = (SessionStreamEventBase & {
|
|
100
|
-
/**
|
|
101
|
-
* Always `user.message`
|
|
102
|
-
*/
|
|
103
|
-
type: "user.message";
|
|
104
|
-
content: Array<SessionStreamContentBlock>;
|
|
105
|
-
metadata?: Record<string, string>;
|
|
106
|
-
}) | (SessionStreamEventBase & {
|
|
107
|
-
/**
|
|
108
|
-
* Always `agent.message`
|
|
109
|
-
*/
|
|
110
|
-
type: "agent.message";
|
|
111
|
-
content: Array<SessionStreamTextContent>;
|
|
112
|
-
}) | (SessionStreamEventBase & {
|
|
113
|
-
/**
|
|
114
|
-
* Always `agent.tool_use`
|
|
115
|
-
*/
|
|
116
|
-
type: "agent.tool_use";
|
|
117
|
-
tool_name: string;
|
|
118
|
-
}) | (SessionStreamEventBase & {
|
|
119
|
-
/**
|
|
120
|
-
* Always `agent.tool_result`
|
|
121
|
-
*/
|
|
122
|
-
type: "agent.tool_result";
|
|
123
|
-
tool_use_id: string;
|
|
124
|
-
tool_name: string;
|
|
125
|
-
is_error: boolean;
|
|
126
|
-
}) | (SessionStreamEventBase & {
|
|
127
|
-
/**
|
|
128
|
-
* Always `session.status`
|
|
129
|
-
*/
|
|
130
|
-
type: "session.status";
|
|
131
|
-
status: "queued" | "in_progress" | "requires_action" | "completed" | "failed" | "canceled" | "terminated";
|
|
132
|
-
required_actions?: Array<SessionStreamRequiredAction>;
|
|
133
|
-
error?: SessionStreamError;
|
|
134
|
-
usage?: SessionStreamUsage;
|
|
135
|
-
artifacts?: Array<SessionStreamArtifact>;
|
|
136
|
-
});
|
|
137
|
-
type SessionStreamProvisionalEvent = {
|
|
138
|
-
/**
|
|
139
|
-
* Always `session_event`
|
|
140
|
-
*/
|
|
141
|
-
object: "session_event";
|
|
142
|
-
id: string;
|
|
143
|
-
session_id: string;
|
|
144
|
-
created_at: string;
|
|
145
|
-
/**
|
|
146
|
-
* Always `agent.message`
|
|
147
|
-
*/
|
|
148
|
-
type: "agent.message";
|
|
149
|
-
content: Array<SessionStreamTextContent>;
|
|
150
|
-
} | {
|
|
151
|
-
/**
|
|
152
|
-
* Always `session_event`
|
|
153
|
-
*/
|
|
154
|
-
object: "session_event";
|
|
155
|
-
id: string;
|
|
156
|
-
session_id: string;
|
|
157
|
-
created_at: string;
|
|
158
|
-
/**
|
|
159
|
-
* Always `agent.tool_use`
|
|
160
|
-
*/
|
|
161
|
-
type: "agent.tool_use";
|
|
162
|
-
tool_name: string;
|
|
163
|
-
};
|
|
164
38
|
export type UpdateSessionStreamResponse = {
|
|
165
39
|
/**
|
|
166
40
|
* Always `session.snapshot`
|
|
@@ -202,13 +76,175 @@ export type UpdateSessionStreamResponse = {
|
|
|
202
76
|
* Always `event.provisional`
|
|
203
77
|
*/
|
|
204
78
|
type: "event.provisional";
|
|
205
|
-
event:
|
|
79
|
+
event: {
|
|
80
|
+
/**
|
|
81
|
+
* Always `session_event`
|
|
82
|
+
*/
|
|
83
|
+
object: "session_event";
|
|
84
|
+
id: string;
|
|
85
|
+
session_id: string;
|
|
86
|
+
created_at: string;
|
|
87
|
+
/**
|
|
88
|
+
* Always `agent.message`
|
|
89
|
+
*/
|
|
90
|
+
type: "agent.message";
|
|
91
|
+
content: Array<{
|
|
92
|
+
/**
|
|
93
|
+
* Always `text`
|
|
94
|
+
*/
|
|
95
|
+
type: "text";
|
|
96
|
+
text: string;
|
|
97
|
+
}>;
|
|
98
|
+
} | {
|
|
99
|
+
/**
|
|
100
|
+
* Always `session_event`
|
|
101
|
+
*/
|
|
102
|
+
object: "session_event";
|
|
103
|
+
id: string;
|
|
104
|
+
session_id: string;
|
|
105
|
+
created_at: string;
|
|
106
|
+
/**
|
|
107
|
+
* Always `agent.tool_use`
|
|
108
|
+
*/
|
|
109
|
+
type: "agent.tool_use";
|
|
110
|
+
tool_name: string;
|
|
111
|
+
};
|
|
206
112
|
} | {
|
|
207
113
|
/**
|
|
208
114
|
* Always `event.committed`
|
|
209
115
|
*/
|
|
210
116
|
type: "event.committed";
|
|
211
|
-
event:
|
|
117
|
+
event: {
|
|
118
|
+
/**
|
|
119
|
+
* Always `session_event`
|
|
120
|
+
*/
|
|
121
|
+
object: "session_event";
|
|
122
|
+
id: string;
|
|
123
|
+
session_id: string;
|
|
124
|
+
sequence: number;
|
|
125
|
+
created_at: string;
|
|
126
|
+
/**
|
|
127
|
+
* Always `user.message`
|
|
128
|
+
*/
|
|
129
|
+
type: "user.message";
|
|
130
|
+
content: Array<{
|
|
131
|
+
/**
|
|
132
|
+
* Always `text`
|
|
133
|
+
*/
|
|
134
|
+
type: "text";
|
|
135
|
+
text: string;
|
|
136
|
+
} | {
|
|
137
|
+
/**
|
|
138
|
+
* Always `file`
|
|
139
|
+
*/
|
|
140
|
+
type: "file";
|
|
141
|
+
file_id: string;
|
|
142
|
+
}>;
|
|
143
|
+
metadata?: Record<string, string>;
|
|
144
|
+
} | {
|
|
145
|
+
/**
|
|
146
|
+
* Always `session_event`
|
|
147
|
+
*/
|
|
148
|
+
object: "session_event";
|
|
149
|
+
id: string;
|
|
150
|
+
session_id: string;
|
|
151
|
+
sequence: number;
|
|
152
|
+
created_at: string;
|
|
153
|
+
/**
|
|
154
|
+
* Always `agent.message`
|
|
155
|
+
*/
|
|
156
|
+
type: "agent.message";
|
|
157
|
+
content: Array<{
|
|
158
|
+
/**
|
|
159
|
+
* Always `text`
|
|
160
|
+
*/
|
|
161
|
+
type: "text";
|
|
162
|
+
text: string;
|
|
163
|
+
}>;
|
|
164
|
+
} | {
|
|
165
|
+
/**
|
|
166
|
+
* Always `session_event`
|
|
167
|
+
*/
|
|
168
|
+
object: "session_event";
|
|
169
|
+
id: string;
|
|
170
|
+
session_id: string;
|
|
171
|
+
sequence: number;
|
|
172
|
+
created_at: string;
|
|
173
|
+
/**
|
|
174
|
+
* Always `agent.tool_use`
|
|
175
|
+
*/
|
|
176
|
+
type: "agent.tool_use";
|
|
177
|
+
tool_name: string;
|
|
178
|
+
} | {
|
|
179
|
+
/**
|
|
180
|
+
* Always `session_event`
|
|
181
|
+
*/
|
|
182
|
+
object: "session_event";
|
|
183
|
+
id: string;
|
|
184
|
+
session_id: string;
|
|
185
|
+
sequence: number;
|
|
186
|
+
created_at: string;
|
|
187
|
+
/**
|
|
188
|
+
* Always `agent.tool_result`
|
|
189
|
+
*/
|
|
190
|
+
type: "agent.tool_result";
|
|
191
|
+
tool_use_id: string;
|
|
192
|
+
tool_name: string;
|
|
193
|
+
is_error: boolean;
|
|
194
|
+
} | {
|
|
195
|
+
/**
|
|
196
|
+
* Always `session_event`
|
|
197
|
+
*/
|
|
198
|
+
object: "session_event";
|
|
199
|
+
id: string;
|
|
200
|
+
session_id: string;
|
|
201
|
+
sequence: number;
|
|
202
|
+
created_at: string;
|
|
203
|
+
/**
|
|
204
|
+
* Always `session.status`
|
|
205
|
+
*/
|
|
206
|
+
type: "session.status";
|
|
207
|
+
/**
|
|
208
|
+
* One of: `queued`, `in_progress`, `requires_action`, `completed`, `failed`, `canceled`, `terminated`
|
|
209
|
+
*/
|
|
210
|
+
status: "queued" | "in_progress" | "requires_action" | "completed" | "failed" | "canceled" | "terminated";
|
|
211
|
+
required_actions?: Array<{
|
|
212
|
+
action_id: string;
|
|
213
|
+
title: string;
|
|
214
|
+
options: Array<{
|
|
215
|
+
/**
|
|
216
|
+
* One of: `approve`, `reject`
|
|
217
|
+
*/
|
|
218
|
+
id: "approve" | "reject";
|
|
219
|
+
label: string;
|
|
220
|
+
}>;
|
|
221
|
+
}>;
|
|
222
|
+
error?: {
|
|
223
|
+
code: string;
|
|
224
|
+
message: string;
|
|
225
|
+
retryable: boolean;
|
|
226
|
+
};
|
|
227
|
+
usage?: {
|
|
228
|
+
total_tokens: number;
|
|
229
|
+
input_tokens?: number;
|
|
230
|
+
output_tokens?: number;
|
|
231
|
+
};
|
|
232
|
+
artifacts?: Array<{
|
|
233
|
+
/**
|
|
234
|
+
* Always `page`
|
|
235
|
+
*/
|
|
236
|
+
type: "page";
|
|
237
|
+
url: string;
|
|
238
|
+
title: string;
|
|
239
|
+
} | {
|
|
240
|
+
/**
|
|
241
|
+
* Always `html_artifact`
|
|
242
|
+
*/
|
|
243
|
+
type: "html_artifact";
|
|
244
|
+
url: string;
|
|
245
|
+
page_url: string;
|
|
246
|
+
}>;
|
|
247
|
+
};
|
|
212
248
|
} | {
|
|
213
249
|
/**
|
|
214
250
|
* Always `stream.timeout`
|
|
@@ -226,7 +262,6 @@ export type UpdateSessionStreamResponse = {
|
|
|
226
262
|
* One of: `requires_action`, `completed`, `failed`, `canceled`, `terminated`
|
|
227
263
|
*/
|
|
228
264
|
status: "requires_action" | "completed" | "failed" | "canceled" | "terminated";
|
|
229
|
-
last_sequence: number;
|
|
230
265
|
} | {
|
|
231
266
|
/**
|
|
232
267
|
* Always `stream.error`
|
|
@@ -478,7 +513,7 @@ type GetAgentQueryParameters = {
|
|
|
478
513
|
export type GetAgentParameters = GetAgentPathParameters & GetAgentQueryParameters;
|
|
479
514
|
export type GetAgentResponse = {
|
|
480
515
|
object: "agent";
|
|
481
|
-
id: IdResponse;
|
|
516
|
+
id: IdResponse | "notion_ai";
|
|
482
517
|
agent_type: "notion_ai" | "custom_agent" | "autofill_custom_agent" | "external";
|
|
483
518
|
name: string;
|
|
484
519
|
description: string | null;
|
|
@@ -723,9 +758,9 @@ type GetInsightsQueryParameters = {
|
|
|
723
758
|
export type GetInsightsParameters = GetInsightsPathParameters & GetInsightsQueryParameters;
|
|
724
759
|
export type GetInsightsResponse = {
|
|
725
760
|
object: "agent_insights";
|
|
726
|
-
id: IdResponse;
|
|
761
|
+
id: IdResponse | "notion_ai";
|
|
727
762
|
name: string;
|
|
728
|
-
agent_type: "custom_agent" | "autofill_custom_agent";
|
|
763
|
+
agent_type: "notion_ai" | "custom_agent" | "autofill_custom_agent";
|
|
729
764
|
status: "active" | "disabled" | "deleted";
|
|
730
765
|
pause_reason: "run_limit" | "credit_limit" | "runaway_credit_usage" | "workspace_credit_limit" | "failure_limit" | "mark_session_failed_autopause" | "disabled_from_workspace_settings" | "disabled_from_api" | "disabled_from_agent_settings" | "disabled_due_to_no_members_with_access" | "disabled_due_to_lack_of_editors" | "disabled_by_notion" | "internal_error" | "needs_user_review" | "tool_unavailable" | null;
|
|
731
766
|
created_by: {
|
|
@@ -761,7 +796,7 @@ export type ListAgentsResponse = {
|
|
|
761
796
|
type: "agent";
|
|
762
797
|
results: Array<{
|
|
763
798
|
object: "agent";
|
|
764
|
-
id: IdResponse;
|
|
799
|
+
id: IdResponse | "notion_ai";
|
|
765
800
|
agent_type: "notion_ai" | "custom_agent" | "autofill_custom_agent" | "external";
|
|
766
801
|
name: string;
|
|
767
802
|
description: string | null;
|
|
@@ -1003,7 +1038,6 @@ export type ListThreadMessagesResponse = {
|
|
|
1003
1038
|
type: "tool_call";
|
|
1004
1039
|
tool_call_id: string | null;
|
|
1005
1040
|
tool_name: string;
|
|
1006
|
-
input: string;
|
|
1007
1041
|
results?: Array<{
|
|
1008
1042
|
id: IdResponse;
|
|
1009
1043
|
agent_step_id: IdResponse | null;
|
|
@@ -1011,9 +1045,6 @@ export type ListThreadMessagesResponse = {
|
|
|
1011
1045
|
tool_name: string;
|
|
1012
1046
|
tool_type: string;
|
|
1013
1047
|
state: string;
|
|
1014
|
-
input: Record<string, never> | null;
|
|
1015
|
-
output: Record<string, never> | null;
|
|
1016
|
-
error: string | null;
|
|
1017
1048
|
started_at: number;
|
|
1018
1049
|
finished_at: number | null;
|
|
1019
1050
|
duration_ms: number | null;
|
|
@@ -1125,7 +1156,7 @@ type ListThreadsPathParameters = {
|
|
|
1125
1156
|
type ListThreadsQueryParameters = {
|
|
1126
1157
|
id?: IdRequest;
|
|
1127
1158
|
title?: string;
|
|
1128
|
-
status?: "pending" | "requires_action" | "completed" | "failed";
|
|
1159
|
+
status?: "pending" | "requires_action" | "completed" | "failed" | "canceled";
|
|
1129
1160
|
activity?: "all" | "pending" | "in_progress" | "failed" | "success";
|
|
1130
1161
|
created_by?: Array<IdRequest | "me">;
|
|
1131
1162
|
last_used_by?: Array<IdRequest | "me">;
|
|
@@ -1142,7 +1173,7 @@ export type ListThreadsResponse = {
|
|
|
1142
1173
|
object: "thread";
|
|
1143
1174
|
id: IdResponse;
|
|
1144
1175
|
title: string;
|
|
1145
|
-
status: "pending" | "requires_action" | "completed" | "failed";
|
|
1176
|
+
status: "pending" | "requires_action" | "completed" | "canceled" | "failed";
|
|
1146
1177
|
created_time: string;
|
|
1147
1178
|
last_edited_time: string;
|
|
1148
1179
|
created_by: {
|
|
@@ -1783,9 +1814,9 @@ export type QueryAgentsResponse = {
|
|
|
1783
1814
|
instructions?: string | null;
|
|
1784
1815
|
} | {
|
|
1785
1816
|
object: "agent";
|
|
1786
|
-
id: "
|
|
1817
|
+
id: "notion_ai";
|
|
1787
1818
|
agent_type: "notion_ai";
|
|
1788
|
-
name:
|
|
1819
|
+
name: string;
|
|
1789
1820
|
description: null;
|
|
1790
1821
|
instructions_page_id: null;
|
|
1791
1822
|
icon: PageIconResponse | {
|
|
@@ -2815,7 +2846,6 @@ export type QueryThreadMessagesResponse = {
|
|
|
2815
2846
|
type: "tool_call";
|
|
2816
2847
|
tool_call_id: string | null;
|
|
2817
2848
|
tool_name: string;
|
|
2818
|
-
input: string;
|
|
2819
2849
|
results?: Array<{
|
|
2820
2850
|
id: IdResponse;
|
|
2821
2851
|
agent_step_id: IdResponse | null;
|
|
@@ -2823,9 +2853,6 @@ export type QueryThreadMessagesResponse = {
|
|
|
2823
2853
|
tool_name: string;
|
|
2824
2854
|
tool_type: string;
|
|
2825
2855
|
state: string;
|
|
2826
|
-
input: Record<string, never> | null;
|
|
2827
|
-
output: Record<string, never> | null;
|
|
2828
|
-
error: string | null;
|
|
2829
2856
|
started_at: number;
|
|
2830
2857
|
finished_at: number | null;
|
|
2831
2858
|
duration_ms: number | null;
|
|
@@ -2928,7 +2955,7 @@ export type QueryThreadsResponse = {
|
|
|
2928
2955
|
object: "thread";
|
|
2929
2956
|
id: IdResponse;
|
|
2930
2957
|
title: string;
|
|
2931
|
-
status: "pending" | "requires_action" | "completed" | "failed";
|
|
2958
|
+
status: "pending" | "requires_action" | "completed" | "canceled" | "failed";
|
|
2932
2959
|
created_time: string;
|
|
2933
2960
|
last_edited_time: string;
|
|
2934
2961
|
created_by: {
|