notte-sdk 1.10.14 → 1.10.15
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/dist/index.d.mts +2225 -2067
- package/dist/index.d.ts +2225 -2067
- package/dist/index.js +133 -84
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +132 -84
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/version.ts
|
|
2
|
-
var SDK_VERSION = true ? "1.10.
|
|
2
|
+
var SDK_VERSION = true ? "1.10.15" : "dev";
|
|
3
3
|
var SDK_PACKAGE_NAME = true ? "notte-sdk" : "notte-sdk";
|
|
4
4
|
|
|
5
5
|
// src/version-check.ts
|
|
@@ -937,16 +937,6 @@ var createClient = (config = {}) => {
|
|
|
937
937
|
var client = createClient(createConfig({ baseUrl: "https://api.notte.cc" }));
|
|
938
938
|
|
|
939
939
|
// src/lib/client/sdk.gen.ts
|
|
940
|
-
var sessionAuthReadiness = (options) => (options.client ?? client).get({
|
|
941
|
-
security: [{ scheme: "bearer", type: "http" }],
|
|
942
|
-
url: "/sessions/{session_id}/auth",
|
|
943
|
-
...options
|
|
944
|
-
});
|
|
945
|
-
var listSessions = (options) => (options?.client ?? client).get({
|
|
946
|
-
security: [{ scheme: "bearer", type: "http" }],
|
|
947
|
-
url: "/sessions",
|
|
948
|
-
...options
|
|
949
|
-
});
|
|
950
940
|
var sessionStart = (options) => (options.client ?? client).post({
|
|
951
941
|
security: [{ scheme: "bearer", type: "http" }],
|
|
952
942
|
url: "/sessions/start",
|
|
@@ -956,11 +946,6 @@ var sessionStart = (options) => (options.client ?? client).post({
|
|
|
956
946
|
...options.headers
|
|
957
947
|
}
|
|
958
948
|
});
|
|
959
|
-
var sessionStatus = (options) => (options.client ?? client).get({
|
|
960
|
-
security: [{ scheme: "bearer", type: "http" }],
|
|
961
|
-
url: "/sessions/{session_id}",
|
|
962
|
-
...options
|
|
963
|
-
});
|
|
964
949
|
var sessionSteps = (options) => (options.client ?? client).get({
|
|
965
950
|
security: [{ scheme: "bearer", type: "http" }],
|
|
966
951
|
url: "/sessions/{session_id}/steps",
|
|
@@ -1087,21 +1072,6 @@ var pageDocumentRead = (options) => (options.client ?? client).post({
|
|
|
1087
1072
|
...options.headers
|
|
1088
1073
|
}
|
|
1089
1074
|
});
|
|
1090
|
-
var sessionNetworkLogs = (options) => (options.client ?? client).get({
|
|
1091
|
-
security: [{ scheme: "bearer", type: "http" }],
|
|
1092
|
-
url: "/sessions/{session_id}/network/logs",
|
|
1093
|
-
...options
|
|
1094
|
-
});
|
|
1095
|
-
var sessionMouseReplay = (options) => (options.client ?? client).get({
|
|
1096
|
-
security: [{ scheme: "bearer", type: "http" }],
|
|
1097
|
-
url: "/sessions/{session_id}/replay/mouse",
|
|
1098
|
-
...options
|
|
1099
|
-
});
|
|
1100
|
-
var sessionReplay = (options) => (options.client ?? client).get({
|
|
1101
|
-
security: [{ scheme: "bearer", type: "http" }],
|
|
1102
|
-
url: "/sessions/{session_id}/replay",
|
|
1103
|
-
...options
|
|
1104
|
-
});
|
|
1105
1075
|
var executeSessionFile = (options) => (options.client ?? client).post({
|
|
1106
1076
|
security: [{ scheme: "bearer", type: "http" }],
|
|
1107
1077
|
url: "/sessions/{session_id}/page/execute/file",
|
|
@@ -1471,48 +1441,6 @@ var profileList = (options) => (options?.client ?? client).get({
|
|
|
1471
1441
|
url: "/profiles",
|
|
1472
1442
|
...options
|
|
1473
1443
|
});
|
|
1474
|
-
var mailboxConnectToken = (options) => (options.client ?? client).post({
|
|
1475
|
-
security: [{ scheme: "bearer", type: "http" }],
|
|
1476
|
-
url: "/mailboxes/connect-token",
|
|
1477
|
-
...options,
|
|
1478
|
-
headers: {
|
|
1479
|
-
"Content-Type": "application/json",
|
|
1480
|
-
...options.headers
|
|
1481
|
-
}
|
|
1482
|
-
});
|
|
1483
|
-
var mailboxSync = (options) => (options?.client ?? client).post({
|
|
1484
|
-
security: [{ scheme: "bearer", type: "http" }],
|
|
1485
|
-
url: "/mailboxes/sync",
|
|
1486
|
-
...options,
|
|
1487
|
-
headers: {
|
|
1488
|
-
"Content-Type": "application/json",
|
|
1489
|
-
...options?.headers
|
|
1490
|
-
}
|
|
1491
|
-
});
|
|
1492
|
-
var mailboxList = (options) => (options?.client ?? client).get({
|
|
1493
|
-
security: [{ scheme: "bearer", type: "http" }],
|
|
1494
|
-
url: "/mailboxes",
|
|
1495
|
-
...options
|
|
1496
|
-
});
|
|
1497
|
-
var mailboxDelete = (options) => (options.client ?? client).delete({
|
|
1498
|
-
security: [{ scheme: "bearer", type: "http" }],
|
|
1499
|
-
url: "/mailboxes/{mailbox_id}",
|
|
1500
|
-
...options
|
|
1501
|
-
});
|
|
1502
|
-
var mailboxGet = (options) => (options.client ?? client).get({
|
|
1503
|
-
security: [{ scheme: "bearer", type: "http" }],
|
|
1504
|
-
url: "/mailboxes/{mailbox_id}",
|
|
1505
|
-
...options
|
|
1506
|
-
});
|
|
1507
|
-
var mailboxUpdate = (options) => (options.client ?? client).patch({
|
|
1508
|
-
security: [{ scheme: "bearer", type: "http" }],
|
|
1509
|
-
url: "/mailboxes/{mailbox_id}",
|
|
1510
|
-
...options,
|
|
1511
|
-
headers: {
|
|
1512
|
-
"Content-Type": "application/json",
|
|
1513
|
-
...options.headers
|
|
1514
|
-
}
|
|
1515
|
-
});
|
|
1516
1444
|
var managedAuthConnectLinkCreate = (options) => (options.client ?? client).post({
|
|
1517
1445
|
security: [{ scheme: "bearer", type: "http" }],
|
|
1518
1446
|
url: "/managed-auth/connect-links",
|
|
@@ -1549,15 +1477,6 @@ var connectLinkSubmit = (options) => (options.client ?? client).post({
|
|
|
1549
1477
|
}
|
|
1550
1478
|
});
|
|
1551
1479
|
var connectLinkStatus = (options) => (options.client ?? client).get({ url: "/managed-auth/connect-links/status", ...options });
|
|
1552
|
-
var anythingStart = (options) => (options.client ?? client).post({
|
|
1553
|
-
security: [{ scheme: "bearer", type: "http" }],
|
|
1554
|
-
url: "/anything/start",
|
|
1555
|
-
...options,
|
|
1556
|
-
headers: {
|
|
1557
|
-
"Content-Type": "application/json",
|
|
1558
|
-
...options.headers
|
|
1559
|
-
}
|
|
1560
|
-
});
|
|
1561
1480
|
var listSecrets = (options) => (options?.client ?? client).get({
|
|
1562
1481
|
security: [{ scheme: "bearer", type: "http" }],
|
|
1563
1482
|
url: "/secrets",
|
|
@@ -1820,11 +1739,62 @@ var scrapeFromHtml = (options) => (options.client ?? client).post({
|
|
|
1820
1739
|
...options.headers
|
|
1821
1740
|
}
|
|
1822
1741
|
});
|
|
1742
|
+
var anythingStart = (options) => (options.client ?? client).sse.post({
|
|
1743
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1744
|
+
url: "/anything/start",
|
|
1745
|
+
...options,
|
|
1746
|
+
headers: {
|
|
1747
|
+
"Content-Type": "application/json",
|
|
1748
|
+
...options.headers
|
|
1749
|
+
}
|
|
1750
|
+
});
|
|
1823
1751
|
var listAuditEvents = (options) => (options?.client ?? client).get({
|
|
1824
1752
|
security: [{ scheme: "bearer", type: "http" }],
|
|
1825
1753
|
url: "/audit-events",
|
|
1826
1754
|
...options
|
|
1827
1755
|
});
|
|
1756
|
+
var mailboxList = (options) => (options?.client ?? client).get({
|
|
1757
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1758
|
+
url: "/mailboxes",
|
|
1759
|
+
...options
|
|
1760
|
+
});
|
|
1761
|
+
var mailboxConnectToken = (options) => (options.client ?? client).post({
|
|
1762
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1763
|
+
url: "/mailboxes/connect-token",
|
|
1764
|
+
...options,
|
|
1765
|
+
headers: {
|
|
1766
|
+
"Content-Type": "application/json",
|
|
1767
|
+
...options.headers
|
|
1768
|
+
}
|
|
1769
|
+
});
|
|
1770
|
+
var mailboxSync = (options) => (options?.client ?? client).post({
|
|
1771
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1772
|
+
url: "/mailboxes/sync",
|
|
1773
|
+
...options,
|
|
1774
|
+
headers: {
|
|
1775
|
+
"Content-Type": "application/json",
|
|
1776
|
+
...options?.headers
|
|
1777
|
+
}
|
|
1778
|
+
});
|
|
1779
|
+
var mailboxDelete = (options) => (options.client ?? client).delete({
|
|
1780
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1781
|
+
url: "/mailboxes/{mailbox_id}",
|
|
1782
|
+
...options
|
|
1783
|
+
});
|
|
1784
|
+
var mailboxGet = (options) => (options.client ?? client).get({
|
|
1785
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1786
|
+
url: "/mailboxes/{mailbox_id}",
|
|
1787
|
+
...options
|
|
1788
|
+
});
|
|
1789
|
+
var mailboxUpdate = (options) => (options.client ?? client).patch({
|
|
1790
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1791
|
+
url: "/mailboxes/{mailbox_id}",
|
|
1792
|
+
...options,
|
|
1793
|
+
headers: {
|
|
1794
|
+
"Content-Type": "application/json",
|
|
1795
|
+
...options.headers
|
|
1796
|
+
}
|
|
1797
|
+
});
|
|
1828
1798
|
var listPersonas = (options) => (options?.client ?? client).get({
|
|
1829
1799
|
security: [{ scheme: "bearer", type: "http" }],
|
|
1830
1800
|
url: "/personas",
|
|
@@ -1873,6 +1843,36 @@ var listSecretProxyHostPresets = (options) => (options?.client ?? client).get({
|
|
|
1873
1843
|
url: "/secret-proxy/host-presets",
|
|
1874
1844
|
...options
|
|
1875
1845
|
});
|
|
1846
|
+
var listSessions = (options) => (options?.client ?? client).get({
|
|
1847
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1848
|
+
url: "/sessions",
|
|
1849
|
+
...options
|
|
1850
|
+
});
|
|
1851
|
+
var sessionStatus = (options) => (options.client ?? client).get({
|
|
1852
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1853
|
+
url: "/sessions/{session_id}",
|
|
1854
|
+
...options
|
|
1855
|
+
});
|
|
1856
|
+
var sessionAuthReadiness = (options) => (options.client ?? client).get({
|
|
1857
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1858
|
+
url: "/sessions/{session_id}/auth",
|
|
1859
|
+
...options
|
|
1860
|
+
});
|
|
1861
|
+
var sessionNetworkLogs = (options) => (options.client ?? client).get({
|
|
1862
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1863
|
+
url: "/sessions/{session_id}/network/logs",
|
|
1864
|
+
...options
|
|
1865
|
+
});
|
|
1866
|
+
var sessionReplay = (options) => (options.client ?? client).get({
|
|
1867
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1868
|
+
url: "/sessions/{session_id}/replay",
|
|
1869
|
+
...options
|
|
1870
|
+
});
|
|
1871
|
+
var sessionMouseReplay = (options) => (options.client ?? client).get({
|
|
1872
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1873
|
+
url: "/sessions/{session_id}/replay/mouse",
|
|
1874
|
+
...options
|
|
1875
|
+
});
|
|
1876
1876
|
var getUsage = (options) => (options?.client ?? client).get({
|
|
1877
1877
|
security: [{ scheme: "bearer", type: "http" }],
|
|
1878
1878
|
url: "/usage",
|
|
@@ -2044,6 +2044,31 @@ var CaptchaRejectedError = class extends ActionExecutionError {
|
|
|
2044
2044
|
super({ error_type: "CaptchaRejectedError", dev_message: message, user_message: message, agent_message: message });
|
|
2045
2045
|
}
|
|
2046
2046
|
};
|
|
2047
|
+
var SessionClosedError = class extends NotteError {
|
|
2048
|
+
sessionId;
|
|
2049
|
+
status;
|
|
2050
|
+
closeReason;
|
|
2051
|
+
constructor(sessionId, status, closeReason, timeouts = {}, options) {
|
|
2052
|
+
super(`Session ${sessionId} is closed: ${closeDescription(status, closeReason, timeouts)}. Start a new session.`, options);
|
|
2053
|
+
this.sessionId = sessionId;
|
|
2054
|
+
this.status = status;
|
|
2055
|
+
this.closeReason = closeReason;
|
|
2056
|
+
}
|
|
2057
|
+
};
|
|
2058
|
+
function closeDescription(status, closeReason, { idleTimeoutMinutes, maxDurationMinutes }) {
|
|
2059
|
+
switch (closeReason) {
|
|
2060
|
+
case "idle_timeout":
|
|
2061
|
+
return idleTimeoutMinutes === void 0 ? "it timed out without activity" : `it timed out after ${idleTimeoutMinutes} minutes without activity`;
|
|
2062
|
+
case "max_duration":
|
|
2063
|
+
return maxDurationMinutes === void 0 ? "it reached its maximum duration" : `it reached its maximum duration of ${maxDurationMinutes} minutes`;
|
|
2064
|
+
case "manual":
|
|
2065
|
+
return "it was stopped";
|
|
2066
|
+
case "error":
|
|
2067
|
+
return "it ended with an error";
|
|
2068
|
+
default:
|
|
2069
|
+
return `its status is ${status}`;
|
|
2070
|
+
}
|
|
2071
|
+
}
|
|
2047
2072
|
var EvaluateJsNoDataError = class extends NotteError {
|
|
2048
2073
|
constructor() {
|
|
2049
2074
|
super("evaluate_js returned no data. Upgrade the Notte API to a build that returns the evaluated value.");
|
|
@@ -3325,6 +3350,18 @@ async function* iterSessionSteps(client2, sessionId, options = {}) {
|
|
|
3325
3350
|
var SESSION_START_TRIES = 3;
|
|
3326
3351
|
var CLUSTER_OVERLOAD_RETRY_DELAY_MS = 3e4;
|
|
3327
3352
|
var CAPTCHA_SOLVE_TIMEOUT_MS = 1e5;
|
|
3353
|
+
function closedSessionError(response, cause) {
|
|
3354
|
+
if (response.status !== "closed" && response.status !== "error" && response.status !== "timed_out") {
|
|
3355
|
+
return null;
|
|
3356
|
+
}
|
|
3357
|
+
return new SessionClosedError(
|
|
3358
|
+
response.session_id,
|
|
3359
|
+
response.status,
|
|
3360
|
+
response.close_reason ?? null,
|
|
3361
|
+
{ idleTimeoutMinutes: response.idle_timeout_minutes, maxDurationMinutes: response.max_duration_minutes },
|
|
3362
|
+
{ cause }
|
|
3363
|
+
);
|
|
3364
|
+
}
|
|
3328
3365
|
var OBSERVE_MIGRATION_URL = "https://docs.notte.cc/features/sessions/observe-migration";
|
|
3329
3366
|
var OBSERVE_DEPRECATIONS = {
|
|
3330
3367
|
instructions: `\`observe({ instructions })\` is deprecated and will be removed on December 1, 2026; the Python SDK's local sessions replace it with session.act(); here, call observe() without it and pick from the returned actions. See ${OBSERVE_MIGRATION_URL}`,
|
|
@@ -3952,6 +3989,14 @@ var Session = class {
|
|
|
3952
3989
|
this.playwrightPage = page;
|
|
3953
3990
|
return page;
|
|
3954
3991
|
} catch (error) {
|
|
3992
|
+
let closed = null;
|
|
3993
|
+
try {
|
|
3994
|
+
closed = closedSessionError(await this.status(), error);
|
|
3995
|
+
} catch {
|
|
3996
|
+
}
|
|
3997
|
+
if (closed) {
|
|
3998
|
+
throw closed;
|
|
3999
|
+
}
|
|
3955
4000
|
throw new Error(`Failed to access the playwright page from CDP: ${error instanceof Error ? error.message : String(error)}`, {
|
|
3956
4001
|
cause: error
|
|
3957
4002
|
});
|
|
@@ -5925,9 +5970,11 @@ var NotteAnything = class {
|
|
|
5925
5970
|
* Rejects with a `NotteAPIError` when the API answers with a non-2xx status.
|
|
5926
5971
|
*/
|
|
5927
5972
|
async start(body) {
|
|
5928
|
-
const { data, response } = await
|
|
5929
|
-
|
|
5973
|
+
const { data, response } = await this.client.getClient().post({
|
|
5974
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
5975
|
+
url: "/anything/start",
|
|
5930
5976
|
body,
|
|
5977
|
+
headers: { "Content-Type": "application/json" },
|
|
5931
5978
|
parseAs: "stream",
|
|
5932
5979
|
throwOnError: true
|
|
5933
5980
|
});
|
|
@@ -6626,6 +6673,7 @@ export {
|
|
|
6626
6673
|
SESSION_START_TRIES,
|
|
6627
6674
|
ScrapeFailedError,
|
|
6628
6675
|
Session,
|
|
6676
|
+
SessionClosedError,
|
|
6629
6677
|
SessionFiles,
|
|
6630
6678
|
TIMEOUT_HEADER,
|
|
6631
6679
|
accountChanges,
|