notte-sdk 1.9.6 → 1.9.7

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.js CHANGED
@@ -116,11 +116,11 @@ __export(index_exports, {
116
116
  getUsage: () => getUsage,
117
117
  getUsageLogs: () => getUsageLogs,
118
118
  healthCheck: () => healthCheck,
119
- improvePrompt: () => improvePrompt,
120
119
  installServerOwnedDialogPolicy: () => installServerOwnedDialogPolicy,
121
120
  isCaptchaSolveAction: () => isCaptchaSolveAction,
122
121
  isValidMfaSecret: () => isValidMfaSecret,
123
122
  listAgents: () => listAgents,
123
+ listAuditEvents: () => listAuditEvents,
124
124
  listFunctionRunsByFunctionId: () => listFunctionRunsByFunctionId,
125
125
  listFunctions: () => listFunctions,
126
126
  listPersonas: () => listPersonas,
@@ -135,7 +135,6 @@ __export(index_exports, {
135
135
  mailboxSync: () => mailboxSync,
136
136
  mailboxUpdate: () => mailboxUpdate,
137
137
  managedAuthConnectLinkCreate: () => managedAuthConnectLinkCreate,
138
- nudgePrompt: () => nudgePrompt,
139
138
  observeServerOwnedDialog: () => observeServerOwnedDialog,
140
139
  pageExecute: () => pageExecute,
141
140
  pageObserve: () => pageObserve,
@@ -173,6 +172,7 @@ __export(index_exports, {
173
172
  sessionNetworkLogs: () => sessionNetworkLogs,
174
173
  sessionOffset: () => sessionOffset,
175
174
  sessionProfilePreview: () => sessionProfilePreview,
175
+ sessionProfileSave: () => sessionProfileSave,
176
176
  sessionReplay: () => sessionReplay,
177
177
  sessionStart: () => sessionStart,
178
178
  sessionStatus: () => sessionStatus,
@@ -197,7 +197,7 @@ __export(index_exports, {
197
197
  module.exports = __toCommonJS(index_exports);
198
198
 
199
199
  // src/version.ts
200
- var SDK_VERSION = true ? "1.9.6" : "dev";
200
+ var SDK_VERSION = true ? "1.9.7" : "dev";
201
201
  var SDK_PACKAGE_NAME = true ? "notte-sdk" : "notte-sdk";
202
202
 
203
203
  // src/version-check.ts
@@ -1159,6 +1159,15 @@ var sessionProfilePreview = (options) => (options.client ?? client).get({
1159
1159
  url: "/sessions/{session_id}/profile-preview",
1160
1160
  ...options
1161
1161
  });
1162
+ var sessionProfileSave = (options) => (options.client ?? client).post({
1163
+ security: [{ scheme: "bearer", type: "http" }],
1164
+ url: "/sessions/{session_id}/profile/save",
1165
+ ...options,
1166
+ headers: {
1167
+ "Content-Type": "application/json",
1168
+ ...options.headers
1169
+ }
1170
+ });
1162
1171
  var getSessionScript = (options) => (options.client ?? client).get({
1163
1172
  security: [{ scheme: "bearer", type: "http" }],
1164
1173
  url: "/sessions/{session_id}/workflow/code",
@@ -1684,24 +1693,6 @@ var connectLinkSubmit = (options) => (options.client ?? client).post({
1684
1693
  }
1685
1694
  });
1686
1695
  var connectLinkStatus = (options) => (options.client ?? client).get({ url: "/managed-auth/connect-links/status", ...options });
1687
- var improvePrompt = (options) => (options.client ?? client).post({
1688
- security: [{ scheme: "bearer", type: "http" }],
1689
- url: "/prompts/improve",
1690
- ...options,
1691
- headers: {
1692
- "Content-Type": "application/json",
1693
- ...options.headers
1694
- }
1695
- });
1696
- var nudgePrompt = (options) => (options.client ?? client).post({
1697
- security: [{ scheme: "bearer", type: "http" }],
1698
- url: "/prompts/nudge",
1699
- ...options,
1700
- headers: {
1701
- "Content-Type": "application/json",
1702
- ...options.headers
1703
- }
1704
- });
1705
1696
  var getUsage = (options) => (options?.client ?? client).get({
1706
1697
  security: [{ scheme: "bearer", type: "http" }],
1707
1698
  url: "/usage",
@@ -1745,6 +1736,11 @@ var deleteSecret = (options) => (options.client ?? client).delete({
1745
1736
  url: "/secrets/{secret_id}",
1746
1737
  ...options
1747
1738
  });
1739
+ var listAuditEvents = (options) => (options?.client ?? client).get({
1740
+ security: [{ scheme: "bearer", type: "http" }],
1741
+ url: "/audit-events",
1742
+ ...options
1743
+ });
1748
1744
  var healthCheck = (options) => (options?.client ?? client).get({ url: "/health", ...options });
1749
1745
  var readyCheck = (options) => (options?.client ?? client).get({ url: "/ready", ...options });
1750
1746
  var scrapeWebpage = (options) => (options.client ?? client).post({
@@ -2111,6 +2107,11 @@ function createResources(client2, getApiKey) {
2111
2107
  const response = await sessionProfilePreview({ client: client2, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { "session_id": sessionId }, query });
2112
2108
  return response.data;
2113
2109
  },
2110
+ /** sessionProfileSave: /sessions/{session_id}/profile/save. Returns the API response body. */
2111
+ profileSave: async (sessionId, body, requestOptions = {}) => {
2112
+ const response = await sessionProfileSave({ client: client2, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { "session_id": sessionId }, body });
2113
+ return response.data;
2114
+ },
2114
2115
  /** sessionReplay: /sessions/{session_id}/replay. Returns the API response body. */
2115
2116
  replay: async (sessionId, requestOptions = {}) => {
2116
2117
  const response = await sessionReplay({ client: client2, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { "session_id": sessionId } });
@@ -3406,6 +3407,44 @@ var Session = class {
3406
3407
  return response.data.cookies;
3407
3408
  }
3408
3409
  // #######################################################################
3410
+ // ############################# Profiles ################################
3411
+ // #######################################################################
3412
+ /**
3413
+ * Save the session's current browser state (cookies, localStorage, sessionStorage) into a
3414
+ * profile, without stopping the session.
3415
+ *
3416
+ * Pass `profile_id` to overwrite an existing profile or `name` to create a new one. With
3417
+ * neither, the state is saved into the profile the session was started with. The session's
3418
+ * start-time profile settings are not changed, so a session started with `persist: true`
3419
+ * still saves again when it stops.
3420
+ *
3421
+ * @example
3422
+ * const profile = await session.saveProfile({ name: 'github' });
3423
+ * // later: client.Session({ profile: { id: profile.profile_id } })
3424
+ */
3425
+ async saveProfile(options = {}) {
3426
+ const { profile_id, name } = options;
3427
+ if (profile_id !== void 0 && name !== void 0) {
3428
+ throw new Error("profile_id and name are mutually exclusive");
3429
+ }
3430
+ if (profile_id !== void 0 && profile_id.trim() === "") {
3431
+ throw new Error("profile_id must not be empty");
3432
+ }
3433
+ if (name !== void 0 && name.trim() === "") {
3434
+ throw new Error("name must not be empty");
3435
+ }
3436
+ const body = {};
3437
+ if (profile_id !== void 0) body.profile_id = profile_id;
3438
+ if (name !== void 0) body.name = name;
3439
+ const response = await sessionProfileSave({
3440
+ client: this.client.getClient(),
3441
+ path: { session_id: this.requireSessionId() },
3442
+ body,
3443
+ throwOnError: true
3444
+ });
3445
+ return response.data;
3446
+ }
3447
+ // #######################################################################
3409
3448
  // ############################# Debug / CDP #############################
3410
3449
  // #######################################################################
3411
3450
  /** Detailed debug information for the session (debug URL, websocket URLs, tabs). */
@@ -3482,7 +3521,9 @@ var Session = class {
3482
3521
  try {
3483
3522
  if (!this.playwrightBrowser) {
3484
3523
  const cdpUrl = await this.cdpUrl();
3485
- this.playwrightBrowser = await playwright.chromium.connectOverCDP(cdpUrl);
3524
+ this.playwrightBrowser = this.options.cdp_url ? await playwright.chromium.connectOverCDP(cdpUrl) : await playwright.chromium.connectOverCDP(cdpUrl, {
3525
+ headers: { "x-notte-request-origin": REQUEST_ORIGIN, "x-notte-sdk-version": SDK_VERSION }
3526
+ });
3486
3527
  installServerOwnedDialogPolicy(this.playwrightBrowser);
3487
3528
  }
3488
3529
  const page = this.playwrightBrowser.contexts()[0]?.pages()[0];
@@ -6520,11 +6561,11 @@ var createClient2 = (config) => {
6520
6561
  getUsage,
6521
6562
  getUsageLogs,
6522
6563
  healthCheck,
6523
- improvePrompt,
6524
6564
  installServerOwnedDialogPolicy,
6525
6565
  isCaptchaSolveAction,
6526
6566
  isValidMfaSecret,
6527
6567
  listAgents,
6568
+ listAuditEvents,
6528
6569
  listFunctionRunsByFunctionId,
6529
6570
  listFunctions,
6530
6571
  listPersonas,
@@ -6539,7 +6580,6 @@ var createClient2 = (config) => {
6539
6580
  mailboxSync,
6540
6581
  mailboxUpdate,
6541
6582
  managedAuthConnectLinkCreate,
6542
- nudgePrompt,
6543
6583
  observeServerOwnedDialog,
6544
6584
  pageExecute,
6545
6585
  pageObserve,
@@ -6577,6 +6617,7 @@ var createClient2 = (config) => {
6577
6617
  sessionNetworkLogs,
6578
6618
  sessionOffset,
6579
6619
  sessionProfilePreview,
6620
+ sessionProfileSave,
6580
6621
  sessionReplay,
6581
6622
  sessionStart,
6582
6623
  sessionStatus,