notte-sdk 0.0.20 → 0.0.22

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
@@ -6,7 +6,7 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
6
6
  });
7
7
 
8
8
  // src/version.ts
9
- var SDK_VERSION = true ? "0.0.20" : "dev";
9
+ var SDK_VERSION = true ? "0.0.22" : "dev";
10
10
  var SDK_PACKAGE_NAME = true ? "notte-sdk" : "notte-sdk";
11
11
 
12
12
  // src/version-check.ts
@@ -1014,6 +1014,31 @@ var sessionReplay = (options) => (options.client ?? client).get({
1014
1014
  url: "/sessions/{session_id}/replay",
1015
1015
  ...options
1016
1016
  });
1017
+ var listSessionFiles = (options) => (options.client ?? client).get({
1018
+ security: [{ scheme: "bearer", type: "http" }],
1019
+ url: "/sessions/{session_id}/files",
1020
+ ...options
1021
+ });
1022
+ var uploadSessionFile = (options) => (options.client ?? client).post({
1023
+ ...formDataBodySerializer,
1024
+ security: [{ scheme: "bearer", type: "http" }],
1025
+ url: "/sessions/{session_id}/files",
1026
+ ...options,
1027
+ headers: {
1028
+ "Content-Type": null,
1029
+ ...options.headers
1030
+ }
1031
+ });
1032
+ var deleteSessionFile = (options) => (options.client ?? client).delete({
1033
+ security: [{ scheme: "bearer", type: "http" }],
1034
+ url: "/sessions/{session_id}/files/{file_id}",
1035
+ ...options
1036
+ });
1037
+ var downloadSessionFile = (options) => (options.client ?? client).get({
1038
+ security: [{ scheme: "bearer", type: "http" }],
1039
+ url: "/sessions/{session_id}/files/{file_id}",
1040
+ ...options
1041
+ });
1017
1042
  var agentStart = (options) => (options.client ?? client).post({
1018
1043
  security: [{ scheme: "bearer", type: "http" }],
1019
1044
  url: "/agents/start",
@@ -1043,6 +1068,11 @@ var listAgents = (options) => (options?.client ?? client).get({
1043
1068
  url: "/agents",
1044
1069
  ...options
1045
1070
  });
1071
+ var functionRuntimeHealth = (options) => (options?.client ?? client).get({
1072
+ security: [{ scheme: "bearer", type: "http" }],
1073
+ url: "/functions/health",
1074
+ ...options
1075
+ });
1046
1076
  var listFunctions = (options) => (options?.client ?? client).get({
1047
1077
  security: [{ scheme: "bearer", type: "http" }],
1048
1078
  url: "/functions",
@@ -1092,6 +1122,15 @@ var functionFork = (options) => (options.client ?? client).post({
1092
1122
  url: "/functions/{function_id}/fork",
1093
1123
  ...options
1094
1124
  });
1125
+ var functionRollback = (options) => (options.client ?? client).post({
1126
+ security: [{ scheme: "bearer", type: "http" }],
1127
+ url: "/functions/{function_id}/rollback",
1128
+ ...options,
1129
+ headers: {
1130
+ "Content-Type": "application/json",
1131
+ ...options.headers
1132
+ }
1133
+ });
1095
1134
  var functionScheduleDelete = (options) => (options.client ?? client).delete({
1096
1135
  security: [{ scheme: "bearer", type: "http" }],
1097
1136
  url: "/functions/{function_id}/schedule",
@@ -1342,70 +1381,66 @@ var mailboxUpdate = (options) => (options.client ?? client).patch({
1342
1381
  ...options.headers
1343
1382
  }
1344
1383
  });
1345
- var improvePrompt = (options) => (options.client ?? client).post({
1346
- url: "/prompts/improve",
1384
+ var managedAuthConnectLinkCreate = (options) => (options.client ?? client).post({
1385
+ security: [{ scheme: "bearer", type: "http" }],
1386
+ url: "/managed-auth/connect-links",
1347
1387
  ...options,
1348
1388
  headers: {
1349
1389
  "Content-Type": "application/json",
1350
1390
  ...options.headers
1351
1391
  }
1352
1392
  });
1353
- var nudgePrompt = (options) => (options.client ?? client).post({
1354
- url: "/prompts/nudge",
1393
+ var connectLinkContext = (options) => (options.client ?? client).post({ url: "/managed-auth/connect-links/context", ...options });
1394
+ var connectLinkMailboxes = (options) => (options.client ?? client).post({ url: "/managed-auth/connect-links/mailboxes", ...options });
1395
+ var connectLinkMailboxConnect = (options) => (options.client ?? client).post({
1396
+ url: "/managed-auth/connect-links/mailboxes/connect",
1355
1397
  ...options,
1356
1398
  headers: {
1357
1399
  "Content-Type": "application/json",
1358
1400
  ...options.headers
1359
1401
  }
1360
1402
  });
1361
- var getUsage = (options) => (options?.client ?? client).get({
1362
- security: [{ scheme: "bearer", type: "http" }],
1363
- url: "/usage",
1364
- ...options
1365
- });
1366
- var getUsageLogs = (options) => (options?.client ?? client).get({
1367
- security: [{ scheme: "bearer", type: "http" }],
1368
- url: "/usage/logs",
1369
- ...options
1370
- });
1371
- var fileDownload = (options) => (options.client ?? client).get({
1372
- security: [{ scheme: "bearer", type: "http" }],
1373
- url: "/storage/{session_id}/downloads/{filename}",
1374
- ...options
1375
- });
1376
- var fileUploadDownloadedFile = (options) => (options.client ?? client).post({
1377
- ...formDataBodySerializer,
1378
- security: [{ scheme: "bearer", type: "http" }],
1379
- url: "/storage/{session_id}/downloads/{filename}",
1403
+ var connectLinkMailboxSync = (options) => (options.client ?? client).post({
1404
+ url: "/managed-auth/connect-links/mailboxes/sync",
1380
1405
  ...options,
1381
1406
  headers: {
1382
- "Content-Type": null,
1407
+ "Content-Type": "application/json",
1383
1408
  ...options.headers
1384
1409
  }
1385
1410
  });
1386
- var fileListDownloads = (options) => (options.client ?? client).get({
1387
- security: [{ scheme: "bearer", type: "http" }],
1388
- url: "/storage/{session_id}/downloads",
1389
- ...options
1411
+ var connectLinkSubmit = (options) => (options.client ?? client).post({
1412
+ url: "/managed-auth/connect-links/submit",
1413
+ ...options,
1414
+ headers: {
1415
+ "Content-Type": "application/json",
1416
+ ...options.headers
1417
+ }
1390
1418
  });
1391
- var fileDownloadUploadedFile = (options) => (options.client ?? client).get({
1392
- security: [{ scheme: "bearer", type: "http" }],
1393
- url: "/storage/uploads/{filename}",
1394
- ...options
1419
+ var connectLinkStatus = (options) => (options.client ?? client).get({ url: "/managed-auth/connect-links/status", ...options });
1420
+ var improvePrompt = (options) => (options.client ?? client).post({
1421
+ url: "/prompts/improve",
1422
+ ...options,
1423
+ headers: {
1424
+ "Content-Type": "application/json",
1425
+ ...options.headers
1426
+ }
1395
1427
  });
1396
- var fileUpload = (options) => (options.client ?? client).post({
1397
- ...formDataBodySerializer,
1398
- security: [{ scheme: "bearer", type: "http" }],
1399
- url: "/storage/uploads/{filename}",
1428
+ var nudgePrompt = (options) => (options.client ?? client).post({
1429
+ url: "/prompts/nudge",
1400
1430
  ...options,
1401
1431
  headers: {
1402
- "Content-Type": null,
1432
+ "Content-Type": "application/json",
1403
1433
  ...options.headers
1404
1434
  }
1405
1435
  });
1406
- var fileListUploads = (options) => (options?.client ?? client).get({
1436
+ var getUsage = (options) => (options?.client ?? client).get({
1437
+ security: [{ scheme: "bearer", type: "http" }],
1438
+ url: "/usage",
1439
+ ...options
1440
+ });
1441
+ var getUsageLogs = (options) => (options?.client ?? client).get({
1407
1442
  security: [{ scheme: "bearer", type: "http" }],
1408
- url: "/storage/uploads",
1443
+ url: "/usage/logs",
1409
1444
  ...options
1410
1445
  });
1411
1446
  var anythingStart = (options) => (options.client ?? client).post({
@@ -1441,6 +1476,15 @@ var deleteSecret = (options) => (options.client ?? client).delete({
1441
1476
  url: "/secrets/{secret_id}",
1442
1477
  ...options
1443
1478
  });
1479
+ var mintProxyCredentials = (options) => (options.client ?? client).post({
1480
+ security: [{ scheme: "bearer", type: "http" }],
1481
+ url: "/proxies/gateway/credentials",
1482
+ ...options,
1483
+ headers: {
1484
+ "Content-Type": "application/json",
1485
+ ...options.headers
1486
+ }
1487
+ });
1444
1488
  var healthCheck = (options) => (options?.client ?? client).get({ url: "/health", ...options });
1445
1489
  var readyCheck = (options) => (options?.client ?? client).get({ url: "/ready", ...options });
1446
1490
  var scrapeWebpage = (options) => (options.client ?? client).post({
@@ -2642,6 +2686,18 @@ var NottePersona = class {
2642
2686
  }
2643
2687
  return this.response.persona_id;
2644
2688
  }
2689
+ /**
2690
+ * Public, human-readable email address of the persona
2691
+ */
2692
+ get email() {
2693
+ return this.info.email;
2694
+ }
2695
+ /**
2696
+ * Internal UUID-backed mailbox address of the persona
2697
+ */
2698
+ get internalEmail() {
2699
+ return this.info.internal_email;
2700
+ }
2645
2701
  /**
2646
2702
  * Start the persona - ensures initialization
2647
2703
  */
@@ -2857,10 +2913,52 @@ var NotteFunction = class {
2857
2913
  throw new Error(`Failed to get function run metadata: ${error instanceof Error ? error.message : String(error)}`);
2858
2914
  }
2859
2915
  }
2916
+ /**
2917
+ * List the runs of this function.
2918
+ *
2919
+ * `only_active` is sent as `false` unless the caller says otherwise, and that
2920
+ * is deliberate rather than redundant. `GET /functions/{function_id}/runs`
2921
+ * now defaults it to `false` server-side as well, but it used to default to
2922
+ * `true`: the request model was a bare subclass of the session one, where
2923
+ * "only active" reads sensibly as "list my running sessions" and, for "list
2924
+ * this function's runs", was a trap. Hitting the endpoint with no query
2925
+ * parameters returned only the runs executing right now - an empty list for
2926
+ * any function that had finished. That cost us a bug in the anything-api
2927
+ * console, where a function with 15 recorded runs displayed "Nothing has run
2928
+ * this endpoint yet".
2929
+ *
2930
+ * Sending it explicitly pins this method to the documented behaviour against
2931
+ * whichever API version it is talking to, including deployments that predate
2932
+ * the server-side change. Callers who want only in-flight runs pass
2933
+ * `only_active: true`.
2934
+ */
2935
+ async runs(options = {}) {
2936
+ try {
2937
+ const response = await listFunctionRunsByFunctionId({
2938
+ client: this.client.getClient(),
2939
+ path: {
2940
+ function_id: this.functionId
2941
+ },
2942
+ query: {
2943
+ ...options,
2944
+ only_active: options.only_active ?? false
2945
+ }
2946
+ });
2947
+ if (response?.error) {
2948
+ throw new Error(`Failed to list function runs: ${formatError(response.error)}`);
2949
+ }
2950
+ return response.data;
2951
+ } catch (error) {
2952
+ if (error instanceof Error && error.message.startsWith("Failed to list function runs:")) {
2953
+ throw error;
2954
+ }
2955
+ throw new Error(`Failed to list function runs: ${error instanceof Error ? error.message : String(error)}`);
2956
+ }
2957
+ }
2860
2958
  /**
2861
2959
  * Start a function run
2862
2960
  */
2863
- async run(variables = {}) {
2961
+ async run(variables = {}, options = {}) {
2864
2962
  const apiKey = this.client.getConfig().apiKey || "";
2865
2963
  if (!apiKey) {
2866
2964
  throw new Error("API key is required. Provide it via config.apiKey or set the NOTTE_API_KEY environment variable.");
@@ -2879,7 +2977,8 @@ var NotteFunction = class {
2879
2977
  body: {
2880
2978
  workflow_id: this.functionId,
2881
2979
  variables,
2882
- stream: false
2980
+ stream: false,
2981
+ ...options.runtime ? { runtime: options.runtime } : {}
2883
2982
  }
2884
2983
  });
2885
2984
  if (response?.error) {
@@ -2972,6 +3071,53 @@ function isHttpUrl(value) {
2972
3071
 
2973
3072
  // src/client.ts
2974
3073
  import { z as z3 } from "zod";
3074
+
3075
+ // src/files.ts
3076
+ var SessionFiles = class {
3077
+ constructor(client2, sessionId) {
3078
+ this.client = client2;
3079
+ this.sessionId = sessionId;
3080
+ }
3081
+ path(fileId) {
3082
+ const root = `/sessions/${encodeURIComponent(this.sessionId)}/files`;
3083
+ return fileId ? `${root}/${encodeURIComponent(fileId)}` : root;
3084
+ }
3085
+ async upload(file, filename = "file") {
3086
+ const body = new FormData();
3087
+ body.append("file", file, filename);
3088
+ const result = await this.client.request({
3089
+ method: "POST",
3090
+ url: this.path(),
3091
+ body
3092
+ });
3093
+ if (result.error || !result.data) throw new Error("Failed to upload session file");
3094
+ return result.data;
3095
+ }
3096
+ async list(options = {}) {
3097
+ const result = await this.client.request({
3098
+ method: "GET",
3099
+ url: this.path(),
3100
+ query: { limit: options.limit ?? 100, offset: options.offset ?? 0, source: options.source }
3101
+ });
3102
+ if (result.error || !result.data) throw new Error("Failed to list session files");
3103
+ return result.data;
3104
+ }
3105
+ async download(fileId) {
3106
+ const result = await this.client.request({
3107
+ method: "GET",
3108
+ url: this.path(fileId),
3109
+ parseAs: "blob"
3110
+ });
3111
+ if (result.error || !result.data) throw new Error(`Failed to download session file ${fileId}`);
3112
+ return result.data;
3113
+ }
3114
+ async delete(fileId) {
3115
+ const result = await this.client.request({ method: "DELETE", url: this.path(fileId) });
3116
+ if (result.error) throw new Error(`Failed to delete session file ${fileId}`);
3117
+ }
3118
+ };
3119
+
3120
+ // src/client.ts
2975
3121
  var NotteClient = class {
2976
3122
  constructor(config = {}) {
2977
3123
  const apiKey = config.apiKey || process.env.NOTTE_API_KEY;
@@ -3028,6 +3174,10 @@ var NotteClient = class {
3028
3174
  Session(options = {}) {
3029
3175
  return new Session(this, options);
3030
3176
  }
3177
+ /** Access files owned by a specific session, including closed sessions. */
3178
+ Files(sessionId) {
3179
+ return new SessionFiles(this.getClient(), sessionId);
3180
+ }
3031
3181
  /**
3032
3182
  * Create a new agent
3033
3183
  */
@@ -3148,29 +3298,34 @@ export {
3148
3298
  NotteProxyAuthError,
3149
3299
  NotteVault,
3150
3300
  Session,
3301
+ SessionFiles,
3151
3302
  agentStart,
3152
3303
  agentStatus,
3153
3304
  agentStop,
3154
3305
  anythingStart,
3155
3306
  client,
3307
+ connectLinkContext,
3308
+ connectLinkMailboxConnect,
3309
+ connectLinkMailboxSync,
3310
+ connectLinkMailboxes,
3311
+ connectLinkStatus,
3312
+ connectLinkSubmit,
3156
3313
  createClient2 as createClient,
3157
3314
  NotteClient as default,
3158
3315
  deleteSecret,
3159
- fileDownload,
3160
- fileDownloadUploadedFile,
3161
- fileListDownloads,
3162
- fileListUploads,
3163
- fileUpload,
3164
- fileUploadDownloadedFile,
3316
+ deleteSessionFile,
3317
+ downloadSessionFile,
3165
3318
  functionCreate,
3166
3319
  functionDelete,
3167
3320
  functionDownloadUrl,
3168
3321
  functionFork,
3169
3322
  functionMetadataUpdate,
3323
+ functionRollback,
3170
3324
  functionRunGetMetadata,
3171
3325
  functionRunStart,
3172
3326
  functionRunStop,
3173
3327
  functionRunUpdateMetadata,
3328
+ functionRuntimeHealth,
3174
3329
  functionScheduleDelete,
3175
3330
  functionScheduleSet,
3176
3331
  functionUpdate,
@@ -3186,6 +3341,7 @@ export {
3186
3341
  listFunctions,
3187
3342
  listPersonas,
3188
3343
  listSecrets,
3344
+ listSessionFiles,
3189
3345
  listSessions,
3190
3346
  listVaults,
3191
3347
  mailboxConnectToken,
@@ -3194,6 +3350,8 @@ export {
3194
3350
  mailboxList,
3195
3351
  mailboxSync,
3196
3352
  mailboxUpdate,
3353
+ managedAuthConnectLinkCreate,
3354
+ mintProxyCredentials,
3197
3355
  nudgePrompt,
3198
3356
  pageExecute,
3199
3357
  pageObserve,
@@ -3226,6 +3384,7 @@ export {
3226
3384
  sessionStatus,
3227
3385
  sessionStop,
3228
3386
  storeSecret,
3387
+ uploadSessionFile,
3229
3388
  vaultCreate,
3230
3389
  vaultCredentialsAdd,
3231
3390
  vaultCredentialsDelete,