notte-sdk 1.10.13 → 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 +3264 -2897
- package/dist/index.d.ts +3264 -2897
- package/dist/index.js +256 -130
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +254 -130
- package/dist/index.mjs.map +1 -1
- package/dist/proxy/core.js +2 -0
- package/dist/proxy/core.js.map +1 -1
- package/dist/proxy/core.mjs +2 -0
- package/dist/proxy/core.mjs.map +1 -1
- package/dist/proxy/next.js +2 -0
- package/dist/proxy/next.js.map +1 -1
- package/dist/proxy/next.mjs +2 -0
- package/dist/proxy/next.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,9 +946,9 @@ var sessionStart = (options) => (options.client ?? client).post({
|
|
|
956
946
|
...options.headers
|
|
957
947
|
}
|
|
958
948
|
});
|
|
959
|
-
var
|
|
949
|
+
var sessionSteps = (options) => (options.client ?? client).get({
|
|
960
950
|
security: [{ scheme: "bearer", type: "http" }],
|
|
961
|
-
url: "/sessions/{session_id}",
|
|
951
|
+
url: "/sessions/{session_id}/steps",
|
|
962
952
|
...options
|
|
963
953
|
});
|
|
964
954
|
var sessionProfilePreview = (options) => (options.client ?? client).get({
|
|
@@ -1082,21 +1072,6 @@ var pageDocumentRead = (options) => (options.client ?? client).post({
|
|
|
1082
1072
|
...options.headers
|
|
1083
1073
|
}
|
|
1084
1074
|
});
|
|
1085
|
-
var sessionNetworkLogs = (options) => (options.client ?? client).get({
|
|
1086
|
-
security: [{ scheme: "bearer", type: "http" }],
|
|
1087
|
-
url: "/sessions/{session_id}/network/logs",
|
|
1088
|
-
...options
|
|
1089
|
-
});
|
|
1090
|
-
var sessionMouseReplay = (options) => (options.client ?? client).get({
|
|
1091
|
-
security: [{ scheme: "bearer", type: "http" }],
|
|
1092
|
-
url: "/sessions/{session_id}/replay/mouse",
|
|
1093
|
-
...options
|
|
1094
|
-
});
|
|
1095
|
-
var sessionReplay = (options) => (options.client ?? client).get({
|
|
1096
|
-
security: [{ scheme: "bearer", type: "http" }],
|
|
1097
|
-
url: "/sessions/{session_id}/replay",
|
|
1098
|
-
...options
|
|
1099
|
-
});
|
|
1100
1075
|
var executeSessionFile = (options) => (options.client ?? client).post({
|
|
1101
1076
|
security: [{ scheme: "bearer", type: "http" }],
|
|
1102
1077
|
url: "/sessions/{session_id}/page/execute/file",
|
|
@@ -1466,91 +1441,6 @@ var profileList = (options) => (options?.client ?? client).get({
|
|
|
1466
1441
|
url: "/profiles",
|
|
1467
1442
|
...options
|
|
1468
1443
|
});
|
|
1469
|
-
var personaCreate = (options) => (options.client ?? client).post({
|
|
1470
|
-
security: [{ scheme: "bearer", type: "http" }],
|
|
1471
|
-
url: "/personas/create",
|
|
1472
|
-
...options,
|
|
1473
|
-
headers: {
|
|
1474
|
-
"Content-Type": "application/json",
|
|
1475
|
-
...options.headers
|
|
1476
|
-
}
|
|
1477
|
-
});
|
|
1478
|
-
var personaDelete = (options) => (options.client ?? client).delete({
|
|
1479
|
-
security: [{ scheme: "bearer", type: "http" }],
|
|
1480
|
-
url: "/personas/{persona_id}",
|
|
1481
|
-
...options
|
|
1482
|
-
});
|
|
1483
|
-
var personaGet = (options) => (options.client ?? client).get({
|
|
1484
|
-
security: [{ scheme: "bearer", type: "http" }],
|
|
1485
|
-
url: "/personas/{persona_id}",
|
|
1486
|
-
...options
|
|
1487
|
-
});
|
|
1488
|
-
var personaUpdate = (options) => (options.client ?? client).patch({
|
|
1489
|
-
security: [{ scheme: "bearer", type: "http" }],
|
|
1490
|
-
url: "/personas/{persona_id}",
|
|
1491
|
-
...options,
|
|
1492
|
-
headers: {
|
|
1493
|
-
"Content-Type": "application/json",
|
|
1494
|
-
...options.headers
|
|
1495
|
-
}
|
|
1496
|
-
});
|
|
1497
|
-
var personaEmailsList = (options) => (options.client ?? client).get({
|
|
1498
|
-
security: [{ scheme: "bearer", type: "http" }],
|
|
1499
|
-
url: "/personas/{persona_id}/emails",
|
|
1500
|
-
...options
|
|
1501
|
-
});
|
|
1502
|
-
var listPersonas = (options) => (options?.client ?? client).get({
|
|
1503
|
-
security: [{ scheme: "bearer", type: "http" }],
|
|
1504
|
-
url: "/personas",
|
|
1505
|
-
...options
|
|
1506
|
-
});
|
|
1507
|
-
var personaSmsList = (options) => (options.client ?? client).get({
|
|
1508
|
-
security: [{ scheme: "bearer", type: "http" }],
|
|
1509
|
-
url: "/personas/{persona_id}/sms",
|
|
1510
|
-
...options
|
|
1511
|
-
});
|
|
1512
|
-
var mailboxConnectToken = (options) => (options.client ?? client).post({
|
|
1513
|
-
security: [{ scheme: "bearer", type: "http" }],
|
|
1514
|
-
url: "/mailboxes/connect-token",
|
|
1515
|
-
...options,
|
|
1516
|
-
headers: {
|
|
1517
|
-
"Content-Type": "application/json",
|
|
1518
|
-
...options.headers
|
|
1519
|
-
}
|
|
1520
|
-
});
|
|
1521
|
-
var mailboxSync = (options) => (options?.client ?? client).post({
|
|
1522
|
-
security: [{ scheme: "bearer", type: "http" }],
|
|
1523
|
-
url: "/mailboxes/sync",
|
|
1524
|
-
...options,
|
|
1525
|
-
headers: {
|
|
1526
|
-
"Content-Type": "application/json",
|
|
1527
|
-
...options?.headers
|
|
1528
|
-
}
|
|
1529
|
-
});
|
|
1530
|
-
var mailboxList = (options) => (options?.client ?? client).get({
|
|
1531
|
-
security: [{ scheme: "bearer", type: "http" }],
|
|
1532
|
-
url: "/mailboxes",
|
|
1533
|
-
...options
|
|
1534
|
-
});
|
|
1535
|
-
var mailboxDelete = (options) => (options.client ?? client).delete({
|
|
1536
|
-
security: [{ scheme: "bearer", type: "http" }],
|
|
1537
|
-
url: "/mailboxes/{mailbox_id}",
|
|
1538
|
-
...options
|
|
1539
|
-
});
|
|
1540
|
-
var mailboxGet = (options) => (options.client ?? client).get({
|
|
1541
|
-
security: [{ scheme: "bearer", type: "http" }],
|
|
1542
|
-
url: "/mailboxes/{mailbox_id}",
|
|
1543
|
-
...options
|
|
1544
|
-
});
|
|
1545
|
-
var mailboxUpdate = (options) => (options.client ?? client).patch({
|
|
1546
|
-
security: [{ scheme: "bearer", type: "http" }],
|
|
1547
|
-
url: "/mailboxes/{mailbox_id}",
|
|
1548
|
-
...options,
|
|
1549
|
-
headers: {
|
|
1550
|
-
"Content-Type": "application/json",
|
|
1551
|
-
...options.headers
|
|
1552
|
-
}
|
|
1553
|
-
});
|
|
1554
1444
|
var managedAuthConnectLinkCreate = (options) => (options.client ?? client).post({
|
|
1555
1445
|
security: [{ scheme: "bearer", type: "http" }],
|
|
1556
1446
|
url: "/managed-auth/connect-links",
|
|
@@ -1587,15 +1477,6 @@ var connectLinkSubmit = (options) => (options.client ?? client).post({
|
|
|
1587
1477
|
}
|
|
1588
1478
|
});
|
|
1589
1479
|
var connectLinkStatus = (options) => (options.client ?? client).get({ url: "/managed-auth/connect-links/status", ...options });
|
|
1590
|
-
var anythingStart = (options) => (options.client ?? client).post({
|
|
1591
|
-
security: [{ scheme: "bearer", type: "http" }],
|
|
1592
|
-
url: "/anything/start",
|
|
1593
|
-
...options,
|
|
1594
|
-
headers: {
|
|
1595
|
-
"Content-Type": "application/json",
|
|
1596
|
-
...options.headers
|
|
1597
|
-
}
|
|
1598
|
-
});
|
|
1599
1480
|
var listSecrets = (options) => (options?.client ?? client).get({
|
|
1600
1481
|
security: [{ scheme: "bearer", type: "http" }],
|
|
1601
1482
|
url: "/secrets",
|
|
@@ -1620,11 +1501,6 @@ var deleteSecret = (options) => (options.client ?? client).delete({
|
|
|
1620
1501
|
url: "/secrets/{secret_id}",
|
|
1621
1502
|
...options
|
|
1622
1503
|
});
|
|
1623
|
-
var listSecretProxyHostPresets = (options) => (options?.client ?? client).get({
|
|
1624
|
-
security: [{ scheme: "bearer", type: "http" }],
|
|
1625
|
-
url: "/secret-proxy/host-presets",
|
|
1626
|
-
...options
|
|
1627
|
-
});
|
|
1628
1504
|
var healthCheck = (options) => (options?.client ?? client).get({ url: "/health", ...options });
|
|
1629
1505
|
var readyCheck = (options) => (options?.client ?? client).get({ url: "/ready", ...options });
|
|
1630
1506
|
var scrapeWebpage = (options) => (options.client ?? client).post({
|
|
@@ -1863,11 +1739,140 @@ var scrapeFromHtml = (options) => (options.client ?? client).post({
|
|
|
1863
1739
|
...options.headers
|
|
1864
1740
|
}
|
|
1865
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
|
+
});
|
|
1866
1751
|
var listAuditEvents = (options) => (options?.client ?? client).get({
|
|
1867
1752
|
security: [{ scheme: "bearer", type: "http" }],
|
|
1868
1753
|
url: "/audit-events",
|
|
1869
1754
|
...options
|
|
1870
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
|
+
});
|
|
1798
|
+
var listPersonas = (options) => (options?.client ?? client).get({
|
|
1799
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1800
|
+
url: "/personas",
|
|
1801
|
+
...options
|
|
1802
|
+
});
|
|
1803
|
+
var personaCreate = (options) => (options.client ?? client).post({
|
|
1804
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1805
|
+
url: "/personas/create",
|
|
1806
|
+
...options,
|
|
1807
|
+
headers: {
|
|
1808
|
+
"Content-Type": "application/json",
|
|
1809
|
+
...options.headers
|
|
1810
|
+
}
|
|
1811
|
+
});
|
|
1812
|
+
var personaDelete = (options) => (options.client ?? client).delete({
|
|
1813
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1814
|
+
url: "/personas/{persona_id}",
|
|
1815
|
+
...options
|
|
1816
|
+
});
|
|
1817
|
+
var personaGet = (options) => (options.client ?? client).get({
|
|
1818
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1819
|
+
url: "/personas/{persona_id}",
|
|
1820
|
+
...options
|
|
1821
|
+
});
|
|
1822
|
+
var personaUpdate = (options) => (options.client ?? client).patch({
|
|
1823
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1824
|
+
url: "/personas/{persona_id}",
|
|
1825
|
+
...options,
|
|
1826
|
+
headers: {
|
|
1827
|
+
"Content-Type": "application/json",
|
|
1828
|
+
...options.headers
|
|
1829
|
+
}
|
|
1830
|
+
});
|
|
1831
|
+
var personaEmailsList = (options) => (options.client ?? client).get({
|
|
1832
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1833
|
+
url: "/personas/{persona_id}/emails",
|
|
1834
|
+
...options
|
|
1835
|
+
});
|
|
1836
|
+
var personaSmsList = (options) => (options.client ?? client).get({
|
|
1837
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1838
|
+
url: "/personas/{persona_id}/sms",
|
|
1839
|
+
...options
|
|
1840
|
+
});
|
|
1841
|
+
var listSecretProxyHostPresets = (options) => (options?.client ?? client).get({
|
|
1842
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1843
|
+
url: "/secret-proxy/host-presets",
|
|
1844
|
+
...options
|
|
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
|
+
});
|
|
1871
1876
|
var getUsage = (options) => (options?.client ?? client).get({
|
|
1872
1877
|
security: [{ scheme: "bearer", type: "http" }],
|
|
1873
1878
|
url: "/usage",
|
|
@@ -2039,6 +2044,31 @@ var CaptchaRejectedError = class extends ActionExecutionError {
|
|
|
2039
2044
|
super({ error_type: "CaptchaRejectedError", dev_message: message, user_message: message, agent_message: message });
|
|
2040
2045
|
}
|
|
2041
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
|
+
}
|
|
2042
2072
|
var EvaluateJsNoDataError = class extends NotteError {
|
|
2043
2073
|
constructor() {
|
|
2044
2074
|
super("evaluate_js returned no data. Upgrade the Notte API to a build that returns the evaluated value.");
|
|
@@ -2447,6 +2477,7 @@ function createResources(client2, getApiKey) {
|
|
|
2447
2477
|
},
|
|
2448
2478
|
/** functionRunStart: /functions/{function_id}/runs/start. Returns the API response body. */
|
|
2449
2479
|
runStart: async (functionId, body, requestOptions = {}) => {
|
|
2480
|
+
if (typeof functionId !== "string" || !functionId.trim()) throw new TypeError("runStart requires a non-empty functionId.");
|
|
2450
2481
|
const response = await functionRunStart({ client: client2, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers, "x-notte-api-key": getApiKey() }, path: { "function_id": functionId }, body });
|
|
2451
2482
|
return response.data;
|
|
2452
2483
|
},
|
|
@@ -3296,10 +3327,41 @@ function abortableSleep(ms, signal) {
|
|
|
3296
3327
|
});
|
|
3297
3328
|
}
|
|
3298
3329
|
|
|
3330
|
+
// src/session-steps.ts
|
|
3331
|
+
async function getSessionSteps(client2, sessionId, options = {}) {
|
|
3332
|
+
const response = await client2.getClient().get({
|
|
3333
|
+
url: `/sessions/${encodeURIComponent(sessionId)}/steps`,
|
|
3334
|
+
query: { cursor: options.cursor, limit: options.limit },
|
|
3335
|
+
throwOnError: true
|
|
3336
|
+
});
|
|
3337
|
+
return { steps: response.data.steps ?? [], next_cursor: response.data.next_cursor ?? null };
|
|
3338
|
+
}
|
|
3339
|
+
async function* iterSessionSteps(client2, sessionId, options = {}) {
|
|
3340
|
+
let cursor;
|
|
3341
|
+
while (true) {
|
|
3342
|
+
const page = await getSessionSteps(client2, sessionId, { cursor, limit: options.limit });
|
|
3343
|
+
yield* page.steps;
|
|
3344
|
+
if (page.next_cursor === null) return;
|
|
3345
|
+
cursor = page.next_cursor;
|
|
3346
|
+
}
|
|
3347
|
+
}
|
|
3348
|
+
|
|
3299
3349
|
// src/session.ts
|
|
3300
3350
|
var SESSION_START_TRIES = 3;
|
|
3301
3351
|
var CLUSTER_OVERLOAD_RETRY_DELAY_MS = 3e4;
|
|
3302
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
|
+
}
|
|
3303
3365
|
var OBSERVE_MIGRATION_URL = "https://docs.notte.cc/features/sessions/observe-migration";
|
|
3304
3366
|
var OBSERVE_DEPRECATIONS = {
|
|
3305
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}`,
|
|
@@ -3806,6 +3868,36 @@ var Session = class {
|
|
|
3806
3868
|
});
|
|
3807
3869
|
return response.data;
|
|
3808
3870
|
}
|
|
3871
|
+
/**
|
|
3872
|
+
* Get one page of the session's steps. Each step has the shape of an item of
|
|
3873
|
+
* `status().steps`. Pass the page's `next_cursor` back as `cursor`, as is, to
|
|
3874
|
+
* get the next page; it is `null` on the last page. Works after `stop()`.
|
|
3875
|
+
*
|
|
3876
|
+
* @throws NotteAPIError with status 400 when `cursor` is no longer valid: restart from the first page (no `cursor`).
|
|
3877
|
+
* @example
|
|
3878
|
+
* let page = await session.steps({ limit: 50 });
|
|
3879
|
+
* while (page.next_cursor !== null) {
|
|
3880
|
+
* page = await session.steps({ cursor: page.next_cursor, limit: 50 });
|
|
3881
|
+
* }
|
|
3882
|
+
*/
|
|
3883
|
+
async steps(options = {}) {
|
|
3884
|
+
return getSessionSteps(this.client, this.lastSessionId(), options);
|
|
3885
|
+
}
|
|
3886
|
+
/**
|
|
3887
|
+
* Iterate over all of the session's steps, following `next_cursor` page by page.
|
|
3888
|
+
* A cursor that is no longer valid stops the iteration with a `NotteAPIError`
|
|
3889
|
+
* with status 400, after the steps already yielded; it is not restarted here,
|
|
3890
|
+
* since that would yield those steps again. To read the steps again, start a
|
|
3891
|
+
* new iteration. Works after `stop()`.
|
|
3892
|
+
*
|
|
3893
|
+
* @example
|
|
3894
|
+
* for await (const step of session.iterSteps({ limit: 50 })) {
|
|
3895
|
+
* console.log(step);
|
|
3896
|
+
* }
|
|
3897
|
+
*/
|
|
3898
|
+
async *iterSteps(options = {}) {
|
|
3899
|
+
yield* iterSessionSteps(this.client, this.lastSessionId(), options);
|
|
3900
|
+
}
|
|
3809
3901
|
// #######################################################################
|
|
3810
3902
|
// ############################# Debug / CDP #############################
|
|
3811
3903
|
// #######################################################################
|
|
@@ -3897,6 +3989,14 @@ var Session = class {
|
|
|
3897
3989
|
this.playwrightPage = page;
|
|
3898
3990
|
return page;
|
|
3899
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
|
+
}
|
|
3900
4000
|
throw new Error(`Failed to access the playwright page from CDP: ${error instanceof Error ? error.message : String(error)}`, {
|
|
3901
4001
|
cause: error
|
|
3902
4002
|
});
|
|
@@ -5870,9 +5970,11 @@ var NotteAnything = class {
|
|
|
5870
5970
|
* Rejects with a `NotteAPIError` when the API answers with a non-2xx status.
|
|
5871
5971
|
*/
|
|
5872
5972
|
async start(body) {
|
|
5873
|
-
const { data, response } = await
|
|
5874
|
-
|
|
5973
|
+
const { data, response } = await this.client.getClient().post({
|
|
5974
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
5975
|
+
url: "/anything/start",
|
|
5875
5976
|
body,
|
|
5977
|
+
headers: { "Content-Type": "application/json" },
|
|
5876
5978
|
parseAs: "stream",
|
|
5877
5979
|
throwOnError: true
|
|
5878
5980
|
});
|
|
@@ -6273,7 +6375,27 @@ var NotteClient3 = class {
|
|
|
6273
6375
|
list: async (options = {}) => {
|
|
6274
6376
|
const response = await listSessions({ client: this.getClient(), query: options });
|
|
6275
6377
|
return response.data?.items ?? [];
|
|
6276
|
-
}
|
|
6378
|
+
},
|
|
6379
|
+
/**
|
|
6380
|
+
* One page of the session's steps (`{ steps, next_cursor }`), from
|
|
6381
|
+
* `GET /sessions/{session_id}/steps`. Each step has the shape of an item of
|
|
6382
|
+
* `status().steps`. Pass `next_cursor` back as `cursor`, as is, for the next
|
|
6383
|
+
* page; it is `null` on the last page. A `NotteAPIError` with status 400 means
|
|
6384
|
+
* the cursor is no longer valid: restart from the first page (no `cursor`).
|
|
6385
|
+
*/
|
|
6386
|
+
steps: (sessionId, options = {}) => getSessionSteps(this, sessionId, options),
|
|
6387
|
+
/**
|
|
6388
|
+
* Every step of the session, following `next_cursor` page by page. A cursor
|
|
6389
|
+
* that is no longer valid stops the iteration with the 400 `NotteAPIError`,
|
|
6390
|
+
* after the steps already yielded; start a new iteration to read them again.
|
|
6391
|
+
*
|
|
6392
|
+
* ```ts
|
|
6393
|
+
* for await (const step of client.sessions.iterSteps(sessionId, { limit: 50 })) {
|
|
6394
|
+
* console.log(step);
|
|
6395
|
+
* }
|
|
6396
|
+
* ```
|
|
6397
|
+
*/
|
|
6398
|
+
iterSteps: (sessionId, options = {}) => iterSessionSteps(this, sessionId, options)
|
|
6277
6399
|
};
|
|
6278
6400
|
}
|
|
6279
6401
|
/** Client-bound vault API operations. `list()` retains its array return value. */
|
|
@@ -6551,6 +6673,7 @@ export {
|
|
|
6551
6673
|
SESSION_START_TRIES,
|
|
6552
6674
|
ScrapeFailedError,
|
|
6553
6675
|
Session,
|
|
6676
|
+
SessionClosedError,
|
|
6554
6677
|
SessionFiles,
|
|
6555
6678
|
TIMEOUT_HEADER,
|
|
6556
6679
|
accountChanges,
|
|
@@ -6705,6 +6828,7 @@ export {
|
|
|
6705
6828
|
sessionResume,
|
|
6706
6829
|
sessionStart,
|
|
6707
6830
|
sessionStatus,
|
|
6831
|
+
sessionSteps,
|
|
6708
6832
|
sessionStop,
|
|
6709
6833
|
startVersionCheck,
|
|
6710
6834
|
storeSecret,
|