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.js CHANGED
@@ -38,29 +38,34 @@ __export(index_exports, {
38
38
  NotteProxyAuthError: () => NotteProxyAuthError,
39
39
  NotteVault: () => NotteVault,
40
40
  Session: () => Session,
41
+ SessionFiles: () => SessionFiles,
41
42
  agentStart: () => agentStart,
42
43
  agentStatus: () => agentStatus,
43
44
  agentStop: () => agentStop,
44
45
  anythingStart: () => anythingStart,
45
46
  client: () => client,
47
+ connectLinkContext: () => connectLinkContext,
48
+ connectLinkMailboxConnect: () => connectLinkMailboxConnect,
49
+ connectLinkMailboxSync: () => connectLinkMailboxSync,
50
+ connectLinkMailboxes: () => connectLinkMailboxes,
51
+ connectLinkStatus: () => connectLinkStatus,
52
+ connectLinkSubmit: () => connectLinkSubmit,
46
53
  createClient: () => createClient2,
47
54
  default: () => NotteClient,
48
55
  deleteSecret: () => deleteSecret,
49
- fileDownload: () => fileDownload,
50
- fileDownloadUploadedFile: () => fileDownloadUploadedFile,
51
- fileListDownloads: () => fileListDownloads,
52
- fileListUploads: () => fileListUploads,
53
- fileUpload: () => fileUpload,
54
- fileUploadDownloadedFile: () => fileUploadDownloadedFile,
56
+ deleteSessionFile: () => deleteSessionFile,
57
+ downloadSessionFile: () => downloadSessionFile,
55
58
  functionCreate: () => functionCreate,
56
59
  functionDelete: () => functionDelete,
57
60
  functionDownloadUrl: () => functionDownloadUrl,
58
61
  functionFork: () => functionFork,
59
62
  functionMetadataUpdate: () => functionMetadataUpdate,
63
+ functionRollback: () => functionRollback,
60
64
  functionRunGetMetadata: () => functionRunGetMetadata,
61
65
  functionRunStart: () => functionRunStart,
62
66
  functionRunStop: () => functionRunStop,
63
67
  functionRunUpdateMetadata: () => functionRunUpdateMetadata,
68
+ functionRuntimeHealth: () => functionRuntimeHealth,
64
69
  functionScheduleDelete: () => functionScheduleDelete,
65
70
  functionScheduleSet: () => functionScheduleSet,
66
71
  functionUpdate: () => functionUpdate,
@@ -76,6 +81,7 @@ __export(index_exports, {
76
81
  listFunctions: () => listFunctions,
77
82
  listPersonas: () => listPersonas,
78
83
  listSecrets: () => listSecrets,
84
+ listSessionFiles: () => listSessionFiles,
79
85
  listSessions: () => listSessions,
80
86
  listVaults: () => listVaults,
81
87
  mailboxConnectToken: () => mailboxConnectToken,
@@ -84,6 +90,8 @@ __export(index_exports, {
84
90
  mailboxList: () => mailboxList,
85
91
  mailboxSync: () => mailboxSync,
86
92
  mailboxUpdate: () => mailboxUpdate,
93
+ managedAuthConnectLinkCreate: () => managedAuthConnectLinkCreate,
94
+ mintProxyCredentials: () => mintProxyCredentials,
87
95
  nudgePrompt: () => nudgePrompt,
88
96
  pageExecute: () => pageExecute,
89
97
  pageObserve: () => pageObserve,
@@ -116,6 +124,7 @@ __export(index_exports, {
116
124
  sessionStatus: () => sessionStatus,
117
125
  sessionStop: () => sessionStop,
118
126
  storeSecret: () => storeSecret,
127
+ uploadSessionFile: () => uploadSessionFile,
119
128
  vaultCreate: () => vaultCreate,
120
129
  vaultCredentialsAdd: () => vaultCredentialsAdd,
121
130
  vaultCredentialsDelete: () => vaultCredentialsDelete,
@@ -130,7 +139,7 @@ __export(index_exports, {
130
139
  module.exports = __toCommonJS(index_exports);
131
140
 
132
141
  // src/version.ts
133
- var SDK_VERSION = true ? "0.0.20" : "dev";
142
+ var SDK_VERSION = true ? "0.0.22" : "dev";
134
143
  var SDK_PACKAGE_NAME = true ? "notte-sdk" : "notte-sdk";
135
144
 
136
145
  // src/version-check.ts
@@ -1138,6 +1147,31 @@ var sessionReplay = (options) => (options.client ?? client).get({
1138
1147
  url: "/sessions/{session_id}/replay",
1139
1148
  ...options
1140
1149
  });
1150
+ var listSessionFiles = (options) => (options.client ?? client).get({
1151
+ security: [{ scheme: "bearer", type: "http" }],
1152
+ url: "/sessions/{session_id}/files",
1153
+ ...options
1154
+ });
1155
+ var uploadSessionFile = (options) => (options.client ?? client).post({
1156
+ ...formDataBodySerializer,
1157
+ security: [{ scheme: "bearer", type: "http" }],
1158
+ url: "/sessions/{session_id}/files",
1159
+ ...options,
1160
+ headers: {
1161
+ "Content-Type": null,
1162
+ ...options.headers
1163
+ }
1164
+ });
1165
+ var deleteSessionFile = (options) => (options.client ?? client).delete({
1166
+ security: [{ scheme: "bearer", type: "http" }],
1167
+ url: "/sessions/{session_id}/files/{file_id}",
1168
+ ...options
1169
+ });
1170
+ var downloadSessionFile = (options) => (options.client ?? client).get({
1171
+ security: [{ scheme: "bearer", type: "http" }],
1172
+ url: "/sessions/{session_id}/files/{file_id}",
1173
+ ...options
1174
+ });
1141
1175
  var agentStart = (options) => (options.client ?? client).post({
1142
1176
  security: [{ scheme: "bearer", type: "http" }],
1143
1177
  url: "/agents/start",
@@ -1167,6 +1201,11 @@ var listAgents = (options) => (options?.client ?? client).get({
1167
1201
  url: "/agents",
1168
1202
  ...options
1169
1203
  });
1204
+ var functionRuntimeHealth = (options) => (options?.client ?? client).get({
1205
+ security: [{ scheme: "bearer", type: "http" }],
1206
+ url: "/functions/health",
1207
+ ...options
1208
+ });
1170
1209
  var listFunctions = (options) => (options?.client ?? client).get({
1171
1210
  security: [{ scheme: "bearer", type: "http" }],
1172
1211
  url: "/functions",
@@ -1216,6 +1255,15 @@ var functionFork = (options) => (options.client ?? client).post({
1216
1255
  url: "/functions/{function_id}/fork",
1217
1256
  ...options
1218
1257
  });
1258
+ var functionRollback = (options) => (options.client ?? client).post({
1259
+ security: [{ scheme: "bearer", type: "http" }],
1260
+ url: "/functions/{function_id}/rollback",
1261
+ ...options,
1262
+ headers: {
1263
+ "Content-Type": "application/json",
1264
+ ...options.headers
1265
+ }
1266
+ });
1219
1267
  var functionScheduleDelete = (options) => (options.client ?? client).delete({
1220
1268
  security: [{ scheme: "bearer", type: "http" }],
1221
1269
  url: "/functions/{function_id}/schedule",
@@ -1466,70 +1514,66 @@ var mailboxUpdate = (options) => (options.client ?? client).patch({
1466
1514
  ...options.headers
1467
1515
  }
1468
1516
  });
1469
- var improvePrompt = (options) => (options.client ?? client).post({
1470
- url: "/prompts/improve",
1517
+ var managedAuthConnectLinkCreate = (options) => (options.client ?? client).post({
1518
+ security: [{ scheme: "bearer", type: "http" }],
1519
+ url: "/managed-auth/connect-links",
1471
1520
  ...options,
1472
1521
  headers: {
1473
1522
  "Content-Type": "application/json",
1474
1523
  ...options.headers
1475
1524
  }
1476
1525
  });
1477
- var nudgePrompt = (options) => (options.client ?? client).post({
1478
- url: "/prompts/nudge",
1526
+ var connectLinkContext = (options) => (options.client ?? client).post({ url: "/managed-auth/connect-links/context", ...options });
1527
+ var connectLinkMailboxes = (options) => (options.client ?? client).post({ url: "/managed-auth/connect-links/mailboxes", ...options });
1528
+ var connectLinkMailboxConnect = (options) => (options.client ?? client).post({
1529
+ url: "/managed-auth/connect-links/mailboxes/connect",
1479
1530
  ...options,
1480
1531
  headers: {
1481
1532
  "Content-Type": "application/json",
1482
1533
  ...options.headers
1483
1534
  }
1484
1535
  });
1485
- var getUsage = (options) => (options?.client ?? client).get({
1486
- security: [{ scheme: "bearer", type: "http" }],
1487
- url: "/usage",
1488
- ...options
1489
- });
1490
- var getUsageLogs = (options) => (options?.client ?? client).get({
1491
- security: [{ scheme: "bearer", type: "http" }],
1492
- url: "/usage/logs",
1493
- ...options
1494
- });
1495
- var fileDownload = (options) => (options.client ?? client).get({
1496
- security: [{ scheme: "bearer", type: "http" }],
1497
- url: "/storage/{session_id}/downloads/{filename}",
1498
- ...options
1499
- });
1500
- var fileUploadDownloadedFile = (options) => (options.client ?? client).post({
1501
- ...formDataBodySerializer,
1502
- security: [{ scheme: "bearer", type: "http" }],
1503
- url: "/storage/{session_id}/downloads/{filename}",
1536
+ var connectLinkMailboxSync = (options) => (options.client ?? client).post({
1537
+ url: "/managed-auth/connect-links/mailboxes/sync",
1504
1538
  ...options,
1505
1539
  headers: {
1506
- "Content-Type": null,
1540
+ "Content-Type": "application/json",
1507
1541
  ...options.headers
1508
1542
  }
1509
1543
  });
1510
- var fileListDownloads = (options) => (options.client ?? client).get({
1511
- security: [{ scheme: "bearer", type: "http" }],
1512
- url: "/storage/{session_id}/downloads",
1513
- ...options
1544
+ var connectLinkSubmit = (options) => (options.client ?? client).post({
1545
+ url: "/managed-auth/connect-links/submit",
1546
+ ...options,
1547
+ headers: {
1548
+ "Content-Type": "application/json",
1549
+ ...options.headers
1550
+ }
1514
1551
  });
1515
- var fileDownloadUploadedFile = (options) => (options.client ?? client).get({
1516
- security: [{ scheme: "bearer", type: "http" }],
1517
- url: "/storage/uploads/{filename}",
1518
- ...options
1552
+ var connectLinkStatus = (options) => (options.client ?? client).get({ url: "/managed-auth/connect-links/status", ...options });
1553
+ var improvePrompt = (options) => (options.client ?? client).post({
1554
+ url: "/prompts/improve",
1555
+ ...options,
1556
+ headers: {
1557
+ "Content-Type": "application/json",
1558
+ ...options.headers
1559
+ }
1519
1560
  });
1520
- var fileUpload = (options) => (options.client ?? client).post({
1521
- ...formDataBodySerializer,
1522
- security: [{ scheme: "bearer", type: "http" }],
1523
- url: "/storage/uploads/{filename}",
1561
+ var nudgePrompt = (options) => (options.client ?? client).post({
1562
+ url: "/prompts/nudge",
1524
1563
  ...options,
1525
1564
  headers: {
1526
- "Content-Type": null,
1565
+ "Content-Type": "application/json",
1527
1566
  ...options.headers
1528
1567
  }
1529
1568
  });
1530
- var fileListUploads = (options) => (options?.client ?? client).get({
1569
+ var getUsage = (options) => (options?.client ?? client).get({
1570
+ security: [{ scheme: "bearer", type: "http" }],
1571
+ url: "/usage",
1572
+ ...options
1573
+ });
1574
+ var getUsageLogs = (options) => (options?.client ?? client).get({
1531
1575
  security: [{ scheme: "bearer", type: "http" }],
1532
- url: "/storage/uploads",
1576
+ url: "/usage/logs",
1533
1577
  ...options
1534
1578
  });
1535
1579
  var anythingStart = (options) => (options.client ?? client).post({
@@ -1565,6 +1609,15 @@ var deleteSecret = (options) => (options.client ?? client).delete({
1565
1609
  url: "/secrets/{secret_id}",
1566
1610
  ...options
1567
1611
  });
1612
+ var mintProxyCredentials = (options) => (options.client ?? client).post({
1613
+ security: [{ scheme: "bearer", type: "http" }],
1614
+ url: "/proxies/gateway/credentials",
1615
+ ...options,
1616
+ headers: {
1617
+ "Content-Type": "application/json",
1618
+ ...options.headers
1619
+ }
1620
+ });
1568
1621
  var healthCheck = (options) => (options?.client ?? client).get({ url: "/health", ...options });
1569
1622
  var readyCheck = (options) => (options?.client ?? client).get({ url: "/ready", ...options });
1570
1623
  var scrapeWebpage = (options) => (options.client ?? client).post({
@@ -2766,6 +2819,18 @@ var NottePersona = class {
2766
2819
  }
2767
2820
  return this.response.persona_id;
2768
2821
  }
2822
+ /**
2823
+ * Public, human-readable email address of the persona
2824
+ */
2825
+ get email() {
2826
+ return this.info.email;
2827
+ }
2828
+ /**
2829
+ * Internal UUID-backed mailbox address of the persona
2830
+ */
2831
+ get internalEmail() {
2832
+ return this.info.internal_email;
2833
+ }
2769
2834
  /**
2770
2835
  * Start the persona - ensures initialization
2771
2836
  */
@@ -2981,10 +3046,52 @@ var NotteFunction = class {
2981
3046
  throw new Error(`Failed to get function run metadata: ${error instanceof Error ? error.message : String(error)}`);
2982
3047
  }
2983
3048
  }
3049
+ /**
3050
+ * List the runs of this function.
3051
+ *
3052
+ * `only_active` is sent as `false` unless the caller says otherwise, and that
3053
+ * is deliberate rather than redundant. `GET /functions/{function_id}/runs`
3054
+ * now defaults it to `false` server-side as well, but it used to default to
3055
+ * `true`: the request model was a bare subclass of the session one, where
3056
+ * "only active" reads sensibly as "list my running sessions" and, for "list
3057
+ * this function's runs", was a trap. Hitting the endpoint with no query
3058
+ * parameters returned only the runs executing right now - an empty list for
3059
+ * any function that had finished. That cost us a bug in the anything-api
3060
+ * console, where a function with 15 recorded runs displayed "Nothing has run
3061
+ * this endpoint yet".
3062
+ *
3063
+ * Sending it explicitly pins this method to the documented behaviour against
3064
+ * whichever API version it is talking to, including deployments that predate
3065
+ * the server-side change. Callers who want only in-flight runs pass
3066
+ * `only_active: true`.
3067
+ */
3068
+ async runs(options = {}) {
3069
+ try {
3070
+ const response = await listFunctionRunsByFunctionId({
3071
+ client: this.client.getClient(),
3072
+ path: {
3073
+ function_id: this.functionId
3074
+ },
3075
+ query: {
3076
+ ...options,
3077
+ only_active: options.only_active ?? false
3078
+ }
3079
+ });
3080
+ if (response?.error) {
3081
+ throw new Error(`Failed to list function runs: ${formatError(response.error)}`);
3082
+ }
3083
+ return response.data;
3084
+ } catch (error) {
3085
+ if (error instanceof Error && error.message.startsWith("Failed to list function runs:")) {
3086
+ throw error;
3087
+ }
3088
+ throw new Error(`Failed to list function runs: ${error instanceof Error ? error.message : String(error)}`);
3089
+ }
3090
+ }
2984
3091
  /**
2985
3092
  * Start a function run
2986
3093
  */
2987
- async run(variables = {}) {
3094
+ async run(variables = {}, options = {}) {
2988
3095
  const apiKey = this.client.getConfig().apiKey || "";
2989
3096
  if (!apiKey) {
2990
3097
  throw new Error("API key is required. Provide it via config.apiKey or set the NOTTE_API_KEY environment variable.");
@@ -3003,7 +3110,8 @@ var NotteFunction = class {
3003
3110
  body: {
3004
3111
  workflow_id: this.functionId,
3005
3112
  variables,
3006
- stream: false
3113
+ stream: false,
3114
+ ...options.runtime ? { runtime: options.runtime } : {}
3007
3115
  }
3008
3116
  });
3009
3117
  if (response?.error) {
@@ -3096,6 +3204,53 @@ function isHttpUrl(value) {
3096
3204
 
3097
3205
  // src/client.ts
3098
3206
  var import_zod3 = require("zod");
3207
+
3208
+ // src/files.ts
3209
+ var SessionFiles = class {
3210
+ constructor(client2, sessionId) {
3211
+ this.client = client2;
3212
+ this.sessionId = sessionId;
3213
+ }
3214
+ path(fileId) {
3215
+ const root = `/sessions/${encodeURIComponent(this.sessionId)}/files`;
3216
+ return fileId ? `${root}/${encodeURIComponent(fileId)}` : root;
3217
+ }
3218
+ async upload(file, filename = "file") {
3219
+ const body = new FormData();
3220
+ body.append("file", file, filename);
3221
+ const result = await this.client.request({
3222
+ method: "POST",
3223
+ url: this.path(),
3224
+ body
3225
+ });
3226
+ if (result.error || !result.data) throw new Error("Failed to upload session file");
3227
+ return result.data;
3228
+ }
3229
+ async list(options = {}) {
3230
+ const result = await this.client.request({
3231
+ method: "GET",
3232
+ url: this.path(),
3233
+ query: { limit: options.limit ?? 100, offset: options.offset ?? 0, source: options.source }
3234
+ });
3235
+ if (result.error || !result.data) throw new Error("Failed to list session files");
3236
+ return result.data;
3237
+ }
3238
+ async download(fileId) {
3239
+ const result = await this.client.request({
3240
+ method: "GET",
3241
+ url: this.path(fileId),
3242
+ parseAs: "blob"
3243
+ });
3244
+ if (result.error || !result.data) throw new Error(`Failed to download session file ${fileId}`);
3245
+ return result.data;
3246
+ }
3247
+ async delete(fileId) {
3248
+ const result = await this.client.request({ method: "DELETE", url: this.path(fileId) });
3249
+ if (result.error) throw new Error(`Failed to delete session file ${fileId}`);
3250
+ }
3251
+ };
3252
+
3253
+ // src/client.ts
3099
3254
  var NotteClient = class {
3100
3255
  constructor(config = {}) {
3101
3256
  const apiKey = config.apiKey || process.env.NOTTE_API_KEY;
@@ -3152,6 +3307,10 @@ var NotteClient = class {
3152
3307
  Session(options = {}) {
3153
3308
  return new Session(this, options);
3154
3309
  }
3310
+ /** Access files owned by a specific session, including closed sessions. */
3311
+ Files(sessionId) {
3312
+ return new SessionFiles(this.getClient(), sessionId);
3313
+ }
3155
3314
  /**
3156
3315
  * Create a new agent
3157
3316
  */
@@ -3273,28 +3432,33 @@ var createClient2 = (config) => {
3273
3432
  NotteProxyAuthError,
3274
3433
  NotteVault,
3275
3434
  Session,
3435
+ SessionFiles,
3276
3436
  agentStart,
3277
3437
  agentStatus,
3278
3438
  agentStop,
3279
3439
  anythingStart,
3280
3440
  client,
3441
+ connectLinkContext,
3442
+ connectLinkMailboxConnect,
3443
+ connectLinkMailboxSync,
3444
+ connectLinkMailboxes,
3445
+ connectLinkStatus,
3446
+ connectLinkSubmit,
3281
3447
  createClient,
3282
3448
  deleteSecret,
3283
- fileDownload,
3284
- fileDownloadUploadedFile,
3285
- fileListDownloads,
3286
- fileListUploads,
3287
- fileUpload,
3288
- fileUploadDownloadedFile,
3449
+ deleteSessionFile,
3450
+ downloadSessionFile,
3289
3451
  functionCreate,
3290
3452
  functionDelete,
3291
3453
  functionDownloadUrl,
3292
3454
  functionFork,
3293
3455
  functionMetadataUpdate,
3456
+ functionRollback,
3294
3457
  functionRunGetMetadata,
3295
3458
  functionRunStart,
3296
3459
  functionRunStop,
3297
3460
  functionRunUpdateMetadata,
3461
+ functionRuntimeHealth,
3298
3462
  functionScheduleDelete,
3299
3463
  functionScheduleSet,
3300
3464
  functionUpdate,
@@ -3310,6 +3474,7 @@ var createClient2 = (config) => {
3310
3474
  listFunctions,
3311
3475
  listPersonas,
3312
3476
  listSecrets,
3477
+ listSessionFiles,
3313
3478
  listSessions,
3314
3479
  listVaults,
3315
3480
  mailboxConnectToken,
@@ -3318,6 +3483,8 @@ var createClient2 = (config) => {
3318
3483
  mailboxList,
3319
3484
  mailboxSync,
3320
3485
  mailboxUpdate,
3486
+ managedAuthConnectLinkCreate,
3487
+ mintProxyCredentials,
3321
3488
  nudgePrompt,
3322
3489
  pageExecute,
3323
3490
  pageObserve,
@@ -3350,6 +3517,7 @@ var createClient2 = (config) => {
3350
3517
  sessionStatus,
3351
3518
  sessionStop,
3352
3519
  storeSecret,
3520
+ uploadSessionFile,
3353
3521
  vaultCreate,
3354
3522
  vaultCredentialsAdd,
3355
3523
  vaultCredentialsDelete,