@agentrun/sdk 0.0.2-test.21112547326 → 0.0.2-test.21113892804
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 +528 -673
- 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 +528 -673
- 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
|
|
@@ -2829,7 +2817,6 @@ __export(credential_exports, {
|
|
|
2829
2817
|
exports.Credential = void 0;
|
|
2830
2818
|
var init_credential = __esm({
|
|
2831
2819
|
"src/credential/credential.ts"() {
|
|
2832
|
-
init_exception();
|
|
2833
2820
|
init_resource();
|
|
2834
2821
|
init_resource();
|
|
2835
2822
|
init_client2();
|
|
@@ -2867,15 +2854,7 @@ var init_credential = __esm({
|
|
|
2867
2854
|
const hasInputProp = paramsOrInput && paramsOrInput.input !== void 0;
|
|
2868
2855
|
const input = hasInputProp ? paramsOrInput.input : paramsOrInput;
|
|
2869
2856
|
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
|
-
}
|
|
2857
|
+
return await _Credential.getClient().create({ input, config: config2 });
|
|
2879
2858
|
};
|
|
2880
2859
|
/**
|
|
2881
2860
|
* Delete a Credential by name
|
|
@@ -2884,15 +2863,7 @@ var init_credential = __esm({
|
|
|
2884
2863
|
const isString = typeof paramsOrName === "string";
|
|
2885
2864
|
const name = isString ? paramsOrName : paramsOrName.name;
|
|
2886
2865
|
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
|
-
}
|
|
2866
|
+
return await _Credential.getClient().delete({ name, config: config2 });
|
|
2896
2867
|
};
|
|
2897
2868
|
/**
|
|
2898
2869
|
* Update a Credential by name
|
|
@@ -2901,15 +2872,7 @@ var init_credential = __esm({
|
|
|
2901
2872
|
const name = paramsOrName.name;
|
|
2902
2873
|
const input = paramsOrName.input;
|
|
2903
2874
|
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
|
-
}
|
|
2875
|
+
return await _Credential.getClient().update({ name, input, config: config2 });
|
|
2913
2876
|
};
|
|
2914
2877
|
/**
|
|
2915
2878
|
* Get a Credential by name
|
|
@@ -2918,15 +2881,7 @@ var init_credential = __esm({
|
|
|
2918
2881
|
const isString = typeof paramsOrName === "string";
|
|
2919
2882
|
const name = isString ? paramsOrName : paramsOrName.name;
|
|
2920
2883
|
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
|
-
}
|
|
2884
|
+
return await _Credential.getClient().get({ name, config: config2 });
|
|
2930
2885
|
};
|
|
2931
2886
|
/**
|
|
2932
2887
|
* List all Credentials (with pagination)
|
|
@@ -2934,15 +2889,7 @@ var init_credential = __esm({
|
|
|
2934
2889
|
static list = async (paramsOrUndefined) => {
|
|
2935
2890
|
const input = paramsOrUndefined?.input ?? paramsOrUndefined;
|
|
2936
2891
|
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
|
-
}
|
|
2892
|
+
return await _Credential.getClient().list({ input, config: config2 });
|
|
2946
2893
|
};
|
|
2947
2894
|
static listAll = listAllResourcesFunction(this.list);
|
|
2948
2895
|
/**
|
|
@@ -3122,7 +3069,6 @@ var init_client2 = __esm({
|
|
|
3122
3069
|
"src/credential/client.ts"() {
|
|
3123
3070
|
init_utils();
|
|
3124
3071
|
init_config();
|
|
3125
|
-
init_model();
|
|
3126
3072
|
init_control2();
|
|
3127
3073
|
init_credential();
|
|
3128
3074
|
init_model3();
|
|
@@ -3172,8 +3118,7 @@ var init_client2 = __esm({
|
|
|
3172
3118
|
input: new $AgentRun3__namespace.CreateCredentialInput(normalized),
|
|
3173
3119
|
config: cfg
|
|
3174
3120
|
});
|
|
3175
|
-
|
|
3176
|
-
return new exports.Credential(credential);
|
|
3121
|
+
return new exports.Credential(result);
|
|
3177
3122
|
} catch (error) {
|
|
3178
3123
|
if (error instanceof exports.HTTPError) {
|
|
3179
3124
|
throw error.toResourceError(
|
|
@@ -3195,8 +3140,7 @@ var init_client2 = __esm({
|
|
|
3195
3140
|
credentialName: name,
|
|
3196
3141
|
config: cfg
|
|
3197
3142
|
});
|
|
3198
|
-
|
|
3199
|
-
return new exports.Credential(credential);
|
|
3143
|
+
return new exports.Credential(result);
|
|
3200
3144
|
} catch (error) {
|
|
3201
3145
|
if (error instanceof exports.HTTPError) {
|
|
3202
3146
|
throw error.toResourceError("Credential", params?.name);
|
|
@@ -4172,7 +4116,6 @@ exports.Sandbox = void 0;
|
|
|
4172
4116
|
var init_sandbox = __esm({
|
|
4173
4117
|
"src/sandbox/sandbox.ts"() {
|
|
4174
4118
|
init_config();
|
|
4175
|
-
init_exception();
|
|
4176
4119
|
init_resource();
|
|
4177
4120
|
init_model4();
|
|
4178
4121
|
exports.Sandbox = class _Sandbox extends ResourceBase {
|
|
@@ -4272,88 +4215,34 @@ var init_sandbox = __esm({
|
|
|
4272
4215
|
* 创建新沙箱 / Create a New Sandbox
|
|
4273
4216
|
*/
|
|
4274
4217
|
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
|
-
}
|
|
4218
|
+
return await _Sandbox.getClient().createSandbox({ input, config: config2 });
|
|
4284
4219
|
}
|
|
4285
4220
|
/**
|
|
4286
4221
|
* Delete a Sandbox by ID
|
|
4287
4222
|
*/
|
|
4288
4223
|
static async delete(params) {
|
|
4289
4224
|
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
|
-
}
|
|
4225
|
+
return await _Sandbox.getClient().deleteSandbox({ id, config: config2 });
|
|
4299
4226
|
}
|
|
4300
4227
|
/**
|
|
4301
4228
|
* Stop a Sandbox by ID
|
|
4302
4229
|
*/
|
|
4303
4230
|
static async stop(params) {
|
|
4304
4231
|
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
|
-
}
|
|
4232
|
+
return await _Sandbox.getClient().stopSandbox({ id, config: config2 });
|
|
4314
4233
|
}
|
|
4315
4234
|
/**
|
|
4316
4235
|
* Get a Sandbox by ID
|
|
4317
4236
|
*/
|
|
4318
4237
|
static async get(params) {
|
|
4319
4238
|
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
|
-
}
|
|
4239
|
+
return await _Sandbox.getClient().getSandbox({ id, templateType, config: config2 });
|
|
4329
4240
|
}
|
|
4330
4241
|
/**
|
|
4331
4242
|
* 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;
|
|
4243
|
+
*/
|
|
4244
|
+
static async list(input, config2) {
|
|
4245
|
+
return await _Sandbox.getClient().listSandboxes({ input, config: config2 });
|
|
4357
4246
|
}
|
|
4358
4247
|
get = async (params) => {
|
|
4359
4248
|
const { config: config2 } = params ?? {};
|
|
@@ -5100,7 +4989,6 @@ var init_code_interpreter_sandbox = __esm({
|
|
|
5100
4989
|
exports.Template = void 0;
|
|
5101
4990
|
var init_template = __esm({
|
|
5102
4991
|
"src/sandbox/template.ts"() {
|
|
5103
|
-
init_exception();
|
|
5104
4992
|
init_resource();
|
|
5105
4993
|
exports.Template = class _Template extends ResourceBase {
|
|
5106
4994
|
/**
|
|
@@ -5189,94 +5077,40 @@ var init_template = __esm({
|
|
|
5189
5077
|
*/
|
|
5190
5078
|
static async create(params) {
|
|
5191
5079
|
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
|
-
}
|
|
5080
|
+
return await _Template.getClient().createTemplate({ input, config: config2 });
|
|
5201
5081
|
}
|
|
5202
5082
|
/**
|
|
5203
5083
|
* Delete a Template by name
|
|
5204
5084
|
*/
|
|
5205
5085
|
static async delete(params) {
|
|
5206
5086
|
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
|
-
}
|
|
5087
|
+
return await _Template.getClient().deleteTemplate({ name, config: config2 });
|
|
5216
5088
|
}
|
|
5217
5089
|
/**
|
|
5218
5090
|
* Update a Template by name
|
|
5219
5091
|
*/
|
|
5220
5092
|
static async update(params) {
|
|
5221
5093
|
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
|
-
}
|
|
5094
|
+
return await _Template.getClient().updateTemplate({ name, input, config: config2 });
|
|
5231
5095
|
}
|
|
5232
5096
|
/**
|
|
5233
5097
|
* Get a Template by name
|
|
5234
5098
|
*/
|
|
5235
5099
|
static async get(params) {
|
|
5236
5100
|
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
|
-
}
|
|
5101
|
+
return await _Template.getClient().getTemplate({ name, config: config2 });
|
|
5246
5102
|
}
|
|
5247
5103
|
/**
|
|
5248
5104
|
* List Templates
|
|
5249
5105
|
*/
|
|
5250
5106
|
static async list(params) {
|
|
5251
5107
|
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
|
-
}
|
|
5108
|
+
return await _Template.getClient().listTemplates({ input, config: config2 });
|
|
5258
5109
|
}
|
|
5259
5110
|
/**
|
|
5260
5111
|
* List all Templates (with pagination)
|
|
5261
5112
|
*/
|
|
5262
5113
|
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
5114
|
get = async (params = {}) => {
|
|
5281
5115
|
return await _Template.get({
|
|
5282
5116
|
name: this.templateName,
|
|
@@ -5730,6 +5564,7 @@ exports.SandboxClient = void 0;
|
|
|
5730
5564
|
var init_client3 = __esm({
|
|
5731
5565
|
"src/sandbox/client.ts"() {
|
|
5732
5566
|
init_config();
|
|
5567
|
+
init_exception();
|
|
5733
5568
|
init_control3();
|
|
5734
5569
|
init_browser_sandbox();
|
|
5735
5570
|
init_code_interpreter_sandbox();
|
|
@@ -5750,17 +5585,24 @@ var init_client3 = __esm({
|
|
|
5750
5585
|
createTemplate = async (params) => {
|
|
5751
5586
|
const { input, config: config2 } = params;
|
|
5752
5587
|
const cfg = exports.Config.withConfigs(this.config, config2);
|
|
5753
|
-
|
|
5754
|
-
|
|
5755
|
-
|
|
5756
|
-
|
|
5757
|
-
|
|
5758
|
-
|
|
5759
|
-
|
|
5760
|
-
|
|
5761
|
-
|
|
5762
|
-
|
|
5763
|
-
|
|
5588
|
+
try {
|
|
5589
|
+
const finalInput = this.prepareTemplateCreateInput(input);
|
|
5590
|
+
const result = await this.controlApi.createTemplate({
|
|
5591
|
+
input: new $AgentRun3__namespace.CreateTemplateInput({
|
|
5592
|
+
...finalInput,
|
|
5593
|
+
networkConfiguration: finalInput.networkConfiguration ? new $AgentRun3__namespace.NetworkConfiguration({
|
|
5594
|
+
...finalInput.networkConfiguration
|
|
5595
|
+
}) : void 0
|
|
5596
|
+
}),
|
|
5597
|
+
config: cfg
|
|
5598
|
+
});
|
|
5599
|
+
return new exports.Template(result, cfg);
|
|
5600
|
+
} catch (error) {
|
|
5601
|
+
if (error instanceof exports.HTTPError) {
|
|
5602
|
+
throw error.toResourceError("Template", input.templateName);
|
|
5603
|
+
}
|
|
5604
|
+
throw error;
|
|
5605
|
+
}
|
|
5764
5606
|
};
|
|
5765
5607
|
/**
|
|
5766
5608
|
* Delete a Template
|
|
@@ -5768,11 +5610,18 @@ var init_client3 = __esm({
|
|
|
5768
5610
|
deleteTemplate = async (params) => {
|
|
5769
5611
|
const { name, config: config2 } = params;
|
|
5770
5612
|
const cfg = exports.Config.withConfigs(this.config, config2);
|
|
5771
|
-
|
|
5772
|
-
|
|
5773
|
-
|
|
5774
|
-
|
|
5775
|
-
|
|
5613
|
+
try {
|
|
5614
|
+
const result = await this.controlApi.deleteTemplate({
|
|
5615
|
+
templateName: name,
|
|
5616
|
+
config: cfg
|
|
5617
|
+
});
|
|
5618
|
+
return new exports.Template(result, cfg);
|
|
5619
|
+
} catch (error) {
|
|
5620
|
+
if (error instanceof exports.HTTPError) {
|
|
5621
|
+
throw error.toResourceError("Template", name);
|
|
5622
|
+
}
|
|
5623
|
+
throw error;
|
|
5624
|
+
}
|
|
5776
5625
|
};
|
|
5777
5626
|
/**
|
|
5778
5627
|
* Update a Template
|
|
@@ -5780,17 +5629,24 @@ var init_client3 = __esm({
|
|
|
5780
5629
|
updateTemplate = async (params) => {
|
|
5781
5630
|
const { name, input, config: config2 } = params;
|
|
5782
5631
|
const cfg = exports.Config.withConfigs(this.config, config2);
|
|
5783
|
-
|
|
5784
|
-
|
|
5785
|
-
|
|
5786
|
-
|
|
5787
|
-
|
|
5788
|
-
|
|
5789
|
-
|
|
5790
|
-
|
|
5791
|
-
|
|
5792
|
-
|
|
5793
|
-
|
|
5632
|
+
try {
|
|
5633
|
+
const result = await this.controlApi.updateTemplate({
|
|
5634
|
+
templateName: name,
|
|
5635
|
+
input: new $AgentRun3__namespace.UpdateTemplateInput({
|
|
5636
|
+
...input,
|
|
5637
|
+
networkConfiguration: input.networkConfiguration ? new $AgentRun3__namespace.NetworkConfiguration({
|
|
5638
|
+
...input.networkConfiguration
|
|
5639
|
+
}) : void 0
|
|
5640
|
+
}),
|
|
5641
|
+
config: cfg
|
|
5642
|
+
});
|
|
5643
|
+
return new exports.Template(result, cfg);
|
|
5644
|
+
} catch (error) {
|
|
5645
|
+
if (error instanceof exports.HTTPError) {
|
|
5646
|
+
throw error.toResourceError("Template", name);
|
|
5647
|
+
}
|
|
5648
|
+
throw error;
|
|
5649
|
+
}
|
|
5794
5650
|
};
|
|
5795
5651
|
/**
|
|
5796
5652
|
* Get a Template
|
|
@@ -5798,11 +5654,18 @@ var init_client3 = __esm({
|
|
|
5798
5654
|
getTemplate = async (params) => {
|
|
5799
5655
|
const { name, config: config2 } = params;
|
|
5800
5656
|
const cfg = exports.Config.withConfigs(this.config, config2);
|
|
5801
|
-
|
|
5802
|
-
|
|
5803
|
-
|
|
5804
|
-
|
|
5805
|
-
|
|
5657
|
+
try {
|
|
5658
|
+
const result = await this.controlApi.getTemplate({
|
|
5659
|
+
templateName: name,
|
|
5660
|
+
config: cfg
|
|
5661
|
+
});
|
|
5662
|
+
return new exports.Template(result, cfg);
|
|
5663
|
+
} catch (error) {
|
|
5664
|
+
if (error instanceof exports.HTTPError) {
|
|
5665
|
+
throw error.toResourceError("Template", name);
|
|
5666
|
+
}
|
|
5667
|
+
throw error;
|
|
5668
|
+
}
|
|
5806
5669
|
};
|
|
5807
5670
|
/**
|
|
5808
5671
|
* List Templates
|
|
@@ -5826,13 +5689,20 @@ var init_client3 = __esm({
|
|
|
5826
5689
|
createSandbox = async (params) => {
|
|
5827
5690
|
const { input, config: config2 } = params;
|
|
5828
5691
|
const cfg = exports.Config.withConfigs(this.config, config2);
|
|
5829
|
-
|
|
5830
|
-
|
|
5831
|
-
|
|
5832
|
-
|
|
5833
|
-
|
|
5834
|
-
|
|
5835
|
-
|
|
5692
|
+
try {
|
|
5693
|
+
const result = await this.controlApi.createSandbox({
|
|
5694
|
+
input: new $AgentRun3__namespace.CreateSandboxInput({
|
|
5695
|
+
...input
|
|
5696
|
+
}),
|
|
5697
|
+
config: cfg
|
|
5698
|
+
});
|
|
5699
|
+
return exports.Sandbox.fromInnerObject(result, cfg);
|
|
5700
|
+
} catch (error) {
|
|
5701
|
+
if (error instanceof exports.HTTPError) {
|
|
5702
|
+
throw error.toResourceError("Sandbox", input.templateName);
|
|
5703
|
+
}
|
|
5704
|
+
throw error;
|
|
5705
|
+
}
|
|
5836
5706
|
};
|
|
5837
5707
|
/**
|
|
5838
5708
|
* Create a Code Interpreter Sandbox
|
|
@@ -5864,11 +5734,18 @@ var init_client3 = __esm({
|
|
|
5864
5734
|
deleteSandbox = async (params) => {
|
|
5865
5735
|
const { id, config: config2 } = params;
|
|
5866
5736
|
const cfg = exports.Config.withConfigs(this.config, config2);
|
|
5867
|
-
|
|
5868
|
-
|
|
5869
|
-
|
|
5870
|
-
|
|
5871
|
-
|
|
5737
|
+
try {
|
|
5738
|
+
const result = await this.controlApi.deleteSandbox({
|
|
5739
|
+
sandboxId: id,
|
|
5740
|
+
config: cfg
|
|
5741
|
+
});
|
|
5742
|
+
return exports.Sandbox.fromInnerObject(result, cfg);
|
|
5743
|
+
} catch (error) {
|
|
5744
|
+
if (error instanceof exports.HTTPError) {
|
|
5745
|
+
throw error.toResourceError("Sandbox", id);
|
|
5746
|
+
}
|
|
5747
|
+
throw error;
|
|
5748
|
+
}
|
|
5872
5749
|
};
|
|
5873
5750
|
/**
|
|
5874
5751
|
* Stop a Sandbox
|
|
@@ -5876,11 +5753,18 @@ var init_client3 = __esm({
|
|
|
5876
5753
|
stopSandbox = async (params) => {
|
|
5877
5754
|
const { id, config: config2 } = params;
|
|
5878
5755
|
const cfg = exports.Config.withConfigs(this.config, config2);
|
|
5879
|
-
|
|
5880
|
-
|
|
5881
|
-
|
|
5882
|
-
|
|
5883
|
-
|
|
5756
|
+
try {
|
|
5757
|
+
const result = await this.controlApi.stopSandbox({
|
|
5758
|
+
sandboxId: id,
|
|
5759
|
+
config: cfg
|
|
5760
|
+
});
|
|
5761
|
+
return exports.Sandbox.fromInnerObject(result, cfg);
|
|
5762
|
+
} catch (error) {
|
|
5763
|
+
if (error instanceof exports.HTTPError) {
|
|
5764
|
+
throw error.toResourceError("Sandbox", id);
|
|
5765
|
+
}
|
|
5766
|
+
throw error;
|
|
5767
|
+
}
|
|
5884
5768
|
};
|
|
5885
5769
|
/**
|
|
5886
5770
|
* Get a Sandbox
|
|
@@ -5892,26 +5776,33 @@ var init_client3 = __esm({
|
|
|
5892
5776
|
getSandbox = async (params) => {
|
|
5893
5777
|
const { id, templateType, config: config2 } = params;
|
|
5894
5778
|
const cfg = exports.Config.withConfigs(this.config, config2);
|
|
5895
|
-
|
|
5896
|
-
|
|
5897
|
-
|
|
5898
|
-
|
|
5899
|
-
|
|
5900
|
-
|
|
5901
|
-
|
|
5902
|
-
|
|
5903
|
-
|
|
5904
|
-
|
|
5905
|
-
|
|
5906
|
-
|
|
5907
|
-
|
|
5908
|
-
|
|
5909
|
-
|
|
5910
|
-
|
|
5779
|
+
try {
|
|
5780
|
+
const result = await this.controlApi.getSandbox({
|
|
5781
|
+
sandboxId: id,
|
|
5782
|
+
config: cfg
|
|
5783
|
+
});
|
|
5784
|
+
const baseSandbox = exports.Sandbox.fromInnerObject(result, cfg);
|
|
5785
|
+
if (templateType) {
|
|
5786
|
+
switch (templateType) {
|
|
5787
|
+
case "CodeInterpreter" /* CODE_INTERPRETER */: {
|
|
5788
|
+
return new exports.CodeInterpreterSandbox(baseSandbox, cfg);
|
|
5789
|
+
}
|
|
5790
|
+
case "Browser" /* BROWSER */: {
|
|
5791
|
+
return new exports.BrowserSandbox(baseSandbox, cfg);
|
|
5792
|
+
}
|
|
5793
|
+
case "AllInOne" /* AIO */: {
|
|
5794
|
+
const { AioSandbox: AioSandbox2 } = await Promise.resolve().then(() => (init_aio_sandbox(), aio_sandbox_exports));
|
|
5795
|
+
return new AioSandbox2(baseSandbox, cfg);
|
|
5796
|
+
}
|
|
5911
5797
|
}
|
|
5912
5798
|
}
|
|
5799
|
+
return baseSandbox;
|
|
5800
|
+
} catch (error) {
|
|
5801
|
+
if (error instanceof exports.HTTPError) {
|
|
5802
|
+
throw error.toResourceError("Sandbox", id);
|
|
5803
|
+
}
|
|
5804
|
+
throw error;
|
|
5913
5805
|
}
|
|
5914
|
-
return baseSandbox;
|
|
5915
5806
|
};
|
|
5916
5807
|
/**
|
|
5917
5808
|
* List Sandboxes
|
|
@@ -8176,7 +8067,6 @@ exports.ToolSet = void 0;
|
|
|
8176
8067
|
var init_toolset = __esm({
|
|
8177
8068
|
"src/toolset/toolset.ts"() {
|
|
8178
8069
|
init_config();
|
|
8179
|
-
init_exception();
|
|
8180
8070
|
init_log();
|
|
8181
8071
|
init_resource();
|
|
8182
8072
|
exports.ToolSet = class _ToolSet {
|
|
@@ -8208,56 +8098,27 @@ var init_toolset = __esm({
|
|
|
8208
8098
|
*/
|
|
8209
8099
|
static async create(params) {
|
|
8210
8100
|
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
|
-
}
|
|
8101
|
+
return await _ToolSet.getClient().create({ input, config: config2 });
|
|
8220
8102
|
}
|
|
8221
8103
|
/**
|
|
8222
8104
|
* Delete a ToolSet by Name
|
|
8223
8105
|
*/
|
|
8224
8106
|
static async delete(params) {
|
|
8225
8107
|
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
|
-
}
|
|
8108
|
+
return await _ToolSet.getClient().delete({ name, config: config2 });
|
|
8235
8109
|
}
|
|
8236
8110
|
/**
|
|
8237
8111
|
* Get a ToolSet by Name
|
|
8238
8112
|
*/
|
|
8239
8113
|
static async get(params) {
|
|
8240
8114
|
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
|
-
}
|
|
8115
|
+
return await _ToolSet.getClient().get({ name, config: config2 });
|
|
8250
8116
|
}
|
|
8251
8117
|
/**
|
|
8252
8118
|
* List ToolSets
|
|
8253
8119
|
*/
|
|
8254
8120
|
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
|
-
}
|
|
8121
|
+
return await _ToolSet.getClient().list({ input, config: config2 });
|
|
8261
8122
|
}
|
|
8262
8123
|
/**
|
|
8263
8124
|
* List all ToolSets with pagination
|
|
@@ -8293,32 +8154,7 @@ var init_toolset = __esm({
|
|
|
8293
8154
|
*/
|
|
8294
8155
|
static async update(params) {
|
|
8295
8156
|
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;
|
|
8157
|
+
return await _ToolSet.getClient().update({ name, input, config: config2 });
|
|
8322
8158
|
}
|
|
8323
8159
|
/**
|
|
8324
8160
|
* Delete this toolset
|
|
@@ -8523,6 +8359,7 @@ exports.ToolSetClient = void 0;
|
|
|
8523
8359
|
var init_client5 = __esm({
|
|
8524
8360
|
"src/toolset/client.ts"() {
|
|
8525
8361
|
init_config();
|
|
8362
|
+
init_exception();
|
|
8526
8363
|
init_api();
|
|
8527
8364
|
init_toolset();
|
|
8528
8365
|
exports.ToolSetClient = class {
|
|
@@ -8538,31 +8375,38 @@ var init_client5 = __esm({
|
|
|
8538
8375
|
create = async (params) => {
|
|
8539
8376
|
const { input, config: config2 } = params;
|
|
8540
8377
|
const cfg = exports.Config.withConfigs(this.config, config2);
|
|
8541
|
-
|
|
8542
|
-
|
|
8543
|
-
|
|
8544
|
-
|
|
8545
|
-
|
|
8546
|
-
|
|
8547
|
-
|
|
8378
|
+
try {
|
|
8379
|
+
const authConfig = input.spec?.authConfig ? new $Devs.Authorization({
|
|
8380
|
+
type: input.spec.authConfig.type,
|
|
8381
|
+
parameters: new $Devs.AuthorizationParameters({
|
|
8382
|
+
apiKeyParameter: new $Devs.APIKeyAuthParameter({
|
|
8383
|
+
key: input.spec.authConfig.apiKeyHeaderName,
|
|
8384
|
+
value: input.spec.authConfig.apiKeyValue,
|
|
8385
|
+
in: "header"
|
|
8386
|
+
})
|
|
8548
8387
|
})
|
|
8549
|
-
})
|
|
8550
|
-
|
|
8551
|
-
|
|
8552
|
-
|
|
8553
|
-
|
|
8554
|
-
|
|
8555
|
-
|
|
8556
|
-
|
|
8557
|
-
|
|
8558
|
-
|
|
8559
|
-
})
|
|
8560
|
-
|
|
8561
|
-
|
|
8562
|
-
|
|
8563
|
-
|
|
8564
|
-
|
|
8565
|
-
|
|
8388
|
+
}) : void 0;
|
|
8389
|
+
const request = new $Devs.Toolset({
|
|
8390
|
+
...input,
|
|
8391
|
+
spec: input.spec ? new $Devs.ToolsetSpec({
|
|
8392
|
+
...input.spec,
|
|
8393
|
+
schema: input.spec.schema ? new $Devs.ToolsetSchema({
|
|
8394
|
+
...input.spec.schema
|
|
8395
|
+
}) : void 0,
|
|
8396
|
+
authConfig
|
|
8397
|
+
}) : void 0
|
|
8398
|
+
});
|
|
8399
|
+
const result = await this.controlApi.createToolset({
|
|
8400
|
+
input: request,
|
|
8401
|
+
config: cfg
|
|
8402
|
+
});
|
|
8403
|
+
return new exports.ToolSet(result, cfg);
|
|
8404
|
+
} catch (error) {
|
|
8405
|
+
if (error instanceof exports.HTTPError) {
|
|
8406
|
+
throw error.toResourceError("ToolSet", input.name);
|
|
8407
|
+
}
|
|
8408
|
+
throw error;
|
|
8409
|
+
}
|
|
8566
8410
|
};
|
|
8567
8411
|
/**
|
|
8568
8412
|
* Delete a ToolSet by name
|
|
@@ -8570,11 +8414,18 @@ var init_client5 = __esm({
|
|
|
8570
8414
|
delete = async (params) => {
|
|
8571
8415
|
const { name, config: config2 } = params;
|
|
8572
8416
|
const cfg = exports.Config.withConfigs(this.config, config2);
|
|
8573
|
-
|
|
8574
|
-
|
|
8575
|
-
|
|
8576
|
-
|
|
8577
|
-
|
|
8417
|
+
try {
|
|
8418
|
+
const result = await this.controlApi.deleteToolset({
|
|
8419
|
+
name,
|
|
8420
|
+
config: cfg
|
|
8421
|
+
});
|
|
8422
|
+
return new exports.ToolSet(result, cfg);
|
|
8423
|
+
} catch (error) {
|
|
8424
|
+
if (error instanceof exports.HTTPError) {
|
|
8425
|
+
throw error.toResourceError("ToolSet", name);
|
|
8426
|
+
}
|
|
8427
|
+
throw error;
|
|
8428
|
+
}
|
|
8578
8429
|
};
|
|
8579
8430
|
/**
|
|
8580
8431
|
* Update a ToolSet by name
|
|
@@ -8582,55 +8433,59 @@ var init_client5 = __esm({
|
|
|
8582
8433
|
update = async (params) => {
|
|
8583
8434
|
const { name, input, config: config2 } = params;
|
|
8584
8435
|
const cfg = exports.Config.withConfigs(this.config, config2);
|
|
8585
|
-
|
|
8586
|
-
|
|
8587
|
-
|
|
8588
|
-
|
|
8589
|
-
|
|
8590
|
-
|
|
8591
|
-
|
|
8436
|
+
try {
|
|
8437
|
+
const authConfig = input.spec?.authConfig ? new $Devs.Authorization({
|
|
8438
|
+
type: input.spec.authConfig.type,
|
|
8439
|
+
parameters: new $Devs.AuthorizationParameters({
|
|
8440
|
+
apiKeyParameter: new $Devs.APIKeyAuthParameter({
|
|
8441
|
+
key: input.spec.authConfig.apiKeyHeaderName,
|
|
8442
|
+
value: input.spec.authConfig.apiKeyValue,
|
|
8443
|
+
in: "header"
|
|
8444
|
+
})
|
|
8592
8445
|
})
|
|
8593
|
-
})
|
|
8594
|
-
|
|
8595
|
-
|
|
8596
|
-
|
|
8597
|
-
|
|
8598
|
-
|
|
8599
|
-
|
|
8600
|
-
|
|
8601
|
-
|
|
8602
|
-
|
|
8603
|
-
|
|
8604
|
-
})
|
|
8605
|
-
|
|
8606
|
-
|
|
8607
|
-
|
|
8608
|
-
|
|
8609
|
-
|
|
8610
|
-
|
|
8611
|
-
|
|
8446
|
+
}) : void 0;
|
|
8447
|
+
const request = new $Devs.Toolset({
|
|
8448
|
+
name,
|
|
8449
|
+
...input,
|
|
8450
|
+
spec: input.spec ? new $Devs.ToolsetSpec({
|
|
8451
|
+
...input.spec,
|
|
8452
|
+
schema: input.spec.schema ? new $Devs.ToolsetSchema({
|
|
8453
|
+
...input.spec.schema
|
|
8454
|
+
}) : void 0,
|
|
8455
|
+
authConfig
|
|
8456
|
+
}) : void 0
|
|
8457
|
+
});
|
|
8458
|
+
const result = await this.controlApi.updateToolset({
|
|
8459
|
+
name,
|
|
8460
|
+
input: request,
|
|
8461
|
+
config: cfg
|
|
8462
|
+
});
|
|
8463
|
+
return new exports.ToolSet(result, cfg);
|
|
8464
|
+
} catch (error) {
|
|
8465
|
+
if (error instanceof exports.HTTPError) {
|
|
8466
|
+
throw error.toResourceError("ToolSet", name);
|
|
8467
|
+
}
|
|
8468
|
+
throw error;
|
|
8469
|
+
}
|
|
8612
8470
|
};
|
|
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
8471
|
/**
|
|
8624
8472
|
* Get a ToolSet by name
|
|
8625
8473
|
*/
|
|
8626
8474
|
get = async (params) => {
|
|
8627
8475
|
const { name, config: config2 } = params;
|
|
8628
8476
|
const cfg = exports.Config.withConfigs(this.config, config2);
|
|
8629
|
-
|
|
8630
|
-
|
|
8631
|
-
|
|
8632
|
-
|
|
8633
|
-
|
|
8477
|
+
try {
|
|
8478
|
+
const result = await this.controlApi.getToolset({
|
|
8479
|
+
name,
|
|
8480
|
+
config: cfg
|
|
8481
|
+
});
|
|
8482
|
+
return new exports.ToolSet(result, cfg);
|
|
8483
|
+
} catch (error) {
|
|
8484
|
+
if (error instanceof exports.HTTPError) {
|
|
8485
|
+
throw error.toResourceError("ToolSet", name);
|
|
8486
|
+
}
|
|
8487
|
+
throw error;
|
|
8488
|
+
}
|
|
8634
8489
|
};
|
|
8635
8490
|
/**
|
|
8636
8491
|
* List ToolSets
|