@agentrun/sdk 0.0.2-test.21112675887 → 0.0.2-test.21114009592
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +530 -682
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -13
- package/dist/index.d.ts +1 -13
- package/dist/index.js +530 -682
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -250,6 +250,80 @@ var init_exception = __esm({
|
|
|
250
250
|
}
|
|
251
251
|
});
|
|
252
252
|
|
|
253
|
+
// src/utils/model.ts
|
|
254
|
+
function isFinalStatus(status) {
|
|
255
|
+
return [
|
|
256
|
+
void 0,
|
|
257
|
+
null,
|
|
258
|
+
"",
|
|
259
|
+
...[
|
|
260
|
+
"READY",
|
|
261
|
+
"CREATE_FAILED",
|
|
262
|
+
"UPDATE_FAILED",
|
|
263
|
+
"DELETE_FAILED"
|
|
264
|
+
]
|
|
265
|
+
].includes(status);
|
|
266
|
+
}
|
|
267
|
+
var Status, NetworkMode;
|
|
268
|
+
var init_model = __esm({
|
|
269
|
+
"src/utils/model.ts"() {
|
|
270
|
+
Status = {
|
|
271
|
+
CREATING: "CREATING",
|
|
272
|
+
CREATE_FAILED: "CREATE_FAILED",
|
|
273
|
+
READY: "READY",
|
|
274
|
+
UPDATING: "UPDATING",
|
|
275
|
+
UPDATE_FAILED: "UPDATE_FAILED",
|
|
276
|
+
DELETING: "DELETING",
|
|
277
|
+
DELETE_FAILED: "DELETE_FAILED"
|
|
278
|
+
};
|
|
279
|
+
NetworkMode = {
|
|
280
|
+
PUBLIC: "PUBLIC",
|
|
281
|
+
PRIVATE: "PRIVATE",
|
|
282
|
+
PUBLIC_AND_PRIVATE: "PUBLIC_AND_PRIVATE"
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
});
|
|
286
|
+
|
|
287
|
+
// src/utils/control-api.ts
|
|
288
|
+
var control_api_exports = {};
|
|
289
|
+
__export(control_api_exports, {
|
|
290
|
+
$AgentRun: () => $AgentRun3,
|
|
291
|
+
ControlAPI: () => ControlAPI
|
|
292
|
+
});
|
|
293
|
+
var $AgentRunClient, ControlAPI;
|
|
294
|
+
var init_control_api = __esm({
|
|
295
|
+
"src/utils/control-api.ts"() {
|
|
296
|
+
init_config();
|
|
297
|
+
$AgentRunClient = // @ts-expect-error - ESM interop: default.default exists when imported as ESM namespace
|
|
298
|
+
$AgentRun3.default?.default ?? $AgentRun3.default ?? $AgentRun3;
|
|
299
|
+
ControlAPI = class {
|
|
300
|
+
config;
|
|
301
|
+
constructor(config2) {
|
|
302
|
+
this.config = config2;
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Get the underlying AgentRun client instance
|
|
306
|
+
*/
|
|
307
|
+
getClient(config2) {
|
|
308
|
+
const cfg = Config.withConfigs(this.config, config2);
|
|
309
|
+
let endpoint = cfg.controlEndpoint;
|
|
310
|
+
if (endpoint.startsWith("http://") || endpoint.startsWith("https://")) {
|
|
311
|
+
endpoint = endpoint.split("://")[1];
|
|
312
|
+
}
|
|
313
|
+
const openApiConfig = new $OpenApi.Config({
|
|
314
|
+
accessKeyId: cfg.accessKeyId,
|
|
315
|
+
accessKeySecret: cfg.accessKeySecret,
|
|
316
|
+
securityToken: cfg.securityToken || void 0,
|
|
317
|
+
regionId: cfg.regionId,
|
|
318
|
+
endpoint,
|
|
319
|
+
connectTimeout: cfg.timeout
|
|
320
|
+
});
|
|
321
|
+
return new $AgentRunClient(openApiConfig);
|
|
322
|
+
}
|
|
323
|
+
};
|
|
324
|
+
}
|
|
325
|
+
});
|
|
326
|
+
|
|
253
327
|
// src/utils/log.ts
|
|
254
328
|
var LOG_LEVELS, COLORS, Logger, logger;
|
|
255
329
|
var init_log = __esm({
|
|
@@ -448,89 +522,6 @@ ${msg}
|
|
|
448
522
|
}
|
|
449
523
|
}
|
|
450
524
|
});
|
|
451
|
-
|
|
452
|
-
// src/utils/model.ts
|
|
453
|
-
function isFinalStatus(status) {
|
|
454
|
-
return [
|
|
455
|
-
void 0,
|
|
456
|
-
null,
|
|
457
|
-
"",
|
|
458
|
-
...[
|
|
459
|
-
"READY",
|
|
460
|
-
"CREATE_FAILED",
|
|
461
|
-
"UPDATE_FAILED",
|
|
462
|
-
"DELETE_FAILED"
|
|
463
|
-
]
|
|
464
|
-
].includes(status);
|
|
465
|
-
}
|
|
466
|
-
function fromInnerObject(obj, extra) {
|
|
467
|
-
logger.debug(
|
|
468
|
-
"before parse object obj=%s, extra=%s",
|
|
469
|
-
JSON.stringify(obj),
|
|
470
|
-
"null"
|
|
471
|
-
);
|
|
472
|
-
return obj;
|
|
473
|
-
}
|
|
474
|
-
var Status, NetworkMode;
|
|
475
|
-
var init_model = __esm({
|
|
476
|
-
"src/utils/model.ts"() {
|
|
477
|
-
init_log();
|
|
478
|
-
Status = {
|
|
479
|
-
CREATING: "CREATING",
|
|
480
|
-
CREATE_FAILED: "CREATE_FAILED",
|
|
481
|
-
READY: "READY",
|
|
482
|
-
UPDATING: "UPDATING",
|
|
483
|
-
UPDATE_FAILED: "UPDATE_FAILED",
|
|
484
|
-
DELETING: "DELETING",
|
|
485
|
-
DELETE_FAILED: "DELETE_FAILED"
|
|
486
|
-
};
|
|
487
|
-
NetworkMode = {
|
|
488
|
-
PUBLIC: "PUBLIC",
|
|
489
|
-
PRIVATE: "PRIVATE",
|
|
490
|
-
PUBLIC_AND_PRIVATE: "PUBLIC_AND_PRIVATE"
|
|
491
|
-
};
|
|
492
|
-
}
|
|
493
|
-
});
|
|
494
|
-
|
|
495
|
-
// src/utils/control-api.ts
|
|
496
|
-
var control_api_exports = {};
|
|
497
|
-
__export(control_api_exports, {
|
|
498
|
-
$AgentRun: () => $AgentRun3,
|
|
499
|
-
ControlAPI: () => ControlAPI
|
|
500
|
-
});
|
|
501
|
-
var $AgentRunClient, ControlAPI;
|
|
502
|
-
var init_control_api = __esm({
|
|
503
|
-
"src/utils/control-api.ts"() {
|
|
504
|
-
init_config();
|
|
505
|
-
$AgentRunClient = // @ts-expect-error - ESM interop: default.default exists when imported as ESM namespace
|
|
506
|
-
$AgentRun3.default?.default ?? $AgentRun3.default ?? $AgentRun3;
|
|
507
|
-
ControlAPI = class {
|
|
508
|
-
config;
|
|
509
|
-
constructor(config2) {
|
|
510
|
-
this.config = config2;
|
|
511
|
-
}
|
|
512
|
-
/**
|
|
513
|
-
* Get the underlying AgentRun client instance
|
|
514
|
-
*/
|
|
515
|
-
getClient(config2) {
|
|
516
|
-
const cfg = Config.withConfigs(this.config, config2);
|
|
517
|
-
let endpoint = cfg.controlEndpoint;
|
|
518
|
-
if (endpoint.startsWith("http://") || endpoint.startsWith("https://")) {
|
|
519
|
-
endpoint = endpoint.split("://")[1];
|
|
520
|
-
}
|
|
521
|
-
const openApiConfig = new $OpenApi.Config({
|
|
522
|
-
accessKeyId: cfg.accessKeyId,
|
|
523
|
-
accessKeySecret: cfg.accessKeySecret,
|
|
524
|
-
securityToken: cfg.securityToken || void 0,
|
|
525
|
-
regionId: cfg.regionId,
|
|
526
|
-
endpoint,
|
|
527
|
-
connectTimeout: cfg.timeout
|
|
528
|
-
});
|
|
529
|
-
return new $AgentRunClient(openApiConfig);
|
|
530
|
-
}
|
|
531
|
-
};
|
|
532
|
-
}
|
|
533
|
-
});
|
|
534
525
|
var AgentRuntimeControlAPI;
|
|
535
526
|
var init_control = __esm({
|
|
536
527
|
"src/agent-runtime/api/control.ts"() {
|
|
@@ -1657,7 +1648,6 @@ var AgentRuntimeEndpoint;
|
|
|
1657
1648
|
var init_endpoint = __esm({
|
|
1658
1649
|
"src/agent-runtime/endpoint.ts"() {
|
|
1659
1650
|
init_config();
|
|
1660
|
-
init_exception();
|
|
1661
1651
|
init_resource();
|
|
1662
1652
|
init_data();
|
|
1663
1653
|
AgentRuntimeEndpoint = class _AgentRuntimeEndpoint extends ResourceBase {
|
|
@@ -1693,100 +1683,56 @@ var init_endpoint = __esm({
|
|
|
1693
1683
|
*/
|
|
1694
1684
|
static async create(params) {
|
|
1695
1685
|
const { agentRuntimeId, input, config: config2 } = params;
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
throw error.toResourceError(
|
|
1702
|
-
"AgentRuntimeEndpoint",
|
|
1703
|
-
`${agentRuntimeId}/${input.agentRuntimeEndpointName}`
|
|
1704
|
-
);
|
|
1705
|
-
}
|
|
1706
|
-
throw error;
|
|
1707
|
-
}
|
|
1686
|
+
return await _AgentRuntimeEndpoint.getClient().createEndpoint({
|
|
1687
|
+
agentRuntimeId,
|
|
1688
|
+
input,
|
|
1689
|
+
config: config2
|
|
1690
|
+
});
|
|
1708
1691
|
}
|
|
1709
1692
|
/**
|
|
1710
1693
|
* Delete an endpoint by ID
|
|
1711
1694
|
*/
|
|
1712
1695
|
static async delete(params) {
|
|
1713
1696
|
const { agentRuntimeId, endpointId, config: config2 } = params;
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
config: config2
|
|
1720
|
-
});
|
|
1721
|
-
} catch (error) {
|
|
1722
|
-
if (error instanceof HTTPError) {
|
|
1723
|
-
throw error.toResourceError(
|
|
1724
|
-
"AgentRuntimeEndpoint",
|
|
1725
|
-
`${agentRuntimeId}/${endpointId}`
|
|
1726
|
-
);
|
|
1727
|
-
}
|
|
1728
|
-
throw error;
|
|
1729
|
-
}
|
|
1697
|
+
return await _AgentRuntimeEndpoint.getClient().deleteEndpoint({
|
|
1698
|
+
agentRuntimeId,
|
|
1699
|
+
endpointId,
|
|
1700
|
+
config: config2
|
|
1701
|
+
});
|
|
1730
1702
|
}
|
|
1731
1703
|
/**
|
|
1732
1704
|
* Update an endpoint by ID
|
|
1733
1705
|
*/
|
|
1734
1706
|
static async update(params) {
|
|
1735
1707
|
const { agentRuntimeId, endpointId, input, config: config2 } = params;
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
config: config2
|
|
1743
|
-
});
|
|
1744
|
-
} catch (error) {
|
|
1745
|
-
if (error instanceof HTTPError) {
|
|
1746
|
-
throw error.toResourceError(
|
|
1747
|
-
"AgentRuntimeEndpoint",
|
|
1748
|
-
`${agentRuntimeId}/${endpointId}`
|
|
1749
|
-
);
|
|
1750
|
-
}
|
|
1751
|
-
throw error;
|
|
1752
|
-
}
|
|
1708
|
+
return await _AgentRuntimeEndpoint.getClient().updateEndpoint({
|
|
1709
|
+
agentRuntimeId,
|
|
1710
|
+
endpointId,
|
|
1711
|
+
input,
|
|
1712
|
+
config: config2
|
|
1713
|
+
});
|
|
1753
1714
|
}
|
|
1754
1715
|
/**
|
|
1755
1716
|
* Get an endpoint by ID
|
|
1756
1717
|
*/
|
|
1757
1718
|
static async get(params) {
|
|
1758
1719
|
const { agentRuntimeId, endpointId, config: config2 } = params;
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
config: config2
|
|
1765
|
-
});
|
|
1766
|
-
} catch (error) {
|
|
1767
|
-
if (error instanceof HTTPError) {
|
|
1768
|
-
throw error.toResourceError(
|
|
1769
|
-
"AgentRuntimeEndpoint",
|
|
1770
|
-
`${agentRuntimeId}/${endpointId}`
|
|
1771
|
-
);
|
|
1772
|
-
}
|
|
1773
|
-
throw error;
|
|
1774
|
-
}
|
|
1720
|
+
return await _AgentRuntimeEndpoint.getClient().getEndpoint({
|
|
1721
|
+
agentRuntimeId,
|
|
1722
|
+
endpointId,
|
|
1723
|
+
config: config2
|
|
1724
|
+
});
|
|
1775
1725
|
}
|
|
1776
1726
|
/**
|
|
1777
1727
|
* List endpoints by Agent Runtime ID
|
|
1778
1728
|
*/
|
|
1779
1729
|
static async list(params) {
|
|
1780
1730
|
const { agentRuntimeId, input, config: config2 } = params;
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
throw error.toResourceError("AgentRuntime", agentRuntimeId);
|
|
1787
|
-
}
|
|
1788
|
-
throw error;
|
|
1789
|
-
}
|
|
1731
|
+
return await _AgentRuntimeEndpoint.getClient().listEndpoints({
|
|
1732
|
+
agentRuntimeId,
|
|
1733
|
+
input,
|
|
1734
|
+
config: config2
|
|
1735
|
+
});
|
|
1790
1736
|
}
|
|
1791
1737
|
static listAll = async (params) => {
|
|
1792
1738
|
const { agentRuntimeId, ...restParams } = params;
|
|
@@ -1937,7 +1883,6 @@ var AgentRuntime;
|
|
|
1937
1883
|
var init_runtime = __esm({
|
|
1938
1884
|
"src/agent-runtime/runtime.ts"() {
|
|
1939
1885
|
init_config();
|
|
1940
|
-
init_exception();
|
|
1941
1886
|
init_resource();
|
|
1942
1887
|
init_data();
|
|
1943
1888
|
init_endpoint();
|
|
@@ -1987,68 +1932,35 @@ var init_runtime = __esm({
|
|
|
1987
1932
|
*/
|
|
1988
1933
|
static async create(params) {
|
|
1989
1934
|
const { input, config: config2 } = params;
|
|
1990
|
-
|
|
1991
|
-
const client = _AgentRuntime.getClient();
|
|
1992
|
-
return await client.create({ input, config: config2 });
|
|
1993
|
-
} catch (error) {
|
|
1994
|
-
if (error instanceof HTTPError) {
|
|
1995
|
-
throw error.toResourceError("AgentRuntime", input.agentRuntimeName);
|
|
1996
|
-
}
|
|
1997
|
-
throw error;
|
|
1998
|
-
}
|
|
1935
|
+
return await _AgentRuntime.getClient().create({ input, config: config2 });
|
|
1999
1936
|
}
|
|
2000
1937
|
/**
|
|
2001
1938
|
* Delete an Agent Runtime by ID
|
|
2002
1939
|
*/
|
|
2003
1940
|
static async delete(params) {
|
|
2004
1941
|
const { id, config: config2 } = params;
|
|
2005
|
-
|
|
2006
|
-
const client = _AgentRuntime.getClient();
|
|
2007
|
-
return await client.delete({ id, config: config2 });
|
|
2008
|
-
} catch (error) {
|
|
2009
|
-
if (error instanceof HTTPError) {
|
|
2010
|
-
throw error.toResourceError("AgentRuntime", id);
|
|
2011
|
-
}
|
|
2012
|
-
throw error;
|
|
2013
|
-
}
|
|
1942
|
+
return await _AgentRuntime.getClient().delete({ id, config: config2 });
|
|
2014
1943
|
}
|
|
2015
1944
|
/**
|
|
2016
1945
|
* Update an Agent Runtime by ID
|
|
2017
1946
|
*/
|
|
2018
1947
|
static async update(params) {
|
|
2019
1948
|
const { id, input, config: config2 } = params;
|
|
2020
|
-
|
|
2021
|
-
const client = _AgentRuntime.getClient();
|
|
2022
|
-
return await client.update({ id, input, config: config2 });
|
|
2023
|
-
} catch (error) {
|
|
2024
|
-
if (error instanceof HTTPError) {
|
|
2025
|
-
throw error.toResourceError("AgentRuntime", id);
|
|
2026
|
-
}
|
|
2027
|
-
throw error;
|
|
2028
|
-
}
|
|
1949
|
+
return await _AgentRuntime.getClient().update({ id, input, config: config2 });
|
|
2029
1950
|
}
|
|
2030
1951
|
/**
|
|
2031
1952
|
* Get an Agent Runtime by ID
|
|
2032
1953
|
*/
|
|
2033
1954
|
static async get(params) {
|
|
2034
1955
|
const { id, config: config2 } = params;
|
|
2035
|
-
|
|
2036
|
-
const client = _AgentRuntime.getClient();
|
|
2037
|
-
return await client.get({ id, config: config2 });
|
|
2038
|
-
} catch (error) {
|
|
2039
|
-
if (error instanceof HTTPError) {
|
|
2040
|
-
throw error.toResourceError("AgentRuntime", id);
|
|
2041
|
-
}
|
|
2042
|
-
throw error;
|
|
2043
|
-
}
|
|
1956
|
+
return await _AgentRuntime.getClient().get({ id, config: config2 });
|
|
2044
1957
|
}
|
|
2045
1958
|
/**
|
|
2046
1959
|
* List Agent Runtimes
|
|
2047
1960
|
*/
|
|
2048
1961
|
static async list(params) {
|
|
2049
1962
|
const { input, config: config2 } = params ?? {};
|
|
2050
|
-
|
|
2051
|
-
return await client.list({ input, config: config2 });
|
|
1963
|
+
return await _AgentRuntime.getClient().list({ input, config: config2 });
|
|
2052
1964
|
}
|
|
2053
1965
|
static listAll = listAllResourcesFunction(this.list);
|
|
2054
1966
|
/**
|
|
@@ -2244,6 +2156,7 @@ var AgentRuntimeClient;
|
|
|
2244
2156
|
var init_client = __esm({
|
|
2245
2157
|
"src/agent-runtime/client.ts"() {
|
|
2246
2158
|
init_config();
|
|
2159
|
+
init_exception();
|
|
2247
2160
|
init_model();
|
|
2248
2161
|
init_control();
|
|
2249
2162
|
init_data();
|
|
@@ -2263,39 +2176,46 @@ var init_client = __esm({
|
|
|
2263
2176
|
create = async (params) => {
|
|
2264
2177
|
const { input, config: config2 } = params;
|
|
2265
2178
|
const cfg = Config.withConfigs(this.config, config2);
|
|
2266
|
-
|
|
2267
|
-
input.networkConfiguration
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
if (input.
|
|
2271
|
-
input.
|
|
2272
|
-
|
|
2273
|
-
input.
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2179
|
+
try {
|
|
2180
|
+
if (!input.networkConfiguration) {
|
|
2181
|
+
input.networkConfiguration = {};
|
|
2182
|
+
}
|
|
2183
|
+
if (!input.artifactType) {
|
|
2184
|
+
if (input.codeConfiguration) {
|
|
2185
|
+
input.artifactType = AgentRuntimeArtifact.CODE;
|
|
2186
|
+
} else if (input.containerConfiguration) {
|
|
2187
|
+
input.artifactType = AgentRuntimeArtifact.CONTAINER;
|
|
2188
|
+
} else {
|
|
2189
|
+
throw new Error(
|
|
2190
|
+
"Either codeConfiguration or containerConfiguration must be provided"
|
|
2191
|
+
);
|
|
2192
|
+
}
|
|
2278
2193
|
}
|
|
2194
|
+
const result = await this.controlApi.createAgentRuntime({
|
|
2195
|
+
input: new $AgentRun3.CreateAgentRuntimeInput({
|
|
2196
|
+
...input,
|
|
2197
|
+
codeConfiguration: input.codeConfiguration ? new $AgentRun3.CodeConfiguration({
|
|
2198
|
+
...input.codeConfiguration
|
|
2199
|
+
}) : void 0,
|
|
2200
|
+
containerConfiguration: input.containerConfiguration ? new $AgentRun3.ContainerConfiguration({
|
|
2201
|
+
...input.containerConfiguration
|
|
2202
|
+
}) : void 0,
|
|
2203
|
+
networkConfiguration: input.networkConfiguration ? new $AgentRun3.NetworkConfiguration({
|
|
2204
|
+
networkMode: input.networkConfiguration.networkMode || NetworkMode.PUBLIC,
|
|
2205
|
+
securityGroupId: input.networkConfiguration.securityGroupId,
|
|
2206
|
+
vpcId: input.networkConfiguration.vpcId,
|
|
2207
|
+
vswitchIds: input.networkConfiguration.vSwitchIds
|
|
2208
|
+
}) : void 0
|
|
2209
|
+
}),
|
|
2210
|
+
config: cfg
|
|
2211
|
+
});
|
|
2212
|
+
return new AgentRuntime(result, cfg);
|
|
2213
|
+
} catch (error) {
|
|
2214
|
+
if (error instanceof HTTPError) {
|
|
2215
|
+
throw error.toResourceError("AgentRuntime", input.agentRuntimeName);
|
|
2216
|
+
}
|
|
2217
|
+
throw error;
|
|
2279
2218
|
}
|
|
2280
|
-
const result = await this.controlApi.createAgentRuntime({
|
|
2281
|
-
input: new $AgentRun3.CreateAgentRuntimeInput({
|
|
2282
|
-
...input,
|
|
2283
|
-
codeConfiguration: input.codeConfiguration ? new $AgentRun3.CodeConfiguration({
|
|
2284
|
-
...input.codeConfiguration
|
|
2285
|
-
}) : void 0,
|
|
2286
|
-
containerConfiguration: input.containerConfiguration ? new $AgentRun3.ContainerConfiguration({
|
|
2287
|
-
...input.containerConfiguration
|
|
2288
|
-
}) : void 0,
|
|
2289
|
-
networkConfiguration: input.networkConfiguration ? new $AgentRun3.NetworkConfiguration({
|
|
2290
|
-
networkMode: input.networkConfiguration.networkMode || NetworkMode.PUBLIC,
|
|
2291
|
-
securityGroupId: input.networkConfiguration.securityGroupId,
|
|
2292
|
-
vpcId: input.networkConfiguration.vpcId,
|
|
2293
|
-
vswitchIds: input.networkConfiguration.vSwitchIds
|
|
2294
|
-
}) : void 0
|
|
2295
|
-
}),
|
|
2296
|
-
config: cfg
|
|
2297
|
-
});
|
|
2298
|
-
return new AgentRuntime(result, cfg);
|
|
2299
2219
|
};
|
|
2300
2220
|
/**
|
|
2301
2221
|
* Delete an Agent Runtime
|
|
@@ -2303,29 +2223,36 @@ var init_client = __esm({
|
|
|
2303
2223
|
delete = async (params) => {
|
|
2304
2224
|
const { id, config: config2 } = params;
|
|
2305
2225
|
const cfg = Config.withConfigs(this.config, config2);
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
config: cfg
|
|
2316
|
-
});
|
|
2317
|
-
while (remaining.length > 0) {
|
|
2318
|
-
await new Promise((resolve) => setTimeout(resolve, 1e3));
|
|
2319
|
-
remaining = await this.listEndpoints({
|
|
2226
|
+
try {
|
|
2227
|
+
const endpoints = await this.listEndpoints({
|
|
2228
|
+
agentRuntimeId: id,
|
|
2229
|
+
config: cfg
|
|
2230
|
+
});
|
|
2231
|
+
for (const endpoint of endpoints) {
|
|
2232
|
+
await endpoint.delete({ config: cfg });
|
|
2233
|
+
}
|
|
2234
|
+
let remaining = await this.listEndpoints({
|
|
2320
2235
|
agentRuntimeId: id,
|
|
2321
2236
|
config: cfg
|
|
2322
2237
|
});
|
|
2238
|
+
while (remaining.length > 0) {
|
|
2239
|
+
await new Promise((resolve) => setTimeout(resolve, 1e3));
|
|
2240
|
+
remaining = await this.listEndpoints({
|
|
2241
|
+
agentRuntimeId: id,
|
|
2242
|
+
config: cfg
|
|
2243
|
+
});
|
|
2244
|
+
}
|
|
2245
|
+
const result = await this.controlApi.deleteAgentRuntime({
|
|
2246
|
+
agentId: id,
|
|
2247
|
+
config: cfg
|
|
2248
|
+
});
|
|
2249
|
+
return new AgentRuntime(result, cfg);
|
|
2250
|
+
} catch (error) {
|
|
2251
|
+
if (error instanceof HTTPError) {
|
|
2252
|
+
throw error.toResourceError("AgentRuntime", id);
|
|
2253
|
+
}
|
|
2254
|
+
throw error;
|
|
2323
2255
|
}
|
|
2324
|
-
const result = await this.controlApi.deleteAgentRuntime({
|
|
2325
|
-
agentId: id,
|
|
2326
|
-
config: cfg
|
|
2327
|
-
});
|
|
2328
|
-
return new AgentRuntime(result, cfg);
|
|
2329
2256
|
};
|
|
2330
2257
|
/**
|
|
2331
2258
|
* Update an Agent Runtime
|
|
@@ -2333,20 +2260,27 @@ var init_client = __esm({
|
|
|
2333
2260
|
update = async (params) => {
|
|
2334
2261
|
const { id, input, config: config2 } = params;
|
|
2335
2262
|
const cfg = Config.withConfigs(this.config, config2);
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2263
|
+
try {
|
|
2264
|
+
const result = await this.controlApi.updateAgentRuntime({
|
|
2265
|
+
agentId: id,
|
|
2266
|
+
input: new $AgentRun3.UpdateAgentRuntimeInput({
|
|
2267
|
+
...input,
|
|
2268
|
+
codeConfiguration: input.codeConfiguration ? new $AgentRun3.CodeConfiguration({
|
|
2269
|
+
...input.codeConfiguration
|
|
2270
|
+
}) : void 0,
|
|
2271
|
+
containerConfiguration: input.containerConfiguration ? new $AgentRun3.ContainerConfiguration({
|
|
2272
|
+
...input.containerConfiguration
|
|
2273
|
+
}) : void 0
|
|
2274
|
+
}),
|
|
2275
|
+
config: cfg
|
|
2276
|
+
});
|
|
2277
|
+
return new AgentRuntime(result, cfg);
|
|
2278
|
+
} catch (error) {
|
|
2279
|
+
if (error instanceof HTTPError) {
|
|
2280
|
+
throw error.toResourceError("AgentRuntime", id);
|
|
2281
|
+
}
|
|
2282
|
+
throw error;
|
|
2283
|
+
}
|
|
2350
2284
|
};
|
|
2351
2285
|
/**
|
|
2352
2286
|
* Get an Agent Runtime
|
|
@@ -2354,11 +2288,18 @@ var init_client = __esm({
|
|
|
2354
2288
|
get = async (params) => {
|
|
2355
2289
|
const { id, config: config2 } = params;
|
|
2356
2290
|
const cfg = Config.withConfigs(this.config, config2);
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2291
|
+
try {
|
|
2292
|
+
const result = await this.controlApi.getAgentRuntime({
|
|
2293
|
+
agentId: id,
|
|
2294
|
+
config: cfg
|
|
2295
|
+
});
|
|
2296
|
+
return new AgentRuntime(result, cfg);
|
|
2297
|
+
} catch (error) {
|
|
2298
|
+
if (error instanceof HTTPError) {
|
|
2299
|
+
throw error.toResourceError("AgentRuntime", id);
|
|
2300
|
+
}
|
|
2301
|
+
throw error;
|
|
2302
|
+
}
|
|
2362
2303
|
};
|
|
2363
2304
|
/**
|
|
2364
2305
|
* List Agent Runtimes
|
|
@@ -2395,16 +2336,26 @@ var init_client = __esm({
|
|
|
2395
2336
|
createEndpoint = async (params) => {
|
|
2396
2337
|
const { agentRuntimeId, input, config: config2 } = params;
|
|
2397
2338
|
const cfg = Config.withConfigs(this.config, config2);
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2339
|
+
try {
|
|
2340
|
+
const targetVersion = input.targetVersion || "LATEST";
|
|
2341
|
+
const result = await this.controlApi.createAgentRuntimeEndpoint({
|
|
2342
|
+
agentId: agentRuntimeId,
|
|
2343
|
+
input: new $AgentRun3.CreateAgentRuntimeEndpointInput({
|
|
2344
|
+
...input,
|
|
2345
|
+
targetVersion
|
|
2346
|
+
}),
|
|
2347
|
+
config: cfg
|
|
2348
|
+
});
|
|
2349
|
+
return new AgentRuntimeEndpoint(result, cfg);
|
|
2350
|
+
} catch (error) {
|
|
2351
|
+
if (error instanceof HTTPError) {
|
|
2352
|
+
throw error.toResourceError(
|
|
2353
|
+
"AgentRuntimeEndpoint",
|
|
2354
|
+
`${agentRuntimeId}/${input.agentRuntimeEndpointName}`
|
|
2355
|
+
);
|
|
2356
|
+
}
|
|
2357
|
+
throw error;
|
|
2358
|
+
}
|
|
2408
2359
|
};
|
|
2409
2360
|
/**
|
|
2410
2361
|
* Delete an endpoint
|
|
@@ -2412,12 +2363,22 @@ var init_client = __esm({
|
|
|
2412
2363
|
deleteEndpoint = async (params) => {
|
|
2413
2364
|
const { agentRuntimeId, endpointId, config: config2 } = params;
|
|
2414
2365
|
const cfg = Config.withConfigs(this.config, config2);
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2366
|
+
try {
|
|
2367
|
+
const result = await this.controlApi.deleteAgentRuntimeEndpoint({
|
|
2368
|
+
agentId: agentRuntimeId,
|
|
2369
|
+
endpointId,
|
|
2370
|
+
config: cfg
|
|
2371
|
+
});
|
|
2372
|
+
return new AgentRuntimeEndpoint(result, cfg);
|
|
2373
|
+
} catch (error) {
|
|
2374
|
+
if (error instanceof HTTPError) {
|
|
2375
|
+
throw error.toResourceError(
|
|
2376
|
+
"AgentRuntimeEndpoint",
|
|
2377
|
+
`${agentRuntimeId}/${endpointId}`
|
|
2378
|
+
);
|
|
2379
|
+
}
|
|
2380
|
+
throw error;
|
|
2381
|
+
}
|
|
2421
2382
|
};
|
|
2422
2383
|
/**
|
|
2423
2384
|
* Update an endpoint
|
|
@@ -2425,15 +2386,25 @@ var init_client = __esm({
|
|
|
2425
2386
|
updateEndpoint = async (params) => {
|
|
2426
2387
|
const { agentRuntimeId, endpointId, input, config: config2 } = params;
|
|
2427
2388
|
const cfg = Config.withConfigs(this.config, config2);
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2389
|
+
try {
|
|
2390
|
+
const result = await this.controlApi.updateAgentRuntimeEndpoint({
|
|
2391
|
+
agentId: agentRuntimeId,
|
|
2392
|
+
endpointId,
|
|
2393
|
+
input: new $AgentRun3.UpdateAgentRuntimeEndpointInput({
|
|
2394
|
+
...input
|
|
2395
|
+
}),
|
|
2396
|
+
config: cfg
|
|
2397
|
+
});
|
|
2398
|
+
return new AgentRuntimeEndpoint(result, cfg);
|
|
2399
|
+
} catch (error) {
|
|
2400
|
+
if (error instanceof HTTPError) {
|
|
2401
|
+
throw error.toResourceError(
|
|
2402
|
+
"AgentRuntimeEndpoint",
|
|
2403
|
+
`${agentRuntimeId}/${endpointId}`
|
|
2404
|
+
);
|
|
2405
|
+
}
|
|
2406
|
+
throw error;
|
|
2407
|
+
}
|
|
2437
2408
|
};
|
|
2438
2409
|
/**
|
|
2439
2410
|
* Get an endpoint
|
|
@@ -2441,12 +2412,22 @@ var init_client = __esm({
|
|
|
2441
2412
|
getEndpoint = async (params) => {
|
|
2442
2413
|
const { agentRuntimeId, endpointId, config: config2 } = params;
|
|
2443
2414
|
const cfg = Config.withConfigs(this.config, config2);
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2415
|
+
try {
|
|
2416
|
+
const result = await this.controlApi.getAgentRuntimeEndpoint({
|
|
2417
|
+
agentId: agentRuntimeId,
|
|
2418
|
+
endpointId,
|
|
2419
|
+
config: cfg
|
|
2420
|
+
});
|
|
2421
|
+
return new AgentRuntimeEndpoint(result, cfg);
|
|
2422
|
+
} catch (error) {
|
|
2423
|
+
if (error instanceof HTTPError) {
|
|
2424
|
+
throw error.toResourceError(
|
|
2425
|
+
"AgentRuntimeEndpoint",
|
|
2426
|
+
`${agentRuntimeId}/${endpointId}`
|
|
2427
|
+
);
|
|
2428
|
+
}
|
|
2429
|
+
throw error;
|
|
2430
|
+
}
|
|
2450
2431
|
};
|
|
2451
2432
|
/**
|
|
2452
2433
|
* List endpoints for an Agent Runtime
|
|
@@ -2454,17 +2435,24 @@ var init_client = __esm({
|
|
|
2454
2435
|
listEndpoints = async (params) => {
|
|
2455
2436
|
const { agentRuntimeId, input, config: config2 } = params;
|
|
2456
2437
|
const cfg = Config.withConfigs(this.config, config2);
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
(
|
|
2467
|
-
|
|
2438
|
+
try {
|
|
2439
|
+
const request = new $AgentRun3.ListAgentRuntimeEndpointsRequest({
|
|
2440
|
+
...input
|
|
2441
|
+
});
|
|
2442
|
+
const result = await this.controlApi.listAgentRuntimeEndpoints({
|
|
2443
|
+
agentId: agentRuntimeId,
|
|
2444
|
+
input: request,
|
|
2445
|
+
config: cfg
|
|
2446
|
+
});
|
|
2447
|
+
return (result.items || []).map(
|
|
2448
|
+
(item) => new AgentRuntimeEndpoint(item, cfg)
|
|
2449
|
+
);
|
|
2450
|
+
} catch (error) {
|
|
2451
|
+
if (error instanceof HTTPError) {
|
|
2452
|
+
throw error.toResourceError("AgentRuntime", agentRuntimeId);
|
|
2453
|
+
}
|
|
2454
|
+
throw error;
|
|
2455
|
+
}
|
|
2468
2456
|
};
|
|
2469
2457
|
/**
|
|
2470
2458
|
* List versions for an Agent Runtime
|
|
@@ -2555,21 +2543,14 @@ var init_client = __esm({
|
|
|
2555
2543
|
}
|
|
2556
2544
|
});
|
|
2557
2545
|
|
|
2558
|
-
// src/utils/mixin.ts
|
|
2559
|
-
var init_mixin = __esm({
|
|
2560
|
-
"src/utils/mixin.ts"() {
|
|
2561
|
-
}
|
|
2562
|
-
});
|
|
2563
|
-
|
|
2564
2546
|
// src/utils/index.ts
|
|
2565
2547
|
var init_utils = __esm({
|
|
2566
2548
|
"src/utils/index.ts"() {
|
|
2567
2549
|
init_config();
|
|
2550
|
+
init_data_api();
|
|
2568
2551
|
init_exception();
|
|
2569
|
-
init_model();
|
|
2570
2552
|
init_log();
|
|
2571
|
-
|
|
2572
|
-
init_mixin();
|
|
2553
|
+
init_model();
|
|
2573
2554
|
}
|
|
2574
2555
|
});
|
|
2575
2556
|
var CredentialControlAPI;
|
|
@@ -2796,7 +2777,6 @@ __export(credential_exports, {
|
|
|
2796
2777
|
var Credential;
|
|
2797
2778
|
var init_credential = __esm({
|
|
2798
2779
|
"src/credential/credential.ts"() {
|
|
2799
|
-
init_exception();
|
|
2800
2780
|
init_resource();
|
|
2801
2781
|
init_resource();
|
|
2802
2782
|
init_client2();
|
|
@@ -2834,15 +2814,7 @@ var init_credential = __esm({
|
|
|
2834
2814
|
const hasInputProp = paramsOrInput && paramsOrInput.input !== void 0;
|
|
2835
2815
|
const input = hasInputProp ? paramsOrInput.input : paramsOrInput;
|
|
2836
2816
|
const config2 = hasInputProp ? paramsOrInput.config : void 0;
|
|
2837
|
-
|
|
2838
|
-
try {
|
|
2839
|
-
return await client.create({ input, config: config2 });
|
|
2840
|
-
} catch (error) {
|
|
2841
|
-
if (error instanceof HTTPError) {
|
|
2842
|
-
throw error.toResourceError("Credential", input.credentialName || "");
|
|
2843
|
-
}
|
|
2844
|
-
throw error;
|
|
2845
|
-
}
|
|
2817
|
+
return await _Credential.getClient().create({ input, config: config2 });
|
|
2846
2818
|
};
|
|
2847
2819
|
/**
|
|
2848
2820
|
* Delete a Credential by name
|
|
@@ -2851,15 +2823,7 @@ var init_credential = __esm({
|
|
|
2851
2823
|
const isString = typeof paramsOrName === "string";
|
|
2852
2824
|
const name = isString ? paramsOrName : paramsOrName.name;
|
|
2853
2825
|
const config2 = isString ? void 0 : paramsOrName.config;
|
|
2854
|
-
|
|
2855
|
-
try {
|
|
2856
|
-
return await client.delete({ name, config: config2 });
|
|
2857
|
-
} catch (error) {
|
|
2858
|
-
if (error instanceof HTTPError) {
|
|
2859
|
-
throw error.toResourceError("Credential", name);
|
|
2860
|
-
}
|
|
2861
|
-
throw error;
|
|
2862
|
-
}
|
|
2826
|
+
return await _Credential.getClient().delete({ name, config: config2 });
|
|
2863
2827
|
};
|
|
2864
2828
|
/**
|
|
2865
2829
|
* Update a Credential by name
|
|
@@ -2868,15 +2832,7 @@ var init_credential = __esm({
|
|
|
2868
2832
|
const name = paramsOrName.name;
|
|
2869
2833
|
const input = paramsOrName.input;
|
|
2870
2834
|
const config2 = paramsOrName.config;
|
|
2871
|
-
|
|
2872
|
-
try {
|
|
2873
|
-
return await client.update({ name, input, config: config2 });
|
|
2874
|
-
} catch (error) {
|
|
2875
|
-
if (error instanceof HTTPError) {
|
|
2876
|
-
throw error.toResourceError("Credential", name);
|
|
2877
|
-
}
|
|
2878
|
-
throw error;
|
|
2879
|
-
}
|
|
2835
|
+
return await _Credential.getClient().update({ name, input, config: config2 });
|
|
2880
2836
|
};
|
|
2881
2837
|
/**
|
|
2882
2838
|
* Get a Credential by name
|
|
@@ -2885,15 +2841,7 @@ var init_credential = __esm({
|
|
|
2885
2841
|
const isString = typeof paramsOrName === "string";
|
|
2886
2842
|
const name = isString ? paramsOrName : paramsOrName.name;
|
|
2887
2843
|
const config2 = isString ? void 0 : paramsOrName.config;
|
|
2888
|
-
|
|
2889
|
-
try {
|
|
2890
|
-
return await client.get({ name, config: config2 });
|
|
2891
|
-
} catch (error) {
|
|
2892
|
-
if (error instanceof HTTPError) {
|
|
2893
|
-
throw error.toResourceError("Credential", name);
|
|
2894
|
-
}
|
|
2895
|
-
throw error;
|
|
2896
|
-
}
|
|
2844
|
+
return await _Credential.getClient().get({ name, config: config2 });
|
|
2897
2845
|
};
|
|
2898
2846
|
/**
|
|
2899
2847
|
* List all Credentials (with pagination)
|
|
@@ -2901,15 +2849,7 @@ var init_credential = __esm({
|
|
|
2901
2849
|
static list = async (paramsOrUndefined) => {
|
|
2902
2850
|
const input = paramsOrUndefined?.input ?? paramsOrUndefined;
|
|
2903
2851
|
const config2 = paramsOrUndefined?.config;
|
|
2904
|
-
|
|
2905
|
-
try {
|
|
2906
|
-
return await client.list({ input, config: config2 });
|
|
2907
|
-
} catch (error) {
|
|
2908
|
-
if (error instanceof HTTPError) {
|
|
2909
|
-
throw error.toResourceError("Credential", "list");
|
|
2910
|
-
}
|
|
2911
|
-
throw error;
|
|
2912
|
-
}
|
|
2852
|
+
return await _Credential.getClient().list({ input, config: config2 });
|
|
2913
2853
|
};
|
|
2914
2854
|
static listAll = listAllResourcesFunction(this.list);
|
|
2915
2855
|
/**
|
|
@@ -3089,7 +3029,6 @@ var init_client2 = __esm({
|
|
|
3089
3029
|
"src/credential/client.ts"() {
|
|
3090
3030
|
init_utils();
|
|
3091
3031
|
init_config();
|
|
3092
|
-
init_model();
|
|
3093
3032
|
init_control2();
|
|
3094
3033
|
init_credential();
|
|
3095
3034
|
init_model3();
|
|
@@ -3139,8 +3078,7 @@ var init_client2 = __esm({
|
|
|
3139
3078
|
input: new $AgentRun3.CreateCredentialInput(normalized),
|
|
3140
3079
|
config: cfg
|
|
3141
3080
|
});
|
|
3142
|
-
|
|
3143
|
-
return new Credential(credential);
|
|
3081
|
+
return new Credential(result);
|
|
3144
3082
|
} catch (error) {
|
|
3145
3083
|
if (error instanceof HTTPError) {
|
|
3146
3084
|
throw error.toResourceError(
|
|
@@ -3162,8 +3100,7 @@ var init_client2 = __esm({
|
|
|
3162
3100
|
credentialName: name,
|
|
3163
3101
|
config: cfg
|
|
3164
3102
|
});
|
|
3165
|
-
|
|
3166
|
-
return new Credential(credential);
|
|
3103
|
+
return new Credential(result);
|
|
3167
3104
|
} catch (error) {
|
|
3168
3105
|
if (error instanceof HTTPError) {
|
|
3169
3106
|
throw error.toResourceError("Credential", params?.name);
|
|
@@ -4139,7 +4076,6 @@ var Sandbox;
|
|
|
4139
4076
|
var init_sandbox = __esm({
|
|
4140
4077
|
"src/sandbox/sandbox.ts"() {
|
|
4141
4078
|
init_config();
|
|
4142
|
-
init_exception();
|
|
4143
4079
|
init_resource();
|
|
4144
4080
|
init_model4();
|
|
4145
4081
|
Sandbox = class _Sandbox extends ResourceBase {
|
|
@@ -4239,88 +4175,34 @@ var init_sandbox = __esm({
|
|
|
4239
4175
|
* 创建新沙箱 / Create a New Sandbox
|
|
4240
4176
|
*/
|
|
4241
4177
|
static async create(input, config2) {
|
|
4242
|
-
|
|
4243
|
-
const client = _Sandbox.getClient();
|
|
4244
|
-
return await client.createSandbox({ input, config: config2 });
|
|
4245
|
-
} catch (error) {
|
|
4246
|
-
if (error instanceof HTTPError) {
|
|
4247
|
-
throw error.toResourceError("Sandbox", input.templateName);
|
|
4248
|
-
}
|
|
4249
|
-
_Sandbox.handleError(error);
|
|
4250
|
-
}
|
|
4178
|
+
return await _Sandbox.getClient().createSandbox({ input, config: config2 });
|
|
4251
4179
|
}
|
|
4252
4180
|
/**
|
|
4253
4181
|
* Delete a Sandbox by ID
|
|
4254
4182
|
*/
|
|
4255
4183
|
static async delete(params) {
|
|
4256
4184
|
const { id, config: config2 } = params;
|
|
4257
|
-
|
|
4258
|
-
const client = _Sandbox.getClient();
|
|
4259
|
-
return await client.deleteSandbox({ id, config: config2 });
|
|
4260
|
-
} catch (error) {
|
|
4261
|
-
if (error instanceof HTTPError) {
|
|
4262
|
-
throw error.toResourceError("Sandbox", id);
|
|
4263
|
-
}
|
|
4264
|
-
_Sandbox.handleError(error);
|
|
4265
|
-
}
|
|
4185
|
+
return await _Sandbox.getClient().deleteSandbox({ id, config: config2 });
|
|
4266
4186
|
}
|
|
4267
4187
|
/**
|
|
4268
4188
|
* Stop a Sandbox by ID
|
|
4269
4189
|
*/
|
|
4270
4190
|
static async stop(params) {
|
|
4271
4191
|
const { id, config: config2 } = params;
|
|
4272
|
-
|
|
4273
|
-
const client = _Sandbox.getClient();
|
|
4274
|
-
return await client.stopSandbox({ id, config: config2 });
|
|
4275
|
-
} catch (error) {
|
|
4276
|
-
if (error instanceof HTTPError) {
|
|
4277
|
-
throw error.toResourceError("Sandbox", id);
|
|
4278
|
-
}
|
|
4279
|
-
_Sandbox.handleError(error);
|
|
4280
|
-
}
|
|
4192
|
+
return await _Sandbox.getClient().stopSandbox({ id, config: config2 });
|
|
4281
4193
|
}
|
|
4282
4194
|
/**
|
|
4283
4195
|
* Get a Sandbox by ID
|
|
4284
4196
|
*/
|
|
4285
4197
|
static async get(params) {
|
|
4286
4198
|
const { id, templateType, config: config2 } = params;
|
|
4287
|
-
|
|
4288
|
-
const client = _Sandbox.getClient();
|
|
4289
|
-
return await client.getSandbox({ id, templateType, config: config2 });
|
|
4290
|
-
} catch (error) {
|
|
4291
|
-
if (error instanceof HTTPError) {
|
|
4292
|
-
throw error.toResourceError("Sandbox", id);
|
|
4293
|
-
}
|
|
4294
|
-
_Sandbox.handleError(error);
|
|
4295
|
-
}
|
|
4199
|
+
return await _Sandbox.getClient().getSandbox({ id, templateType, config: config2 });
|
|
4296
4200
|
}
|
|
4297
4201
|
/**
|
|
4298
4202
|
* List Sandboxes
|
|
4299
|
-
*/
|
|
4300
|
-
static async list(input, config2) {
|
|
4301
|
-
|
|
4302
|
-
const client = _Sandbox.getClient();
|
|
4303
|
-
return await client.listSandboxes({ input, config: config2 });
|
|
4304
|
-
} catch (error) {
|
|
4305
|
-
_Sandbox.handleError(error);
|
|
4306
|
-
}
|
|
4307
|
-
}
|
|
4308
|
-
/**
|
|
4309
|
-
* Handle API errors
|
|
4310
|
-
*/
|
|
4311
|
-
static handleError(error) {
|
|
4312
|
-
if (error && typeof error === "object" && "statusCode" in error) {
|
|
4313
|
-
const e = error;
|
|
4314
|
-
const statusCode = e.statusCode;
|
|
4315
|
-
const message = e.message || "Unknown error";
|
|
4316
|
-
const requestId = e.data?.requestId;
|
|
4317
|
-
if (statusCode >= 400 && statusCode < 500) {
|
|
4318
|
-
throw new ClientError(statusCode, message, { requestId });
|
|
4319
|
-
} else if (statusCode >= 500) {
|
|
4320
|
-
throw new ServerError(statusCode, message, { requestId });
|
|
4321
|
-
}
|
|
4322
|
-
}
|
|
4323
|
-
throw error;
|
|
4203
|
+
*/
|
|
4204
|
+
static async list(input, config2) {
|
|
4205
|
+
return await _Sandbox.getClient().listSandboxes({ input, config: config2 });
|
|
4324
4206
|
}
|
|
4325
4207
|
get = async (params) => {
|
|
4326
4208
|
const { config: config2 } = params ?? {};
|
|
@@ -5067,7 +4949,6 @@ var init_code_interpreter_sandbox = __esm({
|
|
|
5067
4949
|
var Template;
|
|
5068
4950
|
var init_template = __esm({
|
|
5069
4951
|
"src/sandbox/template.ts"() {
|
|
5070
|
-
init_exception();
|
|
5071
4952
|
init_resource();
|
|
5072
4953
|
Template = class _Template extends ResourceBase {
|
|
5073
4954
|
/**
|
|
@@ -5156,94 +5037,40 @@ var init_template = __esm({
|
|
|
5156
5037
|
*/
|
|
5157
5038
|
static async create(params) {
|
|
5158
5039
|
const { input, config: config2 } = params;
|
|
5159
|
-
|
|
5160
|
-
const client = _Template.getClient();
|
|
5161
|
-
return await client.createTemplate({ input, config: config2 });
|
|
5162
|
-
} catch (error) {
|
|
5163
|
-
if (error instanceof HTTPError) {
|
|
5164
|
-
throw error.toResourceError("Template", input.templateName);
|
|
5165
|
-
}
|
|
5166
|
-
_Template.handleError(error);
|
|
5167
|
-
}
|
|
5040
|
+
return await _Template.getClient().createTemplate({ input, config: config2 });
|
|
5168
5041
|
}
|
|
5169
5042
|
/**
|
|
5170
5043
|
* Delete a Template by name
|
|
5171
5044
|
*/
|
|
5172
5045
|
static async delete(params) {
|
|
5173
5046
|
const { name, config: config2 } = params;
|
|
5174
|
-
|
|
5175
|
-
const client = _Template.getClient();
|
|
5176
|
-
return await client.deleteTemplate({ name, config: config2 });
|
|
5177
|
-
} catch (error) {
|
|
5178
|
-
if (error instanceof HTTPError) {
|
|
5179
|
-
throw error.toResourceError("Template", name);
|
|
5180
|
-
}
|
|
5181
|
-
_Template.handleError(error);
|
|
5182
|
-
}
|
|
5047
|
+
return await _Template.getClient().deleteTemplate({ name, config: config2 });
|
|
5183
5048
|
}
|
|
5184
5049
|
/**
|
|
5185
5050
|
* Update a Template by name
|
|
5186
5051
|
*/
|
|
5187
5052
|
static async update(params) {
|
|
5188
5053
|
const { name, input, config: config2 } = params;
|
|
5189
|
-
|
|
5190
|
-
const client = _Template.getClient();
|
|
5191
|
-
return await client.updateTemplate({ name, input, config: config2 });
|
|
5192
|
-
} catch (error) {
|
|
5193
|
-
if (error instanceof HTTPError) {
|
|
5194
|
-
throw error.toResourceError("Template", name);
|
|
5195
|
-
}
|
|
5196
|
-
_Template.handleError(error);
|
|
5197
|
-
}
|
|
5054
|
+
return await _Template.getClient().updateTemplate({ name, input, config: config2 });
|
|
5198
5055
|
}
|
|
5199
5056
|
/**
|
|
5200
5057
|
* Get a Template by name
|
|
5201
5058
|
*/
|
|
5202
5059
|
static async get(params) {
|
|
5203
5060
|
const { name, config: config2 } = params;
|
|
5204
|
-
|
|
5205
|
-
const client = _Template.getClient();
|
|
5206
|
-
return await client.getTemplate({ name, config: config2 });
|
|
5207
|
-
} catch (error) {
|
|
5208
|
-
if (error instanceof HTTPError) {
|
|
5209
|
-
throw error.toResourceError("Template", name);
|
|
5210
|
-
}
|
|
5211
|
-
_Template.handleError(error);
|
|
5212
|
-
}
|
|
5061
|
+
return await _Template.getClient().getTemplate({ name, config: config2 });
|
|
5213
5062
|
}
|
|
5214
5063
|
/**
|
|
5215
5064
|
* List Templates
|
|
5216
5065
|
*/
|
|
5217
5066
|
static async list(params) {
|
|
5218
5067
|
const { input, config: config2 } = params ?? {};
|
|
5219
|
-
|
|
5220
|
-
const client = _Template.getClient();
|
|
5221
|
-
return await client.listTemplates({ input, config: config2 });
|
|
5222
|
-
} catch (error) {
|
|
5223
|
-
_Template.handleError(error);
|
|
5224
|
-
}
|
|
5068
|
+
return await _Template.getClient().listTemplates({ input, config: config2 });
|
|
5225
5069
|
}
|
|
5226
5070
|
/**
|
|
5227
5071
|
* List all Templates (with pagination)
|
|
5228
5072
|
*/
|
|
5229
5073
|
static listAll = listAllResourcesFunction(this.list);
|
|
5230
|
-
/**
|
|
5231
|
-
* Handle API errors
|
|
5232
|
-
*/
|
|
5233
|
-
static handleError(error) {
|
|
5234
|
-
if (error && typeof error === "object" && "statusCode" in error) {
|
|
5235
|
-
const e = error;
|
|
5236
|
-
const statusCode = e.statusCode;
|
|
5237
|
-
const message = e.message || "Unknown error";
|
|
5238
|
-
const requestId = e.data?.requestId;
|
|
5239
|
-
if (statusCode >= 400 && statusCode < 500) {
|
|
5240
|
-
throw new ClientError(statusCode, message, { requestId });
|
|
5241
|
-
} else if (statusCode >= 500) {
|
|
5242
|
-
throw new ServerError(statusCode, message, { requestId });
|
|
5243
|
-
}
|
|
5244
|
-
}
|
|
5245
|
-
throw error;
|
|
5246
|
-
}
|
|
5247
5074
|
get = async (params = {}) => {
|
|
5248
5075
|
return await _Template.get({
|
|
5249
5076
|
name: this.templateName,
|
|
@@ -5697,6 +5524,7 @@ var SandboxClient;
|
|
|
5697
5524
|
var init_client3 = __esm({
|
|
5698
5525
|
"src/sandbox/client.ts"() {
|
|
5699
5526
|
init_config();
|
|
5527
|
+
init_exception();
|
|
5700
5528
|
init_control3();
|
|
5701
5529
|
init_browser_sandbox();
|
|
5702
5530
|
init_code_interpreter_sandbox();
|
|
@@ -5717,17 +5545,24 @@ var init_client3 = __esm({
|
|
|
5717
5545
|
createTemplate = async (params) => {
|
|
5718
5546
|
const { input, config: config2 } = params;
|
|
5719
5547
|
const cfg = Config.withConfigs(this.config, config2);
|
|
5720
|
-
|
|
5721
|
-
|
|
5722
|
-
|
|
5723
|
-
|
|
5724
|
-
|
|
5725
|
-
|
|
5726
|
-
|
|
5727
|
-
|
|
5728
|
-
|
|
5729
|
-
|
|
5730
|
-
|
|
5548
|
+
try {
|
|
5549
|
+
const finalInput = this.prepareTemplateCreateInput(input);
|
|
5550
|
+
const result = await this.controlApi.createTemplate({
|
|
5551
|
+
input: new $AgentRun3.CreateTemplateInput({
|
|
5552
|
+
...finalInput,
|
|
5553
|
+
networkConfiguration: finalInput.networkConfiguration ? new $AgentRun3.NetworkConfiguration({
|
|
5554
|
+
...finalInput.networkConfiguration
|
|
5555
|
+
}) : void 0
|
|
5556
|
+
}),
|
|
5557
|
+
config: cfg
|
|
5558
|
+
});
|
|
5559
|
+
return new Template(result, cfg);
|
|
5560
|
+
} catch (error) {
|
|
5561
|
+
if (error instanceof HTTPError) {
|
|
5562
|
+
throw error.toResourceError("Template", input.templateName);
|
|
5563
|
+
}
|
|
5564
|
+
throw error;
|
|
5565
|
+
}
|
|
5731
5566
|
};
|
|
5732
5567
|
/**
|
|
5733
5568
|
* Delete a Template
|
|
@@ -5735,11 +5570,18 @@ var init_client3 = __esm({
|
|
|
5735
5570
|
deleteTemplate = async (params) => {
|
|
5736
5571
|
const { name, config: config2 } = params;
|
|
5737
5572
|
const cfg = Config.withConfigs(this.config, config2);
|
|
5738
|
-
|
|
5739
|
-
|
|
5740
|
-
|
|
5741
|
-
|
|
5742
|
-
|
|
5573
|
+
try {
|
|
5574
|
+
const result = await this.controlApi.deleteTemplate({
|
|
5575
|
+
templateName: name,
|
|
5576
|
+
config: cfg
|
|
5577
|
+
});
|
|
5578
|
+
return new Template(result, cfg);
|
|
5579
|
+
} catch (error) {
|
|
5580
|
+
if (error instanceof HTTPError) {
|
|
5581
|
+
throw error.toResourceError("Template", name);
|
|
5582
|
+
}
|
|
5583
|
+
throw error;
|
|
5584
|
+
}
|
|
5743
5585
|
};
|
|
5744
5586
|
/**
|
|
5745
5587
|
* Update a Template
|
|
@@ -5747,17 +5589,24 @@ var init_client3 = __esm({
|
|
|
5747
5589
|
updateTemplate = async (params) => {
|
|
5748
5590
|
const { name, input, config: config2 } = params;
|
|
5749
5591
|
const cfg = Config.withConfigs(this.config, config2);
|
|
5750
|
-
|
|
5751
|
-
|
|
5752
|
-
|
|
5753
|
-
|
|
5754
|
-
|
|
5755
|
-
|
|
5756
|
-
|
|
5757
|
-
|
|
5758
|
-
|
|
5759
|
-
|
|
5760
|
-
|
|
5592
|
+
try {
|
|
5593
|
+
const result = await this.controlApi.updateTemplate({
|
|
5594
|
+
templateName: name,
|
|
5595
|
+
input: new $AgentRun3.UpdateTemplateInput({
|
|
5596
|
+
...input,
|
|
5597
|
+
networkConfiguration: input.networkConfiguration ? new $AgentRun3.NetworkConfiguration({
|
|
5598
|
+
...input.networkConfiguration
|
|
5599
|
+
}) : void 0
|
|
5600
|
+
}),
|
|
5601
|
+
config: cfg
|
|
5602
|
+
});
|
|
5603
|
+
return new Template(result, cfg);
|
|
5604
|
+
} catch (error) {
|
|
5605
|
+
if (error instanceof HTTPError) {
|
|
5606
|
+
throw error.toResourceError("Template", name);
|
|
5607
|
+
}
|
|
5608
|
+
throw error;
|
|
5609
|
+
}
|
|
5761
5610
|
};
|
|
5762
5611
|
/**
|
|
5763
5612
|
* Get a Template
|
|
@@ -5765,11 +5614,18 @@ var init_client3 = __esm({
|
|
|
5765
5614
|
getTemplate = async (params) => {
|
|
5766
5615
|
const { name, config: config2 } = params;
|
|
5767
5616
|
const cfg = Config.withConfigs(this.config, config2);
|
|
5768
|
-
|
|
5769
|
-
|
|
5770
|
-
|
|
5771
|
-
|
|
5772
|
-
|
|
5617
|
+
try {
|
|
5618
|
+
const result = await this.controlApi.getTemplate({
|
|
5619
|
+
templateName: name,
|
|
5620
|
+
config: cfg
|
|
5621
|
+
});
|
|
5622
|
+
return new Template(result, cfg);
|
|
5623
|
+
} catch (error) {
|
|
5624
|
+
if (error instanceof HTTPError) {
|
|
5625
|
+
throw error.toResourceError("Template", name);
|
|
5626
|
+
}
|
|
5627
|
+
throw error;
|
|
5628
|
+
}
|
|
5773
5629
|
};
|
|
5774
5630
|
/**
|
|
5775
5631
|
* List Templates
|
|
@@ -5793,13 +5649,20 @@ var init_client3 = __esm({
|
|
|
5793
5649
|
createSandbox = async (params) => {
|
|
5794
5650
|
const { input, config: config2 } = params;
|
|
5795
5651
|
const cfg = Config.withConfigs(this.config, config2);
|
|
5796
|
-
|
|
5797
|
-
|
|
5798
|
-
|
|
5799
|
-
|
|
5800
|
-
|
|
5801
|
-
|
|
5802
|
-
|
|
5652
|
+
try {
|
|
5653
|
+
const result = await this.controlApi.createSandbox({
|
|
5654
|
+
input: new $AgentRun3.CreateSandboxInput({
|
|
5655
|
+
...input
|
|
5656
|
+
}),
|
|
5657
|
+
config: cfg
|
|
5658
|
+
});
|
|
5659
|
+
return Sandbox.fromInnerObject(result, cfg);
|
|
5660
|
+
} catch (error) {
|
|
5661
|
+
if (error instanceof HTTPError) {
|
|
5662
|
+
throw error.toResourceError("Sandbox", input.templateName);
|
|
5663
|
+
}
|
|
5664
|
+
throw error;
|
|
5665
|
+
}
|
|
5803
5666
|
};
|
|
5804
5667
|
/**
|
|
5805
5668
|
* Create a Code Interpreter Sandbox
|
|
@@ -5831,11 +5694,18 @@ var init_client3 = __esm({
|
|
|
5831
5694
|
deleteSandbox = async (params) => {
|
|
5832
5695
|
const { id, config: config2 } = params;
|
|
5833
5696
|
const cfg = Config.withConfigs(this.config, config2);
|
|
5834
|
-
|
|
5835
|
-
|
|
5836
|
-
|
|
5837
|
-
|
|
5838
|
-
|
|
5697
|
+
try {
|
|
5698
|
+
const result = await this.controlApi.deleteSandbox({
|
|
5699
|
+
sandboxId: id,
|
|
5700
|
+
config: cfg
|
|
5701
|
+
});
|
|
5702
|
+
return Sandbox.fromInnerObject(result, cfg);
|
|
5703
|
+
} catch (error) {
|
|
5704
|
+
if (error instanceof HTTPError) {
|
|
5705
|
+
throw error.toResourceError("Sandbox", id);
|
|
5706
|
+
}
|
|
5707
|
+
throw error;
|
|
5708
|
+
}
|
|
5839
5709
|
};
|
|
5840
5710
|
/**
|
|
5841
5711
|
* Stop a Sandbox
|
|
@@ -5843,11 +5713,18 @@ var init_client3 = __esm({
|
|
|
5843
5713
|
stopSandbox = async (params) => {
|
|
5844
5714
|
const { id, config: config2 } = params;
|
|
5845
5715
|
const cfg = Config.withConfigs(this.config, config2);
|
|
5846
|
-
|
|
5847
|
-
|
|
5848
|
-
|
|
5849
|
-
|
|
5850
|
-
|
|
5716
|
+
try {
|
|
5717
|
+
const result = await this.controlApi.stopSandbox({
|
|
5718
|
+
sandboxId: id,
|
|
5719
|
+
config: cfg
|
|
5720
|
+
});
|
|
5721
|
+
return Sandbox.fromInnerObject(result, cfg);
|
|
5722
|
+
} catch (error) {
|
|
5723
|
+
if (error instanceof HTTPError) {
|
|
5724
|
+
throw error.toResourceError("Sandbox", id);
|
|
5725
|
+
}
|
|
5726
|
+
throw error;
|
|
5727
|
+
}
|
|
5851
5728
|
};
|
|
5852
5729
|
/**
|
|
5853
5730
|
* Get a Sandbox
|
|
@@ -5859,26 +5736,33 @@ var init_client3 = __esm({
|
|
|
5859
5736
|
getSandbox = async (params) => {
|
|
5860
5737
|
const { id, templateType, config: config2 } = params;
|
|
5861
5738
|
const cfg = Config.withConfigs(this.config, config2);
|
|
5862
|
-
|
|
5863
|
-
|
|
5864
|
-
|
|
5865
|
-
|
|
5866
|
-
|
|
5867
|
-
|
|
5868
|
-
|
|
5869
|
-
|
|
5870
|
-
|
|
5871
|
-
|
|
5872
|
-
|
|
5873
|
-
|
|
5874
|
-
|
|
5875
|
-
|
|
5876
|
-
|
|
5877
|
-
|
|
5739
|
+
try {
|
|
5740
|
+
const result = await this.controlApi.getSandbox({
|
|
5741
|
+
sandboxId: id,
|
|
5742
|
+
config: cfg
|
|
5743
|
+
});
|
|
5744
|
+
const baseSandbox = Sandbox.fromInnerObject(result, cfg);
|
|
5745
|
+
if (templateType) {
|
|
5746
|
+
switch (templateType) {
|
|
5747
|
+
case "CodeInterpreter" /* CODE_INTERPRETER */: {
|
|
5748
|
+
return new CodeInterpreterSandbox(baseSandbox, cfg);
|
|
5749
|
+
}
|
|
5750
|
+
case "Browser" /* BROWSER */: {
|
|
5751
|
+
return new BrowserSandbox(baseSandbox, cfg);
|
|
5752
|
+
}
|
|
5753
|
+
case "AllInOne" /* AIO */: {
|
|
5754
|
+
const { AioSandbox: AioSandbox2 } = await Promise.resolve().then(() => (init_aio_sandbox(), aio_sandbox_exports));
|
|
5755
|
+
return new AioSandbox2(baseSandbox, cfg);
|
|
5756
|
+
}
|
|
5878
5757
|
}
|
|
5879
5758
|
}
|
|
5759
|
+
return baseSandbox;
|
|
5760
|
+
} catch (error) {
|
|
5761
|
+
if (error instanceof HTTPError) {
|
|
5762
|
+
throw error.toResourceError("Sandbox", id);
|
|
5763
|
+
}
|
|
5764
|
+
throw error;
|
|
5880
5765
|
}
|
|
5881
|
-
return baseSandbox;
|
|
5882
5766
|
};
|
|
5883
5767
|
/**
|
|
5884
5768
|
* List Sandboxes
|
|
@@ -8143,7 +8027,6 @@ var ToolSet;
|
|
|
8143
8027
|
var init_toolset = __esm({
|
|
8144
8028
|
"src/toolset/toolset.ts"() {
|
|
8145
8029
|
init_config();
|
|
8146
|
-
init_exception();
|
|
8147
8030
|
init_log();
|
|
8148
8031
|
init_resource();
|
|
8149
8032
|
ToolSet = class _ToolSet {
|
|
@@ -8175,56 +8058,27 @@ var init_toolset = __esm({
|
|
|
8175
8058
|
*/
|
|
8176
8059
|
static async create(params) {
|
|
8177
8060
|
const { input, config: config2 } = params;
|
|
8178
|
-
|
|
8179
|
-
const client = _ToolSet.getClient();
|
|
8180
|
-
return await client.create({ input, config: config2 });
|
|
8181
|
-
} catch (error) {
|
|
8182
|
-
if (error instanceof HTTPError) {
|
|
8183
|
-
throw error.toResourceError("ToolSet", input.name);
|
|
8184
|
-
}
|
|
8185
|
-
_ToolSet.handleError(error);
|
|
8186
|
-
}
|
|
8061
|
+
return await _ToolSet.getClient().create({ input, config: config2 });
|
|
8187
8062
|
}
|
|
8188
8063
|
/**
|
|
8189
8064
|
* Delete a ToolSet by Name
|
|
8190
8065
|
*/
|
|
8191
8066
|
static async delete(params) {
|
|
8192
8067
|
const { name, config: config2 } = params;
|
|
8193
|
-
|
|
8194
|
-
const client = _ToolSet.getClient();
|
|
8195
|
-
return await client.delete({ name, config: config2 });
|
|
8196
|
-
} catch (error) {
|
|
8197
|
-
if (error instanceof HTTPError) {
|
|
8198
|
-
throw error.toResourceError("ToolSet", name);
|
|
8199
|
-
}
|
|
8200
|
-
_ToolSet.handleError(error);
|
|
8201
|
-
}
|
|
8068
|
+
return await _ToolSet.getClient().delete({ name, config: config2 });
|
|
8202
8069
|
}
|
|
8203
8070
|
/**
|
|
8204
8071
|
* Get a ToolSet by Name
|
|
8205
8072
|
*/
|
|
8206
8073
|
static async get(params) {
|
|
8207
8074
|
const { name, config: config2 } = params;
|
|
8208
|
-
|
|
8209
|
-
const client = _ToolSet.getClient();
|
|
8210
|
-
return await client.get({ name, config: config2 });
|
|
8211
|
-
} catch (error) {
|
|
8212
|
-
if (error instanceof HTTPError) {
|
|
8213
|
-
throw error.toResourceError("ToolSet", name);
|
|
8214
|
-
}
|
|
8215
|
-
_ToolSet.handleError(error);
|
|
8216
|
-
}
|
|
8075
|
+
return await _ToolSet.getClient().get({ name, config: config2 });
|
|
8217
8076
|
}
|
|
8218
8077
|
/**
|
|
8219
8078
|
* List ToolSets
|
|
8220
8079
|
*/
|
|
8221
8080
|
static async list(input, config2) {
|
|
8222
|
-
|
|
8223
|
-
const client = _ToolSet.getClient();
|
|
8224
|
-
return await client.list({ input, config: config2 });
|
|
8225
|
-
} catch (error) {
|
|
8226
|
-
_ToolSet.handleError(error);
|
|
8227
|
-
}
|
|
8081
|
+
return await _ToolSet.getClient().list({ input, config: config2 });
|
|
8228
8082
|
}
|
|
8229
8083
|
/**
|
|
8230
8084
|
* List all ToolSets with pagination
|
|
@@ -8260,32 +8114,7 @@ var init_toolset = __esm({
|
|
|
8260
8114
|
*/
|
|
8261
8115
|
static async update(params) {
|
|
8262
8116
|
const { name, input, config: config2 } = params;
|
|
8263
|
-
|
|
8264
|
-
const client = _ToolSet.getClient();
|
|
8265
|
-
return await client.update({ name, input, config: config2 });
|
|
8266
|
-
} catch (error) {
|
|
8267
|
-
if (error instanceof HTTPError) {
|
|
8268
|
-
throw error.toResourceError("ToolSet", name);
|
|
8269
|
-
}
|
|
8270
|
-
_ToolSet.handleError(error);
|
|
8271
|
-
}
|
|
8272
|
-
}
|
|
8273
|
-
/**
|
|
8274
|
-
* Handle API errors
|
|
8275
|
-
*/
|
|
8276
|
-
static handleError(error) {
|
|
8277
|
-
if (error && typeof error === "object" && "statusCode" in error) {
|
|
8278
|
-
const e = error;
|
|
8279
|
-
const statusCode = e.statusCode;
|
|
8280
|
-
const message = e.message || "Unknown error";
|
|
8281
|
-
const requestId = e.data?.requestId;
|
|
8282
|
-
if (statusCode >= 400 && statusCode < 500) {
|
|
8283
|
-
throw new ClientError(statusCode, message, { requestId });
|
|
8284
|
-
} else if (statusCode >= 500) {
|
|
8285
|
-
throw new ServerError(statusCode, message, { requestId });
|
|
8286
|
-
}
|
|
8287
|
-
}
|
|
8288
|
-
throw error;
|
|
8117
|
+
return await _ToolSet.getClient().update({ name, input, config: config2 });
|
|
8289
8118
|
}
|
|
8290
8119
|
/**
|
|
8291
8120
|
* Delete this toolset
|
|
@@ -8490,6 +8319,7 @@ var ToolSetClient;
|
|
|
8490
8319
|
var init_client5 = __esm({
|
|
8491
8320
|
"src/toolset/client.ts"() {
|
|
8492
8321
|
init_config();
|
|
8322
|
+
init_exception();
|
|
8493
8323
|
init_api();
|
|
8494
8324
|
init_toolset();
|
|
8495
8325
|
ToolSetClient = class {
|
|
@@ -8505,31 +8335,38 @@ var init_client5 = __esm({
|
|
|
8505
8335
|
create = async (params) => {
|
|
8506
8336
|
const { input, config: config2 } = params;
|
|
8507
8337
|
const cfg = Config.withConfigs(this.config, config2);
|
|
8508
|
-
|
|
8509
|
-
|
|
8510
|
-
|
|
8511
|
-
|
|
8512
|
-
|
|
8513
|
-
|
|
8514
|
-
|
|
8338
|
+
try {
|
|
8339
|
+
const authConfig = input.spec?.authConfig ? new Authorization({
|
|
8340
|
+
type: input.spec.authConfig.type,
|
|
8341
|
+
parameters: new AuthorizationParameters({
|
|
8342
|
+
apiKeyParameter: new APIKeyAuthParameter({
|
|
8343
|
+
key: input.spec.authConfig.apiKeyHeaderName,
|
|
8344
|
+
value: input.spec.authConfig.apiKeyValue,
|
|
8345
|
+
in: "header"
|
|
8346
|
+
})
|
|
8515
8347
|
})
|
|
8516
|
-
})
|
|
8517
|
-
|
|
8518
|
-
|
|
8519
|
-
|
|
8520
|
-
|
|
8521
|
-
|
|
8522
|
-
|
|
8523
|
-
|
|
8524
|
-
|
|
8525
|
-
|
|
8526
|
-
})
|
|
8527
|
-
|
|
8528
|
-
|
|
8529
|
-
|
|
8530
|
-
|
|
8531
|
-
|
|
8532
|
-
|
|
8348
|
+
}) : void 0;
|
|
8349
|
+
const request = new Toolset({
|
|
8350
|
+
...input,
|
|
8351
|
+
spec: input.spec ? new ToolsetSpec({
|
|
8352
|
+
...input.spec,
|
|
8353
|
+
schema: input.spec.schema ? new ToolsetSchema({
|
|
8354
|
+
...input.spec.schema
|
|
8355
|
+
}) : void 0,
|
|
8356
|
+
authConfig
|
|
8357
|
+
}) : void 0
|
|
8358
|
+
});
|
|
8359
|
+
const result = await this.controlApi.createToolset({
|
|
8360
|
+
input: request,
|
|
8361
|
+
config: cfg
|
|
8362
|
+
});
|
|
8363
|
+
return new ToolSet(result, cfg);
|
|
8364
|
+
} catch (error) {
|
|
8365
|
+
if (error instanceof HTTPError) {
|
|
8366
|
+
throw error.toResourceError("ToolSet", input.name);
|
|
8367
|
+
}
|
|
8368
|
+
throw error;
|
|
8369
|
+
}
|
|
8533
8370
|
};
|
|
8534
8371
|
/**
|
|
8535
8372
|
* Delete a ToolSet by name
|
|
@@ -8537,11 +8374,18 @@ var init_client5 = __esm({
|
|
|
8537
8374
|
delete = async (params) => {
|
|
8538
8375
|
const { name, config: config2 } = params;
|
|
8539
8376
|
const cfg = Config.withConfigs(this.config, config2);
|
|
8540
|
-
|
|
8541
|
-
|
|
8542
|
-
|
|
8543
|
-
|
|
8544
|
-
|
|
8377
|
+
try {
|
|
8378
|
+
const result = await this.controlApi.deleteToolset({
|
|
8379
|
+
name,
|
|
8380
|
+
config: cfg
|
|
8381
|
+
});
|
|
8382
|
+
return new ToolSet(result, cfg);
|
|
8383
|
+
} catch (error) {
|
|
8384
|
+
if (error instanceof HTTPError) {
|
|
8385
|
+
throw error.toResourceError("ToolSet", name);
|
|
8386
|
+
}
|
|
8387
|
+
throw error;
|
|
8388
|
+
}
|
|
8545
8389
|
};
|
|
8546
8390
|
/**
|
|
8547
8391
|
* Update a ToolSet by name
|
|
@@ -8549,55 +8393,59 @@ var init_client5 = __esm({
|
|
|
8549
8393
|
update = async (params) => {
|
|
8550
8394
|
const { name, input, config: config2 } = params;
|
|
8551
8395
|
const cfg = Config.withConfigs(this.config, config2);
|
|
8552
|
-
|
|
8553
|
-
|
|
8554
|
-
|
|
8555
|
-
|
|
8556
|
-
|
|
8557
|
-
|
|
8558
|
-
|
|
8396
|
+
try {
|
|
8397
|
+
const authConfig = input.spec?.authConfig ? new Authorization({
|
|
8398
|
+
type: input.spec.authConfig.type,
|
|
8399
|
+
parameters: new AuthorizationParameters({
|
|
8400
|
+
apiKeyParameter: new APIKeyAuthParameter({
|
|
8401
|
+
key: input.spec.authConfig.apiKeyHeaderName,
|
|
8402
|
+
value: input.spec.authConfig.apiKeyValue,
|
|
8403
|
+
in: "header"
|
|
8404
|
+
})
|
|
8559
8405
|
})
|
|
8560
|
-
})
|
|
8561
|
-
|
|
8562
|
-
|
|
8563
|
-
|
|
8564
|
-
|
|
8565
|
-
|
|
8566
|
-
|
|
8567
|
-
|
|
8568
|
-
|
|
8569
|
-
|
|
8570
|
-
|
|
8571
|
-
})
|
|
8572
|
-
|
|
8573
|
-
|
|
8574
|
-
|
|
8575
|
-
|
|
8576
|
-
|
|
8577
|
-
|
|
8578
|
-
|
|
8406
|
+
}) : void 0;
|
|
8407
|
+
const request = new Toolset({
|
|
8408
|
+
name,
|
|
8409
|
+
...input,
|
|
8410
|
+
spec: input.spec ? new ToolsetSpec({
|
|
8411
|
+
...input.spec,
|
|
8412
|
+
schema: input.spec.schema ? new ToolsetSchema({
|
|
8413
|
+
...input.spec.schema
|
|
8414
|
+
}) : void 0,
|
|
8415
|
+
authConfig
|
|
8416
|
+
}) : void 0
|
|
8417
|
+
});
|
|
8418
|
+
const result = await this.controlApi.updateToolset({
|
|
8419
|
+
name,
|
|
8420
|
+
input: request,
|
|
8421
|
+
config: cfg
|
|
8422
|
+
});
|
|
8423
|
+
return new ToolSet(result, cfg);
|
|
8424
|
+
} catch (error) {
|
|
8425
|
+
if (error instanceof HTTPError) {
|
|
8426
|
+
throw error.toResourceError("ToolSet", name);
|
|
8427
|
+
}
|
|
8428
|
+
throw error;
|
|
8429
|
+
}
|
|
8579
8430
|
};
|
|
8580
|
-
// /**
|
|
8581
|
-
// * Delete a ToolSet by name
|
|
8582
|
-
// */
|
|
8583
|
-
// deleteToolSet = async (params: {
|
|
8584
|
-
// name: string;
|
|
8585
|
-
// config?: Config;
|
|
8586
|
-
// }): Promise<ToolSet> => {
|
|
8587
|
-
// const { name, config } = params;
|
|
8588
|
-
// return ToolSet.delete({ name, config: config ?? this.config });
|
|
8589
|
-
// };
|
|
8590
8431
|
/**
|
|
8591
8432
|
* Get a ToolSet by name
|
|
8592
8433
|
*/
|
|
8593
8434
|
get = async (params) => {
|
|
8594
8435
|
const { name, config: config2 } = params;
|
|
8595
8436
|
const cfg = Config.withConfigs(this.config, config2);
|
|
8596
|
-
|
|
8597
|
-
|
|
8598
|
-
|
|
8599
|
-
|
|
8600
|
-
|
|
8437
|
+
try {
|
|
8438
|
+
const result = await this.controlApi.getToolset({
|
|
8439
|
+
name,
|
|
8440
|
+
config: cfg
|
|
8441
|
+
});
|
|
8442
|
+
return new ToolSet(result, cfg);
|
|
8443
|
+
} catch (error) {
|
|
8444
|
+
if (error instanceof HTTPError) {
|
|
8445
|
+
throw error.toResourceError("ToolSet", name);
|
|
8446
|
+
}
|
|
8447
|
+
throw error;
|
|
8448
|
+
}
|
|
8601
8449
|
};
|
|
8602
8450
|
/**
|
|
8603
8451
|
* List ToolSets
|