notte-sdk 1.10.0 → 1.10.2

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.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  // src/version.ts
2
- var SDK_VERSION = true ? "1.10.0" : "dev";
2
+ var SDK_VERSION = true ? "1.10.2" : "dev";
3
3
  var SDK_PACKAGE_NAME = true ? "notte-sdk" : "notte-sdk";
4
4
 
5
5
  // src/version-check.ts
@@ -1148,6 +1148,15 @@ var functionRollback = (options) => (options.client ?? client).post({
1148
1148
  ...options.headers
1149
1149
  }
1150
1150
  });
1151
+ var functionConditionalRollback = (options) => (options.client ?? client).post({
1152
+ security: [{ scheme: "bearer", type: "http" }],
1153
+ url: "/functions/{function_id}/rollback/conditional",
1154
+ ...options,
1155
+ headers: {
1156
+ "Content-Type": "application/json",
1157
+ ...options.headers
1158
+ }
1159
+ });
1151
1160
  var functionScheduleDelete = (options) => (options.client ?? client).delete({
1152
1161
  security: [{ scheme: "bearer", type: "http" }],
1153
1162
  url: "/functions/{function_id}/schedule",
@@ -2008,6 +2017,7 @@ var NotteManagedAuth = class {
2008
2017
  constructor(client2) {
2009
2018
  this.client = client2;
2010
2019
  }
2020
+ client;
2011
2021
  /** Run only the verifier; this does not submit login credentials. */
2012
2022
  async checkConnection(connectionId) {
2013
2023
  const response = await this.client.getClient().post({
@@ -2171,6 +2181,9 @@ function createResources(client2, getApiKey) {
2171
2181
  },
2172
2182
  /** sessionStart: /sessions/start. Returns the API response body. */
2173
2183
  start: async (body, requestOptions = {}) => {
2184
+ body = { ...body };
2185
+ if (body.record_session === true) delete body.record_session;
2186
+ if (body.log_session === true) delete body.log_session;
2174
2187
  const response = await sessionStart({ client: client2, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, body });
2175
2188
  return response.data;
2176
2189
  },
@@ -3127,7 +3140,7 @@ var CLUSTER_OVERLOAD_RETRY_DELAY_MS = 3e4;
3127
3140
  var CAPTCHA_SOLVE_TIMEOUT_MS = 1e5;
3128
3141
  var OBSERVE_MIGRATION_URL = "https://docs.notte.cc/features/sessions/observe-migration";
3129
3142
  var OBSERVE_DEPRECATIONS = {
3130
- instructions: `\`observe({ instructions })\` is deprecated and will be removed on December 1, 2026; <<ALTERNATIVE FOR instructions: session.act() \u2014 pending>>. See ${OBSERVE_MIGRATION_URL}`,
3143
+ 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}`,
3131
3144
  deep: `\`perception_type: 'deep'\` is deprecated and will be removed on December 1, 2026; use \`perception_type: 'fast'\` (the default). See ${OBSERVE_MIGRATION_URL}`
3132
3145
  };
3133
3146
  function observeServerOwnedDialog(_dialog) {
@@ -3212,6 +3225,8 @@ var Session = class {
3212
3225
  ...auth_retry !== void 0 ? { auth_retry } : {},
3213
3226
  ...request.auth_ids?.length ? { wait_for_authentication: false } : {}
3214
3227
  };
3228
+ if (body.record_session === true) delete body.record_session;
3229
+ if (body.log_session === true) delete body.log_session;
3215
3230
  const shouldWait = options.wait_for_authentication ?? wait_for_authentication ?? true;
3216
3231
  const maxRetries = this.client.getConfig().maxRetries ?? 0;
3217
3232
  const timeoutMs = this.client.getConfig().timeoutMs ?? DEFAULT_REQUEST_TIMEOUT_MS;
@@ -3513,7 +3528,11 @@ var Session = class {
3513
3528
  if (!(error instanceof NotteAPIError) || error.statusCode !== 404) {
3514
3529
  throw error;
3515
3530
  }
3516
- if (this.isActive && (error.apiMessage ?? "").includes("still active")) {
3531
+ const waitingForClose = error.error.replay_status === "waiting_for_session";
3532
+ if (error.error.replay_status === "disabled" || error.error.retryable === false && !waitingForClose) {
3533
+ throw error;
3534
+ }
3535
+ if (this.isActive && this.sessionId === sessionId && (waitingForClose || (error.apiMessage ?? "").includes("still active"))) {
3517
3536
  throw new Error(`Session ${sessionId} is still active \u2014 close the session first to generate the replay.`, {
3518
3537
  cause: error
3519
3538
  });
@@ -3837,7 +3856,9 @@ var Session = class {
3837
3856
  * Deprecated: `perception_type: 'deep'` and `instructions` are removed on
3838
3857
  * December 1, 2026, and each warns once per session. Use `perception_type:
3839
3858
  * 'fast'` (the default) instead of `'deep'`. For `instructions`:
3840
- * `<<ALTERNATIVE FOR instructions: session.act() — pending>>`. See https://docs.notte.cc/features/sessions/observe-migration
3859
+ * the Python SDK's local sessions replace it with `session.act()`; here, call
3860
+ * `observe()` without it and pick from the returned actions. See
3861
+ * https://docs.notte.cc/features/sessions/observe-migration
3841
3862
  *
3842
3863
  * @param options - Observation settings, including an optional URL, or a perception-mode string.
3843
3864
  * @returns Structured page analysis, available actions, and page metadata.
@@ -5322,6 +5343,8 @@ var SessionFiles = class {
5322
5343
  this.client = client2;
5323
5344
  this.sessionId = sessionId;
5324
5345
  }
5346
+ client;
5347
+ sessionId;
5325
5348
  /**
5326
5349
  * Upload bytes as a session file. `filename` is what the browser sees when
5327
5350
  * the file is later attached to a page.
@@ -5426,6 +5449,7 @@ var RemoteFileStorage = class _RemoteFileStorage {
5426
5449
  this.client = client2;
5427
5450
  this._sessionId = sessionId ?? null;
5428
5451
  }
5452
+ client;
5429
5453
  _sessionId;
5430
5454
  /** Bind the storage to a session. Called by `Session.start()` when the storage was passed to the session. */
5431
5455
  setSessionId(sessionId) {
@@ -6354,6 +6378,7 @@ export {
6354
6378
  executeSessionFile,
6355
6379
  extractProductEndpoint,
6356
6380
  fetchSpecializedData,
6381
+ functionConditionalRollback,
6357
6382
  functionCreate,
6358
6383
  functionDelete,
6359
6384
  functionDownloadUrl,