@brazosd/node 0.1.2 → 0.1.3
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/README.md +37 -1
- package/browser.d.ts +7631 -0
- package/browser.js +11233 -0
- package/index.d.ts +854 -76
- package/index.js +1556 -99
- package/package.json +11 -1
package/index.js
CHANGED
|
@@ -15,14 +15,14 @@ var ApiError = class extends Error {
|
|
|
15
15
|
statusText;
|
|
16
16
|
body;
|
|
17
17
|
request;
|
|
18
|
-
constructor(
|
|
18
|
+
constructor(request3, response, message) {
|
|
19
19
|
super(message);
|
|
20
20
|
this.name = "ApiError";
|
|
21
21
|
this.url = response.url;
|
|
22
22
|
this.status = response.status;
|
|
23
23
|
this.statusText = response.statusText;
|
|
24
24
|
this.body = response.body;
|
|
25
|
-
this.request =
|
|
25
|
+
this.request = request3;
|
|
26
26
|
}
|
|
27
27
|
};
|
|
28
28
|
|
|
@@ -260,17 +260,17 @@ var getRequestBody = (options) => {
|
|
|
260
260
|
};
|
|
261
261
|
var sendRequest = async (config, options, url, body, formData, headers, onCancel) => {
|
|
262
262
|
const controller = new AbortController();
|
|
263
|
-
const
|
|
263
|
+
const request3 = {
|
|
264
264
|
headers,
|
|
265
265
|
body: body ?? formData,
|
|
266
266
|
method: options.method,
|
|
267
267
|
signal: controller.signal
|
|
268
268
|
};
|
|
269
269
|
if (config.WITH_CREDENTIALS) {
|
|
270
|
-
|
|
270
|
+
request3.credentials = config.CREDENTIALS;
|
|
271
271
|
}
|
|
272
272
|
onCancel(() => controller.abort());
|
|
273
|
-
return await fetch(url,
|
|
273
|
+
return await fetch(url, request3);
|
|
274
274
|
};
|
|
275
275
|
var getResponseHeader = (response, responseHeader) => {
|
|
276
276
|
if (responseHeader) {
|
|
@@ -1012,7 +1012,7 @@ var DefaultService = class {
|
|
|
1012
1012
|
}
|
|
1013
1013
|
/**
|
|
1014
1014
|
* Update agent repository third-party markup
|
|
1015
|
-
*
|
|
1015
|
+
* Enterprise members with repository edit permission, or ordinary-organization owners, may change the multiplier. Decreases apply immediately. Increases have five days of notice, one day for settlement fanout, and apply on day six.
|
|
1016
1016
|
* @returns AgentRepoTrdpMarkupState Third-party markup updated or scheduled
|
|
1017
1017
|
* @throws ApiError
|
|
1018
1018
|
*/
|
|
@@ -1030,7 +1030,7 @@ var DefaultService = class {
|
|
|
1030
1030
|
mediaType: "application/json",
|
|
1031
1031
|
errors: {
|
|
1032
1032
|
400: `Invalid multiplier or unchanged price`,
|
|
1033
|
-
403: `
|
|
1033
|
+
403: `Repository edit permission required in enterprise organizations; creator-organization owner required in ordinary organizations`,
|
|
1034
1034
|
404: `Agent repository not found`,
|
|
1035
1035
|
409: `Another price change is still active`
|
|
1036
1036
|
}
|
|
@@ -1038,7 +1038,7 @@ var DefaultService = class {
|
|
|
1038
1038
|
}
|
|
1039
1039
|
/**
|
|
1040
1040
|
* Cancel a pending third-party markup increase
|
|
1041
|
-
*
|
|
1041
|
+
* Enterprise members with repository edit permission, or ordinary-organization owners, may cancel during the five-day notice window. Settlement and later states are locked.
|
|
1042
1042
|
* @returns AgentRepoTrdpMarkupState Increase cancelled
|
|
1043
1043
|
* @throws ApiError
|
|
1044
1044
|
*/
|
|
@@ -1054,7 +1054,7 @@ var DefaultService = class {
|
|
|
1054
1054
|
"changeId": changeId
|
|
1055
1055
|
},
|
|
1056
1056
|
errors: {
|
|
1057
|
-
403: `
|
|
1057
|
+
403: `Repository edit permission required in enterprise organizations; creator-organization owner required in ordinary organizations`,
|
|
1058
1058
|
404: `Repository or change not found`,
|
|
1059
1059
|
409: `The notice window has ended or the change is no longer cancellable`
|
|
1060
1060
|
}
|
|
@@ -1062,7 +1062,7 @@ var DefaultService = class {
|
|
|
1062
1062
|
}
|
|
1063
1063
|
/**
|
|
1064
1064
|
* List published agent users' daily token costs
|
|
1065
|
-
*
|
|
1065
|
+
* Members with the repository token-costs:read permission (or ordinary-organization owners) can query a currently published repository. Includes all deployments and versions, grouped by UTC settlement date and organization-scoped anonymous user UUID. Amounts are actual LLM charges for input, output and cached tokens, including session-title calls; excludes marketplace markup, tools and sandboxes. Agent clone calls belong to the clone's repository. Data is eventually consistent via RisingWave. No consumer organization IDs, numeric user IDs or profile information are returned.
|
|
1066
1066
|
* @returns PublishedAgentUserDailyTokenCostPage Daily token costs listed; users without recorded usage have no row.
|
|
1067
1067
|
* @throws ApiError
|
|
1068
1068
|
*/
|
|
@@ -1086,7 +1086,7 @@ var DefaultService = class {
|
|
|
1086
1086
|
errors: {
|
|
1087
1087
|
400: `Invalid days, limit or cursor`,
|
|
1088
1088
|
401: `Authentication required`,
|
|
1089
|
-
403: `
|
|
1089
|
+
403: `Repository token-costs:read permission required in enterprise organizations; owner required in ordinary organizations`,
|
|
1090
1090
|
404: `Published repository not found in the current organization`
|
|
1091
1091
|
}
|
|
1092
1092
|
});
|
|
@@ -1236,6 +1236,111 @@ var DefaultService = class {
|
|
|
1236
1236
|
}
|
|
1237
1237
|
});
|
|
1238
1238
|
}
|
|
1239
|
+
/**
|
|
1240
|
+
* Submit a client-side MCP tool result
|
|
1241
|
+
* First accepted write wins. HTTP 204 confirms storage only; near timeout the model may still receive a timeout. Duplicate submissions and calls not accepting results return 409.
|
|
1242
|
+
* @returns void
|
|
1243
|
+
* @throws ApiError
|
|
1244
|
+
*/
|
|
1245
|
+
submitAgentSessionClientMcpResult({
|
|
1246
|
+
sessionId,
|
|
1247
|
+
runId,
|
|
1248
|
+
toolCallId,
|
|
1249
|
+
requestBody
|
|
1250
|
+
}) {
|
|
1251
|
+
return this.httpRequest.request({
|
|
1252
|
+
method: "POST",
|
|
1253
|
+
url: "/agent-sessions/{sessionId}/client-mcp-results/{runId}/{toolCallId}",
|
|
1254
|
+
path: {
|
|
1255
|
+
"sessionId": sessionId,
|
|
1256
|
+
"runId": runId,
|
|
1257
|
+
"toolCallId": toolCallId
|
|
1258
|
+
},
|
|
1259
|
+
body: requestBody,
|
|
1260
|
+
mediaType: "application/json",
|
|
1261
|
+
errors: {
|
|
1262
|
+
400: `Invalid request`,
|
|
1263
|
+
403: `Session access denied`,
|
|
1264
|
+
404: `Session not found`,
|
|
1265
|
+
409: `Session archived, installation conflict, result already received, or call no longer accepting results`
|
|
1266
|
+
}
|
|
1267
|
+
});
|
|
1268
|
+
}
|
|
1269
|
+
/**
|
|
1270
|
+
* List client-side MCP installations in a session
|
|
1271
|
+
* @returns ClientMCPInstallation Session client-side MCPs
|
|
1272
|
+
* @throws ApiError
|
|
1273
|
+
*/
|
|
1274
|
+
listAgentSessionClientMcPs({
|
|
1275
|
+
sessionId
|
|
1276
|
+
}) {
|
|
1277
|
+
return this.httpRequest.request({
|
|
1278
|
+
method: "GET",
|
|
1279
|
+
url: "/agent-sessions/{sessionId}/client-mcps",
|
|
1280
|
+
path: {
|
|
1281
|
+
"sessionId": sessionId
|
|
1282
|
+
},
|
|
1283
|
+
errors: {
|
|
1284
|
+
400: `Invalid request`,
|
|
1285
|
+
403: `Session access denied`,
|
|
1286
|
+
404: `Session not found`,
|
|
1287
|
+
409: `Session archived, installation conflict, result already received, or call no longer accepting results`
|
|
1288
|
+
}
|
|
1289
|
+
});
|
|
1290
|
+
}
|
|
1291
|
+
/**
|
|
1292
|
+
* Uninstall a session client-side MCP
|
|
1293
|
+
* Idempotent. Uninstall affects future tool dispatch; already waiting calls may still submit their results.
|
|
1294
|
+
* @returns void
|
|
1295
|
+
* @throws ApiError
|
|
1296
|
+
*/
|
|
1297
|
+
uninstallAgentSessionClientMcp({
|
|
1298
|
+
sessionId,
|
|
1299
|
+
namespace
|
|
1300
|
+
}) {
|
|
1301
|
+
return this.httpRequest.request({
|
|
1302
|
+
method: "DELETE",
|
|
1303
|
+
url: "/agent-sessions/{sessionId}/client-mcps/{namespace}",
|
|
1304
|
+
path: {
|
|
1305
|
+
"sessionId": sessionId,
|
|
1306
|
+
"namespace": namespace
|
|
1307
|
+
},
|
|
1308
|
+
errors: {
|
|
1309
|
+
400: `Invalid request`,
|
|
1310
|
+
403: `Session access denied`,
|
|
1311
|
+
404: `Session not found`,
|
|
1312
|
+
409: `Session archived, installation conflict, result already received, or call no longer accepting results`
|
|
1313
|
+
}
|
|
1314
|
+
});
|
|
1315
|
+
}
|
|
1316
|
+
/**
|
|
1317
|
+
* Install or replace a session client-side MCP
|
|
1318
|
+
* Idempotent by session and namespace. Identical definitions retain their revision. Maximum 32 client MCPs per session and 1 MiB per installation.
|
|
1319
|
+
* @returns ClientMCPInstallation Installed snapshot
|
|
1320
|
+
* @throws ApiError
|
|
1321
|
+
*/
|
|
1322
|
+
installAgentSessionClientMcp({
|
|
1323
|
+
sessionId,
|
|
1324
|
+
namespace,
|
|
1325
|
+
requestBody
|
|
1326
|
+
}) {
|
|
1327
|
+
return this.httpRequest.request({
|
|
1328
|
+
method: "PUT",
|
|
1329
|
+
url: "/agent-sessions/{sessionId}/client-mcps/{namespace}",
|
|
1330
|
+
path: {
|
|
1331
|
+
"sessionId": sessionId,
|
|
1332
|
+
"namespace": namespace
|
|
1333
|
+
},
|
|
1334
|
+
body: requestBody,
|
|
1335
|
+
mediaType: "application/json",
|
|
1336
|
+
errors: {
|
|
1337
|
+
400: `Invalid request`,
|
|
1338
|
+
403: `Session access denied`,
|
|
1339
|
+
404: `Session not found`,
|
|
1340
|
+
409: `Session archived, installation conflict, result already received, or call no longer accepting results`
|
|
1341
|
+
}
|
|
1342
|
+
});
|
|
1343
|
+
}
|
|
1239
1344
|
/**
|
|
1240
1345
|
* Compact agent session
|
|
1241
1346
|
* Trigger an asynchronous context compaction run for a managed agent session
|
|
@@ -1363,6 +1468,28 @@ var DefaultService = class {
|
|
|
1363
1468
|
}
|
|
1364
1469
|
});
|
|
1365
1470
|
}
|
|
1471
|
+
/**
|
|
1472
|
+
* Interrupt an agent session and its descendants
|
|
1473
|
+
* Interrupt unarchived working or retrying sessions in the subtree rooted at sessionId, root first and then each level from top to bottom. Children are discovered after their parents are interrupted. Traverse through inactive and archived ancestors. Execution stops on the first error; earlier successful interruptions remain applied and a retry skips them.
|
|
1474
|
+
* @returns AgentSessionTreeActionResult All active sessions interrupted
|
|
1475
|
+
* @throws ApiError
|
|
1476
|
+
*/
|
|
1477
|
+
interruptAgentSessionTree({
|
|
1478
|
+
sessionId
|
|
1479
|
+
}) {
|
|
1480
|
+
return this.httpRequest.request({
|
|
1481
|
+
method: "POST",
|
|
1482
|
+
url: "/agent-sessions/{sessionId}/interrupt-tree",
|
|
1483
|
+
path: {
|
|
1484
|
+
"sessionId": sessionId
|
|
1485
|
+
},
|
|
1486
|
+
errors: {
|
|
1487
|
+
403: `Forbidden`,
|
|
1488
|
+
404: `Agent session not found`,
|
|
1489
|
+
409: `A session could not be interrupted; earlier changes remain applied`
|
|
1490
|
+
}
|
|
1491
|
+
});
|
|
1492
|
+
}
|
|
1366
1493
|
/**
|
|
1367
1494
|
* Update agent session LLM model
|
|
1368
1495
|
* Change the model used by subsequent LLM requests in an agent session
|
|
@@ -1388,6 +1515,52 @@ var DefaultService = class {
|
|
|
1388
1515
|
}
|
|
1389
1516
|
});
|
|
1390
1517
|
}
|
|
1518
|
+
/**
|
|
1519
|
+
* Resume an interrupted agent session
|
|
1520
|
+
* Continue unfinished work without adding a user prompt. Starts a new run linked to the stopped run. Already running or otherwise ineligible sessions return 409.
|
|
1521
|
+
* @returns AgentSession Recovery accepted
|
|
1522
|
+
* @throws ApiError
|
|
1523
|
+
*/
|
|
1524
|
+
resumeAgentSession({
|
|
1525
|
+
sessionId
|
|
1526
|
+
}) {
|
|
1527
|
+
return this.httpRequest.request({
|
|
1528
|
+
method: "POST",
|
|
1529
|
+
url: "/agent-sessions/{sessionId}/resume",
|
|
1530
|
+
path: {
|
|
1531
|
+
"sessionId": sessionId
|
|
1532
|
+
},
|
|
1533
|
+
errors: {
|
|
1534
|
+
402: `Payment required`,
|
|
1535
|
+
403: `Forbidden`,
|
|
1536
|
+
404: `Agent session not found`,
|
|
1537
|
+
409: `Session is already running, not resumable, or requires another action`
|
|
1538
|
+
}
|
|
1539
|
+
});
|
|
1540
|
+
}
|
|
1541
|
+
/**
|
|
1542
|
+
* Resume an agent session and its descendants
|
|
1543
|
+
* Resume unarchived interrupted sessions in the subtree rooted at sessionId, deepest level first and root last. Traverse through inactive and archived ancestors. Other session states are skipped. Each resume uses the existing recovery, model, permission and quota checks. Execution stops on the first error; earlier successful resumes remain applied and a retry skips them.
|
|
1544
|
+
* @returns AgentSessionTreeActionResult All eligible sessions resumed
|
|
1545
|
+
* @throws ApiError
|
|
1546
|
+
*/
|
|
1547
|
+
resumeAgentSessionTree({
|
|
1548
|
+
sessionId
|
|
1549
|
+
}) {
|
|
1550
|
+
return this.httpRequest.request({
|
|
1551
|
+
method: "POST",
|
|
1552
|
+
url: "/agent-sessions/{sessionId}/resume-tree",
|
|
1553
|
+
path: {
|
|
1554
|
+
"sessionId": sessionId
|
|
1555
|
+
},
|
|
1556
|
+
errors: {
|
|
1557
|
+
402: `Payment required`,
|
|
1558
|
+
403: `Forbidden`,
|
|
1559
|
+
404: `Agent session not found`,
|
|
1560
|
+
409: `A session could not be resumed; earlier changes remain applied`
|
|
1561
|
+
}
|
|
1562
|
+
});
|
|
1563
|
+
}
|
|
1391
1564
|
/**
|
|
1392
1565
|
* Revoke the active agent session share
|
|
1393
1566
|
* Invalidate the current share link immediately.
|
|
@@ -1474,6 +1647,31 @@ var DefaultService = class {
|
|
|
1474
1647
|
}
|
|
1475
1648
|
});
|
|
1476
1649
|
}
|
|
1650
|
+
/**
|
|
1651
|
+
* Rename agent session
|
|
1652
|
+
* Change the title of a session owned by the current user in the current organization, including archived sessions. A manually set title is preserved when automatic title generation finishes.
|
|
1653
|
+
* @returns AgentSession Agent session renamed
|
|
1654
|
+
* @throws ApiError
|
|
1655
|
+
*/
|
|
1656
|
+
updateAgentSessionTitle({
|
|
1657
|
+
sessionId,
|
|
1658
|
+
requestBody
|
|
1659
|
+
}) {
|
|
1660
|
+
return this.httpRequest.request({
|
|
1661
|
+
method: "PUT",
|
|
1662
|
+
url: "/agent-sessions/{sessionId}/title",
|
|
1663
|
+
path: {
|
|
1664
|
+
"sessionId": sessionId
|
|
1665
|
+
},
|
|
1666
|
+
body: requestBody,
|
|
1667
|
+
mediaType: "application/json",
|
|
1668
|
+
errors: {
|
|
1669
|
+
400: `Title is blank or exceeds 200 characters`,
|
|
1670
|
+
403: `Forbidden`,
|
|
1671
|
+
404: `Agent session not found`
|
|
1672
|
+
}
|
|
1673
|
+
});
|
|
1674
|
+
}
|
|
1477
1675
|
/**
|
|
1478
1676
|
* Get agent session todo list
|
|
1479
1677
|
* Get the persisted todo list for a managed agent session ordered by ordinal ascending
|
|
@@ -2054,6 +2252,51 @@ var DefaultService = class {
|
|
|
2054
2252
|
}
|
|
2055
2253
|
});
|
|
2056
2254
|
}
|
|
2255
|
+
/**
|
|
2256
|
+
* Read agent MCP and tool whitelists
|
|
2257
|
+
* @returns AgentToolSettingsResponse Agent tool settings
|
|
2258
|
+
* @throws ApiError
|
|
2259
|
+
*/
|
|
2260
|
+
getAgentToolSettings({
|
|
2261
|
+
agentId
|
|
2262
|
+
}) {
|
|
2263
|
+
return this.httpRequest.request({
|
|
2264
|
+
method: "GET",
|
|
2265
|
+
url: "/agents/{agentId}/tool-settings",
|
|
2266
|
+
path: {
|
|
2267
|
+
"agentId": agentId
|
|
2268
|
+
},
|
|
2269
|
+
errors: {
|
|
2270
|
+
400: `Invalid settings`,
|
|
2271
|
+
403: `Forbidden`,
|
|
2272
|
+
404: `Agent not found`
|
|
2273
|
+
}
|
|
2274
|
+
});
|
|
2275
|
+
}
|
|
2276
|
+
/**
|
|
2277
|
+
* Update agent MCP and tool whitelists
|
|
2278
|
+
* @returns AgentToolSettingsResponse Agent tool settings
|
|
2279
|
+
* @throws ApiError
|
|
2280
|
+
*/
|
|
2281
|
+
updateAgentToolSettings({
|
|
2282
|
+
agentId,
|
|
2283
|
+
requestBody
|
|
2284
|
+
}) {
|
|
2285
|
+
return this.httpRequest.request({
|
|
2286
|
+
method: "PUT",
|
|
2287
|
+
url: "/agents/{agentId}/tool-settings",
|
|
2288
|
+
path: {
|
|
2289
|
+
"agentId": agentId
|
|
2290
|
+
},
|
|
2291
|
+
body: requestBody,
|
|
2292
|
+
mediaType: "application/json",
|
|
2293
|
+
errors: {
|
|
2294
|
+
400: `Invalid settings`,
|
|
2295
|
+
403: `Forbidden`,
|
|
2296
|
+
404: `Agent not found`
|
|
2297
|
+
}
|
|
2298
|
+
});
|
|
2299
|
+
}
|
|
2057
2300
|
/**
|
|
2058
2301
|
* Get recruited agent price confirmation status
|
|
2059
2302
|
* All members of the consumer organization can read this status for the session price-change banner.
|
|
@@ -2077,7 +2320,7 @@ var DefaultService = class {
|
|
|
2077
2320
|
}
|
|
2078
2321
|
/**
|
|
2079
2322
|
* Confirm a recruited agent price
|
|
2080
|
-
*
|
|
2323
|
+
* Enterprise members with agent edit permission, or ordinary-organization owners, can raise the accepted maximum price and clear a price-caused system pause.
|
|
2081
2324
|
* @returns AgentTrdpMarkupStatus Price confirmed
|
|
2082
2325
|
* @throws ApiError
|
|
2083
2326
|
*/
|
|
@@ -2093,7 +2336,7 @@ var DefaultService = class {
|
|
|
2093
2336
|
"changeId": changeId
|
|
2094
2337
|
},
|
|
2095
2338
|
errors: {
|
|
2096
|
-
403: `
|
|
2339
|
+
403: `Agent edit permission required in enterprise organizations; consumer-organization owner required in ordinary organizations`,
|
|
2097
2340
|
404: `Agent or relevant price change not found`,
|
|
2098
2341
|
409: `The change is cancelled, failed, stale, or otherwise not confirmable`
|
|
2099
2342
|
}
|
|
@@ -3287,7 +3530,7 @@ var DefaultService = class {
|
|
|
3287
3530
|
}
|
|
3288
3531
|
/**
|
|
3289
3532
|
* Upload cloud drive file
|
|
3290
|
-
*
|
|
3533
|
+
* Stream a file of at most 5 GiB (5368709120 bytes) into a canonical cloud drive destination path without buffering the complete payload in application memory or on disk. Query parameters are signed; the multipart body is sent with unsigned payload mode and the file content integrity is checked with the signed sha256 query parameter. Interrupted uploads must be restarted from the beginning.
|
|
3291
3534
|
* @returns CloudDriveFnode File uploaded
|
|
3292
3535
|
* @throws ApiError
|
|
3293
3536
|
*/
|
|
@@ -3320,6 +3563,7 @@ var DefaultService = class {
|
|
|
3320
3563
|
404: `Parent directory not found`,
|
|
3321
3564
|
409: `File already exists or flags conflict`,
|
|
3322
3565
|
412: `Existing file content no longer matches If-Match`,
|
|
3566
|
+
413: `File exceeds the 5 GiB limit`,
|
|
3323
3567
|
429: `This client already wrote the same file within the last second`,
|
|
3324
3568
|
503: `File-write rate limiter unavailable`
|
|
3325
3569
|
}
|
|
@@ -3327,7 +3571,7 @@ var DefaultService = class {
|
|
|
3327
3571
|
}
|
|
3328
3572
|
/**
|
|
3329
3573
|
* Upload cloud drive file into user tmp
|
|
3330
|
-
* Stream a file of at most
|
|
3574
|
+
* Stream a file of at most 5 GiB (5368709120 bytes) into the authenticated user's cloud-drive temporary area without buffering the complete payload in application memory or on disk. The backend allocates a unique dated tmp path so clients do not need to generate one. Interrupted uploads must be restarted from the beginning.
|
|
3331
3575
|
* @returns CloudDriveFnode File uploaded into tmp
|
|
3332
3576
|
* @throws ApiError
|
|
3333
3577
|
*/
|
|
@@ -3348,7 +3592,7 @@ var DefaultService = class {
|
|
|
3348
3592
|
402: `Payment required`,
|
|
3349
3593
|
403: `Forbidden`,
|
|
3350
3594
|
409: `Tmp path conflict`,
|
|
3351
|
-
413: `File exceeds the
|
|
3595
|
+
413: `File exceeds the 5 GiB limit`
|
|
3352
3596
|
}
|
|
3353
3597
|
});
|
|
3354
3598
|
}
|
|
@@ -3359,6 +3603,7 @@ var DefaultService = class {
|
|
|
3359
3603
|
* @throws ApiError
|
|
3360
3604
|
*/
|
|
3361
3605
|
listConsentForms({
|
|
3606
|
+
pendingOnly,
|
|
3362
3607
|
offset,
|
|
3363
3608
|
limit
|
|
3364
3609
|
}) {
|
|
@@ -3366,6 +3611,7 @@ var DefaultService = class {
|
|
|
3366
3611
|
method: "GET",
|
|
3367
3612
|
url: "/consent-forms",
|
|
3368
3613
|
query: {
|
|
3614
|
+
"pendingOnly": pendingOnly,
|
|
3369
3615
|
"offset": offset,
|
|
3370
3616
|
"limit": limit
|
|
3371
3617
|
},
|
|
@@ -3743,7 +3989,7 @@ var DefaultService = class {
|
|
|
3743
3989
|
}
|
|
3744
3990
|
/**
|
|
3745
3991
|
* Register device
|
|
3746
|
-
* Register a new device.
|
|
3992
|
+
* Register a new device. Enterprise organizations require devices:create. Ordinary organization settings may disable registration for members; the organization owner is exempt. Existing device connections and usage are unchanged.
|
|
3747
3993
|
* @returns RegisterDeviceResult Device registered
|
|
3748
3994
|
* @throws ApiError
|
|
3749
3995
|
*/
|
|
@@ -3932,6 +4178,33 @@ var DefaultService = class {
|
|
|
3932
4178
|
}
|
|
3933
4179
|
});
|
|
3934
4180
|
}
|
|
4181
|
+
/**
|
|
4182
|
+
* Set device access scope
|
|
4183
|
+
* Set a device to organization-visible or private. In non-enterprise organizations only the device owner can change its scope. Enterprise organizations use the existing device access permission, subject to device visibility; ownership does not bypass enterprise permissions. Setting orgScope to false saves private visibility before requesting disconnection of the current device tunnel. Repeating a private request retries disconnection. Device credentials remain valid for reconnecting.
|
|
4184
|
+
* @returns Device Device access scope updated and, for private scope, tunnel disconnection requested if a tunnel record exists. This does not acknowledge actual closure.
|
|
4185
|
+
* @throws ApiError
|
|
4186
|
+
*/
|
|
4187
|
+
setDeviceScope({
|
|
4188
|
+
deviceId,
|
|
4189
|
+
requestBody
|
|
4190
|
+
}) {
|
|
4191
|
+
return this.httpRequest.request({
|
|
4192
|
+
method: "PUT",
|
|
4193
|
+
url: "/devices/{deviceId}/scope",
|
|
4194
|
+
path: {
|
|
4195
|
+
"deviceId": deviceId
|
|
4196
|
+
},
|
|
4197
|
+
body: requestBody,
|
|
4198
|
+
mediaType: "application/json",
|
|
4199
|
+
errors: {
|
|
4200
|
+
400: `A boolean orgScope is required`,
|
|
4201
|
+
401: `Unauthorized`,
|
|
4202
|
+
403: `Device ownership or enterprise device permission required`,
|
|
4203
|
+
404: `Device not found or not visible to the current user`,
|
|
4204
|
+
503: `Scope was saved as private, but tunnel lookup or disconnect notification failed. The device remains private; its owner can retry the request.`
|
|
4205
|
+
}
|
|
4206
|
+
});
|
|
4207
|
+
}
|
|
3935
4208
|
/**
|
|
3936
4209
|
* Rotate device token
|
|
3937
4210
|
* @returns RotateDeviceTokenResult Device token rotated
|
|
@@ -4209,7 +4482,7 @@ var DefaultService = class {
|
|
|
4209
4482
|
}
|
|
4210
4483
|
/**
|
|
4211
4484
|
* Update current organization
|
|
4212
|
-
* Update the current organization's profile.
|
|
4485
|
+
* Update the current organization's profile. An authorized enterprise member or an ordinary-organization owner can update it.
|
|
4213
4486
|
* @returns AccountOrg Current organization updated
|
|
4214
4487
|
* @throws ApiError
|
|
4215
4488
|
*/
|
|
@@ -4223,7 +4496,7 @@ var DefaultService = class {
|
|
|
4223
4496
|
mediaType: "application/json",
|
|
4224
4497
|
errors: {
|
|
4225
4498
|
400: `Organization name is required`,
|
|
4226
|
-
403: `
|
|
4499
|
+
403: `An authorized enterprise member or an ordinary-organization owner can update the organization`,
|
|
4227
4500
|
404: `Current organization user not found`
|
|
4228
4501
|
}
|
|
4229
4502
|
});
|
|
@@ -4393,7 +4666,7 @@ var DefaultService = class {
|
|
|
4393
4666
|
}
|
|
4394
4667
|
/**
|
|
4395
4668
|
* Get org invitation token
|
|
4396
|
-
* Get the current organization invitation token.
|
|
4669
|
+
* Get the current organization invitation token. An authorized enterprise member or an ordinary-organization owner can read it.
|
|
4397
4670
|
* @returns OrgInvitationToken Token exists
|
|
4398
4671
|
* @throws ApiError
|
|
4399
4672
|
*/
|
|
@@ -4402,7 +4675,7 @@ var DefaultService = class {
|
|
|
4402
4675
|
method: "GET",
|
|
4403
4676
|
url: "/org-invitation-token",
|
|
4404
4677
|
errors: {
|
|
4405
|
-
403: `
|
|
4678
|
+
403: `An authorized enterprise member or an ordinary-organization owner can read invitation tokens`,
|
|
4406
4679
|
404: `No invitation token exists`
|
|
4407
4680
|
}
|
|
4408
4681
|
});
|
|
@@ -4423,7 +4696,7 @@ var DefaultService = class {
|
|
|
4423
4696
|
mediaType: "application/json",
|
|
4424
4697
|
errors: {
|
|
4425
4698
|
400: `Invalid request`,
|
|
4426
|
-
403: `
|
|
4699
|
+
403: `An authorized enterprise member or an ordinary-organization owner can manage invitation tokens`
|
|
4427
4700
|
}
|
|
4428
4701
|
});
|
|
4429
4702
|
}
|
|
@@ -4438,7 +4711,7 @@ var DefaultService = class {
|
|
|
4438
4711
|
method: "POST",
|
|
4439
4712
|
url: "/org-invitation-token/refresh",
|
|
4440
4713
|
errors: {
|
|
4441
|
-
403: `
|
|
4714
|
+
403: `An authorized enterprise member or an ordinary-organization owner can manage invitation tokens`,
|
|
4442
4715
|
404: `No invitation token exists`
|
|
4443
4716
|
}
|
|
4444
4717
|
});
|
|
@@ -4510,7 +4783,7 @@ var DefaultService = class {
|
|
|
4510
4783
|
}
|
|
4511
4784
|
/**
|
|
4512
4785
|
* Create an organization-managed account
|
|
4513
|
-
*
|
|
4786
|
+
* Requires rn:orgs:<orgId>:users:create in an enterprise organization with an active subscription. Ordinary organizations retain the owner fallback, but still require an active subscription to provision accounts. Creates an account without a phone number, allocates an enterprise seat, and returns a random temporary password once. The user must change it on first login. Never log the response.
|
|
4514
4787
|
* @returns ManagedAccountCredentials Account created; save the temporary password before leaving this response
|
|
4515
4788
|
* @throws ApiError
|
|
4516
4789
|
*/
|
|
@@ -4526,7 +4799,7 @@ var DefaultService = class {
|
|
|
4526
4799
|
400: `Username or display name is empty`,
|
|
4527
4800
|
401: `Organization authentication required`,
|
|
4528
4801
|
402: `Insufficient credits for an additional enterprise seat`,
|
|
4529
|
-
403: `
|
|
4802
|
+
403: `Active enterprise subscription and the operation RN permission required`,
|
|
4530
4803
|
404: `Organization not found`,
|
|
4531
4804
|
409: `Username is already taken (plain text), or organization active-user quota exceeded (JSON)`
|
|
4532
4805
|
}
|
|
@@ -4534,7 +4807,7 @@ var DefaultService = class {
|
|
|
4534
4807
|
}
|
|
4535
4808
|
/**
|
|
4536
4809
|
* Deactivate org user
|
|
4537
|
-
* Deactivate an existing org user.
|
|
4810
|
+
* Deactivate an existing org user. An authorized enterprise member or an ordinary-organization owner can deactivate users.
|
|
4538
4811
|
* @returns void
|
|
4539
4812
|
* @throws ApiError
|
|
4540
4813
|
*/
|
|
@@ -4548,7 +4821,7 @@ var DefaultService = class {
|
|
|
4548
4821
|
"userId": userId
|
|
4549
4822
|
},
|
|
4550
4823
|
errors: {
|
|
4551
|
-
403: `
|
|
4824
|
+
403: `An authorized enterprise member or an ordinary-organization owner can delete users`,
|
|
4552
4825
|
404: `Org user not found`,
|
|
4553
4826
|
409: `The organization owner cannot be deactivated`
|
|
4554
4827
|
}
|
|
@@ -4572,14 +4845,14 @@ var DefaultService = class {
|
|
|
4572
4845
|
body: requestBody,
|
|
4573
4846
|
mediaType: "application/json",
|
|
4574
4847
|
errors: {
|
|
4575
|
-
403: `
|
|
4848
|
+
403: `Operation RN permission required for enterprise organizations; owner required for ordinary organizations`,
|
|
4576
4849
|
404: `Managed member not found in this organization`
|
|
4577
4850
|
}
|
|
4578
4851
|
});
|
|
4579
4852
|
}
|
|
4580
4853
|
/**
|
|
4581
4854
|
* Deactivate a managed account
|
|
4582
|
-
*
|
|
4855
|
+
* Requires the operation RN in enterprise organizations; ordinary organizations require the owner. Stops login, revokes credentials and releases its occupied seat. Repeated deactivation preserves the original cooldown start.
|
|
4583
4856
|
* @returns void
|
|
4584
4857
|
* @throws ApiError
|
|
4585
4858
|
*/
|
|
@@ -4593,7 +4866,7 @@ var DefaultService = class {
|
|
|
4593
4866
|
"userId": userId
|
|
4594
4867
|
},
|
|
4595
4868
|
errors: {
|
|
4596
|
-
403: `
|
|
4869
|
+
403: `Operation RN permission required for enterprise organizations; owner required for ordinary organizations`,
|
|
4597
4870
|
404: `Managed member not found`,
|
|
4598
4871
|
409: `Organization owner cannot be deactivated`
|
|
4599
4872
|
}
|
|
@@ -4601,7 +4874,7 @@ var DefaultService = class {
|
|
|
4601
4874
|
}
|
|
4602
4875
|
/**
|
|
4603
4876
|
* Reactivate a managed account
|
|
4604
|
-
*
|
|
4877
|
+
* Requires the operation RN in enterprise organizations, or the owner in ordinary organizations, at least 24 hours after deactivation. Rechecks quotas and enterprise seats transactionally. Does not reset the password or automatically log in the user.
|
|
4605
4878
|
* @returns void
|
|
4606
4879
|
* @throws ApiError
|
|
4607
4880
|
*/
|
|
@@ -4616,7 +4889,7 @@ var DefaultService = class {
|
|
|
4616
4889
|
},
|
|
4617
4890
|
errors: {
|
|
4618
4891
|
402: `Insufficient credits for an additional seat`,
|
|
4619
|
-
403: `
|
|
4892
|
+
403: `Operation RN permission required for enterprise organizations; owner required for ordinary organizations`,
|
|
4620
4893
|
404: `Managed member not found`,
|
|
4621
4894
|
409: `Cooldown has not elapsed or a member quota is exceeded`
|
|
4622
4895
|
}
|
|
@@ -4624,7 +4897,7 @@ var DefaultService = class {
|
|
|
4624
4897
|
}
|
|
4625
4898
|
/**
|
|
4626
4899
|
* Reset a managed account's password
|
|
4627
|
-
*
|
|
4900
|
+
* Requires the operation RN in enterprise organizations; ordinary organizations require the owner. Generates a temporary password and revokes existing credentials without changing activation status.
|
|
4628
4901
|
* @returns ManagedPasswordReset Temporary password generated
|
|
4629
4902
|
* @throws ApiError
|
|
4630
4903
|
*/
|
|
@@ -4638,7 +4911,7 @@ var DefaultService = class {
|
|
|
4638
4911
|
"userId": userId
|
|
4639
4912
|
},
|
|
4640
4913
|
errors: {
|
|
4641
|
-
403: `
|
|
4914
|
+
403: `Operation RN permission required for enterprise organizations; owner required for ordinary organizations`,
|
|
4642
4915
|
404: `Managed member not found`
|
|
4643
4916
|
}
|
|
4644
4917
|
});
|
|
@@ -4687,7 +4960,7 @@ var DefaultService = class {
|
|
|
4687
4960
|
}
|
|
4688
4961
|
/**
|
|
4689
4962
|
* Get organization agent-session settings
|
|
4690
|
-
* Get the current organization's inactivity archive timeout.
|
|
4963
|
+
* Get the current organization's inactivity archive timeout. An authorized enterprise member or an ordinary-organization owner can read this setting.
|
|
4691
4964
|
* @returns OrgAgentSessionSettings Agent-session settings returned
|
|
4692
4965
|
* @throws ApiError
|
|
4693
4966
|
*/
|
|
@@ -4696,13 +4969,13 @@ var DefaultService = class {
|
|
|
4696
4969
|
method: "GET",
|
|
4697
4970
|
url: "/org/agent-session-settings",
|
|
4698
4971
|
errors: {
|
|
4699
|
-
403: `
|
|
4972
|
+
403: `An authorized enterprise member or an ordinary-organization owner can read these settings`
|
|
4700
4973
|
}
|
|
4701
4974
|
});
|
|
4702
4975
|
}
|
|
4703
4976
|
/**
|
|
4704
4977
|
* Update organization agent-session settings
|
|
4705
|
-
* Set the inactivity archive timeout for all sessions in the current organization.
|
|
4978
|
+
* Set the inactivity archive timeout for all sessions in the current organization. An authorized enterprise member or an ordinary-organization owner can update this setting.
|
|
4706
4979
|
* @returns OrgAgentSessionSettings Agent-session settings updated
|
|
4707
4980
|
* @throws ApiError
|
|
4708
4981
|
*/
|
|
@@ -4716,7 +4989,7 @@ var DefaultService = class {
|
|
|
4716
4989
|
mediaType: "application/json",
|
|
4717
4990
|
errors: {
|
|
4718
4991
|
400: `Timeout must be between 1 and 288 hours`,
|
|
4719
|
-
403: `
|
|
4992
|
+
403: `An authorized enterprise member or an ordinary-organization owner can update these settings`
|
|
4720
4993
|
}
|
|
4721
4994
|
});
|
|
4722
4995
|
}
|
|
@@ -4736,7 +5009,7 @@ var DefaultService = class {
|
|
|
4736
5009
|
mediaType: "multipart/form-data",
|
|
4737
5010
|
errors: {
|
|
4738
5011
|
400: `Invalid request`,
|
|
4739
|
-
403: `
|
|
5012
|
+
403: `An authorized enterprise member or an ordinary-organization owner can update the organization avatar`,
|
|
4740
5013
|
404: `Org user not found`
|
|
4741
5014
|
}
|
|
4742
5015
|
});
|
|
@@ -4758,7 +5031,7 @@ var DefaultService = class {
|
|
|
4758
5031
|
}
|
|
4759
5032
|
/**
|
|
4760
5033
|
* Activate organization enterprise subscription
|
|
4761
|
-
* Activate enterprise billing, or restore automatic renewal for an active paid period.
|
|
5034
|
+
* Activate enterprise billing, or restore automatic renewal for an active paid period. An authorized enterprise member or an ordinary-organization owner can perform this operation.
|
|
4762
5035
|
* @returns OrgEnterpriseSubscription Enterprise subscription activated or automatic renewal restored
|
|
4763
5036
|
* @throws ApiError
|
|
4764
5037
|
*/
|
|
@@ -4768,7 +5041,7 @@ var DefaultService = class {
|
|
|
4768
5041
|
url: "/org/enterprise",
|
|
4769
5042
|
errors: {
|
|
4770
5043
|
402: `Organization credits are insufficient for the initial seat charge`,
|
|
4771
|
-
403: `
|
|
5044
|
+
403: `An authorized enterprise member or an ordinary-organization owner can activate enterprise billing`
|
|
4772
5045
|
}
|
|
4773
5046
|
});
|
|
4774
5047
|
}
|
|
@@ -4886,7 +5159,7 @@ var DefaultService = class {
|
|
|
4886
5159
|
}
|
|
4887
5160
|
/**
|
|
4888
5161
|
* Cancel organization enterprise renewal
|
|
4889
|
-
* Stop automatic renewal after the current paid period. The organization remains enterprise until the period ends.
|
|
5162
|
+
* Stop automatic renewal after the current paid period. The organization remains enterprise until the period ends. An authorized enterprise member or an ordinary-organization owner can perform this operation.
|
|
4890
5163
|
* @returns OrgEnterpriseSubscription Automatic renewal cancelled
|
|
4891
5164
|
* @throws ApiError
|
|
4892
5165
|
*/
|
|
@@ -4895,13 +5168,13 @@ var DefaultService = class {
|
|
|
4895
5168
|
method: "POST",
|
|
4896
5169
|
url: "/org/enterprise/cancel-renewal",
|
|
4897
5170
|
errors: {
|
|
4898
|
-
403: `
|
|
5171
|
+
403: `An authorized enterprise member or an ordinary-organization owner can cancel enterprise renewal`
|
|
4899
5172
|
}
|
|
4900
5173
|
});
|
|
4901
5174
|
}
|
|
4902
5175
|
/**
|
|
4903
5176
|
* Get organization feature settings
|
|
4904
|
-
* Read organization settings and the current user's effective permissions. All settings default to allowed.
|
|
5177
|
+
* Read organization settings and the current user's effective permissions. All settings default to allowed. Enterprise recruitment and device registration use RN permissions instead of the legacy member switches; ordinary-organization owners bypass those two switches. Publishing and sharing switches apply to everyone.
|
|
4905
5178
|
* @returns OrgFeatureSettingsResponse Organization feature settings and effective permissions
|
|
4906
5179
|
* @throws ApiError
|
|
4907
5180
|
*/
|
|
@@ -4916,7 +5189,7 @@ var DefaultService = class {
|
|
|
4916
5189
|
}
|
|
4917
5190
|
/**
|
|
4918
5191
|
* Update organization feature settings
|
|
4919
|
-
*
|
|
5192
|
+
* Requires the operation RN in enterprise organizations; ordinary organizations require the owner. Replace all four settings. Restrictions apply to subsequent recruitment, device registration, publishing, and share creation or rotation requests. Existing agents, devices, publications, and shares remain unchanged.
|
|
4920
5193
|
* @returns OrgFeatureSettingsResponse Organization feature settings updated
|
|
4921
5194
|
* @throws ApiError
|
|
4922
5195
|
*/
|
|
@@ -4931,7 +5204,7 @@ var DefaultService = class {
|
|
|
4931
5204
|
errors: {
|
|
4932
5205
|
400: `All four boolean settings are required`,
|
|
4933
5206
|
401: `Unauthorized`,
|
|
4934
|
-
403: `
|
|
5207
|
+
403: `Operation RN permission required for enterprise organizations; owner required for ordinary organizations`
|
|
4935
5208
|
}
|
|
4936
5209
|
});
|
|
4937
5210
|
}
|
|
@@ -5154,7 +5427,7 @@ var DefaultService = class {
|
|
|
5154
5427
|
}
|
|
5155
5428
|
/**
|
|
5156
5429
|
* Replace organization model settings
|
|
5157
|
-
*
|
|
5430
|
+
* Enterprise members with llm-model-settings:edit, or ordinary-organization owners, may change these settings. Omitted or null overrides restore the corresponding default. Existing agents, sessions, and forks are not migrated.
|
|
5158
5431
|
* @returns OrgLlmSettings Organization model settings saved
|
|
5159
5432
|
* @throws ApiError
|
|
5160
5433
|
*/
|
|
@@ -5168,11 +5441,26 @@ var DefaultService = class {
|
|
|
5168
5441
|
mediaType: "application/json",
|
|
5169
5442
|
errors: {
|
|
5170
5443
|
400: `Invalid settings or model capability`,
|
|
5171
|
-
403: `
|
|
5444
|
+
403: `Management permission or an active Enterprise subscription for a custom model is required`,
|
|
5172
5445
|
404: `Model not found`
|
|
5173
5446
|
}
|
|
5174
5447
|
});
|
|
5175
5448
|
}
|
|
5449
|
+
/**
|
|
5450
|
+
* Get the current user's organization authorization
|
|
5451
|
+
* Returns the authenticated user's effective enterprise rules, including group and policy grants and denies, or ordinary-organization owner fallback. Subscription expiry does not disable enterprise authorization. This read-only response never initializes grants and cannot inspect another user. Operations always recheck authorization independently.
|
|
5452
|
+
* @returns CurrentOrgPermissions Current organization authorization
|
|
5453
|
+
* @throws ApiError
|
|
5454
|
+
*/
|
|
5455
|
+
getCurrentOrgPermissions() {
|
|
5456
|
+
return this.httpRequest.request({
|
|
5457
|
+
method: "GET",
|
|
5458
|
+
url: "/org/permissions",
|
|
5459
|
+
errors: {
|
|
5460
|
+
401: `Authentication required`
|
|
5461
|
+
}
|
|
5462
|
+
});
|
|
5463
|
+
}
|
|
5176
5464
|
/**
|
|
5177
5465
|
* List organization quotas
|
|
5178
5466
|
* List effective quota limits and current usage for the authenticated organization.
|
|
@@ -5188,6 +5476,52 @@ var DefaultService = class {
|
|
|
5188
5476
|
}
|
|
5189
5477
|
});
|
|
5190
5478
|
}
|
|
5479
|
+
/**
|
|
5480
|
+
* Get an enterprise member's daily usage budget
|
|
5481
|
+
* Uses the current UTC billing date and all usage categories from the billing aggregates. Only Agent/model admission is limited. Subscription expiry does not remove configured budgets.
|
|
5482
|
+
* @returns UserDailyBudget Current budget and aggregated usage
|
|
5483
|
+
* @throws ApiError
|
|
5484
|
+
*/
|
|
5485
|
+
getUserDailyBudget({
|
|
5486
|
+
userId
|
|
5487
|
+
}) {
|
|
5488
|
+
return this.httpRequest.request({
|
|
5489
|
+
method: "GET",
|
|
5490
|
+
url: "/org/users/{userId}/daily-budget",
|
|
5491
|
+
path: {
|
|
5492
|
+
"userId": userId
|
|
5493
|
+
},
|
|
5494
|
+
errors: {
|
|
5495
|
+
403: `Enterprise organization and member budget read permission required`,
|
|
5496
|
+
404: `Member not found in this organization`
|
|
5497
|
+
}
|
|
5498
|
+
});
|
|
5499
|
+
}
|
|
5500
|
+
/**
|
|
5501
|
+
* Set an enterprise member's daily usage budget
|
|
5502
|
+
* Zero blocks new Agent/model work; omit limitMicroyuans or set it to null for unlimited usage. Settings propagate to other workers within 7 seconds while dependencies are healthy. Usage checks additionally cache billing aggregates for at most 5 seconds. RisingWave lag and already admitted concurrent calls can cause overspending. No automatic replay of stopped work occurs at the next UTC day.
|
|
5503
|
+
* @returns UserDailyBudget Saved budget and current aggregated usage
|
|
5504
|
+
* @throws ApiError
|
|
5505
|
+
*/
|
|
5506
|
+
setUserDailyBudget({
|
|
5507
|
+
userId,
|
|
5508
|
+
requestBody
|
|
5509
|
+
}) {
|
|
5510
|
+
return this.httpRequest.request({
|
|
5511
|
+
method: "PUT",
|
|
5512
|
+
url: "/org/users/{userId}/daily-budget",
|
|
5513
|
+
path: {
|
|
5514
|
+
"userId": userId
|
|
5515
|
+
},
|
|
5516
|
+
body: requestBody,
|
|
5517
|
+
mediaType: "application/json",
|
|
5518
|
+
errors: {
|
|
5519
|
+
400: `Invalid amount`,
|
|
5520
|
+
403: `Enterprise organization and member budget edit permission required`,
|
|
5521
|
+
404: `Member not found in this organization`
|
|
5522
|
+
}
|
|
5523
|
+
});
|
|
5524
|
+
}
|
|
5191
5525
|
/**
|
|
5192
5526
|
* Get a member's bound policy IDs
|
|
5193
5527
|
* Requires an enterprise organization and the corresponding enterprise RN permission.
|
|
@@ -5332,7 +5666,7 @@ var DefaultService = class {
|
|
|
5332
5666
|
q,
|
|
5333
5667
|
limit,
|
|
5334
5668
|
page = 1,
|
|
5335
|
-
pageSize = 24
|
|
5669
|
+
pageSize: pageSize2 = 24
|
|
5336
5670
|
}) {
|
|
5337
5671
|
return this.httpRequest.request({
|
|
5338
5672
|
method: "GET",
|
|
@@ -5341,7 +5675,7 @@ var DefaultService = class {
|
|
|
5341
5675
|
"q": q,
|
|
5342
5676
|
"limit": limit,
|
|
5343
5677
|
"page": page,
|
|
5344
|
-
"pageSize":
|
|
5678
|
+
"pageSize": pageSize2
|
|
5345
5679
|
},
|
|
5346
5680
|
errors: {
|
|
5347
5681
|
400: `Invalid page or page size`
|
|
@@ -5387,6 +5721,43 @@ var DefaultService = class {
|
|
|
5387
5721
|
}
|
|
5388
5722
|
});
|
|
5389
5723
|
}
|
|
5724
|
+
/**
|
|
5725
|
+
* List public snapshots
|
|
5726
|
+
* @returns PublicSnapshot Public snapshots
|
|
5727
|
+
* @throws ApiError
|
|
5728
|
+
*/
|
|
5729
|
+
listPublicSnapshots({
|
|
5730
|
+
after
|
|
5731
|
+
}) {
|
|
5732
|
+
return this.httpRequest.request({
|
|
5733
|
+
method: "GET",
|
|
5734
|
+
url: "/public-snapshots",
|
|
5735
|
+
query: {
|
|
5736
|
+
"after": after
|
|
5737
|
+
}
|
|
5738
|
+
});
|
|
5739
|
+
}
|
|
5740
|
+
/**
|
|
5741
|
+
* Import a public snapshot into the current organization
|
|
5742
|
+
* Create an independent saved snapshot reference to the same immutable resource. Storage billing starts when imported.
|
|
5743
|
+
* @returns Snapshot Organization snapshot created
|
|
5744
|
+
* @throws ApiError
|
|
5745
|
+
*/
|
|
5746
|
+
importPublicSnapshot({
|
|
5747
|
+
publicationId
|
|
5748
|
+
}) {
|
|
5749
|
+
return this.httpRequest.request({
|
|
5750
|
+
method: "POST",
|
|
5751
|
+
url: "/public-snapshots/{publicationID}/copies",
|
|
5752
|
+
path: {
|
|
5753
|
+
"publicationID": publicationId
|
|
5754
|
+
},
|
|
5755
|
+
errors: {
|
|
5756
|
+
402: `Payment required`,
|
|
5757
|
+
404: `Public snapshot not found`
|
|
5758
|
+
}
|
|
5759
|
+
});
|
|
5760
|
+
}
|
|
5390
5761
|
/**
|
|
5391
5762
|
* Get public agent
|
|
5392
5763
|
* Get the current published main version of a public agent repository. This endpoint does not require authentication.
|
|
@@ -5473,7 +5844,7 @@ var DefaultService = class {
|
|
|
5473
5844
|
}
|
|
5474
5845
|
/**
|
|
5475
5846
|
* Reserve or change the org's publisher namespace
|
|
5476
|
-
*
|
|
5847
|
+
* An authorized enterprise member or an ordinary-organization owner can change the namespace. It can be changed once every 7 days; prior namespaces remain reserved and working for 60 days.
|
|
5477
5848
|
* @returns PublisherNamespace Namespace updated
|
|
5478
5849
|
* @throws ApiError
|
|
5479
5850
|
*/
|
|
@@ -5487,7 +5858,7 @@ var DefaultService = class {
|
|
|
5487
5858
|
mediaType: "application/json",
|
|
5488
5859
|
errors: {
|
|
5489
5860
|
400: `Invalid namespace`,
|
|
5490
|
-
403: `
|
|
5861
|
+
403: `An authorized enterprise member or an ordinary-organization owner can change the namespace`,
|
|
5491
5862
|
409: `Namespace is already reserved`,
|
|
5492
5863
|
429: `Namespace was changed within the last 7 days`
|
|
5493
5864
|
}
|
|
@@ -5590,6 +5961,154 @@ var DefaultService = class {
|
|
|
5590
5961
|
}
|
|
5591
5962
|
});
|
|
5592
5963
|
}
|
|
5964
|
+
/**
|
|
5965
|
+
* List accessible platform scheduled tasks in the current organization
|
|
5966
|
+
* @returns ScheduledTask Organization tasks and the current user's personal tasks
|
|
5967
|
+
* @throws ApiError
|
|
5968
|
+
*/
|
|
5969
|
+
listScheduledTasks({
|
|
5970
|
+
scope
|
|
5971
|
+
}) {
|
|
5972
|
+
return this.httpRequest.request({
|
|
5973
|
+
method: "GET",
|
|
5974
|
+
url: "/scheduled-tasks",
|
|
5975
|
+
query: {
|
|
5976
|
+
"scope": scope
|
|
5977
|
+
}
|
|
5978
|
+
});
|
|
5979
|
+
}
|
|
5980
|
+
/**
|
|
5981
|
+
* Create a platform scheduled task
|
|
5982
|
+
* @returns ScheduledTask Created
|
|
5983
|
+
* @throws ApiError
|
|
5984
|
+
*/
|
|
5985
|
+
createScheduledTask({
|
|
5986
|
+
requestBody
|
|
5987
|
+
}) {
|
|
5988
|
+
return this.httpRequest.request({
|
|
5989
|
+
method: "POST",
|
|
5990
|
+
url: "/scheduled-tasks",
|
|
5991
|
+
body: requestBody,
|
|
5992
|
+
mediaType: "application/json",
|
|
5993
|
+
errors: {
|
|
5994
|
+
400: `Invalid task or request body exceeds 64 KiB`,
|
|
5995
|
+
403: `Permission denied`,
|
|
5996
|
+
409: `Organization quota exceeded`
|
|
5997
|
+
}
|
|
5998
|
+
});
|
|
5999
|
+
}
|
|
6000
|
+
/**
|
|
6001
|
+
* Delete a task while retaining its history
|
|
6002
|
+
* @returns void
|
|
6003
|
+
* @throws ApiError
|
|
6004
|
+
*/
|
|
6005
|
+
deleteScheduledTask({
|
|
6006
|
+
scheduledTaskId
|
|
6007
|
+
}) {
|
|
6008
|
+
return this.httpRequest.request({
|
|
6009
|
+
method: "DELETE",
|
|
6010
|
+
url: "/scheduled-tasks/{scheduledTaskId}",
|
|
6011
|
+
path: {
|
|
6012
|
+
"scheduledTaskId": scheduledTaskId
|
|
6013
|
+
}
|
|
6014
|
+
});
|
|
6015
|
+
}
|
|
6016
|
+
/**
|
|
6017
|
+
* Get a scheduled task
|
|
6018
|
+
* @returns ScheduledTask Task
|
|
6019
|
+
* @throws ApiError
|
|
6020
|
+
*/
|
|
6021
|
+
getScheduledTask({
|
|
6022
|
+
scheduledTaskId
|
|
6023
|
+
}) {
|
|
6024
|
+
return this.httpRequest.request({
|
|
6025
|
+
method: "GET",
|
|
6026
|
+
url: "/scheduled-tasks/{scheduledTaskId}",
|
|
6027
|
+
path: {
|
|
6028
|
+
"scheduledTaskId": scheduledTaskId
|
|
6029
|
+
},
|
|
6030
|
+
errors: {
|
|
6031
|
+
404: `Task not found`
|
|
6032
|
+
}
|
|
6033
|
+
});
|
|
6034
|
+
}
|
|
6035
|
+
/**
|
|
6036
|
+
* Update a task without changing its owner or execution user
|
|
6037
|
+
* @returns ScheduledTask Updated
|
|
6038
|
+
* @throws ApiError
|
|
6039
|
+
*/
|
|
6040
|
+
updateScheduledTask({
|
|
6041
|
+
scheduledTaskId,
|
|
6042
|
+
requestBody
|
|
6043
|
+
}) {
|
|
6044
|
+
return this.httpRequest.request({
|
|
6045
|
+
method: "PUT",
|
|
6046
|
+
url: "/scheduled-tasks/{scheduledTaskId}",
|
|
6047
|
+
path: {
|
|
6048
|
+
"scheduledTaskId": scheduledTaskId
|
|
6049
|
+
},
|
|
6050
|
+
body: requestBody,
|
|
6051
|
+
mediaType: "application/json",
|
|
6052
|
+
errors: {
|
|
6053
|
+
400: `Invalid task`,
|
|
6054
|
+
409: `Task is running or already completed`
|
|
6055
|
+
}
|
|
6056
|
+
});
|
|
6057
|
+
}
|
|
6058
|
+
/**
|
|
6059
|
+
* Pause a scheduled task
|
|
6060
|
+
* @returns ScheduledTask Paused
|
|
6061
|
+
* @throws ApiError
|
|
6062
|
+
*/
|
|
6063
|
+
pauseScheduledTask({
|
|
6064
|
+
scheduledTaskId
|
|
6065
|
+
}) {
|
|
6066
|
+
return this.httpRequest.request({
|
|
6067
|
+
method: "POST",
|
|
6068
|
+
url: "/scheduled-tasks/{scheduledTaskId}/pause",
|
|
6069
|
+
path: {
|
|
6070
|
+
"scheduledTaskId": scheduledTaskId
|
|
6071
|
+
},
|
|
6072
|
+
errors: {
|
|
6073
|
+
409: `Task cannot be paused`
|
|
6074
|
+
}
|
|
6075
|
+
});
|
|
6076
|
+
}
|
|
6077
|
+
/**
|
|
6078
|
+
* Resume a scheduled task
|
|
6079
|
+
* @returns ScheduledTask Resumed
|
|
6080
|
+
* @throws ApiError
|
|
6081
|
+
*/
|
|
6082
|
+
resumeScheduledTask({
|
|
6083
|
+
scheduledTaskId
|
|
6084
|
+
}) {
|
|
6085
|
+
return this.httpRequest.request({
|
|
6086
|
+
method: "POST",
|
|
6087
|
+
url: "/scheduled-tasks/{scheduledTaskId}/resume",
|
|
6088
|
+
path: {
|
|
6089
|
+
"scheduledTaskId": scheduledTaskId
|
|
6090
|
+
},
|
|
6091
|
+
errors: {
|
|
6092
|
+
409: `Task cannot be resumed`
|
|
6093
|
+
}
|
|
6094
|
+
});
|
|
6095
|
+
}
|
|
6096
|
+
/**
|
|
6097
|
+
* List the latest 100 executions, newest first
|
|
6098
|
+
* @returns ScheduledTaskRun Executions; message acceptance does not imply agent completion
|
|
6099
|
+
* @throws ApiError
|
|
6100
|
+
*/
|
|
6101
|
+
listScheduledTaskRuns({
|
|
6102
|
+
scheduledTaskId
|
|
6103
|
+
}) {
|
|
6104
|
+
return this.httpRequest.request({
|
|
6105
|
+
method: "GET",
|
|
6106
|
+
url: "/scheduled-tasks/{scheduledTaskId}/runs",
|
|
6107
|
+
path: {
|
|
6108
|
+
"scheduledTaskId": scheduledTaskId
|
|
6109
|
+
}
|
|
6110
|
+
});
|
|
6111
|
+
}
|
|
5593
6112
|
/**
|
|
5594
6113
|
* List organization service users
|
|
5595
6114
|
* @returns ServiceUser Service users, which do not consume seats
|
|
@@ -5741,8 +6260,8 @@ var DefaultService = class {
|
|
|
5741
6260
|
}
|
|
5742
6261
|
/**
|
|
5743
6262
|
* Delete snapshot
|
|
5744
|
-
*
|
|
5745
|
-
* @returns any Snapshot
|
|
6263
|
+
* Remove a snapshot and its public publication. Imported copies and managed sandbox references remain usable. Enterprise members need the snapshot delete permission. Ordinary organizations allow its creator or owner to delete it.
|
|
6264
|
+
* @returns any Snapshot reference removed; provider cleanup is deferred
|
|
5746
6265
|
* @throws ApiError
|
|
5747
6266
|
*/
|
|
5748
6267
|
deleteSnapshot({
|
|
@@ -5780,9 +6299,51 @@ var DefaultService = class {
|
|
|
5780
6299
|
}
|
|
5781
6300
|
});
|
|
5782
6301
|
}
|
|
6302
|
+
/**
|
|
6303
|
+
* Unpublish an organization snapshot
|
|
6304
|
+
* @returns void
|
|
6305
|
+
* @throws ApiError
|
|
6306
|
+
*/
|
|
6307
|
+
unpublishSnapshot({
|
|
6308
|
+
snapshotUuid
|
|
6309
|
+
}) {
|
|
6310
|
+
return this.httpRequest.request({
|
|
6311
|
+
method: "DELETE",
|
|
6312
|
+
url: "/snapshots/{snapshotUUID}/publication",
|
|
6313
|
+
path: {
|
|
6314
|
+
"snapshotUUID": snapshotUuid
|
|
6315
|
+
},
|
|
6316
|
+
errors: {
|
|
6317
|
+
403: `Forbidden`,
|
|
6318
|
+
404: `Snapshot not found`
|
|
6319
|
+
}
|
|
6320
|
+
});
|
|
6321
|
+
}
|
|
6322
|
+
/**
|
|
6323
|
+
* Publish an organization snapshot
|
|
6324
|
+
* Publish a ready saved snapshot for other organizations to import. Enterprise members need the snapshot publish permission. Ordinary organizations allow its creator or owner to publish it.
|
|
6325
|
+
* @returns SnapshotPublication Publication ID (publishing again is idempotent)
|
|
6326
|
+
* @throws ApiError
|
|
6327
|
+
*/
|
|
6328
|
+
publishSnapshot({
|
|
6329
|
+
snapshotUuid
|
|
6330
|
+
}) {
|
|
6331
|
+
return this.httpRequest.request({
|
|
6332
|
+
method: "PUT",
|
|
6333
|
+
url: "/snapshots/{snapshotUUID}/publication",
|
|
6334
|
+
path: {
|
|
6335
|
+
"snapshotUUID": snapshotUuid
|
|
6336
|
+
},
|
|
6337
|
+
errors: {
|
|
6338
|
+
403: `Forbidden`,
|
|
6339
|
+
404: `Snapshot not found`,
|
|
6340
|
+
409: `Snapshot is not ready`
|
|
6341
|
+
}
|
|
6342
|
+
});
|
|
6343
|
+
}
|
|
5783
6344
|
/**
|
|
5784
6345
|
* Register additional exact SSO callback URLs
|
|
5785
|
-
* Requires
|
|
6346
|
+
* Requires active membership in the application's organization; enterprise permissions are enforced at the API layer. The application's https hostname with /auth/brazosd/callback is always registered. HTTPS is required except for loopback development callbacks.
|
|
5786
6347
|
* @returns SSOAppConfiguration Configured callbacks
|
|
5787
6348
|
* @throws ApiError
|
|
5788
6349
|
*/
|
|
@@ -6322,6 +6883,68 @@ var DefaultService3 = class {
|
|
|
6322
6883
|
this.httpRequest = httpRequest;
|
|
6323
6884
|
}
|
|
6324
6885
|
httpRequest;
|
|
6886
|
+
/**
|
|
6887
|
+
* @returns CustomDomain Custom domains and DNS configuration
|
|
6888
|
+
* @throws ApiError
|
|
6889
|
+
*/
|
|
6890
|
+
listAppDomains({
|
|
6891
|
+
id
|
|
6892
|
+
}) {
|
|
6893
|
+
return this.httpRequest.request({
|
|
6894
|
+
method: "GET",
|
|
6895
|
+
url: "/apps/{id}/domains",
|
|
6896
|
+
path: {
|
|
6897
|
+
"id": id
|
|
6898
|
+
},
|
|
6899
|
+
errors: {
|
|
6900
|
+
404: `Function not found`
|
|
6901
|
+
}
|
|
6902
|
+
});
|
|
6903
|
+
}
|
|
6904
|
+
/**
|
|
6905
|
+
* @returns CustomDomain Domain reserved; configure both DNS records to begin verification
|
|
6906
|
+
* @throws ApiError
|
|
6907
|
+
*/
|
|
6908
|
+
createAppDomain({
|
|
6909
|
+
id,
|
|
6910
|
+
requestBody
|
|
6911
|
+
}) {
|
|
6912
|
+
return this.httpRequest.request({
|
|
6913
|
+
method: "POST",
|
|
6914
|
+
url: "/apps/{id}/domains",
|
|
6915
|
+
path: {
|
|
6916
|
+
"id": id
|
|
6917
|
+
},
|
|
6918
|
+
body: requestBody,
|
|
6919
|
+
mediaType: "application/json",
|
|
6920
|
+
errors: {
|
|
6921
|
+
400: `Invalid subdomain`,
|
|
6922
|
+
404: `Function not found`,
|
|
6923
|
+
409: `Domain already bound or function domain limit reached`,
|
|
6924
|
+
503: `Custom domains unavailable`
|
|
6925
|
+
}
|
|
6926
|
+
});
|
|
6927
|
+
}
|
|
6928
|
+
/**
|
|
6929
|
+
* @returns void
|
|
6930
|
+
* @throws ApiError
|
|
6931
|
+
*/
|
|
6932
|
+
deleteAppDomain({
|
|
6933
|
+
id,
|
|
6934
|
+
domainId
|
|
6935
|
+
}) {
|
|
6936
|
+
return this.httpRequest.request({
|
|
6937
|
+
method: "DELETE",
|
|
6938
|
+
url: "/apps/{id}/domains/{domainId}",
|
|
6939
|
+
path: {
|
|
6940
|
+
"id": id,
|
|
6941
|
+
"domainId": domainId
|
|
6942
|
+
},
|
|
6943
|
+
errors: {
|
|
6944
|
+
404: `Domain not found`
|
|
6945
|
+
}
|
|
6946
|
+
});
|
|
6947
|
+
}
|
|
6325
6948
|
/**
|
|
6326
6949
|
* @returns string Serverless API contract; paths are relative to /api/v1/serverless.
|
|
6327
6950
|
* @throws ApiError
|
|
@@ -6333,6 +6956,7 @@ var DefaultService3 = class {
|
|
|
6333
6956
|
});
|
|
6334
6957
|
}
|
|
6335
6958
|
/**
|
|
6959
|
+
* Lists all undeleted functions in the caller's organization. Active organization members share management access; enterprise permissions belong to the API layer.
|
|
6336
6960
|
* @returns AppSummary Success
|
|
6337
6961
|
* @throws ApiError
|
|
6338
6962
|
*/
|
|
@@ -6444,6 +7068,88 @@ var DefaultService3 = class {
|
|
|
6444
7068
|
}
|
|
6445
7069
|
});
|
|
6446
7070
|
}
|
|
7071
|
+
/**
|
|
7072
|
+
* Query cloud function stdout and stderr without waking the function
|
|
7073
|
+
* Queries retained container logs for current and stopped instances. Requires the same
|
|
7074
|
+
* active organization membership as getApp. Enterprise permissions belong to the API layer.
|
|
7075
|
+
* The interval is [from, to),
|
|
7076
|
+
* at most seven days, with to no later than the request time. Results are newest first.
|
|
7077
|
+
* Each response contains at most 100 entries and 1 MiB of JSON. Messages longer than
|
|
7078
|
+
* 32 KiB are previews with truncated=true and a short-lived downloadToken for the original.
|
|
7079
|
+
* Keep from, to and stream unchanged when following nextCursor. Cursors expire after
|
|
7080
|
+
* 15 minutes. An incomplete page contains no entries and a retry cursor at the same position.
|
|
7081
|
+
* Recent logs can arrive late: pagination is not a snapshot of SLS ingestion; refresh the
|
|
7082
|
+
* interval to include delayed logs. Retention is seven days, not archival storage.
|
|
7083
|
+
* Queries spanning more than 256 instances must use a narrower time range.
|
|
7084
|
+
*
|
|
7085
|
+
* @returns AppLogPage Bounded log page; inspect status before treating it as complete.
|
|
7086
|
+
* @throws ApiError
|
|
7087
|
+
*/
|
|
7088
|
+
listAppLogs({
|
|
7089
|
+
id,
|
|
7090
|
+
from,
|
|
7091
|
+
to,
|
|
7092
|
+
limit = 100,
|
|
7093
|
+
stream,
|
|
7094
|
+
cursor
|
|
7095
|
+
}) {
|
|
7096
|
+
return this.httpRequest.request({
|
|
7097
|
+
method: "GET",
|
|
7098
|
+
url: "/apps/{id}/logs",
|
|
7099
|
+
path: {
|
|
7100
|
+
"id": id
|
|
7101
|
+
},
|
|
7102
|
+
query: {
|
|
7103
|
+
"from": from,
|
|
7104
|
+
"to": to,
|
|
7105
|
+
"limit": limit,
|
|
7106
|
+
"stream": stream,
|
|
7107
|
+
"cursor": cursor
|
|
7108
|
+
},
|
|
7109
|
+
errors: {
|
|
7110
|
+
400: `Invalid time range, limit or cursor`,
|
|
7111
|
+
401: `Unauthorized`,
|
|
7112
|
+
403: `Forbidden`,
|
|
7113
|
+
404: `Function not found`,
|
|
7114
|
+
409: `Instance mapping changed; restart the query`,
|
|
7115
|
+
410: `Cursor expired; restart the query`,
|
|
7116
|
+
422: `Too many instances; narrow the time range`,
|
|
7117
|
+
502: `Log provider failed; this is not an empty result`,
|
|
7118
|
+
503: `Log collection query is not configured`
|
|
7119
|
+
}
|
|
7120
|
+
});
|
|
7121
|
+
}
|
|
7122
|
+
/**
|
|
7123
|
+
* Download one original log message referenced by a truncated preview
|
|
7124
|
+
* @returns binary Original UTF-8 log message, served as an attachment.
|
|
7125
|
+
* @throws ApiError
|
|
7126
|
+
*/
|
|
7127
|
+
downloadAppLogContent({
|
|
7128
|
+
id,
|
|
7129
|
+
token
|
|
7130
|
+
}) {
|
|
7131
|
+
return this.httpRequest.request({
|
|
7132
|
+
method: "GET",
|
|
7133
|
+
url: "/apps/{id}/logs/content",
|
|
7134
|
+
path: {
|
|
7135
|
+
"id": id
|
|
7136
|
+
},
|
|
7137
|
+
query: {
|
|
7138
|
+
"token": token
|
|
7139
|
+
},
|
|
7140
|
+
errors: {
|
|
7141
|
+
400: `Invalid token`,
|
|
7142
|
+
401: `Unauthorized`,
|
|
7143
|
+
403: `Forbidden`,
|
|
7144
|
+
404: `Function or retained log no longer exists`,
|
|
7145
|
+
409: `Log position changed; restart the query`,
|
|
7146
|
+
410: `Token expired; restart the query`,
|
|
7147
|
+
422: `Too many instances; narrow the time range and query again`,
|
|
7148
|
+
502: `Log provider failed`,
|
|
7149
|
+
503: `Logs unavailable or provider query incomplete; retry later`
|
|
7150
|
+
}
|
|
7151
|
+
});
|
|
7152
|
+
}
|
|
6447
7153
|
/**
|
|
6448
7154
|
* @returns any Success
|
|
6449
7155
|
* @throws ApiError
|
|
@@ -6801,33 +7507,6 @@ var ServerlessClient = class {
|
|
|
6801
7507
|
}
|
|
6802
7508
|
};
|
|
6803
7509
|
|
|
6804
|
-
// src/credentials.ts
|
|
6805
|
-
import { readFile } from "node:fs/promises";
|
|
6806
|
-
var DEFAULT_CREDENTIALS_FILE = "/run/brazosd/identity/credentials.json";
|
|
6807
|
-
function fileCredentials(path = DEFAULT_CREDENTIALS_FILE) {
|
|
6808
|
-
let cached;
|
|
6809
|
-
let cacheUntil = 0;
|
|
6810
|
-
let pending;
|
|
6811
|
-
return () => {
|
|
6812
|
-
if (cached && Date.now() < cacheUntil) return Promise.resolve(cached);
|
|
6813
|
-
if (!pending) {
|
|
6814
|
-
pending = readFile(path, "utf8").then((raw) => {
|
|
6815
|
-
const value = JSON.parse(raw);
|
|
6816
|
-
const expiresAt = Date.parse(value.expiresAt);
|
|
6817
|
-
if (typeof value.accessToken !== "string" || !value.accessToken || !Number.isFinite(expiresAt) || expiresAt <= Date.now()) {
|
|
6818
|
-
throw new Error("Brazosd instance credentials are missing or expired");
|
|
6819
|
-
}
|
|
6820
|
-
cached = { accessToken: value.accessToken, apiUrl: value.apiUrl, expiresAt: value.expiresAt };
|
|
6821
|
-
cacheUntil = Math.min(Date.now() + 1e3, expiresAt);
|
|
6822
|
-
return cached;
|
|
6823
|
-
}).finally(() => {
|
|
6824
|
-
pending = void 0;
|
|
6825
|
-
});
|
|
6826
|
-
}
|
|
6827
|
-
return pending;
|
|
6828
|
-
};
|
|
6829
|
-
}
|
|
6830
|
-
|
|
6831
7510
|
// src/generated/operations.ts
|
|
6832
7511
|
var operations = {
|
|
6833
7512
|
"api": {
|
|
@@ -7214,6 +7893,50 @@ var operations = {
|
|
|
7214
7893
|
"404": "void"
|
|
7215
7894
|
}
|
|
7216
7895
|
},
|
|
7896
|
+
"POST /agent-sessions/{sessionId}/client-mcp-results/{runId}/{toolCallId}": {
|
|
7897
|
+
"authenticated": true,
|
|
7898
|
+
"redirect": false,
|
|
7899
|
+
"responses": {
|
|
7900
|
+
"204": "void",
|
|
7901
|
+
"400": "void",
|
|
7902
|
+
"403": "void",
|
|
7903
|
+
"404": "void",
|
|
7904
|
+
"409": "void"
|
|
7905
|
+
}
|
|
7906
|
+
},
|
|
7907
|
+
"GET /agent-sessions/{sessionId}/client-mcps": {
|
|
7908
|
+
"authenticated": true,
|
|
7909
|
+
"redirect": false,
|
|
7910
|
+
"responses": {
|
|
7911
|
+
"200": "json",
|
|
7912
|
+
"400": "void",
|
|
7913
|
+
"403": "void",
|
|
7914
|
+
"404": "void",
|
|
7915
|
+
"409": "void"
|
|
7916
|
+
}
|
|
7917
|
+
},
|
|
7918
|
+
"DELETE /agent-sessions/{sessionId}/client-mcps/{namespace}": {
|
|
7919
|
+
"authenticated": true,
|
|
7920
|
+
"redirect": false,
|
|
7921
|
+
"responses": {
|
|
7922
|
+
"204": "void",
|
|
7923
|
+
"400": "void",
|
|
7924
|
+
"403": "void",
|
|
7925
|
+
"404": "void",
|
|
7926
|
+
"409": "void"
|
|
7927
|
+
}
|
|
7928
|
+
},
|
|
7929
|
+
"PUT /agent-sessions/{sessionId}/client-mcps/{namespace}": {
|
|
7930
|
+
"authenticated": true,
|
|
7931
|
+
"redirect": false,
|
|
7932
|
+
"responses": {
|
|
7933
|
+
"200": "json",
|
|
7934
|
+
"400": "void",
|
|
7935
|
+
"403": "void",
|
|
7936
|
+
"404": "void",
|
|
7937
|
+
"409": "void"
|
|
7938
|
+
}
|
|
7939
|
+
},
|
|
7217
7940
|
"POST /agent-sessions/{sessionId}/compact": {
|
|
7218
7941
|
"authenticated": true,
|
|
7219
7942
|
"redirect": false,
|
|
@@ -7267,6 +7990,16 @@ var operations = {
|
|
|
7267
7990
|
"409": "void"
|
|
7268
7991
|
}
|
|
7269
7992
|
},
|
|
7993
|
+
"POST /agent-sessions/{sessionId}/interrupt-tree": {
|
|
7994
|
+
"authenticated": true,
|
|
7995
|
+
"redirect": false,
|
|
7996
|
+
"responses": {
|
|
7997
|
+
"200": "json",
|
|
7998
|
+
"403": "void",
|
|
7999
|
+
"404": "void",
|
|
8000
|
+
"409": "json"
|
|
8001
|
+
}
|
|
8002
|
+
},
|
|
7270
8003
|
"PUT /agent-sessions/{sessionId}/llm-model": {
|
|
7271
8004
|
"authenticated": true,
|
|
7272
8005
|
"redirect": false,
|
|
@@ -7277,6 +8010,28 @@ var operations = {
|
|
|
7277
8010
|
"404": "void"
|
|
7278
8011
|
}
|
|
7279
8012
|
},
|
|
8013
|
+
"POST /agent-sessions/{sessionId}/resume": {
|
|
8014
|
+
"authenticated": true,
|
|
8015
|
+
"redirect": false,
|
|
8016
|
+
"responses": {
|
|
8017
|
+
"202": "json",
|
|
8018
|
+
"402": "void",
|
|
8019
|
+
"403": "void",
|
|
8020
|
+
"404": "void",
|
|
8021
|
+
"409": "json"
|
|
8022
|
+
}
|
|
8023
|
+
},
|
|
8024
|
+
"POST /agent-sessions/{sessionId}/resume-tree": {
|
|
8025
|
+
"authenticated": true,
|
|
8026
|
+
"redirect": false,
|
|
8027
|
+
"responses": {
|
|
8028
|
+
"202": "json",
|
|
8029
|
+
"402": "void",
|
|
8030
|
+
"403": "void",
|
|
8031
|
+
"404": "void",
|
|
8032
|
+
"409": "json"
|
|
8033
|
+
}
|
|
8034
|
+
},
|
|
7280
8035
|
"DELETE /agent-sessions/{sessionId}/share": {
|
|
7281
8036
|
"authenticated": true,
|
|
7282
8037
|
"redirect": false,
|
|
@@ -7315,6 +8070,16 @@ var operations = {
|
|
|
7315
8070
|
"409": "void"
|
|
7316
8071
|
}
|
|
7317
8072
|
},
|
|
8073
|
+
"PUT /agent-sessions/{sessionId}/title": {
|
|
8074
|
+
"authenticated": true,
|
|
8075
|
+
"redirect": false,
|
|
8076
|
+
"responses": {
|
|
8077
|
+
"200": "json",
|
|
8078
|
+
"400": "void",
|
|
8079
|
+
"403": "void",
|
|
8080
|
+
"404": "void"
|
|
8081
|
+
}
|
|
8082
|
+
},
|
|
7318
8083
|
"GET /agent-sessions/{sessionId}/todo-list": {
|
|
7319
8084
|
"authenticated": true,
|
|
7320
8085
|
"redirect": false,
|
|
@@ -7543,6 +8308,26 @@ var operations = {
|
|
|
7543
8308
|
"404": "void"
|
|
7544
8309
|
}
|
|
7545
8310
|
},
|
|
8311
|
+
"GET /agents/{agentId}/tool-settings": {
|
|
8312
|
+
"authenticated": true,
|
|
8313
|
+
"redirect": false,
|
|
8314
|
+
"responses": {
|
|
8315
|
+
"200": "json",
|
|
8316
|
+
"400": "void",
|
|
8317
|
+
"403": "void",
|
|
8318
|
+
"404": "void"
|
|
8319
|
+
}
|
|
8320
|
+
},
|
|
8321
|
+
"PUT /agents/{agentId}/tool-settings": {
|
|
8322
|
+
"authenticated": true,
|
|
8323
|
+
"redirect": false,
|
|
8324
|
+
"responses": {
|
|
8325
|
+
"200": "json",
|
|
8326
|
+
"400": "void",
|
|
8327
|
+
"403": "void",
|
|
8328
|
+
"404": "void"
|
|
8329
|
+
}
|
|
8330
|
+
},
|
|
7546
8331
|
"GET /agents/{agentId}/trdp-markup": {
|
|
7547
8332
|
"authenticated": true,
|
|
7548
8333
|
"redirect": false,
|
|
@@ -8072,6 +8857,7 @@ var operations = {
|
|
|
8072
8857
|
"404": "void",
|
|
8073
8858
|
"409": "void",
|
|
8074
8859
|
"412": "void",
|
|
8860
|
+
"413": "void",
|
|
8075
8861
|
"429": "void",
|
|
8076
8862
|
"503": "void"
|
|
8077
8863
|
}
|
|
@@ -8343,6 +9129,18 @@ var operations = {
|
|
|
8343
9129
|
"501": "void"
|
|
8344
9130
|
}
|
|
8345
9131
|
},
|
|
9132
|
+
"PUT /devices/{deviceId}/scope": {
|
|
9133
|
+
"authenticated": true,
|
|
9134
|
+
"redirect": false,
|
|
9135
|
+
"responses": {
|
|
9136
|
+
"200": "json",
|
|
9137
|
+
"400": "void",
|
|
9138
|
+
"401": "void",
|
|
9139
|
+
"403": "void",
|
|
9140
|
+
"404": "void",
|
|
9141
|
+
"503": "void"
|
|
9142
|
+
}
|
|
9143
|
+
},
|
|
8346
9144
|
"POST /devices/{deviceId}/token": {
|
|
8347
9145
|
"authenticated": true,
|
|
8348
9146
|
"redirect": false,
|
|
@@ -8920,6 +9718,14 @@ var operations = {
|
|
|
8920
9718
|
"404": "void"
|
|
8921
9719
|
}
|
|
8922
9720
|
},
|
|
9721
|
+
"GET /org/permissions": {
|
|
9722
|
+
"authenticated": true,
|
|
9723
|
+
"redirect": false,
|
|
9724
|
+
"responses": {
|
|
9725
|
+
"200": "json",
|
|
9726
|
+
"401": "void"
|
|
9727
|
+
}
|
|
9728
|
+
},
|
|
8923
9729
|
"GET /org/quotas": {
|
|
8924
9730
|
"authenticated": true,
|
|
8925
9731
|
"redirect": false,
|
|
@@ -8928,6 +9734,25 @@ var operations = {
|
|
|
8928
9734
|
"401": "void"
|
|
8929
9735
|
}
|
|
8930
9736
|
},
|
|
9737
|
+
"GET /org/users/{userId}/daily-budget": {
|
|
9738
|
+
"authenticated": true,
|
|
9739
|
+
"redirect": false,
|
|
9740
|
+
"responses": {
|
|
9741
|
+
"200": "json",
|
|
9742
|
+
"403": "void",
|
|
9743
|
+
"404": "void"
|
|
9744
|
+
}
|
|
9745
|
+
},
|
|
9746
|
+
"PUT /org/users/{userId}/daily-budget": {
|
|
9747
|
+
"authenticated": true,
|
|
9748
|
+
"redirect": false,
|
|
9749
|
+
"responses": {
|
|
9750
|
+
"200": "json",
|
|
9751
|
+
"400": "void",
|
|
9752
|
+
"403": "void",
|
|
9753
|
+
"404": "void"
|
|
9754
|
+
}
|
|
9755
|
+
},
|
|
8931
9756
|
"GET /org/users/{userId}/enterprise-permission-policies": {
|
|
8932
9757
|
"authenticated": true,
|
|
8933
9758
|
"redirect": false,
|
|
@@ -9011,6 +9836,22 @@ var operations = {
|
|
|
9011
9836
|
"404": "void"
|
|
9012
9837
|
}
|
|
9013
9838
|
},
|
|
9839
|
+
"GET /public-snapshots": {
|
|
9840
|
+
"authenticated": true,
|
|
9841
|
+
"redirect": false,
|
|
9842
|
+
"responses": {
|
|
9843
|
+
"200": "json"
|
|
9844
|
+
}
|
|
9845
|
+
},
|
|
9846
|
+
"POST /public-snapshots/{publicationID}/copies": {
|
|
9847
|
+
"authenticated": true,
|
|
9848
|
+
"redirect": false,
|
|
9849
|
+
"responses": {
|
|
9850
|
+
"201": "json",
|
|
9851
|
+
"402": "void",
|
|
9852
|
+
"404": "void"
|
|
9853
|
+
}
|
|
9854
|
+
},
|
|
9014
9855
|
"GET /public/agents/{agentRepoId}": {
|
|
9015
9856
|
"authenticated": false,
|
|
9016
9857
|
"redirect": false,
|
|
@@ -9104,6 +9945,70 @@ var operations = {
|
|
|
9104
9945
|
"404": "void"
|
|
9105
9946
|
}
|
|
9106
9947
|
},
|
|
9948
|
+
"GET /scheduled-tasks": {
|
|
9949
|
+
"authenticated": true,
|
|
9950
|
+
"redirect": false,
|
|
9951
|
+
"responses": {
|
|
9952
|
+
"200": "json"
|
|
9953
|
+
}
|
|
9954
|
+
},
|
|
9955
|
+
"POST /scheduled-tasks": {
|
|
9956
|
+
"authenticated": true,
|
|
9957
|
+
"redirect": false,
|
|
9958
|
+
"responses": {
|
|
9959
|
+
"201": "json",
|
|
9960
|
+
"400": "void",
|
|
9961
|
+
"403": "void",
|
|
9962
|
+
"409": "void"
|
|
9963
|
+
}
|
|
9964
|
+
},
|
|
9965
|
+
"DELETE /scheduled-tasks/{scheduledTaskId}": {
|
|
9966
|
+
"authenticated": true,
|
|
9967
|
+
"redirect": false,
|
|
9968
|
+
"responses": {
|
|
9969
|
+
"204": "void"
|
|
9970
|
+
}
|
|
9971
|
+
},
|
|
9972
|
+
"GET /scheduled-tasks/{scheduledTaskId}": {
|
|
9973
|
+
"authenticated": true,
|
|
9974
|
+
"redirect": false,
|
|
9975
|
+
"responses": {
|
|
9976
|
+
"200": "json",
|
|
9977
|
+
"404": "void"
|
|
9978
|
+
}
|
|
9979
|
+
},
|
|
9980
|
+
"PUT /scheduled-tasks/{scheduledTaskId}": {
|
|
9981
|
+
"authenticated": true,
|
|
9982
|
+
"redirect": false,
|
|
9983
|
+
"responses": {
|
|
9984
|
+
"200": "json",
|
|
9985
|
+
"400": "void",
|
|
9986
|
+
"409": "void"
|
|
9987
|
+
}
|
|
9988
|
+
},
|
|
9989
|
+
"POST /scheduled-tasks/{scheduledTaskId}/pause": {
|
|
9990
|
+
"authenticated": true,
|
|
9991
|
+
"redirect": false,
|
|
9992
|
+
"responses": {
|
|
9993
|
+
"200": "json",
|
|
9994
|
+
"409": "void"
|
|
9995
|
+
}
|
|
9996
|
+
},
|
|
9997
|
+
"POST /scheduled-tasks/{scheduledTaskId}/resume": {
|
|
9998
|
+
"authenticated": true,
|
|
9999
|
+
"redirect": false,
|
|
10000
|
+
"responses": {
|
|
10001
|
+
"200": "json",
|
|
10002
|
+
"409": "void"
|
|
10003
|
+
}
|
|
10004
|
+
},
|
|
10005
|
+
"GET /scheduled-tasks/{scheduledTaskId}/runs": {
|
|
10006
|
+
"authenticated": true,
|
|
10007
|
+
"redirect": false,
|
|
10008
|
+
"responses": {
|
|
10009
|
+
"200": "json"
|
|
10010
|
+
}
|
|
10011
|
+
},
|
|
9107
10012
|
"GET /service-users": {
|
|
9108
10013
|
"authenticated": true,
|
|
9109
10014
|
"redirect": false,
|
|
@@ -9183,6 +10088,25 @@ var operations = {
|
|
|
9183
10088
|
"404": "void"
|
|
9184
10089
|
}
|
|
9185
10090
|
},
|
|
10091
|
+
"DELETE /snapshots/{snapshotUUID}/publication": {
|
|
10092
|
+
"authenticated": true,
|
|
10093
|
+
"redirect": false,
|
|
10094
|
+
"responses": {
|
|
10095
|
+
"204": "void",
|
|
10096
|
+
"403": "void",
|
|
10097
|
+
"404": "void"
|
|
10098
|
+
}
|
|
10099
|
+
},
|
|
10100
|
+
"PUT /snapshots/{snapshotUUID}/publication": {
|
|
10101
|
+
"authenticated": true,
|
|
10102
|
+
"redirect": false,
|
|
10103
|
+
"responses": {
|
|
10104
|
+
"200": "json",
|
|
10105
|
+
"403": "void",
|
|
10106
|
+
"404": "void",
|
|
10107
|
+
"409": "void"
|
|
10108
|
+
}
|
|
10109
|
+
},
|
|
9186
10110
|
"PUT /sso/apps/{appId}": {
|
|
9187
10111
|
"authenticated": true,
|
|
9188
10112
|
"redirect": false,
|
|
@@ -9415,6 +10339,33 @@ var operations = {
|
|
|
9415
10339
|
}
|
|
9416
10340
|
},
|
|
9417
10341
|
"serverless": {
|
|
10342
|
+
"GET /apps/{id}/domains": {
|
|
10343
|
+
"authenticated": true,
|
|
10344
|
+
"redirect": false,
|
|
10345
|
+
"responses": {
|
|
10346
|
+
"200": "json",
|
|
10347
|
+
"404": "void"
|
|
10348
|
+
}
|
|
10349
|
+
},
|
|
10350
|
+
"POST /apps/{id}/domains": {
|
|
10351
|
+
"authenticated": true,
|
|
10352
|
+
"redirect": false,
|
|
10353
|
+
"responses": {
|
|
10354
|
+
"201": "json",
|
|
10355
|
+
"400": "void",
|
|
10356
|
+
"404": "void",
|
|
10357
|
+
"409": "void",
|
|
10358
|
+
"503": "void"
|
|
10359
|
+
}
|
|
10360
|
+
},
|
|
10361
|
+
"DELETE /apps/{id}/domains/{domainId}": {
|
|
10362
|
+
"authenticated": true,
|
|
10363
|
+
"redirect": false,
|
|
10364
|
+
"responses": {
|
|
10365
|
+
"204": "void",
|
|
10366
|
+
"404": "void"
|
|
10367
|
+
}
|
|
10368
|
+
},
|
|
9418
10369
|
"GET /openapi.yaml": {
|
|
9419
10370
|
"authenticated": false,
|
|
9420
10371
|
"redirect": false,
|
|
@@ -9487,6 +10438,38 @@ var operations = {
|
|
|
9487
10438
|
"503": "void"
|
|
9488
10439
|
}
|
|
9489
10440
|
},
|
|
10441
|
+
"GET /apps/{id}/logs": {
|
|
10442
|
+
"authenticated": true,
|
|
10443
|
+
"redirect": false,
|
|
10444
|
+
"responses": {
|
|
10445
|
+
"200": "json",
|
|
10446
|
+
"400": "void",
|
|
10447
|
+
"401": "void",
|
|
10448
|
+
"403": "void",
|
|
10449
|
+
"404": "void",
|
|
10450
|
+
"409": "void",
|
|
10451
|
+
"410": "void",
|
|
10452
|
+
"422": "void",
|
|
10453
|
+
"502": "void",
|
|
10454
|
+
"503": "void"
|
|
10455
|
+
}
|
|
10456
|
+
},
|
|
10457
|
+
"GET /apps/{id}/logs/content": {
|
|
10458
|
+
"authenticated": true,
|
|
10459
|
+
"redirect": false,
|
|
10460
|
+
"responses": {
|
|
10461
|
+
"200": "stream",
|
|
10462
|
+
"400": "void",
|
|
10463
|
+
"401": "void",
|
|
10464
|
+
"403": "void",
|
|
10465
|
+
"404": "void",
|
|
10466
|
+
"409": "void",
|
|
10467
|
+
"410": "void",
|
|
10468
|
+
"422": "void",
|
|
10469
|
+
"502": "void",
|
|
10470
|
+
"503": "void"
|
|
10471
|
+
}
|
|
10472
|
+
},
|
|
9490
10473
|
"PUT /apps/{id}/databases/{databaseId}": {
|
|
9491
10474
|
"authenticated": true,
|
|
9492
10475
|
"redirect": false,
|
|
@@ -9710,6 +10693,20 @@ async function rejectResponse(response) {
|
|
|
9710
10693
|
}
|
|
9711
10694
|
throw new BrazosdError(response.status, `Brazosd API returned HTTP ${response.status}`, body);
|
|
9712
10695
|
}
|
|
10696
|
+
async function realtimeURL(context) {
|
|
10697
|
+
const authorization = new Headers(context.headers).get("Authorization");
|
|
10698
|
+
const credential = !authorization || !context.apiUrl ? await context.credentials() : void 0;
|
|
10699
|
+
const token = authorization?.replace(/^Bearer\s+/i, "") ?? credential?.accessToken;
|
|
10700
|
+
if (!token || credential?.expiresAt && !(Date.parse(credential.expiresAt) > Date.now())) {
|
|
10701
|
+
throw new Error("Brazosd credentials are missing or expired");
|
|
10702
|
+
}
|
|
10703
|
+
const url = new URL(context.apiUrl ?? apiURL(credential.apiUrl));
|
|
10704
|
+
const path = url.pathname.replace(/\/+$/, "");
|
|
10705
|
+
url.pathname = path.endsWith("/api/v1") ? path.slice(0, -7) + "/ws" : "/ws";
|
|
10706
|
+
url.protocol = url.protocol === "https:" ? "wss:" : "ws:";
|
|
10707
|
+
url.searchParams.set("access_token", token);
|
|
10708
|
+
return url.toString();
|
|
10709
|
+
}
|
|
9713
10710
|
function createRequest(context, kind) {
|
|
9714
10711
|
return class AuthenticatedRequest extends BaseHttpRequest {
|
|
9715
10712
|
request(options) {
|
|
@@ -9782,6 +10779,475 @@ async function execute(context, kind, options, signal) {
|
|
|
9782
10779
|
return response.text();
|
|
9783
10780
|
}
|
|
9784
10781
|
|
|
10782
|
+
// src/client-mcp.ts
|
|
10783
|
+
var pageSize = 100;
|
|
10784
|
+
var receiptLimit = 1024;
|
|
10785
|
+
var errorResult = (message) => ({ isError: true, content: [{ type: "text", text: message }] });
|
|
10786
|
+
var asError = (value) => value instanceof Error ? value : new Error(String(value));
|
|
10787
|
+
function webMCPResult(value) {
|
|
10788
|
+
const encoded = JSON.stringify(value);
|
|
10789
|
+
if (encoded === void 0) throw new Error("WebMCP callbacks must return a JSON-serializable value");
|
|
10790
|
+
const result = JSON.parse(encoded);
|
|
10791
|
+
if (result && Array.isArray(result.content)) return result;
|
|
10792
|
+
return {
|
|
10793
|
+
content: [{ type: "text", text: typeof result === "string" ? result : encoded }],
|
|
10794
|
+
...result !== null && typeof result === "object" && !Array.isArray(result) ? { structuredContent: result } : {}
|
|
10795
|
+
};
|
|
10796
|
+
}
|
|
10797
|
+
function delay(ms, signal) {
|
|
10798
|
+
return new Promise((resolve2, reject) => {
|
|
10799
|
+
if (signal.aborted) {
|
|
10800
|
+
reject(signal.reason);
|
|
10801
|
+
return;
|
|
10802
|
+
}
|
|
10803
|
+
const abort = () => {
|
|
10804
|
+
clearTimeout(timer);
|
|
10805
|
+
reject(signal.reason);
|
|
10806
|
+
};
|
|
10807
|
+
const timer = setTimeout(() => {
|
|
10808
|
+
signal.removeEventListener("abort", abort);
|
|
10809
|
+
resolve2();
|
|
10810
|
+
}, ms);
|
|
10811
|
+
signal.addEventListener("abort", abort, { once: true });
|
|
10812
|
+
});
|
|
10813
|
+
}
|
|
10814
|
+
async function request2(pending, signal) {
|
|
10815
|
+
const abort = () => pending.cancel();
|
|
10816
|
+
if (signal.aborted) abort();
|
|
10817
|
+
else signal.addEventListener("abort", abort, { once: true });
|
|
10818
|
+
try {
|
|
10819
|
+
return await pending;
|
|
10820
|
+
} finally {
|
|
10821
|
+
signal.removeEventListener("abort", abort);
|
|
10822
|
+
}
|
|
10823
|
+
}
|
|
10824
|
+
var ClientMCPBridge = class {
|
|
10825
|
+
constructor(api, sessionId, socketURL, options = {}) {
|
|
10826
|
+
this.api = api;
|
|
10827
|
+
this.sessionId = sessionId;
|
|
10828
|
+
this.socketURL = socketURL;
|
|
10829
|
+
this.options = options;
|
|
10830
|
+
this.signal = options.signal ? AbortSignal.any([options.signal, this.controller.signal]) : this.controller.signal;
|
|
10831
|
+
this.storageKey = `brazosd:client-mcp:v1:${sessionId}`;
|
|
10832
|
+
if (options.storage) {
|
|
10833
|
+
try {
|
|
10834
|
+
const cached = JSON.parse(options.storage.getItem(this.storageKey) ?? "[]");
|
|
10835
|
+
if (!Array.isArray(cached) || cached.some((value) => typeof value !== "string")) throw new Error("Invalid client MCP receipt cache");
|
|
10836
|
+
for (const key of cached.slice(-receiptLimit)) this.receipts.add(key);
|
|
10837
|
+
} catch (error) {
|
|
10838
|
+
this.report(error);
|
|
10839
|
+
}
|
|
10840
|
+
}
|
|
10841
|
+
}
|
|
10842
|
+
api;
|
|
10843
|
+
sessionId;
|
|
10844
|
+
socketURL;
|
|
10845
|
+
options;
|
|
10846
|
+
controller = new AbortController();
|
|
10847
|
+
signal;
|
|
10848
|
+
callbacks = /* @__PURE__ */ new Map();
|
|
10849
|
+
installations = /* @__PURE__ */ new Map();
|
|
10850
|
+
definitions = /* @__PURE__ */ new Map();
|
|
10851
|
+
registrationCleanups = /* @__PURE__ */ new Map();
|
|
10852
|
+
mutation = Promise.resolve();
|
|
10853
|
+
pending = /* @__PURE__ */ new Map();
|
|
10854
|
+
receipts = /* @__PURE__ */ new Set();
|
|
10855
|
+
storageKey;
|
|
10856
|
+
socket;
|
|
10857
|
+
connection;
|
|
10858
|
+
online = false;
|
|
10859
|
+
cursor = 0;
|
|
10860
|
+
buffer = [];
|
|
10861
|
+
syncing;
|
|
10862
|
+
catchUp = false;
|
|
10863
|
+
/** Registers one named tool in this bridge's namespace, following WebMCP's declaration shape. */
|
|
10864
|
+
registerTool(tool, options = {}) {
|
|
10865
|
+
return this.mutate(async () => {
|
|
10866
|
+
this.signal.throwIfAborted();
|
|
10867
|
+
options.signal?.throwIfAborted();
|
|
10868
|
+
const namespace = this.options.namespace ?? "browser";
|
|
10869
|
+
const current = this.definitions.get(namespace) ?? {};
|
|
10870
|
+
if (Object.hasOwn(current, tool.name)) throw new Error(`Client MCP tool already registered: ${tool.name}`);
|
|
10871
|
+
const callback = {
|
|
10872
|
+
description: tool.description,
|
|
10873
|
+
inputSchema: tool.inputSchema ?? { type: "object", properties: {} },
|
|
10874
|
+
execute: async (args, context) => {
|
|
10875
|
+
const signal = options.signal ? AbortSignal.any([context.signal, options.signal]) : context.signal;
|
|
10876
|
+
signal.throwIfAborted();
|
|
10877
|
+
return webMCPResult(await tool.execute(args, { ...context, signal }));
|
|
10878
|
+
}
|
|
10879
|
+
};
|
|
10880
|
+
await this.installTools(namespace, { ...current, [tool.name]: callback });
|
|
10881
|
+
if (options.signal) {
|
|
10882
|
+
const abort = () => {
|
|
10883
|
+
void this.mutate(async () => {
|
|
10884
|
+
const installed = this.definitions.get(namespace);
|
|
10885
|
+
if (installed?.[tool.name] !== callback) return;
|
|
10886
|
+
const remaining = { ...installed };
|
|
10887
|
+
delete remaining[tool.name];
|
|
10888
|
+
if (Object.keys(remaining).length) await this.installTools(namespace, remaining);
|
|
10889
|
+
else await this.uninstallTools(namespace);
|
|
10890
|
+
}).catch((error) => {
|
|
10891
|
+
if (!this.signal.aborted) this.report(error);
|
|
10892
|
+
});
|
|
10893
|
+
};
|
|
10894
|
+
this.registrationCleanups.set(callback, () => {
|
|
10895
|
+
options.signal.removeEventListener("abort", abort);
|
|
10896
|
+
this.registrationCleanups.delete(callback);
|
|
10897
|
+
});
|
|
10898
|
+
options.signal.addEventListener("abort", abort, { once: true });
|
|
10899
|
+
if (options.signal.aborted) abort();
|
|
10900
|
+
}
|
|
10901
|
+
});
|
|
10902
|
+
}
|
|
10903
|
+
install(namespace, tools) {
|
|
10904
|
+
return this.mutate(() => this.installTools(namespace, tools));
|
|
10905
|
+
}
|
|
10906
|
+
async installTools(namespace, tools) {
|
|
10907
|
+
const prefix = `clientmcp_${namespace}_`;
|
|
10908
|
+
const registrations = Object.entries(tools).map(([name, tool]) => [prefix + name.replaceAll(".", "_"), tool]);
|
|
10909
|
+
const names = new Set(registrations.map(([name]) => name));
|
|
10910
|
+
if (names.size !== registrations.length) throw new Error("Duplicate client MCP tool names after normalization");
|
|
10911
|
+
for (const [installed, registered] of this.installations) {
|
|
10912
|
+
if (installed !== namespace && [...names].some((name) => registered.has(name))) throw new Error("Client MCP tool name already registered");
|
|
10913
|
+
}
|
|
10914
|
+
const previous = new Map(registrations.map(([name]) => [name, this.callbacks.get(name)]));
|
|
10915
|
+
for (const [name, tool] of registrations) this.callbacks.set(name, tool);
|
|
10916
|
+
try {
|
|
10917
|
+
const installation = await request2(this.api.installAgentSessionClientMcp({ sessionId: this.sessionId, namespace, requestBody: {
|
|
10918
|
+
tools: Object.entries(tools).map(([name, tool]) => ({ name, description: tool.description, inputSchema: tool.inputSchema }))
|
|
10919
|
+
} }), this.signal);
|
|
10920
|
+
for (const name of this.installations.get(namespace) ?? []) if (!names.has(name)) this.callbacks.delete(name);
|
|
10921
|
+
for (const [name, old] of Object.entries(this.definitions.get(namespace) ?? {})) {
|
|
10922
|
+
if (tools[name] !== old) this.registrationCleanups.get(old)?.();
|
|
10923
|
+
}
|
|
10924
|
+
this.installations.set(namespace, names);
|
|
10925
|
+
this.definitions.set(namespace, { ...tools });
|
|
10926
|
+
return installation;
|
|
10927
|
+
} catch (error) {
|
|
10928
|
+
for (const [name, callback] of previous) {
|
|
10929
|
+
if (callback) this.callbacks.set(name, callback);
|
|
10930
|
+
else this.callbacks.delete(name);
|
|
10931
|
+
}
|
|
10932
|
+
throw error;
|
|
10933
|
+
}
|
|
10934
|
+
}
|
|
10935
|
+
uninstall(namespace) {
|
|
10936
|
+
return this.mutate(() => this.uninstallTools(namespace));
|
|
10937
|
+
}
|
|
10938
|
+
async uninstallTools(namespace) {
|
|
10939
|
+
await request2(this.api.uninstallAgentSessionClientMcp({ sessionId: this.sessionId, namespace }), this.signal);
|
|
10940
|
+
for (const name of this.installations.get(namespace) ?? []) this.callbacks.delete(name);
|
|
10941
|
+
for (const callback of Object.values(this.definitions.get(namespace) ?? {})) this.registrationCleanups.get(callback)?.();
|
|
10942
|
+
this.installations.delete(namespace);
|
|
10943
|
+
this.definitions.delete(namespace);
|
|
10944
|
+
}
|
|
10945
|
+
mutate(operation) {
|
|
10946
|
+
const result = this.mutation.then(operation);
|
|
10947
|
+
this.mutation = result.catch(() => void 0);
|
|
10948
|
+
return result;
|
|
10949
|
+
}
|
|
10950
|
+
/** Resolves after subscription ACK and canonical history catch-up. Reconnects automatically thereafter. */
|
|
10951
|
+
connect() {
|
|
10952
|
+
if (!this.connection) {
|
|
10953
|
+
this.connection = new Promise((resolve2, reject) => {
|
|
10954
|
+
void this.run(resolve2).then(() => reject(this.signal.reason ?? new Error("Client MCP bridge closed")), reject);
|
|
10955
|
+
});
|
|
10956
|
+
}
|
|
10957
|
+
return this.connection;
|
|
10958
|
+
}
|
|
10959
|
+
/** Stops communication and aborts callback signals. Installations remain for refresh/reconnect. */
|
|
10960
|
+
close() {
|
|
10961
|
+
this.controller.abort(new Error("Client MCP bridge closed"));
|
|
10962
|
+
this.socket?.close();
|
|
10963
|
+
for (const cleanup of this.registrationCleanups.values()) cleanup();
|
|
10964
|
+
}
|
|
10965
|
+
report(error) {
|
|
10966
|
+
if (this.options.onError) this.options.onError(asError(error));
|
|
10967
|
+
else console.error("Brazosd client MCP:", asError(error));
|
|
10968
|
+
}
|
|
10969
|
+
async run(ready) {
|
|
10970
|
+
let failures = 0;
|
|
10971
|
+
while (!this.signal.aborted) {
|
|
10972
|
+
try {
|
|
10973
|
+
await this.openSocket(() => {
|
|
10974
|
+
failures = 0;
|
|
10975
|
+
ready();
|
|
10976
|
+
});
|
|
10977
|
+
} catch (error) {
|
|
10978
|
+
if (this.signal.aborted) break;
|
|
10979
|
+
this.report(error);
|
|
10980
|
+
if (error instanceof SubscriptionRejected) throw error;
|
|
10981
|
+
await delay(Math.min(1e3 * 2 ** Math.min(failures++, 5), 3e4), this.signal);
|
|
10982
|
+
}
|
|
10983
|
+
}
|
|
10984
|
+
}
|
|
10985
|
+
async openSocket(ready) {
|
|
10986
|
+
const url = await this.socketURL();
|
|
10987
|
+
this.signal.throwIfAborted();
|
|
10988
|
+
const socket = this.options.webSocketFactory?.(url) ?? new WebSocket(url);
|
|
10989
|
+
this.socket = socket;
|
|
10990
|
+
const connection = new AbortController();
|
|
10991
|
+
const signal = AbortSignal.any([this.signal, connection.signal]);
|
|
10992
|
+
const topic = `agent_session_events:${this.sessionId}`;
|
|
10993
|
+
this.buffer = [];
|
|
10994
|
+
return new Promise((resolve2, reject) => {
|
|
10995
|
+
let ended = false;
|
|
10996
|
+
let pingPending = false;
|
|
10997
|
+
let heartbeat;
|
|
10998
|
+
const timeout = setTimeout(() => finish(new Error("Client MCP subscription timed out")), 15e3);
|
|
10999
|
+
const finish = (error) => {
|
|
11000
|
+
if (ended) return;
|
|
11001
|
+
ended = true;
|
|
11002
|
+
this.online = false;
|
|
11003
|
+
clearTimeout(timeout);
|
|
11004
|
+
clearInterval(heartbeat);
|
|
11005
|
+
this.signal.removeEventListener("abort", abort);
|
|
11006
|
+
connection.abort();
|
|
11007
|
+
socket.close();
|
|
11008
|
+
if (error) reject(error);
|
|
11009
|
+
else resolve2();
|
|
11010
|
+
};
|
|
11011
|
+
const abort = () => finish();
|
|
11012
|
+
this.signal.addEventListener("abort", abort, { once: true });
|
|
11013
|
+
socket.onopen = () => socket.send(JSON.stringify({ id: "client-mcp", type: "subscribe", payload: { subscribe: { topic } } }));
|
|
11014
|
+
socket.onclose = () => finish(new Error("Client MCP websocket disconnected"));
|
|
11015
|
+
socket.onerror = () => finish(new Error("Client MCP websocket error"));
|
|
11016
|
+
socket.onmessage = (event) => {
|
|
11017
|
+
if (ended) return;
|
|
11018
|
+
try {
|
|
11019
|
+
const frame = JSON.parse(String(event.data));
|
|
11020
|
+
if (frame.type === "ping") {
|
|
11021
|
+
pingPending = false;
|
|
11022
|
+
return;
|
|
11023
|
+
}
|
|
11024
|
+
if (frame.type === "error") {
|
|
11025
|
+
const message = frame.payload?.error?.msg ?? "Client MCP subscription failed";
|
|
11026
|
+
finish(frame.payload?.error?.retryable === false ? new SubscriptionRejected(message) : new Error(message));
|
|
11027
|
+
} else if (frame.type === "success" && frame.id === "client-mcp") {
|
|
11028
|
+
clearTimeout(timeout);
|
|
11029
|
+
heartbeat = setInterval(() => {
|
|
11030
|
+
if (pingPending) {
|
|
11031
|
+
finish(new Error("Client MCP heartbeat timed out"));
|
|
11032
|
+
return;
|
|
11033
|
+
}
|
|
11034
|
+
pingPending = true;
|
|
11035
|
+
socket.send(JSON.stringify({ id: "heartbeat", type: "ping" }));
|
|
11036
|
+
}, 15e3);
|
|
11037
|
+
void this.synchronize(signal, true).then(() => {
|
|
11038
|
+
if (ended) return;
|
|
11039
|
+
this.online = true;
|
|
11040
|
+
this.dispatch();
|
|
11041
|
+
ready();
|
|
11042
|
+
}, (error) => finish(asError(error)));
|
|
11043
|
+
} else if (frame.type === "event") {
|
|
11044
|
+
const event2 = frame.payload?.event;
|
|
11045
|
+
if (event2?.topic === "agent_session_events" && event2.data?.sessionId === this.sessionId) {
|
|
11046
|
+
this.buffer.push(event2.data);
|
|
11047
|
+
if (this.buffer.length > 4096) {
|
|
11048
|
+
this.buffer = [];
|
|
11049
|
+
this.catchUp = true;
|
|
11050
|
+
}
|
|
11051
|
+
if (this.online) void this.synchronize(signal).catch((error) => finish(asError(error)));
|
|
11052
|
+
} else if (event2?.topic === "realtime_resync") {
|
|
11053
|
+
if (event2.data?.resubscribe && event2.data?.topics?.includes(topic)) {
|
|
11054
|
+
finish(new Error("Client MCP event reader requires resubscription"));
|
|
11055
|
+
} else {
|
|
11056
|
+
void this.synchronize(signal, true).catch((error) => finish(asError(error)));
|
|
11057
|
+
}
|
|
11058
|
+
}
|
|
11059
|
+
}
|
|
11060
|
+
} catch (error) {
|
|
11061
|
+
finish(asError(error));
|
|
11062
|
+
}
|
|
11063
|
+
};
|
|
11064
|
+
if (this.signal.aborted) finish();
|
|
11065
|
+
});
|
|
11066
|
+
}
|
|
11067
|
+
synchronize(signal, catchUp = false) {
|
|
11068
|
+
this.catchUp ||= catchUp;
|
|
11069
|
+
if (this.syncing) return this.syncing;
|
|
11070
|
+
this.syncing = (async () => {
|
|
11071
|
+
do {
|
|
11072
|
+
if (this.catchUp) {
|
|
11073
|
+
this.catchUp = false;
|
|
11074
|
+
await this.loadHistory(signal);
|
|
11075
|
+
}
|
|
11076
|
+
const events = this.buffer.splice(0).sort((a, b) => (a.serialNumber ?? 0) - (b.serialNumber ?? 0));
|
|
11077
|
+
for (const event of events) {
|
|
11078
|
+
if (event.sessionId !== this.sessionId || !event.serialNumber) continue;
|
|
11079
|
+
if (event.serialNumber > this.cursor + 1) await this.loadHistory(signal);
|
|
11080
|
+
if (event.serialNumber > this.cursor + 1) throw new Error("Gap in client MCP session history");
|
|
11081
|
+
this.consume(event);
|
|
11082
|
+
}
|
|
11083
|
+
} while (this.buffer.length || this.catchUp);
|
|
11084
|
+
})().finally(() => {
|
|
11085
|
+
this.syncing = void 0;
|
|
11086
|
+
});
|
|
11087
|
+
return this.syncing.then(() => {
|
|
11088
|
+
if (this.buffer.length || this.catchUp) return this.synchronize(signal);
|
|
11089
|
+
this.dispatch();
|
|
11090
|
+
});
|
|
11091
|
+
}
|
|
11092
|
+
async loadHistory(signal) {
|
|
11093
|
+
for (; ; ) {
|
|
11094
|
+
const events = await request2(this.api.getAgentSessionEvents({ sessionId: this.sessionId, from: this.cursor + 1, limit: pageSize }), signal);
|
|
11095
|
+
signal.throwIfAborted();
|
|
11096
|
+
const before = this.cursor;
|
|
11097
|
+
for (const event of events) this.consume(event);
|
|
11098
|
+
if (events.length < pageSize) return;
|
|
11099
|
+
if (this.cursor <= before) throw new Error("Session history did not advance");
|
|
11100
|
+
}
|
|
11101
|
+
}
|
|
11102
|
+
consume(event) {
|
|
11103
|
+
if (event.sessionId !== this.sessionId || !event.serialNumber || event.serialNumber <= this.cursor) return;
|
|
11104
|
+
this.cursor = event.serialNumber;
|
|
11105
|
+
if (event.eventType === "session_archived" || event.eventType === "session_forked" && event.event.forkedSessionId === this.sessionId) {
|
|
11106
|
+
for (const key2 of this.pending.keys()) this.complete(key2);
|
|
11107
|
+
return;
|
|
11108
|
+
}
|
|
11109
|
+
if (!event.runId) return;
|
|
11110
|
+
if (["agent_end", "interrupt", "run_stopped"].includes(event.eventType)) {
|
|
11111
|
+
for (const [key2, call] of this.pending) if (call.context.runId === event.runId) this.complete(key2);
|
|
11112
|
+
return;
|
|
11113
|
+
}
|
|
11114
|
+
const data = event.event;
|
|
11115
|
+
if (typeof data.toolCallId !== "string") return;
|
|
11116
|
+
const key = `${this.sessionId}:${event.runId}:${data.toolCallId}`;
|
|
11117
|
+
if (["tool_result", "tool_execution_end"].includes(event.eventType)) {
|
|
11118
|
+
if (this.pending.has(key) || String(data.toolName).startsWith("clientmcp_")) this.complete(key);
|
|
11119
|
+
return;
|
|
11120
|
+
}
|
|
11121
|
+
if (event.eventType !== "tool_execution_start" || typeof data.toolName !== "string" || !data.toolName.startsWith("clientmcp_") || this.receipts.has(key) || this.pending.has(key)) return;
|
|
11122
|
+
const controller = new AbortController();
|
|
11123
|
+
this.pending.set(key, { controller, running: false, args: data.args ?? {}, context: {
|
|
11124
|
+
sessionId: this.sessionId,
|
|
11125
|
+
runId: event.runId,
|
|
11126
|
+
toolCallId: data.toolCallId,
|
|
11127
|
+
toolName: data.toolName,
|
|
11128
|
+
idempotencyKey: key,
|
|
11129
|
+
signal: AbortSignal.any([this.signal, controller.signal])
|
|
11130
|
+
} });
|
|
11131
|
+
}
|
|
11132
|
+
complete(key) {
|
|
11133
|
+
this.pending.get(key)?.controller.abort(new Error("Client MCP call completed"));
|
|
11134
|
+
this.pending.delete(key);
|
|
11135
|
+
this.receipts.add(key);
|
|
11136
|
+
while (this.receipts.size > receiptLimit) this.receipts.delete(this.receipts.values().next().value);
|
|
11137
|
+
if (this.options.storage) {
|
|
11138
|
+
try {
|
|
11139
|
+
this.options.storage.setItem(this.storageKey, JSON.stringify([...this.receipts]));
|
|
11140
|
+
} catch (error) {
|
|
11141
|
+
this.report(error);
|
|
11142
|
+
}
|
|
11143
|
+
}
|
|
11144
|
+
}
|
|
11145
|
+
dispatch() {
|
|
11146
|
+
if (!this.online || this.syncing || this.signal.aborted) return;
|
|
11147
|
+
for (const call of this.pending.values()) {
|
|
11148
|
+
if (call.running) continue;
|
|
11149
|
+
call.running = true;
|
|
11150
|
+
void this.execute(call).catch((error) => {
|
|
11151
|
+
if (!call.context.signal.aborted) this.report(error);
|
|
11152
|
+
});
|
|
11153
|
+
}
|
|
11154
|
+
}
|
|
11155
|
+
async execute(call) {
|
|
11156
|
+
const { context } = call;
|
|
11157
|
+
let result;
|
|
11158
|
+
const callback = this.callbacks.get(context.toolName);
|
|
11159
|
+
try {
|
|
11160
|
+
result = callback ? await callback.execute(call.args, context) : errorResult(`CLIENT_MCP_CALLBACK_NOT_REGISTERED: ${context.toolName}`);
|
|
11161
|
+
if (!result || !Array.isArray(result.content)) throw new Error("Callback must return an MCP result with a content array");
|
|
11162
|
+
result = JSON.parse(JSON.stringify(result));
|
|
11163
|
+
} catch (error) {
|
|
11164
|
+
if (context.signal.aborted) return;
|
|
11165
|
+
result = errorResult(`CLIENT_MCP_CALLBACK_ERROR: ${asError(error).message}`);
|
|
11166
|
+
}
|
|
11167
|
+
let failures = 0;
|
|
11168
|
+
let invalidResult = false;
|
|
11169
|
+
while (!context.signal.aborted) {
|
|
11170
|
+
try {
|
|
11171
|
+
await request2(this.api.submitAgentSessionClientMcpResult({ sessionId: this.sessionId, runId: context.runId, toolCallId: context.toolCallId, requestBody: result }), context.signal);
|
|
11172
|
+
this.complete(context.idempotencyKey);
|
|
11173
|
+
return;
|
|
11174
|
+
} catch (error) {
|
|
11175
|
+
if (context.signal.aborted) return;
|
|
11176
|
+
if (error instanceof BrazosdError && error.status === 409) {
|
|
11177
|
+
this.complete(context.idempotencyKey);
|
|
11178
|
+
return;
|
|
11179
|
+
}
|
|
11180
|
+
this.report(error);
|
|
11181
|
+
if (error instanceof BrazosdError && error.status === 400 && !invalidResult) {
|
|
11182
|
+
invalidResult = true;
|
|
11183
|
+
result = errorResult("CLIENT_MCP_INVALID_RESULT: the callback returned an invalid MCP result");
|
|
11184
|
+
continue;
|
|
11185
|
+
}
|
|
11186
|
+
if (error instanceof BrazosdError && error.status >= 400 && error.status < 500 && ![401, 408, 429].includes(error.status)) return;
|
|
11187
|
+
await delay(Math.min(500 * 2 ** Math.min(failures++, 6), 3e4), context.signal);
|
|
11188
|
+
}
|
|
11189
|
+
}
|
|
11190
|
+
}
|
|
11191
|
+
};
|
|
11192
|
+
var SubscriptionRejected = class extends Error {
|
|
11193
|
+
};
|
|
11194
|
+
|
|
11195
|
+
// src/client.ts
|
|
11196
|
+
var BrazosdClient = class {
|
|
11197
|
+
api;
|
|
11198
|
+
anclax;
|
|
11199
|
+
serverless;
|
|
11200
|
+
socketURL;
|
|
11201
|
+
signal;
|
|
11202
|
+
constructor(options = {}) {
|
|
11203
|
+
const context = {
|
|
11204
|
+
...options,
|
|
11205
|
+
apiUrl: options.apiUrl ? apiURL(options.apiUrl) : void 0,
|
|
11206
|
+
credentials: options.credentials ?? (() => {
|
|
11207
|
+
throw new Error("Provide a Brazosd credential provider");
|
|
11208
|
+
})
|
|
11209
|
+
};
|
|
11210
|
+
this.api = new ApiClient({}, createRequest(context, "api")).default;
|
|
11211
|
+
this.anclax = new AnclaxClient({}, createRequest(context, "anclax")).default;
|
|
11212
|
+
this.serverless = new ServerlessClient({}, createRequest(context, "serverless")).default;
|
|
11213
|
+
this.socketURL = () => realtimeURL(context);
|
|
11214
|
+
this.signal = options.signal;
|
|
11215
|
+
}
|
|
11216
|
+
clientMCP(sessionId, options = {}) {
|
|
11217
|
+
return new ClientMCPBridge(this.api, sessionId, this.socketURL, {
|
|
11218
|
+
...options,
|
|
11219
|
+
signal: this.signal && options.signal ? AbortSignal.any([this.signal, options.signal]) : options.signal ?? this.signal
|
|
11220
|
+
});
|
|
11221
|
+
}
|
|
11222
|
+
};
|
|
11223
|
+
|
|
11224
|
+
// src/credentials.ts
|
|
11225
|
+
import { readFile } from "node:fs/promises";
|
|
11226
|
+
var DEFAULT_CREDENTIALS_FILE = "/run/brazosd/identity/credentials.json";
|
|
11227
|
+
function fileCredentials(path = DEFAULT_CREDENTIALS_FILE) {
|
|
11228
|
+
let cached;
|
|
11229
|
+
let cacheUntil = 0;
|
|
11230
|
+
let pending;
|
|
11231
|
+
return () => {
|
|
11232
|
+
if (cached && Date.now() < cacheUntil) return Promise.resolve(cached);
|
|
11233
|
+
if (!pending) {
|
|
11234
|
+
pending = readFile(path, "utf8").then((raw) => {
|
|
11235
|
+
const value = JSON.parse(raw);
|
|
11236
|
+
const expiresAt = Date.parse(value.expiresAt);
|
|
11237
|
+
if (typeof value.accessToken !== "string" || !value.accessToken || !Number.isFinite(expiresAt) || expiresAt <= Date.now()) {
|
|
11238
|
+
throw new Error("Brazosd instance credentials are missing or expired");
|
|
11239
|
+
}
|
|
11240
|
+
cached = { accessToken: value.accessToken, apiUrl: value.apiUrl, expiresAt: value.expiresAt };
|
|
11241
|
+
cacheUntil = Math.min(Date.now() + 1e3, expiresAt);
|
|
11242
|
+
return cached;
|
|
11243
|
+
}).finally(() => {
|
|
11244
|
+
pending = void 0;
|
|
11245
|
+
});
|
|
11246
|
+
}
|
|
11247
|
+
return pending;
|
|
11248
|
+
};
|
|
11249
|
+
}
|
|
11250
|
+
|
|
9785
11251
|
// src/sso.ts
|
|
9786
11252
|
import { createCipheriv, createDecipheriv, createHash, randomBytes, timingSafeEqual } from "node:crypto";
|
|
9787
11253
|
import { join } from "node:path";
|
|
@@ -9968,7 +11434,7 @@ var BrazosdSSO = class {
|
|
|
9968
11434
|
if (mode !== "identity" && mode !== "org-user") throw new Error("Invalid SSO mode");
|
|
9969
11435
|
const state = randomBytes(32).toString("base64url");
|
|
9970
11436
|
const verifier = randomBytes(32).toString("base64url");
|
|
9971
|
-
const
|
|
11437
|
+
const request3 = await this.service.api.createSsoRequest({ requestBody: {
|
|
9972
11438
|
appId: this.options.appId,
|
|
9973
11439
|
redirectUri: this.options.redirectUri,
|
|
9974
11440
|
mode,
|
|
@@ -9977,8 +11443,8 @@ var BrazosdSSO = class {
|
|
|
9977
11443
|
} });
|
|
9978
11444
|
const authorization = new URL(mode === "org-user" ? "/sso/" : "/sso_jwt/", this.options.webUrl ?? "https://brazosd.com");
|
|
9979
11445
|
if (!["http:", "https:"].includes(authorization.protocol) || authorization.username || authorization.password) throw new Error("Invalid SSO frontend URL");
|
|
9980
|
-
authorization.searchParams.set("request_id",
|
|
9981
|
-
const expiresAt = Date.parse(
|
|
11446
|
+
authorization.searchParams.set("request_id", request3.id);
|
|
11447
|
+
const expiresAt = Date.parse(request3.expiresAt);
|
|
9982
11448
|
return { authorizationUrl: authorization.href, setCookie: this.cookie(state, this.seal({ state, verifier, mode, expiresAt }), Math.max(0, Math.floor((expiresAt - Date.now()) / 1e3))) };
|
|
9983
11449
|
}
|
|
9984
11450
|
/** Call only on the registered callback. Persist returned tokens in the application's server-side session store. */
|
|
@@ -10068,30 +11534,21 @@ function createSSO(options) {
|
|
|
10068
11534
|
}
|
|
10069
11535
|
|
|
10070
11536
|
// src/index.ts
|
|
10071
|
-
var
|
|
10072
|
-
api;
|
|
10073
|
-
anclax;
|
|
10074
|
-
serverless;
|
|
11537
|
+
var BrazosdClient2 = class extends BrazosdClient {
|
|
10075
11538
|
constructor(options = {}) {
|
|
10076
|
-
|
|
10077
|
-
...options,
|
|
10078
|
-
apiUrl: options.apiUrl ? apiURL(options.apiUrl) : void 0,
|
|
10079
|
-
credentials: options.credentials ?? fileCredentials(options.credentialsFile)
|
|
10080
|
-
};
|
|
10081
|
-
this.api = new ApiClient({}, createRequest(context, "api")).default;
|
|
10082
|
-
this.anclax = new AnclaxClient({}, createRequest(context, "anclax")).default;
|
|
10083
|
-
this.serverless = new ServerlessClient({}, createRequest(context, "serverless")).default;
|
|
11539
|
+
super({ ...options, credentials: options.credentials ?? fileCredentials(options.credentialsFile) });
|
|
10084
11540
|
}
|
|
10085
11541
|
};
|
|
10086
11542
|
function createClient(options) {
|
|
10087
|
-
return new
|
|
11543
|
+
return new BrazosdClient2(options);
|
|
10088
11544
|
}
|
|
10089
11545
|
export {
|
|
10090
|
-
BrazosdClient,
|
|
11546
|
+
BrazosdClient2 as BrazosdClient,
|
|
10091
11547
|
BrazosdError,
|
|
10092
11548
|
BrazosdSSO,
|
|
10093
11549
|
CancelError,
|
|
10094
11550
|
CancelablePromise,
|
|
11551
|
+
ClientMCPBridge,
|
|
10095
11552
|
DEFAULT_CREDENTIALS_FILE,
|
|
10096
11553
|
SQLiteSSOKeyCache,
|
|
10097
11554
|
SSOIdentityVerifier,
|