@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.cjs
CHANGED
|
@@ -283,6 +283,80 @@ var init_exception = __esm({
|
|
|
283
283
|
}
|
|
284
284
|
});
|
|
285
285
|
|
|
286
|
+
// src/utils/model.ts
|
|
287
|
+
function isFinalStatus(status) {
|
|
288
|
+
return [
|
|
289
|
+
void 0,
|
|
290
|
+
null,
|
|
291
|
+
"",
|
|
292
|
+
...[
|
|
293
|
+
"READY",
|
|
294
|
+
"CREATE_FAILED",
|
|
295
|
+
"UPDATE_FAILED",
|
|
296
|
+
"DELETE_FAILED"
|
|
297
|
+
]
|
|
298
|
+
].includes(status);
|
|
299
|
+
}
|
|
300
|
+
exports.Status = void 0; var NetworkMode;
|
|
301
|
+
var init_model = __esm({
|
|
302
|
+
"src/utils/model.ts"() {
|
|
303
|
+
exports.Status = {
|
|
304
|
+
CREATING: "CREATING",
|
|
305
|
+
CREATE_FAILED: "CREATE_FAILED",
|
|
306
|
+
READY: "READY",
|
|
307
|
+
UPDATING: "UPDATING",
|
|
308
|
+
UPDATE_FAILED: "UPDATE_FAILED",
|
|
309
|
+
DELETING: "DELETING",
|
|
310
|
+
DELETE_FAILED: "DELETE_FAILED"
|
|
311
|
+
};
|
|
312
|
+
NetworkMode = {
|
|
313
|
+
PUBLIC: "PUBLIC",
|
|
314
|
+
PRIVATE: "PRIVATE",
|
|
315
|
+
PUBLIC_AND_PRIVATE: "PUBLIC_AND_PRIVATE"
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
});
|
|
319
|
+
|
|
320
|
+
// src/utils/control-api.ts
|
|
321
|
+
var control_api_exports = {};
|
|
322
|
+
__export(control_api_exports, {
|
|
323
|
+
$AgentRun: () => $AgentRun3__namespace,
|
|
324
|
+
ControlAPI: () => exports.ModelControlAPI
|
|
325
|
+
});
|
|
326
|
+
var $AgentRunClient; exports.ModelControlAPI = void 0;
|
|
327
|
+
var init_control_api = __esm({
|
|
328
|
+
"src/utils/control-api.ts"() {
|
|
329
|
+
init_config();
|
|
330
|
+
$AgentRunClient = // @ts-expect-error - ESM interop: default.default exists when imported as ESM namespace
|
|
331
|
+
$AgentRun3__namespace.default?.default ?? $AgentRun3__namespace.default ?? $AgentRun3__namespace;
|
|
332
|
+
exports.ModelControlAPI = class {
|
|
333
|
+
config;
|
|
334
|
+
constructor(config2) {
|
|
335
|
+
this.config = config2;
|
|
336
|
+
}
|
|
337
|
+
/**
|
|
338
|
+
* Get the underlying AgentRun client instance
|
|
339
|
+
*/
|
|
340
|
+
getClient(config2) {
|
|
341
|
+
const cfg = exports.Config.withConfigs(this.config, config2);
|
|
342
|
+
let endpoint = cfg.controlEndpoint;
|
|
343
|
+
if (endpoint.startsWith("http://") || endpoint.startsWith("https://")) {
|
|
344
|
+
endpoint = endpoint.split("://")[1];
|
|
345
|
+
}
|
|
346
|
+
const openApiConfig = new $OpenApi__namespace.Config({
|
|
347
|
+
accessKeyId: cfg.accessKeyId,
|
|
348
|
+
accessKeySecret: cfg.accessKeySecret,
|
|
349
|
+
securityToken: cfg.securityToken || void 0,
|
|
350
|
+
regionId: cfg.regionId,
|
|
351
|
+
endpoint,
|
|
352
|
+
connectTimeout: cfg.timeout
|
|
353
|
+
});
|
|
354
|
+
return new $AgentRunClient(openApiConfig);
|
|
355
|
+
}
|
|
356
|
+
};
|
|
357
|
+
}
|
|
358
|
+
});
|
|
359
|
+
|
|
286
360
|
// src/utils/log.ts
|
|
287
361
|
var LOG_LEVELS, COLORS, Logger, logger;
|
|
288
362
|
var init_log = __esm({
|
|
@@ -481,89 +555,6 @@ ${msg}
|
|
|
481
555
|
}
|
|
482
556
|
}
|
|
483
557
|
});
|
|
484
|
-
|
|
485
|
-
// src/utils/model.ts
|
|
486
|
-
function isFinalStatus(status) {
|
|
487
|
-
return [
|
|
488
|
-
void 0,
|
|
489
|
-
null,
|
|
490
|
-
"",
|
|
491
|
-
...[
|
|
492
|
-
"READY",
|
|
493
|
-
"CREATE_FAILED",
|
|
494
|
-
"UPDATE_FAILED",
|
|
495
|
-
"DELETE_FAILED"
|
|
496
|
-
]
|
|
497
|
-
].includes(status);
|
|
498
|
-
}
|
|
499
|
-
function fromInnerObject(obj, extra) {
|
|
500
|
-
logger.debug(
|
|
501
|
-
"before parse object obj=%s, extra=%s",
|
|
502
|
-
JSON.stringify(obj),
|
|
503
|
-
"null"
|
|
504
|
-
);
|
|
505
|
-
return obj;
|
|
506
|
-
}
|
|
507
|
-
exports.Status = void 0; var NetworkMode;
|
|
508
|
-
var init_model = __esm({
|
|
509
|
-
"src/utils/model.ts"() {
|
|
510
|
-
init_log();
|
|
511
|
-
exports.Status = {
|
|
512
|
-
CREATING: "CREATING",
|
|
513
|
-
CREATE_FAILED: "CREATE_FAILED",
|
|
514
|
-
READY: "READY",
|
|
515
|
-
UPDATING: "UPDATING",
|
|
516
|
-
UPDATE_FAILED: "UPDATE_FAILED",
|
|
517
|
-
DELETING: "DELETING",
|
|
518
|
-
DELETE_FAILED: "DELETE_FAILED"
|
|
519
|
-
};
|
|
520
|
-
NetworkMode = {
|
|
521
|
-
PUBLIC: "PUBLIC",
|
|
522
|
-
PRIVATE: "PRIVATE",
|
|
523
|
-
PUBLIC_AND_PRIVATE: "PUBLIC_AND_PRIVATE"
|
|
524
|
-
};
|
|
525
|
-
}
|
|
526
|
-
});
|
|
527
|
-
|
|
528
|
-
// src/utils/control-api.ts
|
|
529
|
-
var control_api_exports = {};
|
|
530
|
-
__export(control_api_exports, {
|
|
531
|
-
$AgentRun: () => $AgentRun3__namespace,
|
|
532
|
-
ControlAPI: () => exports.ModelControlAPI
|
|
533
|
-
});
|
|
534
|
-
var $AgentRunClient; exports.ModelControlAPI = void 0;
|
|
535
|
-
var init_control_api = __esm({
|
|
536
|
-
"src/utils/control-api.ts"() {
|
|
537
|
-
init_config();
|
|
538
|
-
$AgentRunClient = // @ts-expect-error - ESM interop: default.default exists when imported as ESM namespace
|
|
539
|
-
$AgentRun3__namespace.default?.default ?? $AgentRun3__namespace.default ?? $AgentRun3__namespace;
|
|
540
|
-
exports.ModelControlAPI = class {
|
|
541
|
-
config;
|
|
542
|
-
constructor(config2) {
|
|
543
|
-
this.config = config2;
|
|
544
|
-
}
|
|
545
|
-
/**
|
|
546
|
-
* Get the underlying AgentRun client instance
|
|
547
|
-
*/
|
|
548
|
-
getClient(config2) {
|
|
549
|
-
const cfg = exports.Config.withConfigs(this.config, config2);
|
|
550
|
-
let endpoint = cfg.controlEndpoint;
|
|
551
|
-
if (endpoint.startsWith("http://") || endpoint.startsWith("https://")) {
|
|
552
|
-
endpoint = endpoint.split("://")[1];
|
|
553
|
-
}
|
|
554
|
-
const openApiConfig = new $OpenApi__namespace.Config({
|
|
555
|
-
accessKeyId: cfg.accessKeyId,
|
|
556
|
-
accessKeySecret: cfg.accessKeySecret,
|
|
557
|
-
securityToken: cfg.securityToken || void 0,
|
|
558
|
-
regionId: cfg.regionId,
|
|
559
|
-
endpoint,
|
|
560
|
-
connectTimeout: cfg.timeout
|
|
561
|
-
});
|
|
562
|
-
return new $AgentRunClient(openApiConfig);
|
|
563
|
-
}
|
|
564
|
-
};
|
|
565
|
-
}
|
|
566
|
-
});
|
|
567
558
|
exports.AgentRuntimeControlAPI = void 0;
|
|
568
559
|
var init_control = __esm({
|
|
569
560
|
"src/agent-runtime/api/control.ts"() {
|
|
@@ -1690,7 +1681,6 @@ exports.AgentRuntimeEndpoint = void 0;
|
|
|
1690
1681
|
var init_endpoint = __esm({
|
|
1691
1682
|
"src/agent-runtime/endpoint.ts"() {
|
|
1692
1683
|
init_config();
|
|
1693
|
-
init_exception();
|
|
1694
1684
|
init_resource();
|
|
1695
1685
|
init_data();
|
|
1696
1686
|
exports.AgentRuntimeEndpoint = class _AgentRuntimeEndpoint extends ResourceBase {
|
|
@@ -1726,100 +1716,56 @@ var init_endpoint = __esm({
|
|
|
1726
1716
|
*/
|
|
1727
1717
|
static async create(params) {
|
|
1728
1718
|
const { agentRuntimeId, input, config: config2 } = params;
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
throw error.toResourceError(
|
|
1735
|
-
"AgentRuntimeEndpoint",
|
|
1736
|
-
`${agentRuntimeId}/${input.agentRuntimeEndpointName}`
|
|
1737
|
-
);
|
|
1738
|
-
}
|
|
1739
|
-
throw error;
|
|
1740
|
-
}
|
|
1719
|
+
return await _AgentRuntimeEndpoint.getClient().createEndpoint({
|
|
1720
|
+
agentRuntimeId,
|
|
1721
|
+
input,
|
|
1722
|
+
config: config2
|
|
1723
|
+
});
|
|
1741
1724
|
}
|
|
1742
1725
|
/**
|
|
1743
1726
|
* Delete an endpoint by ID
|
|
1744
1727
|
*/
|
|
1745
1728
|
static async delete(params) {
|
|
1746
1729
|
const { agentRuntimeId, endpointId, config: config2 } = params;
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
config: config2
|
|
1753
|
-
});
|
|
1754
|
-
} catch (error) {
|
|
1755
|
-
if (error instanceof exports.HTTPError) {
|
|
1756
|
-
throw error.toResourceError(
|
|
1757
|
-
"AgentRuntimeEndpoint",
|
|
1758
|
-
`${agentRuntimeId}/${endpointId}`
|
|
1759
|
-
);
|
|
1760
|
-
}
|
|
1761
|
-
throw error;
|
|
1762
|
-
}
|
|
1730
|
+
return await _AgentRuntimeEndpoint.getClient().deleteEndpoint({
|
|
1731
|
+
agentRuntimeId,
|
|
1732
|
+
endpointId,
|
|
1733
|
+
config: config2
|
|
1734
|
+
});
|
|
1763
1735
|
}
|
|
1764
1736
|
/**
|
|
1765
1737
|
* Update an endpoint by ID
|
|
1766
1738
|
*/
|
|
1767
1739
|
static async update(params) {
|
|
1768
1740
|
const { agentRuntimeId, endpointId, input, config: config2 } = params;
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
config: config2
|
|
1776
|
-
});
|
|
1777
|
-
} catch (error) {
|
|
1778
|
-
if (error instanceof exports.HTTPError) {
|
|
1779
|
-
throw error.toResourceError(
|
|
1780
|
-
"AgentRuntimeEndpoint",
|
|
1781
|
-
`${agentRuntimeId}/${endpointId}`
|
|
1782
|
-
);
|
|
1783
|
-
}
|
|
1784
|
-
throw error;
|
|
1785
|
-
}
|
|
1741
|
+
return await _AgentRuntimeEndpoint.getClient().updateEndpoint({
|
|
1742
|
+
agentRuntimeId,
|
|
1743
|
+
endpointId,
|
|
1744
|
+
input,
|
|
1745
|
+
config: config2
|
|
1746
|
+
});
|
|
1786
1747
|
}
|
|
1787
1748
|
/**
|
|
1788
1749
|
* Get an endpoint by ID
|
|
1789
1750
|
*/
|
|
1790
1751
|
static async get(params) {
|
|
1791
1752
|
const { agentRuntimeId, endpointId, config: config2 } = params;
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
config: config2
|
|
1798
|
-
});
|
|
1799
|
-
} catch (error) {
|
|
1800
|
-
if (error instanceof exports.HTTPError) {
|
|
1801
|
-
throw error.toResourceError(
|
|
1802
|
-
"AgentRuntimeEndpoint",
|
|
1803
|
-
`${agentRuntimeId}/${endpointId}`
|
|
1804
|
-
);
|
|
1805
|
-
}
|
|
1806
|
-
throw error;
|
|
1807
|
-
}
|
|
1753
|
+
return await _AgentRuntimeEndpoint.getClient().getEndpoint({
|
|
1754
|
+
agentRuntimeId,
|
|
1755
|
+
endpointId,
|
|
1756
|
+
config: config2
|
|
1757
|
+
});
|
|
1808
1758
|
}
|
|
1809
1759
|
/**
|
|
1810
1760
|
* List endpoints by Agent Runtime ID
|
|
1811
1761
|
*/
|
|
1812
1762
|
static async list(params) {
|
|
1813
1763
|
const { agentRuntimeId, input, config: config2 } = params;
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
throw error.toResourceError("AgentRuntime", agentRuntimeId);
|
|
1820
|
-
}
|
|
1821
|
-
throw error;
|
|
1822
|
-
}
|
|
1764
|
+
return await _AgentRuntimeEndpoint.getClient().listEndpoints({
|
|
1765
|
+
agentRuntimeId,
|
|
1766
|
+
input,
|
|
1767
|
+
config: config2
|
|
1768
|
+
});
|
|
1823
1769
|
}
|
|
1824
1770
|
static listAll = async (params) => {
|
|
1825
1771
|
const { agentRuntimeId, ...restParams } = params;
|
|
@@ -1970,7 +1916,6 @@ exports.AgentRuntime = void 0;
|
|
|
1970
1916
|
var init_runtime = __esm({
|
|
1971
1917
|
"src/agent-runtime/runtime.ts"() {
|
|
1972
1918
|
init_config();
|
|
1973
|
-
init_exception();
|
|
1974
1919
|
init_resource();
|
|
1975
1920
|
init_data();
|
|
1976
1921
|
init_endpoint();
|
|
@@ -2020,68 +1965,35 @@ var init_runtime = __esm({
|
|
|
2020
1965
|
*/
|
|
2021
1966
|
static async create(params) {
|
|
2022
1967
|
const { input, config: config2 } = params;
|
|
2023
|
-
|
|
2024
|
-
const client = _AgentRuntime.getClient();
|
|
2025
|
-
return await client.create({ input, config: config2 });
|
|
2026
|
-
} catch (error) {
|
|
2027
|
-
if (error instanceof exports.HTTPError) {
|
|
2028
|
-
throw error.toResourceError("AgentRuntime", input.agentRuntimeName);
|
|
2029
|
-
}
|
|
2030
|
-
throw error;
|
|
2031
|
-
}
|
|
1968
|
+
return await _AgentRuntime.getClient().create({ input, config: config2 });
|
|
2032
1969
|
}
|
|
2033
1970
|
/**
|
|
2034
1971
|
* Delete an Agent Runtime by ID
|
|
2035
1972
|
*/
|
|
2036
1973
|
static async delete(params) {
|
|
2037
1974
|
const { id, config: config2 } = params;
|
|
2038
|
-
|
|
2039
|
-
const client = _AgentRuntime.getClient();
|
|
2040
|
-
return await client.delete({ id, config: config2 });
|
|
2041
|
-
} catch (error) {
|
|
2042
|
-
if (error instanceof exports.HTTPError) {
|
|
2043
|
-
throw error.toResourceError("AgentRuntime", id);
|
|
2044
|
-
}
|
|
2045
|
-
throw error;
|
|
2046
|
-
}
|
|
1975
|
+
return await _AgentRuntime.getClient().delete({ id, config: config2 });
|
|
2047
1976
|
}
|
|
2048
1977
|
/**
|
|
2049
1978
|
* Update an Agent Runtime by ID
|
|
2050
1979
|
*/
|
|
2051
1980
|
static async update(params) {
|
|
2052
1981
|
const { id, input, config: config2 } = params;
|
|
2053
|
-
|
|
2054
|
-
const client = _AgentRuntime.getClient();
|
|
2055
|
-
return await client.update({ id, input, config: config2 });
|
|
2056
|
-
} catch (error) {
|
|
2057
|
-
if (error instanceof exports.HTTPError) {
|
|
2058
|
-
throw error.toResourceError("AgentRuntime", id);
|
|
2059
|
-
}
|
|
2060
|
-
throw error;
|
|
2061
|
-
}
|
|
1982
|
+
return await _AgentRuntime.getClient().update({ id, input, config: config2 });
|
|
2062
1983
|
}
|
|
2063
1984
|
/**
|
|
2064
1985
|
* Get an Agent Runtime by ID
|
|
2065
1986
|
*/
|
|
2066
1987
|
static async get(params) {
|
|
2067
1988
|
const { id, config: config2 } = params;
|
|
2068
|
-
|
|
2069
|
-
const client = _AgentRuntime.getClient();
|
|
2070
|
-
return await client.get({ id, config: config2 });
|
|
2071
|
-
} catch (error) {
|
|
2072
|
-
if (error instanceof exports.HTTPError) {
|
|
2073
|
-
throw error.toResourceError("AgentRuntime", id);
|
|
2074
|
-
}
|
|
2075
|
-
throw error;
|
|
2076
|
-
}
|
|
1989
|
+
return await _AgentRuntime.getClient().get({ id, config: config2 });
|
|
2077
1990
|
}
|
|
2078
1991
|
/**
|
|
2079
1992
|
* List Agent Runtimes
|
|
2080
1993
|
*/
|
|
2081
1994
|
static async list(params) {
|
|
2082
1995
|
const { input, config: config2 } = params ?? {};
|
|
2083
|
-
|
|
2084
|
-
return await client.list({ input, config: config2 });
|
|
1996
|
+
return await _AgentRuntime.getClient().list({ input, config: config2 });
|
|
2085
1997
|
}
|
|
2086
1998
|
static listAll = listAllResourcesFunction(this.list);
|
|
2087
1999
|
/**
|
|
@@ -2277,6 +2189,7 @@ exports.AgentRuntimeClient = void 0;
|
|
|
2277
2189
|
var init_client = __esm({
|
|
2278
2190
|
"src/agent-runtime/client.ts"() {
|
|
2279
2191
|
init_config();
|
|
2192
|
+
init_exception();
|
|
2280
2193
|
init_model();
|
|
2281
2194
|
init_control();
|
|
2282
2195
|
init_data();
|
|
@@ -2296,39 +2209,46 @@ var init_client = __esm({
|
|
|
2296
2209
|
create = async (params) => {
|
|
2297
2210
|
const { input, config: config2 } = params;
|
|
2298
2211
|
const cfg = exports.Config.withConfigs(this.config, config2);
|
|
2299
|
-
|
|
2300
|
-
input.networkConfiguration
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
if (input.
|
|
2304
|
-
input.
|
|
2305
|
-
|
|
2306
|
-
input.
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2212
|
+
try {
|
|
2213
|
+
if (!input.networkConfiguration) {
|
|
2214
|
+
input.networkConfiguration = {};
|
|
2215
|
+
}
|
|
2216
|
+
if (!input.artifactType) {
|
|
2217
|
+
if (input.codeConfiguration) {
|
|
2218
|
+
input.artifactType = exports.AgentRuntimeArtifact.CODE;
|
|
2219
|
+
} else if (input.containerConfiguration) {
|
|
2220
|
+
input.artifactType = exports.AgentRuntimeArtifact.CONTAINER;
|
|
2221
|
+
} else {
|
|
2222
|
+
throw new Error(
|
|
2223
|
+
"Either codeConfiguration or containerConfiguration must be provided"
|
|
2224
|
+
);
|
|
2225
|
+
}
|
|
2311
2226
|
}
|
|
2227
|
+
const result = await this.controlApi.createAgentRuntime({
|
|
2228
|
+
input: new $AgentRun3__namespace.CreateAgentRuntimeInput({
|
|
2229
|
+
...input,
|
|
2230
|
+
codeConfiguration: input.codeConfiguration ? new $AgentRun3__namespace.CodeConfiguration({
|
|
2231
|
+
...input.codeConfiguration
|
|
2232
|
+
}) : void 0,
|
|
2233
|
+
containerConfiguration: input.containerConfiguration ? new $AgentRun3__namespace.ContainerConfiguration({
|
|
2234
|
+
...input.containerConfiguration
|
|
2235
|
+
}) : void 0,
|
|
2236
|
+
networkConfiguration: input.networkConfiguration ? new $AgentRun3__namespace.NetworkConfiguration({
|
|
2237
|
+
networkMode: input.networkConfiguration.networkMode || NetworkMode.PUBLIC,
|
|
2238
|
+
securityGroupId: input.networkConfiguration.securityGroupId,
|
|
2239
|
+
vpcId: input.networkConfiguration.vpcId,
|
|
2240
|
+
vswitchIds: input.networkConfiguration.vSwitchIds
|
|
2241
|
+
}) : void 0
|
|
2242
|
+
}),
|
|
2243
|
+
config: cfg
|
|
2244
|
+
});
|
|
2245
|
+
return new exports.AgentRuntime(result, cfg);
|
|
2246
|
+
} catch (error) {
|
|
2247
|
+
if (error instanceof exports.HTTPError) {
|
|
2248
|
+
throw error.toResourceError("AgentRuntime", input.agentRuntimeName);
|
|
2249
|
+
}
|
|
2250
|
+
throw error;
|
|
2312
2251
|
}
|
|
2313
|
-
const result = await this.controlApi.createAgentRuntime({
|
|
2314
|
-
input: new $AgentRun3__namespace.CreateAgentRuntimeInput({
|
|
2315
|
-
...input,
|
|
2316
|
-
codeConfiguration: input.codeConfiguration ? new $AgentRun3__namespace.CodeConfiguration({
|
|
2317
|
-
...input.codeConfiguration
|
|
2318
|
-
}) : void 0,
|
|
2319
|
-
containerConfiguration: input.containerConfiguration ? new $AgentRun3__namespace.ContainerConfiguration({
|
|
2320
|
-
...input.containerConfiguration
|
|
2321
|
-
}) : void 0,
|
|
2322
|
-
networkConfiguration: input.networkConfiguration ? new $AgentRun3__namespace.NetworkConfiguration({
|
|
2323
|
-
networkMode: input.networkConfiguration.networkMode || NetworkMode.PUBLIC,
|
|
2324
|
-
securityGroupId: input.networkConfiguration.securityGroupId,
|
|
2325
|
-
vpcId: input.networkConfiguration.vpcId,
|
|
2326
|
-
vswitchIds: input.networkConfiguration.vSwitchIds
|
|
2327
|
-
}) : void 0
|
|
2328
|
-
}),
|
|
2329
|
-
config: cfg
|
|
2330
|
-
});
|
|
2331
|
-
return new exports.AgentRuntime(result, cfg);
|
|
2332
2252
|
};
|
|
2333
2253
|
/**
|
|
2334
2254
|
* Delete an Agent Runtime
|
|
@@ -2336,29 +2256,36 @@ var init_client = __esm({
|
|
|
2336
2256
|
delete = async (params) => {
|
|
2337
2257
|
const { id, config: config2 } = params;
|
|
2338
2258
|
const cfg = exports.Config.withConfigs(this.config, config2);
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
config: cfg
|
|
2349
|
-
});
|
|
2350
|
-
while (remaining.length > 0) {
|
|
2351
|
-
await new Promise((resolve) => setTimeout(resolve, 1e3));
|
|
2352
|
-
remaining = await this.listEndpoints({
|
|
2259
|
+
try {
|
|
2260
|
+
const endpoints = await this.listEndpoints({
|
|
2261
|
+
agentRuntimeId: id,
|
|
2262
|
+
config: cfg
|
|
2263
|
+
});
|
|
2264
|
+
for (const endpoint of endpoints) {
|
|
2265
|
+
await endpoint.delete({ config: cfg });
|
|
2266
|
+
}
|
|
2267
|
+
let remaining = await this.listEndpoints({
|
|
2353
2268
|
agentRuntimeId: id,
|
|
2354
2269
|
config: cfg
|
|
2355
2270
|
});
|
|
2271
|
+
while (remaining.length > 0) {
|
|
2272
|
+
await new Promise((resolve) => setTimeout(resolve, 1e3));
|
|
2273
|
+
remaining = await this.listEndpoints({
|
|
2274
|
+
agentRuntimeId: id,
|
|
2275
|
+
config: cfg
|
|
2276
|
+
});
|
|
2277
|
+
}
|
|
2278
|
+
const result = await this.controlApi.deleteAgentRuntime({
|
|
2279
|
+
agentId: id,
|
|
2280
|
+
config: cfg
|
|
2281
|
+
});
|
|
2282
|
+
return new exports.AgentRuntime(result, cfg);
|
|
2283
|
+
} catch (error) {
|
|
2284
|
+
if (error instanceof exports.HTTPError) {
|
|
2285
|
+
throw error.toResourceError("AgentRuntime", id);
|
|
2286
|
+
}
|
|
2287
|
+
throw error;
|
|
2356
2288
|
}
|
|
2357
|
-
const result = await this.controlApi.deleteAgentRuntime({
|
|
2358
|
-
agentId: id,
|
|
2359
|
-
config: cfg
|
|
2360
|
-
});
|
|
2361
|
-
return new exports.AgentRuntime(result, cfg);
|
|
2362
2289
|
};
|
|
2363
2290
|
/**
|
|
2364
2291
|
* Update an Agent Runtime
|
|
@@ -2366,20 +2293,27 @@ var init_client = __esm({
|
|
|
2366
2293
|
update = async (params) => {
|
|
2367
2294
|
const { id, input, config: config2 } = params;
|
|
2368
2295
|
const cfg = exports.Config.withConfigs(this.config, config2);
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2296
|
+
try {
|
|
2297
|
+
const result = await this.controlApi.updateAgentRuntime({
|
|
2298
|
+
agentId: id,
|
|
2299
|
+
input: new $AgentRun3__namespace.UpdateAgentRuntimeInput({
|
|
2300
|
+
...input,
|
|
2301
|
+
codeConfiguration: input.codeConfiguration ? new $AgentRun3__namespace.CodeConfiguration({
|
|
2302
|
+
...input.codeConfiguration
|
|
2303
|
+
}) : void 0,
|
|
2304
|
+
containerConfiguration: input.containerConfiguration ? new $AgentRun3__namespace.ContainerConfiguration({
|
|
2305
|
+
...input.containerConfiguration
|
|
2306
|
+
}) : void 0
|
|
2307
|
+
}),
|
|
2308
|
+
config: cfg
|
|
2309
|
+
});
|
|
2310
|
+
return new exports.AgentRuntime(result, cfg);
|
|
2311
|
+
} catch (error) {
|
|
2312
|
+
if (error instanceof exports.HTTPError) {
|
|
2313
|
+
throw error.toResourceError("AgentRuntime", id);
|
|
2314
|
+
}
|
|
2315
|
+
throw error;
|
|
2316
|
+
}
|
|
2383
2317
|
};
|
|
2384
2318
|
/**
|
|
2385
2319
|
* Get an Agent Runtime
|
|
@@ -2387,11 +2321,18 @@ var init_client = __esm({
|
|
|
2387
2321
|
get = async (params) => {
|
|
2388
2322
|
const { id, config: config2 } = params;
|
|
2389
2323
|
const cfg = exports.Config.withConfigs(this.config, config2);
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2324
|
+
try {
|
|
2325
|
+
const result = await this.controlApi.getAgentRuntime({
|
|
2326
|
+
agentId: id,
|
|
2327
|
+
config: cfg
|
|
2328
|
+
});
|
|
2329
|
+
return new exports.AgentRuntime(result, cfg);
|
|
2330
|
+
} catch (error) {
|
|
2331
|
+
if (error instanceof exports.HTTPError) {
|
|
2332
|
+
throw error.toResourceError("AgentRuntime", id);
|
|
2333
|
+
}
|
|
2334
|
+
throw error;
|
|
2335
|
+
}
|
|
2395
2336
|
};
|
|
2396
2337
|
/**
|
|
2397
2338
|
* List Agent Runtimes
|
|
@@ -2428,16 +2369,26 @@ var init_client = __esm({
|
|
|
2428
2369
|
createEndpoint = async (params) => {
|
|
2429
2370
|
const { agentRuntimeId, input, config: config2 } = params;
|
|
2430
2371
|
const cfg = exports.Config.withConfigs(this.config, config2);
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2372
|
+
try {
|
|
2373
|
+
const targetVersion = input.targetVersion || "LATEST";
|
|
2374
|
+
const result = await this.controlApi.createAgentRuntimeEndpoint({
|
|
2375
|
+
agentId: agentRuntimeId,
|
|
2376
|
+
input: new $AgentRun3__namespace.CreateAgentRuntimeEndpointInput({
|
|
2377
|
+
...input,
|
|
2378
|
+
targetVersion
|
|
2379
|
+
}),
|
|
2380
|
+
config: cfg
|
|
2381
|
+
});
|
|
2382
|
+
return new exports.AgentRuntimeEndpoint(result, cfg);
|
|
2383
|
+
} catch (error) {
|
|
2384
|
+
if (error instanceof exports.HTTPError) {
|
|
2385
|
+
throw error.toResourceError(
|
|
2386
|
+
"AgentRuntimeEndpoint",
|
|
2387
|
+
`${agentRuntimeId}/${input.agentRuntimeEndpointName}`
|
|
2388
|
+
);
|
|
2389
|
+
}
|
|
2390
|
+
throw error;
|
|
2391
|
+
}
|
|
2441
2392
|
};
|
|
2442
2393
|
/**
|
|
2443
2394
|
* Delete an endpoint
|
|
@@ -2445,12 +2396,22 @@ var init_client = __esm({
|
|
|
2445
2396
|
deleteEndpoint = async (params) => {
|
|
2446
2397
|
const { agentRuntimeId, endpointId, config: config2 } = params;
|
|
2447
2398
|
const cfg = exports.Config.withConfigs(this.config, config2);
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2399
|
+
try {
|
|
2400
|
+
const result = await this.controlApi.deleteAgentRuntimeEndpoint({
|
|
2401
|
+
agentId: agentRuntimeId,
|
|
2402
|
+
endpointId,
|
|
2403
|
+
config: cfg
|
|
2404
|
+
});
|
|
2405
|
+
return new exports.AgentRuntimeEndpoint(result, cfg);
|
|
2406
|
+
} catch (error) {
|
|
2407
|
+
if (error instanceof exports.HTTPError) {
|
|
2408
|
+
throw error.toResourceError(
|
|
2409
|
+
"AgentRuntimeEndpoint",
|
|
2410
|
+
`${agentRuntimeId}/${endpointId}`
|
|
2411
|
+
);
|
|
2412
|
+
}
|
|
2413
|
+
throw error;
|
|
2414
|
+
}
|
|
2454
2415
|
};
|
|
2455
2416
|
/**
|
|
2456
2417
|
* Update an endpoint
|
|
@@ -2458,15 +2419,25 @@ var init_client = __esm({
|
|
|
2458
2419
|
updateEndpoint = async (params) => {
|
|
2459
2420
|
const { agentRuntimeId, endpointId, input, config: config2 } = params;
|
|
2460
2421
|
const cfg = exports.Config.withConfigs(this.config, config2);
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2422
|
+
try {
|
|
2423
|
+
const result = await this.controlApi.updateAgentRuntimeEndpoint({
|
|
2424
|
+
agentId: agentRuntimeId,
|
|
2425
|
+
endpointId,
|
|
2426
|
+
input: new $AgentRun3__namespace.UpdateAgentRuntimeEndpointInput({
|
|
2427
|
+
...input
|
|
2428
|
+
}),
|
|
2429
|
+
config: cfg
|
|
2430
|
+
});
|
|
2431
|
+
return new exports.AgentRuntimeEndpoint(result, cfg);
|
|
2432
|
+
} catch (error) {
|
|
2433
|
+
if (error instanceof exports.HTTPError) {
|
|
2434
|
+
throw error.toResourceError(
|
|
2435
|
+
"AgentRuntimeEndpoint",
|
|
2436
|
+
`${agentRuntimeId}/${endpointId}`
|
|
2437
|
+
);
|
|
2438
|
+
}
|
|
2439
|
+
throw error;
|
|
2440
|
+
}
|
|
2470
2441
|
};
|
|
2471
2442
|
/**
|
|
2472
2443
|
* Get an endpoint
|
|
@@ -2474,12 +2445,22 @@ var init_client = __esm({
|
|
|
2474
2445
|
getEndpoint = async (params) => {
|
|
2475
2446
|
const { agentRuntimeId, endpointId, config: config2 } = params;
|
|
2476
2447
|
const cfg = exports.Config.withConfigs(this.config, config2);
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2448
|
+
try {
|
|
2449
|
+
const result = await this.controlApi.getAgentRuntimeEndpoint({
|
|
2450
|
+
agentId: agentRuntimeId,
|
|
2451
|
+
endpointId,
|
|
2452
|
+
config: cfg
|
|
2453
|
+
});
|
|
2454
|
+
return new exports.AgentRuntimeEndpoint(result, cfg);
|
|
2455
|
+
} catch (error) {
|
|
2456
|
+
if (error instanceof exports.HTTPError) {
|
|
2457
|
+
throw error.toResourceError(
|
|
2458
|
+
"AgentRuntimeEndpoint",
|
|
2459
|
+
`${agentRuntimeId}/${endpointId}`
|
|
2460
|
+
);
|
|
2461
|
+
}
|
|
2462
|
+
throw error;
|
|
2463
|
+
}
|
|
2483
2464
|
};
|
|
2484
2465
|
/**
|
|
2485
2466
|
* List endpoints for an Agent Runtime
|
|
@@ -2487,17 +2468,24 @@ var init_client = __esm({
|
|
|
2487
2468
|
listEndpoints = async (params) => {
|
|
2488
2469
|
const { agentRuntimeId, input, config: config2 } = params;
|
|
2489
2470
|
const cfg = exports.Config.withConfigs(this.config, config2);
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
(
|
|
2500
|
-
|
|
2471
|
+
try {
|
|
2472
|
+
const request = new $AgentRun3__namespace.ListAgentRuntimeEndpointsRequest({
|
|
2473
|
+
...input
|
|
2474
|
+
});
|
|
2475
|
+
const result = await this.controlApi.listAgentRuntimeEndpoints({
|
|
2476
|
+
agentId: agentRuntimeId,
|
|
2477
|
+
input: request,
|
|
2478
|
+
config: cfg
|
|
2479
|
+
});
|
|
2480
|
+
return (result.items || []).map(
|
|
2481
|
+
(item) => new exports.AgentRuntimeEndpoint(item, cfg)
|
|
2482
|
+
);
|
|
2483
|
+
} catch (error) {
|
|
2484
|
+
if (error instanceof exports.HTTPError) {
|
|
2485
|
+
throw error.toResourceError("AgentRuntime", agentRuntimeId);
|
|
2486
|
+
}
|
|
2487
|
+
throw error;
|
|
2488
|
+
}
|
|
2501
2489
|
};
|
|
2502
2490
|
/**
|
|
2503
2491
|
* List versions for an Agent Runtime
|
|
@@ -2588,21 +2576,14 @@ var init_client = __esm({
|
|
|
2588
2576
|
}
|
|
2589
2577
|
});
|
|
2590
2578
|
|
|
2591
|
-
// src/utils/mixin.ts
|
|
2592
|
-
var init_mixin = __esm({
|
|
2593
|
-
"src/utils/mixin.ts"() {
|
|
2594
|
-
}
|
|
2595
|
-
});
|
|
2596
|
-
|
|
2597
2579
|
// src/utils/index.ts
|
|
2598
2580
|
var init_utils = __esm({
|
|
2599
2581
|
"src/utils/index.ts"() {
|
|
2600
2582
|
init_config();
|
|
2583
|
+
init_data_api();
|
|
2601
2584
|
init_exception();
|
|
2602
|
-
init_model();
|
|
2603
2585
|
init_log();
|
|
2604
|
-
|
|
2605
|
-
init_mixin();
|
|
2586
|
+
init_model();
|
|
2606
2587
|
}
|
|
2607
2588
|
});
|
|
2608
2589
|
exports.CredentialControlAPI = void 0;
|
|
@@ -2829,7 +2810,6 @@ __export(credential_exports, {
|
|
|
2829
2810
|
exports.Credential = void 0;
|
|
2830
2811
|
var init_credential = __esm({
|
|
2831
2812
|
"src/credential/credential.ts"() {
|
|
2832
|
-
init_exception();
|
|
2833
2813
|
init_resource();
|
|
2834
2814
|
init_resource();
|
|
2835
2815
|
init_client2();
|
|
@@ -2867,15 +2847,7 @@ var init_credential = __esm({
|
|
|
2867
2847
|
const hasInputProp = paramsOrInput && paramsOrInput.input !== void 0;
|
|
2868
2848
|
const input = hasInputProp ? paramsOrInput.input : paramsOrInput;
|
|
2869
2849
|
const config2 = hasInputProp ? paramsOrInput.config : void 0;
|
|
2870
|
-
|
|
2871
|
-
try {
|
|
2872
|
-
return await client.create({ input, config: config2 });
|
|
2873
|
-
} catch (error) {
|
|
2874
|
-
if (error instanceof exports.HTTPError) {
|
|
2875
|
-
throw error.toResourceError("Credential", input.credentialName || "");
|
|
2876
|
-
}
|
|
2877
|
-
throw error;
|
|
2878
|
-
}
|
|
2850
|
+
return await _Credential.getClient().create({ input, config: config2 });
|
|
2879
2851
|
};
|
|
2880
2852
|
/**
|
|
2881
2853
|
* Delete a Credential by name
|
|
@@ -2884,15 +2856,7 @@ var init_credential = __esm({
|
|
|
2884
2856
|
const isString = typeof paramsOrName === "string";
|
|
2885
2857
|
const name = isString ? paramsOrName : paramsOrName.name;
|
|
2886
2858
|
const config2 = isString ? void 0 : paramsOrName.config;
|
|
2887
|
-
|
|
2888
|
-
try {
|
|
2889
|
-
return await client.delete({ name, config: config2 });
|
|
2890
|
-
} catch (error) {
|
|
2891
|
-
if (error instanceof exports.HTTPError) {
|
|
2892
|
-
throw error.toResourceError("Credential", name);
|
|
2893
|
-
}
|
|
2894
|
-
throw error;
|
|
2895
|
-
}
|
|
2859
|
+
return await _Credential.getClient().delete({ name, config: config2 });
|
|
2896
2860
|
};
|
|
2897
2861
|
/**
|
|
2898
2862
|
* Update a Credential by name
|
|
@@ -2901,15 +2865,7 @@ var init_credential = __esm({
|
|
|
2901
2865
|
const name = paramsOrName.name;
|
|
2902
2866
|
const input = paramsOrName.input;
|
|
2903
2867
|
const config2 = paramsOrName.config;
|
|
2904
|
-
|
|
2905
|
-
try {
|
|
2906
|
-
return await client.update({ name, input, config: config2 });
|
|
2907
|
-
} catch (error) {
|
|
2908
|
-
if (error instanceof exports.HTTPError) {
|
|
2909
|
-
throw error.toResourceError("Credential", name);
|
|
2910
|
-
}
|
|
2911
|
-
throw error;
|
|
2912
|
-
}
|
|
2868
|
+
return await _Credential.getClient().update({ name, input, config: config2 });
|
|
2913
2869
|
};
|
|
2914
2870
|
/**
|
|
2915
2871
|
* Get a Credential by name
|
|
@@ -2918,15 +2874,7 @@ var init_credential = __esm({
|
|
|
2918
2874
|
const isString = typeof paramsOrName === "string";
|
|
2919
2875
|
const name = isString ? paramsOrName : paramsOrName.name;
|
|
2920
2876
|
const config2 = isString ? void 0 : paramsOrName.config;
|
|
2921
|
-
|
|
2922
|
-
try {
|
|
2923
|
-
return await client.get({ name, config: config2 });
|
|
2924
|
-
} catch (error) {
|
|
2925
|
-
if (error instanceof exports.HTTPError) {
|
|
2926
|
-
throw error.toResourceError("Credential", name);
|
|
2927
|
-
}
|
|
2928
|
-
throw error;
|
|
2929
|
-
}
|
|
2877
|
+
return await _Credential.getClient().get({ name, config: config2 });
|
|
2930
2878
|
};
|
|
2931
2879
|
/**
|
|
2932
2880
|
* List all Credentials (with pagination)
|
|
@@ -2934,15 +2882,7 @@ var init_credential = __esm({
|
|
|
2934
2882
|
static list = async (paramsOrUndefined) => {
|
|
2935
2883
|
const input = paramsOrUndefined?.input ?? paramsOrUndefined;
|
|
2936
2884
|
const config2 = paramsOrUndefined?.config;
|
|
2937
|
-
|
|
2938
|
-
try {
|
|
2939
|
-
return await client.list({ input, config: config2 });
|
|
2940
|
-
} catch (error) {
|
|
2941
|
-
if (error instanceof exports.HTTPError) {
|
|
2942
|
-
throw error.toResourceError("Credential", "list");
|
|
2943
|
-
}
|
|
2944
|
-
throw error;
|
|
2945
|
-
}
|
|
2885
|
+
return await _Credential.getClient().list({ input, config: config2 });
|
|
2946
2886
|
};
|
|
2947
2887
|
static listAll = listAllResourcesFunction(this.list);
|
|
2948
2888
|
/**
|
|
@@ -3122,7 +3062,6 @@ var init_client2 = __esm({
|
|
|
3122
3062
|
"src/credential/client.ts"() {
|
|
3123
3063
|
init_utils();
|
|
3124
3064
|
init_config();
|
|
3125
|
-
init_model();
|
|
3126
3065
|
init_control2();
|
|
3127
3066
|
init_credential();
|
|
3128
3067
|
init_model3();
|
|
@@ -3172,8 +3111,7 @@ var init_client2 = __esm({
|
|
|
3172
3111
|
input: new $AgentRun3__namespace.CreateCredentialInput(normalized),
|
|
3173
3112
|
config: cfg
|
|
3174
3113
|
});
|
|
3175
|
-
|
|
3176
|
-
return new exports.Credential(credential);
|
|
3114
|
+
return new exports.Credential(result);
|
|
3177
3115
|
} catch (error) {
|
|
3178
3116
|
if (error instanceof exports.HTTPError) {
|
|
3179
3117
|
throw error.toResourceError(
|
|
@@ -3195,8 +3133,7 @@ var init_client2 = __esm({
|
|
|
3195
3133
|
credentialName: name,
|
|
3196
3134
|
config: cfg
|
|
3197
3135
|
});
|
|
3198
|
-
|
|
3199
|
-
return new exports.Credential(credential);
|
|
3136
|
+
return new exports.Credential(result);
|
|
3200
3137
|
} catch (error) {
|
|
3201
3138
|
if (error instanceof exports.HTTPError) {
|
|
3202
3139
|
throw error.toResourceError("Credential", params?.name);
|
|
@@ -4172,7 +4109,6 @@ exports.Sandbox = void 0;
|
|
|
4172
4109
|
var init_sandbox = __esm({
|
|
4173
4110
|
"src/sandbox/sandbox.ts"() {
|
|
4174
4111
|
init_config();
|
|
4175
|
-
init_exception();
|
|
4176
4112
|
init_resource();
|
|
4177
4113
|
init_model4();
|
|
4178
4114
|
exports.Sandbox = class _Sandbox extends ResourceBase {
|
|
@@ -4272,88 +4208,34 @@ var init_sandbox = __esm({
|
|
|
4272
4208
|
* 创建新沙箱 / Create a New Sandbox
|
|
4273
4209
|
*/
|
|
4274
4210
|
static async create(input, config2) {
|
|
4275
|
-
|
|
4276
|
-
const client = _Sandbox.getClient();
|
|
4277
|
-
return await client.createSandbox({ input, config: config2 });
|
|
4278
|
-
} catch (error) {
|
|
4279
|
-
if (error instanceof exports.HTTPError) {
|
|
4280
|
-
throw error.toResourceError("Sandbox", input.templateName);
|
|
4281
|
-
}
|
|
4282
|
-
_Sandbox.handleError(error);
|
|
4283
|
-
}
|
|
4211
|
+
return await _Sandbox.getClient().createSandbox({ input, config: config2 });
|
|
4284
4212
|
}
|
|
4285
4213
|
/**
|
|
4286
4214
|
* Delete a Sandbox by ID
|
|
4287
4215
|
*/
|
|
4288
4216
|
static async delete(params) {
|
|
4289
4217
|
const { id, config: config2 } = params;
|
|
4290
|
-
|
|
4291
|
-
const client = _Sandbox.getClient();
|
|
4292
|
-
return await client.deleteSandbox({ id, config: config2 });
|
|
4293
|
-
} catch (error) {
|
|
4294
|
-
if (error instanceof exports.HTTPError) {
|
|
4295
|
-
throw error.toResourceError("Sandbox", id);
|
|
4296
|
-
}
|
|
4297
|
-
_Sandbox.handleError(error);
|
|
4298
|
-
}
|
|
4218
|
+
return await _Sandbox.getClient().deleteSandbox({ id, config: config2 });
|
|
4299
4219
|
}
|
|
4300
4220
|
/**
|
|
4301
4221
|
* Stop a Sandbox by ID
|
|
4302
4222
|
*/
|
|
4303
4223
|
static async stop(params) {
|
|
4304
4224
|
const { id, config: config2 } = params;
|
|
4305
|
-
|
|
4306
|
-
const client = _Sandbox.getClient();
|
|
4307
|
-
return await client.stopSandbox({ id, config: config2 });
|
|
4308
|
-
} catch (error) {
|
|
4309
|
-
if (error instanceof exports.HTTPError) {
|
|
4310
|
-
throw error.toResourceError("Sandbox", id);
|
|
4311
|
-
}
|
|
4312
|
-
_Sandbox.handleError(error);
|
|
4313
|
-
}
|
|
4225
|
+
return await _Sandbox.getClient().stopSandbox({ id, config: config2 });
|
|
4314
4226
|
}
|
|
4315
4227
|
/**
|
|
4316
4228
|
* Get a Sandbox by ID
|
|
4317
4229
|
*/
|
|
4318
4230
|
static async get(params) {
|
|
4319
4231
|
const { id, templateType, config: config2 } = params;
|
|
4320
|
-
|
|
4321
|
-
const client = _Sandbox.getClient();
|
|
4322
|
-
return await client.getSandbox({ id, templateType, config: config2 });
|
|
4323
|
-
} catch (error) {
|
|
4324
|
-
if (error instanceof exports.HTTPError) {
|
|
4325
|
-
throw error.toResourceError("Sandbox", id);
|
|
4326
|
-
}
|
|
4327
|
-
_Sandbox.handleError(error);
|
|
4328
|
-
}
|
|
4232
|
+
return await _Sandbox.getClient().getSandbox({ id, templateType, config: config2 });
|
|
4329
4233
|
}
|
|
4330
4234
|
/**
|
|
4331
4235
|
* List Sandboxes
|
|
4332
|
-
*/
|
|
4333
|
-
static async list(input, config2) {
|
|
4334
|
-
|
|
4335
|
-
const client = _Sandbox.getClient();
|
|
4336
|
-
return await client.listSandboxes({ input, config: config2 });
|
|
4337
|
-
} catch (error) {
|
|
4338
|
-
_Sandbox.handleError(error);
|
|
4339
|
-
}
|
|
4340
|
-
}
|
|
4341
|
-
/**
|
|
4342
|
-
* Handle API errors
|
|
4343
|
-
*/
|
|
4344
|
-
static handleError(error) {
|
|
4345
|
-
if (error && typeof error === "object" && "statusCode" in error) {
|
|
4346
|
-
const e = error;
|
|
4347
|
-
const statusCode = e.statusCode;
|
|
4348
|
-
const message = e.message || "Unknown error";
|
|
4349
|
-
const requestId = e.data?.requestId;
|
|
4350
|
-
if (statusCode >= 400 && statusCode < 500) {
|
|
4351
|
-
throw new exports.ClientError(statusCode, message, { requestId });
|
|
4352
|
-
} else if (statusCode >= 500) {
|
|
4353
|
-
throw new exports.ServerError(statusCode, message, { requestId });
|
|
4354
|
-
}
|
|
4355
|
-
}
|
|
4356
|
-
throw error;
|
|
4236
|
+
*/
|
|
4237
|
+
static async list(input, config2) {
|
|
4238
|
+
return await _Sandbox.getClient().listSandboxes({ input, config: config2 });
|
|
4357
4239
|
}
|
|
4358
4240
|
get = async (params) => {
|
|
4359
4241
|
const { config: config2 } = params ?? {};
|
|
@@ -5100,7 +4982,6 @@ var init_code_interpreter_sandbox = __esm({
|
|
|
5100
4982
|
exports.Template = void 0;
|
|
5101
4983
|
var init_template = __esm({
|
|
5102
4984
|
"src/sandbox/template.ts"() {
|
|
5103
|
-
init_exception();
|
|
5104
4985
|
init_resource();
|
|
5105
4986
|
exports.Template = class _Template extends ResourceBase {
|
|
5106
4987
|
/**
|
|
@@ -5189,94 +5070,40 @@ var init_template = __esm({
|
|
|
5189
5070
|
*/
|
|
5190
5071
|
static async create(params) {
|
|
5191
5072
|
const { input, config: config2 } = params;
|
|
5192
|
-
|
|
5193
|
-
const client = _Template.getClient();
|
|
5194
|
-
return await client.createTemplate({ input, config: config2 });
|
|
5195
|
-
} catch (error) {
|
|
5196
|
-
if (error instanceof exports.HTTPError) {
|
|
5197
|
-
throw error.toResourceError("Template", input.templateName);
|
|
5198
|
-
}
|
|
5199
|
-
_Template.handleError(error);
|
|
5200
|
-
}
|
|
5073
|
+
return await _Template.getClient().createTemplate({ input, config: config2 });
|
|
5201
5074
|
}
|
|
5202
5075
|
/**
|
|
5203
5076
|
* Delete a Template by name
|
|
5204
5077
|
*/
|
|
5205
5078
|
static async delete(params) {
|
|
5206
5079
|
const { name, config: config2 } = params;
|
|
5207
|
-
|
|
5208
|
-
const client = _Template.getClient();
|
|
5209
|
-
return await client.deleteTemplate({ name, config: config2 });
|
|
5210
|
-
} catch (error) {
|
|
5211
|
-
if (error instanceof exports.HTTPError) {
|
|
5212
|
-
throw error.toResourceError("Template", name);
|
|
5213
|
-
}
|
|
5214
|
-
_Template.handleError(error);
|
|
5215
|
-
}
|
|
5080
|
+
return await _Template.getClient().deleteTemplate({ name, config: config2 });
|
|
5216
5081
|
}
|
|
5217
5082
|
/**
|
|
5218
5083
|
* Update a Template by name
|
|
5219
5084
|
*/
|
|
5220
5085
|
static async update(params) {
|
|
5221
5086
|
const { name, input, config: config2 } = params;
|
|
5222
|
-
|
|
5223
|
-
const client = _Template.getClient();
|
|
5224
|
-
return await client.updateTemplate({ name, input, config: config2 });
|
|
5225
|
-
} catch (error) {
|
|
5226
|
-
if (error instanceof exports.HTTPError) {
|
|
5227
|
-
throw error.toResourceError("Template", name);
|
|
5228
|
-
}
|
|
5229
|
-
_Template.handleError(error);
|
|
5230
|
-
}
|
|
5087
|
+
return await _Template.getClient().updateTemplate({ name, input, config: config2 });
|
|
5231
5088
|
}
|
|
5232
5089
|
/**
|
|
5233
5090
|
* Get a Template by name
|
|
5234
5091
|
*/
|
|
5235
5092
|
static async get(params) {
|
|
5236
5093
|
const { name, config: config2 } = params;
|
|
5237
|
-
|
|
5238
|
-
const client = _Template.getClient();
|
|
5239
|
-
return await client.getTemplate({ name, config: config2 });
|
|
5240
|
-
} catch (error) {
|
|
5241
|
-
if (error instanceof exports.HTTPError) {
|
|
5242
|
-
throw error.toResourceError("Template", name);
|
|
5243
|
-
}
|
|
5244
|
-
_Template.handleError(error);
|
|
5245
|
-
}
|
|
5094
|
+
return await _Template.getClient().getTemplate({ name, config: config2 });
|
|
5246
5095
|
}
|
|
5247
5096
|
/**
|
|
5248
5097
|
* List Templates
|
|
5249
5098
|
*/
|
|
5250
5099
|
static async list(params) {
|
|
5251
5100
|
const { input, config: config2 } = params ?? {};
|
|
5252
|
-
|
|
5253
|
-
const client = _Template.getClient();
|
|
5254
|
-
return await client.listTemplates({ input, config: config2 });
|
|
5255
|
-
} catch (error) {
|
|
5256
|
-
_Template.handleError(error);
|
|
5257
|
-
}
|
|
5101
|
+
return await _Template.getClient().listTemplates({ input, config: config2 });
|
|
5258
5102
|
}
|
|
5259
5103
|
/**
|
|
5260
5104
|
* List all Templates (with pagination)
|
|
5261
5105
|
*/
|
|
5262
5106
|
static listAll = listAllResourcesFunction(this.list);
|
|
5263
|
-
/**
|
|
5264
|
-
* Handle API errors
|
|
5265
|
-
*/
|
|
5266
|
-
static handleError(error) {
|
|
5267
|
-
if (error && typeof error === "object" && "statusCode" in error) {
|
|
5268
|
-
const e = error;
|
|
5269
|
-
const statusCode = e.statusCode;
|
|
5270
|
-
const message = e.message || "Unknown error";
|
|
5271
|
-
const requestId = e.data?.requestId;
|
|
5272
|
-
if (statusCode >= 400 && statusCode < 500) {
|
|
5273
|
-
throw new exports.ClientError(statusCode, message, { requestId });
|
|
5274
|
-
} else if (statusCode >= 500) {
|
|
5275
|
-
throw new exports.ServerError(statusCode, message, { requestId });
|
|
5276
|
-
}
|
|
5277
|
-
}
|
|
5278
|
-
throw error;
|
|
5279
|
-
}
|
|
5280
5107
|
get = async (params = {}) => {
|
|
5281
5108
|
return await _Template.get({
|
|
5282
5109
|
name: this.templateName,
|
|
@@ -5730,6 +5557,7 @@ exports.SandboxClient = void 0;
|
|
|
5730
5557
|
var init_client3 = __esm({
|
|
5731
5558
|
"src/sandbox/client.ts"() {
|
|
5732
5559
|
init_config();
|
|
5560
|
+
init_exception();
|
|
5733
5561
|
init_control3();
|
|
5734
5562
|
init_browser_sandbox();
|
|
5735
5563
|
init_code_interpreter_sandbox();
|
|
@@ -5750,17 +5578,24 @@ var init_client3 = __esm({
|
|
|
5750
5578
|
createTemplate = async (params) => {
|
|
5751
5579
|
const { input, config: config2 } = params;
|
|
5752
5580
|
const cfg = exports.Config.withConfigs(this.config, config2);
|
|
5753
|
-
|
|
5754
|
-
|
|
5755
|
-
|
|
5756
|
-
|
|
5757
|
-
|
|
5758
|
-
|
|
5759
|
-
|
|
5760
|
-
|
|
5761
|
-
|
|
5762
|
-
|
|
5763
|
-
|
|
5581
|
+
try {
|
|
5582
|
+
const finalInput = this.prepareTemplateCreateInput(input);
|
|
5583
|
+
const result = await this.controlApi.createTemplate({
|
|
5584
|
+
input: new $AgentRun3__namespace.CreateTemplateInput({
|
|
5585
|
+
...finalInput,
|
|
5586
|
+
networkConfiguration: finalInput.networkConfiguration ? new $AgentRun3__namespace.NetworkConfiguration({
|
|
5587
|
+
...finalInput.networkConfiguration
|
|
5588
|
+
}) : void 0
|
|
5589
|
+
}),
|
|
5590
|
+
config: cfg
|
|
5591
|
+
});
|
|
5592
|
+
return new exports.Template(result, cfg);
|
|
5593
|
+
} catch (error) {
|
|
5594
|
+
if (error instanceof exports.HTTPError) {
|
|
5595
|
+
throw error.toResourceError("Template", input.templateName);
|
|
5596
|
+
}
|
|
5597
|
+
throw error;
|
|
5598
|
+
}
|
|
5764
5599
|
};
|
|
5765
5600
|
/**
|
|
5766
5601
|
* Delete a Template
|
|
@@ -5768,11 +5603,18 @@ var init_client3 = __esm({
|
|
|
5768
5603
|
deleteTemplate = async (params) => {
|
|
5769
5604
|
const { name, config: config2 } = params;
|
|
5770
5605
|
const cfg = exports.Config.withConfigs(this.config, config2);
|
|
5771
|
-
|
|
5772
|
-
|
|
5773
|
-
|
|
5774
|
-
|
|
5775
|
-
|
|
5606
|
+
try {
|
|
5607
|
+
const result = await this.controlApi.deleteTemplate({
|
|
5608
|
+
templateName: name,
|
|
5609
|
+
config: cfg
|
|
5610
|
+
});
|
|
5611
|
+
return new exports.Template(result, cfg);
|
|
5612
|
+
} catch (error) {
|
|
5613
|
+
if (error instanceof exports.HTTPError) {
|
|
5614
|
+
throw error.toResourceError("Template", name);
|
|
5615
|
+
}
|
|
5616
|
+
throw error;
|
|
5617
|
+
}
|
|
5776
5618
|
};
|
|
5777
5619
|
/**
|
|
5778
5620
|
* Update a Template
|
|
@@ -5780,17 +5622,24 @@ var init_client3 = __esm({
|
|
|
5780
5622
|
updateTemplate = async (params) => {
|
|
5781
5623
|
const { name, input, config: config2 } = params;
|
|
5782
5624
|
const cfg = exports.Config.withConfigs(this.config, config2);
|
|
5783
|
-
|
|
5784
|
-
|
|
5785
|
-
|
|
5786
|
-
|
|
5787
|
-
|
|
5788
|
-
|
|
5789
|
-
|
|
5790
|
-
|
|
5791
|
-
|
|
5792
|
-
|
|
5793
|
-
|
|
5625
|
+
try {
|
|
5626
|
+
const result = await this.controlApi.updateTemplate({
|
|
5627
|
+
templateName: name,
|
|
5628
|
+
input: new $AgentRun3__namespace.UpdateTemplateInput({
|
|
5629
|
+
...input,
|
|
5630
|
+
networkConfiguration: input.networkConfiguration ? new $AgentRun3__namespace.NetworkConfiguration({
|
|
5631
|
+
...input.networkConfiguration
|
|
5632
|
+
}) : void 0
|
|
5633
|
+
}),
|
|
5634
|
+
config: cfg
|
|
5635
|
+
});
|
|
5636
|
+
return new exports.Template(result, cfg);
|
|
5637
|
+
} catch (error) {
|
|
5638
|
+
if (error instanceof exports.HTTPError) {
|
|
5639
|
+
throw error.toResourceError("Template", name);
|
|
5640
|
+
}
|
|
5641
|
+
throw error;
|
|
5642
|
+
}
|
|
5794
5643
|
};
|
|
5795
5644
|
/**
|
|
5796
5645
|
* Get a Template
|
|
@@ -5798,11 +5647,18 @@ var init_client3 = __esm({
|
|
|
5798
5647
|
getTemplate = async (params) => {
|
|
5799
5648
|
const { name, config: config2 } = params;
|
|
5800
5649
|
const cfg = exports.Config.withConfigs(this.config, config2);
|
|
5801
|
-
|
|
5802
|
-
|
|
5803
|
-
|
|
5804
|
-
|
|
5805
|
-
|
|
5650
|
+
try {
|
|
5651
|
+
const result = await this.controlApi.getTemplate({
|
|
5652
|
+
templateName: name,
|
|
5653
|
+
config: cfg
|
|
5654
|
+
});
|
|
5655
|
+
return new exports.Template(result, cfg);
|
|
5656
|
+
} catch (error) {
|
|
5657
|
+
if (error instanceof exports.HTTPError) {
|
|
5658
|
+
throw error.toResourceError("Template", name);
|
|
5659
|
+
}
|
|
5660
|
+
throw error;
|
|
5661
|
+
}
|
|
5806
5662
|
};
|
|
5807
5663
|
/**
|
|
5808
5664
|
* List Templates
|
|
@@ -5826,13 +5682,20 @@ var init_client3 = __esm({
|
|
|
5826
5682
|
createSandbox = async (params) => {
|
|
5827
5683
|
const { input, config: config2 } = params;
|
|
5828
5684
|
const cfg = exports.Config.withConfigs(this.config, config2);
|
|
5829
|
-
|
|
5830
|
-
|
|
5831
|
-
|
|
5832
|
-
|
|
5833
|
-
|
|
5834
|
-
|
|
5835
|
-
|
|
5685
|
+
try {
|
|
5686
|
+
const result = await this.controlApi.createSandbox({
|
|
5687
|
+
input: new $AgentRun3__namespace.CreateSandboxInput({
|
|
5688
|
+
...input
|
|
5689
|
+
}),
|
|
5690
|
+
config: cfg
|
|
5691
|
+
});
|
|
5692
|
+
return exports.Sandbox.fromInnerObject(result, cfg);
|
|
5693
|
+
} catch (error) {
|
|
5694
|
+
if (error instanceof exports.HTTPError) {
|
|
5695
|
+
throw error.toResourceError("Sandbox", input.templateName);
|
|
5696
|
+
}
|
|
5697
|
+
throw error;
|
|
5698
|
+
}
|
|
5836
5699
|
};
|
|
5837
5700
|
/**
|
|
5838
5701
|
* Create a Code Interpreter Sandbox
|
|
@@ -5864,11 +5727,18 @@ var init_client3 = __esm({
|
|
|
5864
5727
|
deleteSandbox = async (params) => {
|
|
5865
5728
|
const { id, config: config2 } = params;
|
|
5866
5729
|
const cfg = exports.Config.withConfigs(this.config, config2);
|
|
5867
|
-
|
|
5868
|
-
|
|
5869
|
-
|
|
5870
|
-
|
|
5871
|
-
|
|
5730
|
+
try {
|
|
5731
|
+
const result = await this.controlApi.deleteSandbox({
|
|
5732
|
+
sandboxId: id,
|
|
5733
|
+
config: cfg
|
|
5734
|
+
});
|
|
5735
|
+
return exports.Sandbox.fromInnerObject(result, cfg);
|
|
5736
|
+
} catch (error) {
|
|
5737
|
+
if (error instanceof exports.HTTPError) {
|
|
5738
|
+
throw error.toResourceError("Sandbox", id);
|
|
5739
|
+
}
|
|
5740
|
+
throw error;
|
|
5741
|
+
}
|
|
5872
5742
|
};
|
|
5873
5743
|
/**
|
|
5874
5744
|
* Stop a Sandbox
|
|
@@ -5876,11 +5746,18 @@ var init_client3 = __esm({
|
|
|
5876
5746
|
stopSandbox = async (params) => {
|
|
5877
5747
|
const { id, config: config2 } = params;
|
|
5878
5748
|
const cfg = exports.Config.withConfigs(this.config, config2);
|
|
5879
|
-
|
|
5880
|
-
|
|
5881
|
-
|
|
5882
|
-
|
|
5883
|
-
|
|
5749
|
+
try {
|
|
5750
|
+
const result = await this.controlApi.stopSandbox({
|
|
5751
|
+
sandboxId: id,
|
|
5752
|
+
config: cfg
|
|
5753
|
+
});
|
|
5754
|
+
return exports.Sandbox.fromInnerObject(result, cfg);
|
|
5755
|
+
} catch (error) {
|
|
5756
|
+
if (error instanceof exports.HTTPError) {
|
|
5757
|
+
throw error.toResourceError("Sandbox", id);
|
|
5758
|
+
}
|
|
5759
|
+
throw error;
|
|
5760
|
+
}
|
|
5884
5761
|
};
|
|
5885
5762
|
/**
|
|
5886
5763
|
* Get a Sandbox
|
|
@@ -5892,26 +5769,33 @@ var init_client3 = __esm({
|
|
|
5892
5769
|
getSandbox = async (params) => {
|
|
5893
5770
|
const { id, templateType, config: config2 } = params;
|
|
5894
5771
|
const cfg = exports.Config.withConfigs(this.config, config2);
|
|
5895
|
-
|
|
5896
|
-
|
|
5897
|
-
|
|
5898
|
-
|
|
5899
|
-
|
|
5900
|
-
|
|
5901
|
-
|
|
5902
|
-
|
|
5903
|
-
|
|
5904
|
-
|
|
5905
|
-
|
|
5906
|
-
|
|
5907
|
-
|
|
5908
|
-
|
|
5909
|
-
|
|
5910
|
-
|
|
5772
|
+
try {
|
|
5773
|
+
const result = await this.controlApi.getSandbox({
|
|
5774
|
+
sandboxId: id,
|
|
5775
|
+
config: cfg
|
|
5776
|
+
});
|
|
5777
|
+
const baseSandbox = exports.Sandbox.fromInnerObject(result, cfg);
|
|
5778
|
+
if (templateType) {
|
|
5779
|
+
switch (templateType) {
|
|
5780
|
+
case "CodeInterpreter" /* CODE_INTERPRETER */: {
|
|
5781
|
+
return new exports.CodeInterpreterSandbox(baseSandbox, cfg);
|
|
5782
|
+
}
|
|
5783
|
+
case "Browser" /* BROWSER */: {
|
|
5784
|
+
return new exports.BrowserSandbox(baseSandbox, cfg);
|
|
5785
|
+
}
|
|
5786
|
+
case "AllInOne" /* AIO */: {
|
|
5787
|
+
const { AioSandbox: AioSandbox2 } = await Promise.resolve().then(() => (init_aio_sandbox(), aio_sandbox_exports));
|
|
5788
|
+
return new AioSandbox2(baseSandbox, cfg);
|
|
5789
|
+
}
|
|
5911
5790
|
}
|
|
5912
5791
|
}
|
|
5792
|
+
return baseSandbox;
|
|
5793
|
+
} catch (error) {
|
|
5794
|
+
if (error instanceof exports.HTTPError) {
|
|
5795
|
+
throw error.toResourceError("Sandbox", id);
|
|
5796
|
+
}
|
|
5797
|
+
throw error;
|
|
5913
5798
|
}
|
|
5914
|
-
return baseSandbox;
|
|
5915
5799
|
};
|
|
5916
5800
|
/**
|
|
5917
5801
|
* List Sandboxes
|
|
@@ -8176,7 +8060,6 @@ exports.ToolSet = void 0;
|
|
|
8176
8060
|
var init_toolset = __esm({
|
|
8177
8061
|
"src/toolset/toolset.ts"() {
|
|
8178
8062
|
init_config();
|
|
8179
|
-
init_exception();
|
|
8180
8063
|
init_log();
|
|
8181
8064
|
init_resource();
|
|
8182
8065
|
exports.ToolSet = class _ToolSet {
|
|
@@ -8208,56 +8091,27 @@ var init_toolset = __esm({
|
|
|
8208
8091
|
*/
|
|
8209
8092
|
static async create(params) {
|
|
8210
8093
|
const { input, config: config2 } = params;
|
|
8211
|
-
|
|
8212
|
-
const client = _ToolSet.getClient();
|
|
8213
|
-
return await client.create({ input, config: config2 });
|
|
8214
|
-
} catch (error) {
|
|
8215
|
-
if (error instanceof exports.HTTPError) {
|
|
8216
|
-
throw error.toResourceError("ToolSet", input.name);
|
|
8217
|
-
}
|
|
8218
|
-
_ToolSet.handleError(error);
|
|
8219
|
-
}
|
|
8094
|
+
return await _ToolSet.getClient().create({ input, config: config2 });
|
|
8220
8095
|
}
|
|
8221
8096
|
/**
|
|
8222
8097
|
* Delete a ToolSet by Name
|
|
8223
8098
|
*/
|
|
8224
8099
|
static async delete(params) {
|
|
8225
8100
|
const { name, config: config2 } = params;
|
|
8226
|
-
|
|
8227
|
-
const client = _ToolSet.getClient();
|
|
8228
|
-
return await client.delete({ name, config: config2 });
|
|
8229
|
-
} catch (error) {
|
|
8230
|
-
if (error instanceof exports.HTTPError) {
|
|
8231
|
-
throw error.toResourceError("ToolSet", name);
|
|
8232
|
-
}
|
|
8233
|
-
_ToolSet.handleError(error);
|
|
8234
|
-
}
|
|
8101
|
+
return await _ToolSet.getClient().delete({ name, config: config2 });
|
|
8235
8102
|
}
|
|
8236
8103
|
/**
|
|
8237
8104
|
* Get a ToolSet by Name
|
|
8238
8105
|
*/
|
|
8239
8106
|
static async get(params) {
|
|
8240
8107
|
const { name, config: config2 } = params;
|
|
8241
|
-
|
|
8242
|
-
const client = _ToolSet.getClient();
|
|
8243
|
-
return await client.get({ name, config: config2 });
|
|
8244
|
-
} catch (error) {
|
|
8245
|
-
if (error instanceof exports.HTTPError) {
|
|
8246
|
-
throw error.toResourceError("ToolSet", name);
|
|
8247
|
-
}
|
|
8248
|
-
_ToolSet.handleError(error);
|
|
8249
|
-
}
|
|
8108
|
+
return await _ToolSet.getClient().get({ name, config: config2 });
|
|
8250
8109
|
}
|
|
8251
8110
|
/**
|
|
8252
8111
|
* List ToolSets
|
|
8253
8112
|
*/
|
|
8254
8113
|
static async list(input, config2) {
|
|
8255
|
-
|
|
8256
|
-
const client = _ToolSet.getClient();
|
|
8257
|
-
return await client.list({ input, config: config2 });
|
|
8258
|
-
} catch (error) {
|
|
8259
|
-
_ToolSet.handleError(error);
|
|
8260
|
-
}
|
|
8114
|
+
return await _ToolSet.getClient().list({ input, config: config2 });
|
|
8261
8115
|
}
|
|
8262
8116
|
/**
|
|
8263
8117
|
* List all ToolSets with pagination
|
|
@@ -8293,32 +8147,7 @@ var init_toolset = __esm({
|
|
|
8293
8147
|
*/
|
|
8294
8148
|
static async update(params) {
|
|
8295
8149
|
const { name, input, config: config2 } = params;
|
|
8296
|
-
|
|
8297
|
-
const client = _ToolSet.getClient();
|
|
8298
|
-
return await client.update({ name, input, config: config2 });
|
|
8299
|
-
} catch (error) {
|
|
8300
|
-
if (error instanceof exports.HTTPError) {
|
|
8301
|
-
throw error.toResourceError("ToolSet", name);
|
|
8302
|
-
}
|
|
8303
|
-
_ToolSet.handleError(error);
|
|
8304
|
-
}
|
|
8305
|
-
}
|
|
8306
|
-
/**
|
|
8307
|
-
* Handle API errors
|
|
8308
|
-
*/
|
|
8309
|
-
static handleError(error) {
|
|
8310
|
-
if (error && typeof error === "object" && "statusCode" in error) {
|
|
8311
|
-
const e = error;
|
|
8312
|
-
const statusCode = e.statusCode;
|
|
8313
|
-
const message = e.message || "Unknown error";
|
|
8314
|
-
const requestId = e.data?.requestId;
|
|
8315
|
-
if (statusCode >= 400 && statusCode < 500) {
|
|
8316
|
-
throw new exports.ClientError(statusCode, message, { requestId });
|
|
8317
|
-
} else if (statusCode >= 500) {
|
|
8318
|
-
throw new exports.ServerError(statusCode, message, { requestId });
|
|
8319
|
-
}
|
|
8320
|
-
}
|
|
8321
|
-
throw error;
|
|
8150
|
+
return await _ToolSet.getClient().update({ name, input, config: config2 });
|
|
8322
8151
|
}
|
|
8323
8152
|
/**
|
|
8324
8153
|
* Delete this toolset
|
|
@@ -8523,6 +8352,7 @@ exports.ToolSetClient = void 0;
|
|
|
8523
8352
|
var init_client5 = __esm({
|
|
8524
8353
|
"src/toolset/client.ts"() {
|
|
8525
8354
|
init_config();
|
|
8355
|
+
init_exception();
|
|
8526
8356
|
init_api();
|
|
8527
8357
|
init_toolset();
|
|
8528
8358
|
exports.ToolSetClient = class {
|
|
@@ -8538,31 +8368,38 @@ var init_client5 = __esm({
|
|
|
8538
8368
|
create = async (params) => {
|
|
8539
8369
|
const { input, config: config2 } = params;
|
|
8540
8370
|
const cfg = exports.Config.withConfigs(this.config, config2);
|
|
8541
|
-
|
|
8542
|
-
|
|
8543
|
-
|
|
8544
|
-
|
|
8545
|
-
|
|
8546
|
-
|
|
8547
|
-
|
|
8371
|
+
try {
|
|
8372
|
+
const authConfig = input.spec?.authConfig ? new $Devs.Authorization({
|
|
8373
|
+
type: input.spec.authConfig.type,
|
|
8374
|
+
parameters: new $Devs.AuthorizationParameters({
|
|
8375
|
+
apiKeyParameter: new $Devs.APIKeyAuthParameter({
|
|
8376
|
+
key: input.spec.authConfig.apiKeyHeaderName,
|
|
8377
|
+
value: input.spec.authConfig.apiKeyValue,
|
|
8378
|
+
in: "header"
|
|
8379
|
+
})
|
|
8548
8380
|
})
|
|
8549
|
-
})
|
|
8550
|
-
|
|
8551
|
-
|
|
8552
|
-
|
|
8553
|
-
|
|
8554
|
-
|
|
8555
|
-
|
|
8556
|
-
|
|
8557
|
-
|
|
8558
|
-
|
|
8559
|
-
})
|
|
8560
|
-
|
|
8561
|
-
|
|
8562
|
-
|
|
8563
|
-
|
|
8564
|
-
|
|
8565
|
-
|
|
8381
|
+
}) : void 0;
|
|
8382
|
+
const request = new $Devs.Toolset({
|
|
8383
|
+
...input,
|
|
8384
|
+
spec: input.spec ? new $Devs.ToolsetSpec({
|
|
8385
|
+
...input.spec,
|
|
8386
|
+
schema: input.spec.schema ? new $Devs.ToolsetSchema({
|
|
8387
|
+
...input.spec.schema
|
|
8388
|
+
}) : void 0,
|
|
8389
|
+
authConfig
|
|
8390
|
+
}) : void 0
|
|
8391
|
+
});
|
|
8392
|
+
const result = await this.controlApi.createToolset({
|
|
8393
|
+
input: request,
|
|
8394
|
+
config: cfg
|
|
8395
|
+
});
|
|
8396
|
+
return new exports.ToolSet(result, cfg);
|
|
8397
|
+
} catch (error) {
|
|
8398
|
+
if (error instanceof exports.HTTPError) {
|
|
8399
|
+
throw error.toResourceError("ToolSet", input.name);
|
|
8400
|
+
}
|
|
8401
|
+
throw error;
|
|
8402
|
+
}
|
|
8566
8403
|
};
|
|
8567
8404
|
/**
|
|
8568
8405
|
* Delete a ToolSet by name
|
|
@@ -8570,11 +8407,18 @@ var init_client5 = __esm({
|
|
|
8570
8407
|
delete = async (params) => {
|
|
8571
8408
|
const { name, config: config2 } = params;
|
|
8572
8409
|
const cfg = exports.Config.withConfigs(this.config, config2);
|
|
8573
|
-
|
|
8574
|
-
|
|
8575
|
-
|
|
8576
|
-
|
|
8577
|
-
|
|
8410
|
+
try {
|
|
8411
|
+
const result = await this.controlApi.deleteToolset({
|
|
8412
|
+
name,
|
|
8413
|
+
config: cfg
|
|
8414
|
+
});
|
|
8415
|
+
return new exports.ToolSet(result, cfg);
|
|
8416
|
+
} catch (error) {
|
|
8417
|
+
if (error instanceof exports.HTTPError) {
|
|
8418
|
+
throw error.toResourceError("ToolSet", name);
|
|
8419
|
+
}
|
|
8420
|
+
throw error;
|
|
8421
|
+
}
|
|
8578
8422
|
};
|
|
8579
8423
|
/**
|
|
8580
8424
|
* Update a ToolSet by name
|
|
@@ -8582,55 +8426,59 @@ var init_client5 = __esm({
|
|
|
8582
8426
|
update = async (params) => {
|
|
8583
8427
|
const { name, input, config: config2 } = params;
|
|
8584
8428
|
const cfg = exports.Config.withConfigs(this.config, config2);
|
|
8585
|
-
|
|
8586
|
-
|
|
8587
|
-
|
|
8588
|
-
|
|
8589
|
-
|
|
8590
|
-
|
|
8591
|
-
|
|
8429
|
+
try {
|
|
8430
|
+
const authConfig = input.spec?.authConfig ? new $Devs.Authorization({
|
|
8431
|
+
type: input.spec.authConfig.type,
|
|
8432
|
+
parameters: new $Devs.AuthorizationParameters({
|
|
8433
|
+
apiKeyParameter: new $Devs.APIKeyAuthParameter({
|
|
8434
|
+
key: input.spec.authConfig.apiKeyHeaderName,
|
|
8435
|
+
value: input.spec.authConfig.apiKeyValue,
|
|
8436
|
+
in: "header"
|
|
8437
|
+
})
|
|
8592
8438
|
})
|
|
8593
|
-
})
|
|
8594
|
-
|
|
8595
|
-
|
|
8596
|
-
|
|
8597
|
-
|
|
8598
|
-
|
|
8599
|
-
|
|
8600
|
-
|
|
8601
|
-
|
|
8602
|
-
|
|
8603
|
-
|
|
8604
|
-
})
|
|
8605
|
-
|
|
8606
|
-
|
|
8607
|
-
|
|
8608
|
-
|
|
8609
|
-
|
|
8610
|
-
|
|
8611
|
-
|
|
8439
|
+
}) : void 0;
|
|
8440
|
+
const request = new $Devs.Toolset({
|
|
8441
|
+
name,
|
|
8442
|
+
...input,
|
|
8443
|
+
spec: input.spec ? new $Devs.ToolsetSpec({
|
|
8444
|
+
...input.spec,
|
|
8445
|
+
schema: input.spec.schema ? new $Devs.ToolsetSchema({
|
|
8446
|
+
...input.spec.schema
|
|
8447
|
+
}) : void 0,
|
|
8448
|
+
authConfig
|
|
8449
|
+
}) : void 0
|
|
8450
|
+
});
|
|
8451
|
+
const result = await this.controlApi.updateToolset({
|
|
8452
|
+
name,
|
|
8453
|
+
input: request,
|
|
8454
|
+
config: cfg
|
|
8455
|
+
});
|
|
8456
|
+
return new exports.ToolSet(result, cfg);
|
|
8457
|
+
} catch (error) {
|
|
8458
|
+
if (error instanceof exports.HTTPError) {
|
|
8459
|
+
throw error.toResourceError("ToolSet", name);
|
|
8460
|
+
}
|
|
8461
|
+
throw error;
|
|
8462
|
+
}
|
|
8612
8463
|
};
|
|
8613
|
-
// /**
|
|
8614
|
-
// * Delete a ToolSet by name
|
|
8615
|
-
// */
|
|
8616
|
-
// deleteToolSet = async (params: {
|
|
8617
|
-
// name: string;
|
|
8618
|
-
// config?: Config;
|
|
8619
|
-
// }): Promise<ToolSet> => {
|
|
8620
|
-
// const { name, config } = params;
|
|
8621
|
-
// return ToolSet.delete({ name, config: config ?? this.config });
|
|
8622
|
-
// };
|
|
8623
8464
|
/**
|
|
8624
8465
|
* Get a ToolSet by name
|
|
8625
8466
|
*/
|
|
8626
8467
|
get = async (params) => {
|
|
8627
8468
|
const { name, config: config2 } = params;
|
|
8628
8469
|
const cfg = exports.Config.withConfigs(this.config, config2);
|
|
8629
|
-
|
|
8630
|
-
|
|
8631
|
-
|
|
8632
|
-
|
|
8633
|
-
|
|
8470
|
+
try {
|
|
8471
|
+
const result = await this.controlApi.getToolset({
|
|
8472
|
+
name,
|
|
8473
|
+
config: cfg
|
|
8474
|
+
});
|
|
8475
|
+
return new exports.ToolSet(result, cfg);
|
|
8476
|
+
} catch (error) {
|
|
8477
|
+
if (error instanceof exports.HTTPError) {
|
|
8478
|
+
throw error.toResourceError("ToolSet", name);
|
|
8479
|
+
}
|
|
8480
|
+
throw error;
|
|
8481
|
+
}
|
|
8634
8482
|
};
|
|
8635
8483
|
/**
|
|
8636
8484
|
* List ToolSets
|