@semiont/cli 0.2.30-build.49 → 0.2.30-build.50
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/cli.mjs +1011 -261
- package/dist/templates/environments/local.json +11 -0
- package/dist/templates/envoy.yaml +15 -6
- package/package.json +3 -3
package/dist/cli.mjs
CHANGED
|
@@ -341,10 +341,10 @@ function mergeDefs(...defs) {
|
|
|
341
341
|
function cloneDef(schema2) {
|
|
342
342
|
return mergeDefs(schema2._zod.def);
|
|
343
343
|
}
|
|
344
|
-
function getElementAtPath(obj,
|
|
345
|
-
if (!
|
|
344
|
+
function getElementAtPath(obj, path36) {
|
|
345
|
+
if (!path36)
|
|
346
346
|
return obj;
|
|
347
|
-
return
|
|
347
|
+
return path36.reduce((acc, key) => acc?.[key], obj);
|
|
348
348
|
}
|
|
349
349
|
function promiseAllObject(promisesObj) {
|
|
350
350
|
const keys = Object.keys(promisesObj);
|
|
@@ -634,11 +634,11 @@ function aborted(x, startIndex = 0) {
|
|
|
634
634
|
}
|
|
635
635
|
return false;
|
|
636
636
|
}
|
|
637
|
-
function prefixIssues(
|
|
637
|
+
function prefixIssues(path36, issues) {
|
|
638
638
|
return issues.map((iss) => {
|
|
639
639
|
var _a4;
|
|
640
640
|
(_a4 = iss).path ?? (_a4.path = []);
|
|
641
|
-
iss.path.unshift(
|
|
641
|
+
iss.path.unshift(path36);
|
|
642
642
|
return iss;
|
|
643
643
|
});
|
|
644
644
|
}
|
|
@@ -859,7 +859,7 @@ function formatError(error46, mapper = (issue2) => issue2.message) {
|
|
|
859
859
|
}
|
|
860
860
|
function treeifyError(error46, mapper = (issue2) => issue2.message) {
|
|
861
861
|
const result = { errors: [] };
|
|
862
|
-
const processError = (error47,
|
|
862
|
+
const processError = (error47, path36 = []) => {
|
|
863
863
|
var _a4, _b;
|
|
864
864
|
for (const issue2 of error47.issues) {
|
|
865
865
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
@@ -869,7 +869,7 @@ function treeifyError(error46, mapper = (issue2) => issue2.message) {
|
|
|
869
869
|
} else if (issue2.code === "invalid_element") {
|
|
870
870
|
processError({ issues: issue2.issues }, issue2.path);
|
|
871
871
|
} else {
|
|
872
|
-
const fullpath = [...
|
|
872
|
+
const fullpath = [...path36, ...issue2.path];
|
|
873
873
|
if (fullpath.length === 0) {
|
|
874
874
|
result.errors.push(mapper(issue2));
|
|
875
875
|
continue;
|
|
@@ -901,8 +901,8 @@ function treeifyError(error46, mapper = (issue2) => issue2.message) {
|
|
|
901
901
|
}
|
|
902
902
|
function toDotPath(_path) {
|
|
903
903
|
const segs = [];
|
|
904
|
-
const
|
|
905
|
-
for (const seg of
|
|
904
|
+
const path36 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
905
|
+
for (const seg of path36) {
|
|
906
906
|
if (typeof seg === "number")
|
|
907
907
|
segs.push(`[${seg}]`);
|
|
908
908
|
else if (typeof seg === "symbol")
|
|
@@ -13527,7 +13527,7 @@ function getServiceTypeFromAnnotations(annotations) {
|
|
|
13527
13527
|
}
|
|
13528
13528
|
return void 0;
|
|
13529
13529
|
}
|
|
13530
|
-
var SERVICE_TYPES;
|
|
13530
|
+
var SERVICE_TYPES, SERVICE_TYPE_ANNOTATION;
|
|
13531
13531
|
var init_service_types = __esm({
|
|
13532
13532
|
"src/core/service-types.ts"() {
|
|
13533
13533
|
"use strict";
|
|
@@ -13555,10 +13555,13 @@ var init_service_types = __esm({
|
|
|
13555
13555
|
// Infrastructure
|
|
13556
13556
|
STACK: "stack",
|
|
13557
13557
|
// Infrastructure stacks (CloudFormation, Terraform)
|
|
13558
|
+
PROXY: "proxy",
|
|
13559
|
+
// API gateways, reverse proxies, load balancers
|
|
13558
13560
|
// Fallback
|
|
13559
13561
|
GENERIC: "generic"
|
|
13560
13562
|
// Generic service without specific type
|
|
13561
13563
|
};
|
|
13564
|
+
SERVICE_TYPE_ANNOTATION = "service/type";
|
|
13562
13565
|
}
|
|
13563
13566
|
});
|
|
13564
13567
|
|
|
@@ -14356,8 +14359,8 @@ var init_filesystem_service = __esm({
|
|
|
14356
14359
|
async checkHealth() {
|
|
14357
14360
|
const dataPath = this.getDataPath();
|
|
14358
14361
|
try {
|
|
14359
|
-
const
|
|
14360
|
-
await
|
|
14362
|
+
const fs37 = await import("fs");
|
|
14363
|
+
await fs37.promises.access(dataPath, fs37.constants.R_OK | fs37.constants.W_OK);
|
|
14361
14364
|
return {
|
|
14362
14365
|
healthy: true,
|
|
14363
14366
|
details: {
|
|
@@ -14766,6 +14769,50 @@ var init_inference_service = __esm({
|
|
|
14766
14769
|
}
|
|
14767
14770
|
});
|
|
14768
14771
|
|
|
14772
|
+
// src/services/proxy-service.ts
|
|
14773
|
+
var ProxyService;
|
|
14774
|
+
var init_proxy_service = __esm({
|
|
14775
|
+
"src/services/proxy-service.ts"() {
|
|
14776
|
+
"use strict";
|
|
14777
|
+
init_base_service();
|
|
14778
|
+
init_service_requirements();
|
|
14779
|
+
init_service_types();
|
|
14780
|
+
init_service_command_capabilities();
|
|
14781
|
+
ProxyService = class extends BaseService {
|
|
14782
|
+
// Type-narrowed config accessor
|
|
14783
|
+
get typedConfig() {
|
|
14784
|
+
return this.config;
|
|
14785
|
+
}
|
|
14786
|
+
getRequirements() {
|
|
14787
|
+
const baseRequirements = RequirementPresets.statelessApi();
|
|
14788
|
+
const proxyRequirements = {
|
|
14789
|
+
network: {
|
|
14790
|
+
ports: [
|
|
14791
|
+
this.typedConfig.port || 8080,
|
|
14792
|
+
this.typedConfig.adminPort || 9901
|
|
14793
|
+
],
|
|
14794
|
+
protocol: "tcp",
|
|
14795
|
+
healthCheckPort: this.typedConfig.port || 8080
|
|
14796
|
+
},
|
|
14797
|
+
annotations: {
|
|
14798
|
+
// Declare service type
|
|
14799
|
+
[SERVICE_TYPE_ANNOTATION]: SERVICE_TYPES.PROXY,
|
|
14800
|
+
// Declare supported commands
|
|
14801
|
+
[COMMAND_CAPABILITY_ANNOTATIONS.PROVISION]: "true",
|
|
14802
|
+
[COMMAND_CAPABILITY_ANNOTATIONS.START]: "true",
|
|
14803
|
+
[COMMAND_CAPABILITY_ANNOTATIONS.STOP]: "true",
|
|
14804
|
+
[COMMAND_CAPABILITY_ANNOTATIONS.CHECK]: "true"
|
|
14805
|
+
}
|
|
14806
|
+
};
|
|
14807
|
+
return {
|
|
14808
|
+
...baseRequirements,
|
|
14809
|
+
...proxyRequirements
|
|
14810
|
+
};
|
|
14811
|
+
}
|
|
14812
|
+
};
|
|
14813
|
+
}
|
|
14814
|
+
});
|
|
14815
|
+
|
|
14769
14816
|
// src/core/generic-service.ts
|
|
14770
14817
|
var GenericService;
|
|
14771
14818
|
var init_generic_service = __esm({
|
|
@@ -14920,6 +14967,7 @@ var init_service_factory = __esm({
|
|
|
14920
14967
|
init_graph_service();
|
|
14921
14968
|
init_mcp_service();
|
|
14922
14969
|
init_inference_service();
|
|
14970
|
+
init_proxy_service();
|
|
14923
14971
|
init_generic_service();
|
|
14924
14972
|
init_cli_logger();
|
|
14925
14973
|
ServiceFactory = class {
|
|
@@ -14948,6 +14996,8 @@ var init_service_factory = __esm({
|
|
|
14948
14996
|
return new MCPService(name, platform, envConfig, serviceConfig, runtimeFlags);
|
|
14949
14997
|
case "inference":
|
|
14950
14998
|
return new InferenceService(name, platform, envConfig, serviceConfig, runtimeFlags);
|
|
14999
|
+
case "proxy":
|
|
15000
|
+
return new ProxyService("proxy", platform, envConfig, serviceConfig, runtimeFlags);
|
|
14951
15001
|
default:
|
|
14952
15002
|
printInfo(`Using GenericService for unknown service type: ${name}`);
|
|
14953
15003
|
return new GenericService(name, platform, envConfig, serviceConfig, runtimeFlags);
|
|
@@ -15861,11 +15911,11 @@ var init_backend_check = __esm({
|
|
|
15861
15911
|
let logs;
|
|
15862
15912
|
if (fs9.existsSync(appLogPath)) {
|
|
15863
15913
|
try {
|
|
15864
|
-
const { execSync:
|
|
15865
|
-
const recentLogs =
|
|
15914
|
+
const { execSync: execSync38 } = __require("child_process");
|
|
15915
|
+
const recentLogs = execSync38(`tail -10 "${appLogPath}"`, { encoding: "utf-8" }).split("\n").filter((line) => line.trim());
|
|
15866
15916
|
let errorLogs = [];
|
|
15867
15917
|
if (fs9.existsSync(errorLogPath)) {
|
|
15868
|
-
errorLogs =
|
|
15918
|
+
errorLogs = execSync38(`tail -5 "${errorLogPath}"`, { encoding: "utf-8" }).split("\n").filter((line) => line.trim());
|
|
15869
15919
|
}
|
|
15870
15920
|
logs = {
|
|
15871
15921
|
recent: recentLogs,
|
|
@@ -16013,6 +16063,8 @@ var init_frontend_check = __esm({
|
|
|
16013
16063
|
const healthUrl = `http://localhost:${config2.port}`;
|
|
16014
16064
|
try {
|
|
16015
16065
|
const response = await fetch(healthUrl, {
|
|
16066
|
+
redirect: "follow",
|
|
16067
|
+
// Follow redirects automatically (e.g., / -> /en)
|
|
16016
16068
|
signal: AbortSignal.timeout(5e3)
|
|
16017
16069
|
});
|
|
16018
16070
|
if (response.ok) {
|
|
@@ -16026,6 +16078,7 @@ var init_frontend_check = __esm({
|
|
|
16026
16078
|
}
|
|
16027
16079
|
try {
|
|
16028
16080
|
const apiResponse = await fetch(`${healthUrl}/api/health`, {
|
|
16081
|
+
redirect: "follow",
|
|
16029
16082
|
signal: AbortSignal.timeout(2e3)
|
|
16030
16083
|
});
|
|
16031
16084
|
if (apiResponse.ok) {
|
|
@@ -16049,11 +16102,11 @@ var init_frontend_check = __esm({
|
|
|
16049
16102
|
let logs;
|
|
16050
16103
|
if (fs10.existsSync(appLogPath)) {
|
|
16051
16104
|
try {
|
|
16052
|
-
const { execSync:
|
|
16053
|
-
const recentLogs =
|
|
16105
|
+
const { execSync: execSync38 } = __require("child_process");
|
|
16106
|
+
const recentLogs = execSync38(`tail -10 "${appLogPath}"`, { encoding: "utf-8" }).split("\n").filter((line) => line.trim());
|
|
16054
16107
|
let errorLogs = [];
|
|
16055
16108
|
if (fs10.existsSync(errorLogPath)) {
|
|
16056
|
-
errorLogs =
|
|
16109
|
+
errorLogs = execSync38(`tail -5 "${errorLogPath}"`, { encoding: "utf-8" }).split("\n").filter((line) => line.trim());
|
|
16057
16110
|
}
|
|
16058
16111
|
logs = {
|
|
16059
16112
|
recent: recentLogs,
|
|
@@ -16532,8 +16585,8 @@ async function startJanusGraph(context) {
|
|
|
16532
16585
|
for (let i = 0; i < maxAttempts; i++) {
|
|
16533
16586
|
await new Promise((resolve2) => setTimeout(resolve2, 2e3));
|
|
16534
16587
|
try {
|
|
16535
|
-
const { execSync:
|
|
16536
|
-
|
|
16588
|
+
const { execSync: execSync38 } = await import("child_process");
|
|
16589
|
+
execSync38(`${gremlinShellScript} -e "g.V().count()"`, {
|
|
16537
16590
|
stdio: "ignore",
|
|
16538
16591
|
timeout: 5e3
|
|
16539
16592
|
});
|
|
@@ -16584,9 +16637,9 @@ async function startJanusGraph(context) {
|
|
|
16584
16637
|
}
|
|
16585
16638
|
};
|
|
16586
16639
|
}
|
|
16587
|
-
async function fileExists(
|
|
16640
|
+
async function fileExists(path36) {
|
|
16588
16641
|
try {
|
|
16589
|
-
await fs13.access(
|
|
16642
|
+
await fs13.access(path36);
|
|
16590
16643
|
return true;
|
|
16591
16644
|
} catch {
|
|
16592
16645
|
return false;
|
|
@@ -17210,8 +17263,8 @@ var init_filesystem_provision = __esm({
|
|
|
17210
17263
|
metadata.directories.push(dirPath);
|
|
17211
17264
|
}
|
|
17212
17265
|
try {
|
|
17213
|
-
const { execSync:
|
|
17214
|
-
const dfOutput =
|
|
17266
|
+
const { execSync: execSync38 } = __require("child_process");
|
|
17267
|
+
const dfOutput = execSync38(`df -h "${absolutePath}"`, { encoding: "utf-8" });
|
|
17215
17268
|
const lines = dfOutput.split("\n");
|
|
17216
17269
|
if (lines.length > 1) {
|
|
17217
17270
|
const stats = lines[1].split(/\s+/);
|
|
@@ -17308,9 +17361,9 @@ Files placed here will persist across service restarts.
|
|
|
17308
17361
|
// src/platforms/posix/handlers/graph-provision.ts
|
|
17309
17362
|
import * as fs18 from "fs/promises";
|
|
17310
17363
|
import { execSync as execSync8 } from "child_process";
|
|
17311
|
-
async function fileExists2(
|
|
17364
|
+
async function fileExists2(path36) {
|
|
17312
17365
|
try {
|
|
17313
|
-
await fs18.access(
|
|
17366
|
+
await fs18.access(path36);
|
|
17314
17367
|
return true;
|
|
17315
17368
|
} catch {
|
|
17316
17369
|
return false;
|
|
@@ -18386,9 +18439,9 @@ async function stopJanusGraph(context) {
|
|
|
18386
18439
|
};
|
|
18387
18440
|
}
|
|
18388
18441
|
}
|
|
18389
|
-
async function fileExists3(
|
|
18442
|
+
async function fileExists3(path36) {
|
|
18390
18443
|
try {
|
|
18391
|
-
await fs21.access(
|
|
18444
|
+
await fs21.access(path36);
|
|
18392
18445
|
return true;
|
|
18393
18446
|
} catch {
|
|
18394
18447
|
return false;
|
|
@@ -20270,9 +20323,9 @@ async function startJanusGraph2(context) {
|
|
|
20270
20323
|
};
|
|
20271
20324
|
}
|
|
20272
20325
|
}
|
|
20273
|
-
async function fileExists4(
|
|
20326
|
+
async function fileExists4(path36) {
|
|
20274
20327
|
try {
|
|
20275
|
-
await fs26.access(
|
|
20328
|
+
await fs26.access(path36);
|
|
20276
20329
|
return true;
|
|
20277
20330
|
} catch {
|
|
20278
20331
|
return false;
|
|
@@ -23402,9 +23455,9 @@ async function stopJanusGraph2(context) {
|
|
|
23402
23455
|
};
|
|
23403
23456
|
}
|
|
23404
23457
|
}
|
|
23405
|
-
async function fileExists5(
|
|
23458
|
+
async function fileExists5(path36) {
|
|
23406
23459
|
try {
|
|
23407
|
-
await fs29.access(
|
|
23460
|
+
await fs29.access(path36);
|
|
23408
23461
|
return true;
|
|
23409
23462
|
} catch {
|
|
23410
23463
|
return false;
|
|
@@ -23578,6 +23631,694 @@ var init_database_stop = __esm({
|
|
|
23578
23631
|
}
|
|
23579
23632
|
});
|
|
23580
23633
|
|
|
23634
|
+
// src/platforms/container/handlers/proxy-paths.ts
|
|
23635
|
+
import * as path27 from "path";
|
|
23636
|
+
function getProxyPaths(context) {
|
|
23637
|
+
const projectRoot = context.service.projectRoot;
|
|
23638
|
+
const runtimeDir = path27.join(projectRoot, "proxy");
|
|
23639
|
+
return {
|
|
23640
|
+
runtimeDir,
|
|
23641
|
+
logsDir: path27.join(runtimeDir, "logs"),
|
|
23642
|
+
pidFile: path27.join(runtimeDir, "proxy.pid"),
|
|
23643
|
+
configFile: path27.join(runtimeDir, "envoy.yaml"),
|
|
23644
|
+
containerLogFile: path27.join(runtimeDir, "logs", "container.log"),
|
|
23645
|
+
accessLogFile: path27.join(runtimeDir, "logs", "access.log"),
|
|
23646
|
+
adminLogFile: path27.join(runtimeDir, "logs", "admin.log")
|
|
23647
|
+
};
|
|
23648
|
+
}
|
|
23649
|
+
var init_proxy_paths = __esm({
|
|
23650
|
+
"src/platforms/container/handlers/proxy-paths.ts"() {
|
|
23651
|
+
"use strict";
|
|
23652
|
+
}
|
|
23653
|
+
});
|
|
23654
|
+
|
|
23655
|
+
// src/platforms/container/handlers/proxy-provision.ts
|
|
23656
|
+
import * as fs30 from "fs";
|
|
23657
|
+
import * as path28 from "path";
|
|
23658
|
+
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
23659
|
+
import { execSync as execSync26 } from "child_process";
|
|
23660
|
+
function getHostAddress() {
|
|
23661
|
+
const platform = process.platform;
|
|
23662
|
+
if (platform === "darwin" || platform === "win32") {
|
|
23663
|
+
return "host.docker.internal";
|
|
23664
|
+
} else {
|
|
23665
|
+
try {
|
|
23666
|
+
execSync26("docker run --rm alpine getent hosts host-gateway", { stdio: "pipe" });
|
|
23667
|
+
return "host-gateway";
|
|
23668
|
+
} catch {
|
|
23669
|
+
return "172.17.0.1";
|
|
23670
|
+
}
|
|
23671
|
+
}
|
|
23672
|
+
}
|
|
23673
|
+
function getProxyImage(type2, customImage) {
|
|
23674
|
+
if (customImage) {
|
|
23675
|
+
return customImage;
|
|
23676
|
+
}
|
|
23677
|
+
switch (type2) {
|
|
23678
|
+
case "envoy":
|
|
23679
|
+
return "envoyproxy/envoy:v1.28-latest";
|
|
23680
|
+
case "nginx":
|
|
23681
|
+
return "nginx:alpine";
|
|
23682
|
+
case "haproxy":
|
|
23683
|
+
return "haproxy:alpine";
|
|
23684
|
+
default:
|
|
23685
|
+
return "envoyproxy/envoy:v1.28-latest";
|
|
23686
|
+
}
|
|
23687
|
+
}
|
|
23688
|
+
function processProxyConfig(templatePath, outputPath, replacements) {
|
|
23689
|
+
let content = fs30.readFileSync(templatePath, "utf-8");
|
|
23690
|
+
for (const [key, value] of Object.entries(replacements)) {
|
|
23691
|
+
const regex = new RegExp(`{{${key}}}`, "g");
|
|
23692
|
+
content = content.replace(regex, value);
|
|
23693
|
+
}
|
|
23694
|
+
fs30.writeFileSync(outputPath, content);
|
|
23695
|
+
}
|
|
23696
|
+
var provisionProxyService, proxyProvisionDescriptor;
|
|
23697
|
+
var init_proxy_provision = __esm({
|
|
23698
|
+
"src/platforms/container/handlers/proxy-provision.ts"() {
|
|
23699
|
+
"use strict";
|
|
23700
|
+
init_cli_logger();
|
|
23701
|
+
init_proxy_paths();
|
|
23702
|
+
provisionProxyService = async (context) => {
|
|
23703
|
+
const { service } = context;
|
|
23704
|
+
const config2 = service.config;
|
|
23705
|
+
if (!service.quiet) {
|
|
23706
|
+
printInfo(`Provisioning proxy service ${service.name} (type: ${config2.type})...`);
|
|
23707
|
+
}
|
|
23708
|
+
const paths = getProxyPaths(context);
|
|
23709
|
+
fs30.mkdirSync(paths.runtimeDir, { recursive: true });
|
|
23710
|
+
fs30.mkdirSync(paths.logsDir, { recursive: true });
|
|
23711
|
+
if (!service.quiet) {
|
|
23712
|
+
printInfo(`Created proxy directories in: ${paths.runtimeDir}`);
|
|
23713
|
+
}
|
|
23714
|
+
const hostAddress = getHostAddress();
|
|
23715
|
+
if (!service.quiet) {
|
|
23716
|
+
printInfo(`Using host address: ${hostAddress} for Docker container`);
|
|
23717
|
+
}
|
|
23718
|
+
const proxyPort = config2.port || 8080;
|
|
23719
|
+
const adminPort = config2.adminPort || 9901;
|
|
23720
|
+
const backendPort = config2.backendPort || 4e3;
|
|
23721
|
+
const frontendPort = config2.frontendPort || 3e3;
|
|
23722
|
+
if (config2.type === "envoy") {
|
|
23723
|
+
const __dirname2 = path28.dirname(fileURLToPath2(import.meta.url));
|
|
23724
|
+
let templatePath;
|
|
23725
|
+
if (__dirname2.includes(path28.sep + "src" + path28.sep)) {
|
|
23726
|
+
templatePath = path28.join(__dirname2, "..", "..", "..", "..", "templates", "envoy.yaml");
|
|
23727
|
+
} else {
|
|
23728
|
+
templatePath = path28.join(__dirname2, "templates", "envoy.yaml");
|
|
23729
|
+
}
|
|
23730
|
+
if (!fs30.existsSync(templatePath)) {
|
|
23731
|
+
return {
|
|
23732
|
+
success: false,
|
|
23733
|
+
error: `Envoy template not found at ${templatePath}`,
|
|
23734
|
+
metadata: { serviceType: "proxy", proxyType: config2.type }
|
|
23735
|
+
};
|
|
23736
|
+
}
|
|
23737
|
+
processProxyConfig(templatePath, paths.configFile, {
|
|
23738
|
+
HOST_ADDRESS: hostAddress,
|
|
23739
|
+
BACKEND_PORT: backendPort.toString(),
|
|
23740
|
+
FRONTEND_PORT: frontendPort.toString()
|
|
23741
|
+
});
|
|
23742
|
+
if (!service.quiet) {
|
|
23743
|
+
printSuccess(`Created Envoy configuration at ${paths.configFile}`);
|
|
23744
|
+
}
|
|
23745
|
+
} else {
|
|
23746
|
+
return {
|
|
23747
|
+
success: false,
|
|
23748
|
+
error: `Proxy type ${config2.type} is not yet implemented`,
|
|
23749
|
+
metadata: { serviceType: "proxy", proxyType: config2.type }
|
|
23750
|
+
};
|
|
23751
|
+
}
|
|
23752
|
+
const imageName = getProxyImage(config2.type, config2.image);
|
|
23753
|
+
if (!service.quiet) {
|
|
23754
|
+
printInfo(`Pulling Docker image: ${imageName}...`);
|
|
23755
|
+
}
|
|
23756
|
+
try {
|
|
23757
|
+
execSync26(`docker pull ${imageName}`, {
|
|
23758
|
+
stdio: service.verbose ? "inherit" : "pipe"
|
|
23759
|
+
});
|
|
23760
|
+
if (!service.quiet) {
|
|
23761
|
+
printSuccess(`Docker image ${imageName} ready`);
|
|
23762
|
+
}
|
|
23763
|
+
} catch (error46) {
|
|
23764
|
+
printError(`Failed to pull Docker image: ${error46}`);
|
|
23765
|
+
return {
|
|
23766
|
+
success: false,
|
|
23767
|
+
error: `Failed to pull Docker image: ${error46}`,
|
|
23768
|
+
metadata: { serviceType: "proxy", proxyType: config2.type, imageName }
|
|
23769
|
+
};
|
|
23770
|
+
}
|
|
23771
|
+
const frontendService = service.environmentConfig.services["frontend"];
|
|
23772
|
+
const backendService = service.environmentConfig.services["backend"];
|
|
23773
|
+
if (!frontendService) {
|
|
23774
|
+
printWarning("Frontend service not configured in environment");
|
|
23775
|
+
}
|
|
23776
|
+
if (!backendService) {
|
|
23777
|
+
printWarning("Backend service not configured in environment");
|
|
23778
|
+
}
|
|
23779
|
+
const metadata = {
|
|
23780
|
+
serviceType: "proxy",
|
|
23781
|
+
proxyType: config2.type,
|
|
23782
|
+
imageName,
|
|
23783
|
+
configFile: paths.configFile,
|
|
23784
|
+
logsDir: paths.logsDir,
|
|
23785
|
+
hostAddress,
|
|
23786
|
+
ports: {
|
|
23787
|
+
proxy: proxyPort,
|
|
23788
|
+
admin: adminPort,
|
|
23789
|
+
backend: backendPort,
|
|
23790
|
+
frontend: frontendPort
|
|
23791
|
+
},
|
|
23792
|
+
configured: true
|
|
23793
|
+
};
|
|
23794
|
+
if (!service.quiet) {
|
|
23795
|
+
printSuccess(`\u2705 Proxy service ${service.name} provisioned successfully`);
|
|
23796
|
+
printInfo("");
|
|
23797
|
+
printInfo("Proxy details:");
|
|
23798
|
+
printInfo(` Type: ${config2.type}`);
|
|
23799
|
+
printInfo(` Image: ${imageName}`);
|
|
23800
|
+
printInfo(` Config: ${paths.configFile}`);
|
|
23801
|
+
printInfo(` Proxy port: ${proxyPort}`);
|
|
23802
|
+
printInfo(` Admin port: ${adminPort}`);
|
|
23803
|
+
printInfo(` Backend routing: ${hostAddress}:${backendPort}`);
|
|
23804
|
+
printInfo(` Frontend routing: ${hostAddress}:${frontendPort}`);
|
|
23805
|
+
printInfo("");
|
|
23806
|
+
printInfo("Next steps:");
|
|
23807
|
+
printInfo(` 1. Ensure backend is running on port ${backendPort}`);
|
|
23808
|
+
printInfo(` 2. Ensure frontend is running on port ${frontendPort}`);
|
|
23809
|
+
printInfo(` 3. Start proxy: semiont start --service proxy --environment ${service.environment}`);
|
|
23810
|
+
}
|
|
23811
|
+
return {
|
|
23812
|
+
success: true,
|
|
23813
|
+
metadata
|
|
23814
|
+
};
|
|
23815
|
+
};
|
|
23816
|
+
proxyProvisionDescriptor = {
|
|
23817
|
+
command: "provision",
|
|
23818
|
+
platform: "container",
|
|
23819
|
+
serviceType: "proxy",
|
|
23820
|
+
handler: provisionProxyService
|
|
23821
|
+
};
|
|
23822
|
+
}
|
|
23823
|
+
});
|
|
23824
|
+
|
|
23825
|
+
// src/platforms/container/handlers/proxy-start.ts
|
|
23826
|
+
import { execSync as execSync27 } from "child_process";
|
|
23827
|
+
import * as fs31 from "fs";
|
|
23828
|
+
function getProxyImage2(type2, customImage) {
|
|
23829
|
+
if (customImage) {
|
|
23830
|
+
return customImage;
|
|
23831
|
+
}
|
|
23832
|
+
switch (type2) {
|
|
23833
|
+
case "envoy":
|
|
23834
|
+
return "envoyproxy/envoy:v1.28-latest";
|
|
23835
|
+
case "nginx":
|
|
23836
|
+
return "nginx:alpine";
|
|
23837
|
+
case "haproxy":
|
|
23838
|
+
return "haproxy:alpine";
|
|
23839
|
+
default:
|
|
23840
|
+
return "envoyproxy/envoy:v1.28-latest";
|
|
23841
|
+
}
|
|
23842
|
+
}
|
|
23843
|
+
function getProxyCommand(type2) {
|
|
23844
|
+
switch (type2) {
|
|
23845
|
+
case "envoy":
|
|
23846
|
+
return ["-c", "/etc/envoy/envoy.yaml"];
|
|
23847
|
+
case "nginx":
|
|
23848
|
+
return [];
|
|
23849
|
+
case "haproxy":
|
|
23850
|
+
return ["-f", "/usr/local/etc/haproxy/haproxy.cfg"];
|
|
23851
|
+
default:
|
|
23852
|
+
return [];
|
|
23853
|
+
}
|
|
23854
|
+
}
|
|
23855
|
+
var startProxyService, proxyStartDescriptor;
|
|
23856
|
+
var init_proxy_start = __esm({
|
|
23857
|
+
"src/platforms/container/handlers/proxy-start.ts"() {
|
|
23858
|
+
"use strict";
|
|
23859
|
+
init_cli_logger();
|
|
23860
|
+
init_proxy_paths();
|
|
23861
|
+
startProxyService = async (context) => {
|
|
23862
|
+
const { service } = context;
|
|
23863
|
+
const config2 = service.config;
|
|
23864
|
+
if (!service.quiet) {
|
|
23865
|
+
printInfo(`Starting proxy service ${service.name} (type: ${config2.type})...`);
|
|
23866
|
+
}
|
|
23867
|
+
const paths = getProxyPaths(context);
|
|
23868
|
+
if (!fs31.existsSync(paths.configFile)) {
|
|
23869
|
+
return {
|
|
23870
|
+
success: false,
|
|
23871
|
+
error: `Configuration file not found: ${paths.configFile}. Please run 'semiont provision --service proxy' first.`,
|
|
23872
|
+
metadata: { serviceType: "proxy", proxyType: config2.type }
|
|
23873
|
+
};
|
|
23874
|
+
}
|
|
23875
|
+
const containerName = `semiont-proxy-${service.environment}`;
|
|
23876
|
+
try {
|
|
23877
|
+
const existingContainer = execSync27(`docker ps -aq -f name=${containerName}`, { encoding: "utf-8" }).trim();
|
|
23878
|
+
if (existingContainer) {
|
|
23879
|
+
const isRunning = execSync27(`docker ps -q -f name=${containerName}`, { encoding: "utf-8" }).trim();
|
|
23880
|
+
if (isRunning) {
|
|
23881
|
+
if (!service.quiet) {
|
|
23882
|
+
printInfo(`Proxy container ${containerName} is already running`);
|
|
23883
|
+
}
|
|
23884
|
+
return {
|
|
23885
|
+
success: true,
|
|
23886
|
+
metadata: {
|
|
23887
|
+
serviceType: "proxy",
|
|
23888
|
+
proxyType: config2.type,
|
|
23889
|
+
containerId: existingContainer,
|
|
23890
|
+
alreadyRunning: true
|
|
23891
|
+
}
|
|
23892
|
+
};
|
|
23893
|
+
} else {
|
|
23894
|
+
if (!service.quiet) {
|
|
23895
|
+
printInfo(`Removing stopped container ${containerName}`);
|
|
23896
|
+
}
|
|
23897
|
+
execSync27(`docker rm ${containerName}`, { stdio: "pipe" });
|
|
23898
|
+
}
|
|
23899
|
+
}
|
|
23900
|
+
} catch (error46) {
|
|
23901
|
+
}
|
|
23902
|
+
const imageName = getProxyImage2(config2.type, config2.image);
|
|
23903
|
+
const proxyPort = config2.port || 8080;
|
|
23904
|
+
const adminPort = config2.adminPort || 9901;
|
|
23905
|
+
const dockerCmd = [
|
|
23906
|
+
"docker",
|
|
23907
|
+
"run",
|
|
23908
|
+
"-d",
|
|
23909
|
+
"--name",
|
|
23910
|
+
containerName,
|
|
23911
|
+
"-p",
|
|
23912
|
+
`${proxyPort}:8080`,
|
|
23913
|
+
"-p",
|
|
23914
|
+
`${adminPort}:9901`,
|
|
23915
|
+
"-v",
|
|
23916
|
+
`${paths.runtimeDir}:/etc/envoy:ro`,
|
|
23917
|
+
"--restart",
|
|
23918
|
+
"unless-stopped",
|
|
23919
|
+
"--log-driver",
|
|
23920
|
+
"json-file",
|
|
23921
|
+
"--log-opt",
|
|
23922
|
+
"max-size=10m",
|
|
23923
|
+
"--log-opt",
|
|
23924
|
+
"max-file=3",
|
|
23925
|
+
imageName,
|
|
23926
|
+
...getProxyCommand(config2.type)
|
|
23927
|
+
];
|
|
23928
|
+
if (!service.quiet) {
|
|
23929
|
+
printInfo(`Starting Docker container: ${containerName}`);
|
|
23930
|
+
if (service.verbose) {
|
|
23931
|
+
printInfo(`Command: ${dockerCmd.join(" ")}`);
|
|
23932
|
+
}
|
|
23933
|
+
}
|
|
23934
|
+
try {
|
|
23935
|
+
const containerId = execSync27(dockerCmd.join(" "), { encoding: "utf-8" }).trim();
|
|
23936
|
+
if (!service.quiet) {
|
|
23937
|
+
printSuccess(`Docker container started with ID: ${containerId.substring(0, 12)}`);
|
|
23938
|
+
}
|
|
23939
|
+
if (!service.quiet) {
|
|
23940
|
+
printInfo("Waiting for proxy to become healthy...");
|
|
23941
|
+
}
|
|
23942
|
+
await new Promise((resolve2) => setTimeout(resolve2, 2e3));
|
|
23943
|
+
const isRunning = execSync27(`docker ps -q -f id=${containerId}`, { encoding: "utf-8" }).trim();
|
|
23944
|
+
if (!isRunning) {
|
|
23945
|
+
const logs = execSync27(`docker logs ${containerId} 2>&1`, { encoding: "utf-8" });
|
|
23946
|
+
return {
|
|
23947
|
+
success: false,
|
|
23948
|
+
error: `Container exited unexpectedly. Logs:
|
|
23949
|
+
${logs}`,
|
|
23950
|
+
metadata: { serviceType: "proxy", proxyType: config2.type, containerId }
|
|
23951
|
+
};
|
|
23952
|
+
}
|
|
23953
|
+
if (config2.type === "envoy") {
|
|
23954
|
+
try {
|
|
23955
|
+
execSync27(`curl -s http://localhost:${adminPort}/clusters > /dev/null 2>&1`, { stdio: "pipe" });
|
|
23956
|
+
if (!service.quiet) {
|
|
23957
|
+
printSuccess("Proxy admin interface is accessible");
|
|
23958
|
+
}
|
|
23959
|
+
} catch {
|
|
23960
|
+
if (!service.quiet) {
|
|
23961
|
+
printInfo("Admin interface not yet ready, but container is running");
|
|
23962
|
+
}
|
|
23963
|
+
}
|
|
23964
|
+
}
|
|
23965
|
+
const metadata = {
|
|
23966
|
+
serviceType: "proxy",
|
|
23967
|
+
proxyType: config2.type,
|
|
23968
|
+
containerId,
|
|
23969
|
+
containerName,
|
|
23970
|
+
ports: {
|
|
23971
|
+
proxy: proxyPort,
|
|
23972
|
+
admin: adminPort
|
|
23973
|
+
},
|
|
23974
|
+
started: (/* @__PURE__ */ new Date()).toISOString()
|
|
23975
|
+
};
|
|
23976
|
+
if (!service.quiet) {
|
|
23977
|
+
printSuccess(`\u2705 Proxy service ${service.name} started successfully`);
|
|
23978
|
+
printInfo("");
|
|
23979
|
+
printInfo("Proxy is running:");
|
|
23980
|
+
printInfo(` Container: ${containerName}`);
|
|
23981
|
+
printInfo(` Proxy URL: http://localhost:${proxyPort}`);
|
|
23982
|
+
if (config2.type === "envoy") {
|
|
23983
|
+
printInfo(` Admin URL: http://localhost:${adminPort}`);
|
|
23984
|
+
}
|
|
23985
|
+
printInfo("");
|
|
23986
|
+
printInfo("Access your application through the proxy:");
|
|
23987
|
+
printInfo(` Frontend: http://localhost:${proxyPort}/`);
|
|
23988
|
+
printInfo(` Backend API: http://localhost:${proxyPort}/api/`);
|
|
23989
|
+
}
|
|
23990
|
+
return {
|
|
23991
|
+
success: true,
|
|
23992
|
+
metadata,
|
|
23993
|
+
resources: {
|
|
23994
|
+
platform: "container",
|
|
23995
|
+
data: {
|
|
23996
|
+
containerId,
|
|
23997
|
+
containerName
|
|
23998
|
+
}
|
|
23999
|
+
}
|
|
24000
|
+
};
|
|
24001
|
+
} catch (error46) {
|
|
24002
|
+
printError(`Failed to start proxy container: ${error46}`);
|
|
24003
|
+
return {
|
|
24004
|
+
success: false,
|
|
24005
|
+
error: `Failed to start proxy container: ${error46}`,
|
|
24006
|
+
metadata: { serviceType: "proxy", proxyType: config2.type }
|
|
24007
|
+
};
|
|
24008
|
+
}
|
|
24009
|
+
};
|
|
24010
|
+
proxyStartDescriptor = {
|
|
24011
|
+
command: "start",
|
|
24012
|
+
platform: "container",
|
|
24013
|
+
serviceType: "proxy",
|
|
24014
|
+
handler: startProxyService
|
|
24015
|
+
};
|
|
24016
|
+
}
|
|
24017
|
+
});
|
|
24018
|
+
|
|
24019
|
+
// src/platforms/container/handlers/proxy-stop.ts
|
|
24020
|
+
import { execSync as execSync28 } from "child_process";
|
|
24021
|
+
var stopProxyService, proxyStopDescriptor;
|
|
24022
|
+
var init_proxy_stop = __esm({
|
|
24023
|
+
"src/platforms/container/handlers/proxy-stop.ts"() {
|
|
24024
|
+
"use strict";
|
|
24025
|
+
init_cli_logger();
|
|
24026
|
+
stopProxyService = async (context) => {
|
|
24027
|
+
const { service } = context;
|
|
24028
|
+
const config2 = service.config;
|
|
24029
|
+
if (!service.quiet) {
|
|
24030
|
+
printInfo(`Stopping proxy service ${service.name} (type: ${config2.type})...`);
|
|
24031
|
+
}
|
|
24032
|
+
const containerName = `semiont-proxy-${service.environment}`;
|
|
24033
|
+
try {
|
|
24034
|
+
const existingContainer = execSync28(`docker ps -aq -f name=${containerName}`, { encoding: "utf-8" }).trim();
|
|
24035
|
+
if (!existingContainer) {
|
|
24036
|
+
if (!service.quiet) {
|
|
24037
|
+
printWarning(`Proxy container ${containerName} not found`);
|
|
24038
|
+
}
|
|
24039
|
+
return {
|
|
24040
|
+
success: true,
|
|
24041
|
+
metadata: {
|
|
24042
|
+
serviceType: "proxy",
|
|
24043
|
+
proxyType: config2.type,
|
|
24044
|
+
notFound: true
|
|
24045
|
+
}
|
|
24046
|
+
};
|
|
24047
|
+
}
|
|
24048
|
+
const isRunning = execSync28(`docker ps -q -f name=${containerName}`, { encoding: "utf-8" }).trim();
|
|
24049
|
+
if (isRunning) {
|
|
24050
|
+
if (!service.quiet) {
|
|
24051
|
+
printInfo(`Stopping container ${containerName}...`);
|
|
24052
|
+
}
|
|
24053
|
+
execSync28(`docker stop ${containerName}`, {
|
|
24054
|
+
stdio: service.verbose ? "inherit" : "pipe"
|
|
24055
|
+
});
|
|
24056
|
+
if (!service.quiet) {
|
|
24057
|
+
printSuccess(`Container ${containerName} stopped`);
|
|
24058
|
+
}
|
|
24059
|
+
} else {
|
|
24060
|
+
if (!service.quiet) {
|
|
24061
|
+
printInfo(`Container ${containerName} is not running`);
|
|
24062
|
+
}
|
|
24063
|
+
}
|
|
24064
|
+
if (!service.quiet) {
|
|
24065
|
+
printInfo(`Removing container ${containerName}...`);
|
|
24066
|
+
}
|
|
24067
|
+
execSync28(`docker rm ${containerName}`, {
|
|
24068
|
+
stdio: service.verbose ? "inherit" : "pipe"
|
|
24069
|
+
});
|
|
24070
|
+
if (!service.quiet) {
|
|
24071
|
+
printSuccess(`Container ${containerName} removed`);
|
|
24072
|
+
}
|
|
24073
|
+
const metadata = {
|
|
24074
|
+
serviceType: "proxy",
|
|
24075
|
+
proxyType: config2.type,
|
|
24076
|
+
containerName,
|
|
24077
|
+
containerId: existingContainer,
|
|
24078
|
+
stopped: (/* @__PURE__ */ new Date()).toISOString()
|
|
24079
|
+
};
|
|
24080
|
+
if (!service.quiet) {
|
|
24081
|
+
printSuccess(`\u2705 Proxy service ${service.name} stopped successfully`);
|
|
24082
|
+
}
|
|
24083
|
+
return {
|
|
24084
|
+
success: true,
|
|
24085
|
+
metadata
|
|
24086
|
+
};
|
|
24087
|
+
} catch (error46) {
|
|
24088
|
+
printError(`Failed to stop proxy container: ${error46}`);
|
|
24089
|
+
return {
|
|
24090
|
+
success: false,
|
|
24091
|
+
error: `Failed to stop proxy container: ${error46}`,
|
|
24092
|
+
metadata: { serviceType: "proxy", proxyType: config2.type }
|
|
24093
|
+
};
|
|
24094
|
+
}
|
|
24095
|
+
};
|
|
24096
|
+
proxyStopDescriptor = {
|
|
24097
|
+
command: "stop",
|
|
24098
|
+
platform: "container",
|
|
24099
|
+
serviceType: "proxy",
|
|
24100
|
+
handler: stopProxyService
|
|
24101
|
+
};
|
|
24102
|
+
}
|
|
24103
|
+
});
|
|
24104
|
+
|
|
24105
|
+
// src/platforms/container/handlers/proxy-check.ts
|
|
24106
|
+
import { execSync as execSync29 } from "child_process";
|
|
24107
|
+
import * as fs32 from "fs";
|
|
24108
|
+
async function checkUrl(url2, timeout = 5e3) {
|
|
24109
|
+
try {
|
|
24110
|
+
execSync29(`curl -s -f -m ${Math.floor(timeout / 1e3)} ${url2} > /dev/null 2>&1`, { stdio: "pipe" });
|
|
24111
|
+
return true;
|
|
24112
|
+
} catch {
|
|
24113
|
+
return false;
|
|
24114
|
+
}
|
|
24115
|
+
}
|
|
24116
|
+
function getContainerUptime(containerName) {
|
|
24117
|
+
try {
|
|
24118
|
+
const uptime = execSync29(
|
|
24119
|
+
`docker ps --format "table {{.Status}}" --filter name=${containerName} | tail -n +2`,
|
|
24120
|
+
{ encoding: "utf-8" }
|
|
24121
|
+
).trim();
|
|
24122
|
+
return uptime;
|
|
24123
|
+
} catch {
|
|
24124
|
+
return void 0;
|
|
24125
|
+
}
|
|
24126
|
+
}
|
|
24127
|
+
function getRecentLogs(containerName, lines = 20) {
|
|
24128
|
+
try {
|
|
24129
|
+
const logs = execSync29(`docker logs --tail ${lines} ${containerName} 2>&1`, { encoding: "utf-8" });
|
|
24130
|
+
return logs;
|
|
24131
|
+
} catch {
|
|
24132
|
+
return void 0;
|
|
24133
|
+
}
|
|
24134
|
+
}
|
|
24135
|
+
var checkProxyService, proxyCheckDescriptor;
|
|
24136
|
+
var init_proxy_check = __esm({
|
|
24137
|
+
"src/platforms/container/handlers/proxy-check.ts"() {
|
|
24138
|
+
"use strict";
|
|
24139
|
+
init_cli_logger();
|
|
24140
|
+
init_proxy_paths();
|
|
24141
|
+
checkProxyService = async (context) => {
|
|
24142
|
+
const { service } = context;
|
|
24143
|
+
const config2 = service.config;
|
|
24144
|
+
if (!service.quiet) {
|
|
24145
|
+
printInfo(`Checking proxy service ${service.name} (type: ${config2.type})...`);
|
|
24146
|
+
}
|
|
24147
|
+
const paths = getProxyPaths(context);
|
|
24148
|
+
const containerName = `semiont-proxy-${service.environment}`;
|
|
24149
|
+
const healthCheck = {
|
|
24150
|
+
containerRunning: false,
|
|
24151
|
+
adminHealthy: false,
|
|
24152
|
+
frontendRouting: false,
|
|
24153
|
+
backendRouting: false
|
|
24154
|
+
};
|
|
24155
|
+
try {
|
|
24156
|
+
const containerId = execSync29(`docker ps -q -f name=${containerName}`, { encoding: "utf-8" }).trim();
|
|
24157
|
+
if (containerId) {
|
|
24158
|
+
healthCheck.containerRunning = true;
|
|
24159
|
+
healthCheck.containerId = containerId.substring(0, 12);
|
|
24160
|
+
healthCheck.uptime = getContainerUptime(containerName);
|
|
24161
|
+
if (!service.quiet) {
|
|
24162
|
+
printSuccess(`Container ${containerName} is running (${healthCheck.containerId})`);
|
|
24163
|
+
if (healthCheck.uptime) {
|
|
24164
|
+
printInfo(` Uptime: ${healthCheck.uptime}`);
|
|
24165
|
+
}
|
|
24166
|
+
}
|
|
24167
|
+
} else {
|
|
24168
|
+
const stoppedContainer = execSync29(`docker ps -aq -f name=${containerName}`, { encoding: "utf-8" }).trim();
|
|
24169
|
+
if (stoppedContainer) {
|
|
24170
|
+
if (!service.quiet) {
|
|
24171
|
+
printWarning(`Container ${containerName} exists but is not running`);
|
|
24172
|
+
printInfo(" Run `semiont start --service proxy` to start it");
|
|
24173
|
+
}
|
|
24174
|
+
} else {
|
|
24175
|
+
if (!service.quiet) {
|
|
24176
|
+
printWarning(`Container ${containerName} does not exist`);
|
|
24177
|
+
printInfo(" Run `semiont provision --service proxy` to set it up");
|
|
24178
|
+
}
|
|
24179
|
+
}
|
|
24180
|
+
return {
|
|
24181
|
+
success: false,
|
|
24182
|
+
status: "stopped",
|
|
24183
|
+
error: "Proxy container is not running",
|
|
24184
|
+
metadata: {
|
|
24185
|
+
serviceType: "proxy",
|
|
24186
|
+
proxyType: config2.type,
|
|
24187
|
+
healthCheck
|
|
24188
|
+
}
|
|
24189
|
+
};
|
|
24190
|
+
}
|
|
24191
|
+
} catch (error46) {
|
|
24192
|
+
printError(`Failed to check container status: ${error46}`);
|
|
24193
|
+
return {
|
|
24194
|
+
success: false,
|
|
24195
|
+
status: "stopped",
|
|
24196
|
+
error: `Failed to check container status: ${error46}`,
|
|
24197
|
+
metadata: {
|
|
24198
|
+
serviceType: "proxy",
|
|
24199
|
+
proxyType: config2.type,
|
|
24200
|
+
healthCheck
|
|
24201
|
+
}
|
|
24202
|
+
};
|
|
24203
|
+
}
|
|
24204
|
+
const proxyPort = config2.port || 8080;
|
|
24205
|
+
const adminPort = config2.adminPort || 9901;
|
|
24206
|
+
if (config2.type === "envoy") {
|
|
24207
|
+
if (!service.quiet) {
|
|
24208
|
+
printInfo(`Checking admin interface on port ${adminPort}...`);
|
|
24209
|
+
}
|
|
24210
|
+
healthCheck.adminHealthy = await checkUrl(`http://localhost:${adminPort}/clusters`);
|
|
24211
|
+
if (healthCheck.adminHealthy) {
|
|
24212
|
+
if (!service.quiet) {
|
|
24213
|
+
printSuccess(`Admin interface is accessible at http://localhost:${adminPort}`);
|
|
24214
|
+
}
|
|
24215
|
+
} else {
|
|
24216
|
+
if (!service.quiet) {
|
|
24217
|
+
printWarning(`Admin interface is not accessible at http://localhost:${adminPort}`);
|
|
24218
|
+
}
|
|
24219
|
+
}
|
|
24220
|
+
}
|
|
24221
|
+
if (!service.quiet) {
|
|
24222
|
+
printInfo("Checking frontend routing through proxy...");
|
|
24223
|
+
}
|
|
24224
|
+
healthCheck.frontendRouting = await checkUrl(`http://localhost:${proxyPort}/`);
|
|
24225
|
+
if (healthCheck.frontendRouting) {
|
|
24226
|
+
if (!service.quiet) {
|
|
24227
|
+
printSuccess(`Frontend is accessible through proxy at http://localhost:${proxyPort}/`);
|
|
24228
|
+
}
|
|
24229
|
+
} else {
|
|
24230
|
+
if (!service.quiet) {
|
|
24231
|
+
printWarning(`Frontend is not accessible through proxy at http://localhost:${proxyPort}/`);
|
|
24232
|
+
printInfo(" Ensure frontend is running on port " + (config2.frontendPort || 3e3));
|
|
24233
|
+
}
|
|
24234
|
+
}
|
|
24235
|
+
if (!service.quiet) {
|
|
24236
|
+
printInfo("Checking backend API routing through proxy...");
|
|
24237
|
+
}
|
|
24238
|
+
healthCheck.backendRouting = await checkUrl(`http://localhost:${proxyPort}/api/health`);
|
|
24239
|
+
if (healthCheck.backendRouting) {
|
|
24240
|
+
if (!service.quiet) {
|
|
24241
|
+
printSuccess(`Backend API is accessible through proxy at http://localhost:${proxyPort}/api/`);
|
|
24242
|
+
}
|
|
24243
|
+
} else {
|
|
24244
|
+
if (!service.quiet) {
|
|
24245
|
+
printWarning(`Backend API is not accessible through proxy at http://localhost:${proxyPort}/api/`);
|
|
24246
|
+
printInfo(" Ensure backend is running on port " + (config2.backendPort || 4e3));
|
|
24247
|
+
}
|
|
24248
|
+
}
|
|
24249
|
+
if (!service.quiet) {
|
|
24250
|
+
printInfo("Checking configuration...");
|
|
24251
|
+
}
|
|
24252
|
+
if (fs32.existsSync(paths.configFile)) {
|
|
24253
|
+
if (!service.quiet) {
|
|
24254
|
+
printSuccess(`Configuration file exists: ${paths.configFile}`);
|
|
24255
|
+
}
|
|
24256
|
+
} else {
|
|
24257
|
+
if (!service.quiet) {
|
|
24258
|
+
printWarning(`Configuration file missing: ${paths.configFile}`);
|
|
24259
|
+
printInfo(" Run `semiont provision --service proxy` to create it");
|
|
24260
|
+
}
|
|
24261
|
+
}
|
|
24262
|
+
if (!healthCheck.frontendRouting || !healthCheck.backendRouting) {
|
|
24263
|
+
healthCheck.logs = getRecentLogs(containerName, 10);
|
|
24264
|
+
if (healthCheck.logs && !service.quiet && service.verbose) {
|
|
24265
|
+
printInfo("\nRecent container logs:");
|
|
24266
|
+
console.log(healthCheck.logs);
|
|
24267
|
+
}
|
|
24268
|
+
}
|
|
24269
|
+
const isHealthy = healthCheck.containerRunning && (config2.type !== "envoy" || healthCheck.adminHealthy);
|
|
24270
|
+
const metadata = {
|
|
24271
|
+
serviceType: "proxy",
|
|
24272
|
+
proxyType: config2.type,
|
|
24273
|
+
containerName,
|
|
24274
|
+
ports: {
|
|
24275
|
+
proxy: proxyPort,
|
|
24276
|
+
admin: adminPort
|
|
24277
|
+
},
|
|
24278
|
+
healthCheck,
|
|
24279
|
+
checked: (/* @__PURE__ */ new Date()).toISOString()
|
|
24280
|
+
};
|
|
24281
|
+
if (isHealthy) {
|
|
24282
|
+
if (!service.quiet) {
|
|
24283
|
+
printSuccess(`
|
|
24284
|
+
\u2705 Proxy service ${service.name} is healthy`);
|
|
24285
|
+
printInfo("\nRouting status:");
|
|
24286
|
+
printInfo(` Proxy: http://localhost:${proxyPort} [${healthCheck.containerRunning ? "\u2713" : "\u2717"}]`);
|
|
24287
|
+
if (config2.type === "envoy") {
|
|
24288
|
+
printInfo(` Admin: http://localhost:${adminPort} [${healthCheck.adminHealthy ? "\u2713" : "\u2717"}]`);
|
|
24289
|
+
}
|
|
24290
|
+
printInfo(` Frontend routing: [${healthCheck.frontendRouting ? "\u2713" : "\u2717"}]`);
|
|
24291
|
+
printInfo(` Backend routing: [${healthCheck.backendRouting ? "\u2713" : "\u2717"}]`);
|
|
24292
|
+
if (!healthCheck.frontendRouting || !healthCheck.backendRouting) {
|
|
24293
|
+
printInfo("\nNote: Some routes are not accessible. Ensure frontend and backend services are running.");
|
|
24294
|
+
}
|
|
24295
|
+
}
|
|
24296
|
+
return {
|
|
24297
|
+
success: true,
|
|
24298
|
+
status: "running",
|
|
24299
|
+
metadata
|
|
24300
|
+
};
|
|
24301
|
+
} else {
|
|
24302
|
+
const issues = [];
|
|
24303
|
+
if (!healthCheck.containerRunning) issues.push("container not running");
|
|
24304
|
+
if (config2.type === "envoy" && !healthCheck.adminHealthy) issues.push("admin interface not healthy");
|
|
24305
|
+
return {
|
|
24306
|
+
success: false,
|
|
24307
|
+
status: "stopped",
|
|
24308
|
+
error: `Proxy service is not healthy: ${issues.join(", ")}`,
|
|
24309
|
+
metadata
|
|
24310
|
+
};
|
|
24311
|
+
}
|
|
24312
|
+
};
|
|
24313
|
+
proxyCheckDescriptor = {
|
|
24314
|
+
command: "check",
|
|
24315
|
+
platform: "container",
|
|
24316
|
+
serviceType: "proxy",
|
|
24317
|
+
handler: checkProxyService
|
|
24318
|
+
};
|
|
24319
|
+
}
|
|
24320
|
+
});
|
|
24321
|
+
|
|
23581
24322
|
// src/platforms/container/handlers/types.ts
|
|
23582
24323
|
var init_types2 = __esm({
|
|
23583
24324
|
"src/platforms/container/handlers/types.ts"() {
|
|
@@ -23600,29 +24341,37 @@ var init_handlers2 = __esm({
|
|
|
23600
24341
|
init_graph_provision2();
|
|
23601
24342
|
init_graph_stop2();
|
|
23602
24343
|
init_database_stop();
|
|
24344
|
+
init_proxy_provision();
|
|
24345
|
+
init_proxy_start();
|
|
24346
|
+
init_proxy_stop();
|
|
24347
|
+
init_proxy_check();
|
|
23603
24348
|
init_types2();
|
|
23604
24349
|
containerHandlers = [
|
|
23605
24350
|
// Check handlers
|
|
23606
24351
|
webCheckDescriptor,
|
|
23607
24352
|
databaseCheckDescriptor2,
|
|
23608
24353
|
graphCheckDescriptor2,
|
|
24354
|
+
proxyCheckDescriptor,
|
|
23609
24355
|
// Start handlers
|
|
23610
24356
|
webStartDescriptor,
|
|
23611
24357
|
databaseStartDescriptor2,
|
|
23612
24358
|
graphStartDescriptor2,
|
|
24359
|
+
proxyStartDescriptor,
|
|
23613
24360
|
// Stop handlers
|
|
23614
24361
|
graphStopDescriptor2,
|
|
23615
24362
|
databaseStopDescriptor,
|
|
24363
|
+
proxyStopDescriptor,
|
|
23616
24364
|
// Provision handlers
|
|
23617
24365
|
databaseProvisionDescriptor,
|
|
23618
|
-
graphProvisionDescriptor2
|
|
24366
|
+
graphProvisionDescriptor2,
|
|
24367
|
+
proxyProvisionDescriptor
|
|
23619
24368
|
];
|
|
23620
24369
|
handlers2 = containerHandlers;
|
|
23621
24370
|
}
|
|
23622
24371
|
});
|
|
23623
24372
|
|
|
23624
24373
|
// src/platforms/container/platform.ts
|
|
23625
|
-
import { execSync as
|
|
24374
|
+
import { execSync as execSync30 } from "child_process";
|
|
23626
24375
|
var ContainerPlatform;
|
|
23627
24376
|
var init_platform3 = __esm({
|
|
23628
24377
|
"src/platforms/container/platform.ts"() {
|
|
@@ -23650,11 +24399,11 @@ var init_platform3 = __esm({
|
|
|
23650
24399
|
*/
|
|
23651
24400
|
detectContainerRuntime() {
|
|
23652
24401
|
try {
|
|
23653
|
-
|
|
24402
|
+
execSync30("docker version", { stdio: "ignore" });
|
|
23654
24403
|
return "docker";
|
|
23655
24404
|
} catch {
|
|
23656
24405
|
try {
|
|
23657
|
-
|
|
24406
|
+
execSync30("podman version", { stdio: "ignore" });
|
|
23658
24407
|
return "podman";
|
|
23659
24408
|
} catch {
|
|
23660
24409
|
throw new Error("No container runtime (Docker or Podman) found");
|
|
@@ -23680,7 +24429,7 @@ var init_platform3 = __esm({
|
|
|
23680
24429
|
return false;
|
|
23681
24430
|
}
|
|
23682
24431
|
try {
|
|
23683
|
-
const status =
|
|
24432
|
+
const status = execSync30(
|
|
23684
24433
|
`${this.runtime} inspect ${containerId} --format '{{.State.Status}}'`,
|
|
23685
24434
|
{ encoding: "utf-8", stdio: "pipe" }
|
|
23686
24435
|
).trim();
|
|
@@ -23698,7 +24447,8 @@ var init_platform3 = __esm({
|
|
|
23698
24447
|
}
|
|
23699
24448
|
if (declaredType === "database") return "database";
|
|
23700
24449
|
if (declaredType === "graph") return "graph";
|
|
23701
|
-
|
|
24450
|
+
if (declaredType === "proxy") return "proxy";
|
|
24451
|
+
throw new Error(`Unsupported service type for container platform: ${declaredType}. Supported types: frontend, backend, database, graph, proxy`);
|
|
23702
24452
|
}
|
|
23703
24453
|
/**
|
|
23704
24454
|
* Build platform-specific context extensions for handlers
|
|
@@ -23742,7 +24492,7 @@ var init_platform3 = __esm({
|
|
|
23742
24492
|
const sinceStr = since.toISOString();
|
|
23743
24493
|
cmd += ` --since "${sinceStr}"`;
|
|
23744
24494
|
}
|
|
23745
|
-
const output =
|
|
24495
|
+
const output = execSync30(cmd, {
|
|
23746
24496
|
encoding: "utf-8",
|
|
23747
24497
|
stdio: ["ignore", "pipe", "pipe"]
|
|
23748
24498
|
// Capture both stdout and stderr
|
|
@@ -23955,7 +24705,7 @@ var init_lambda_check = __esm({
|
|
|
23955
24705
|
});
|
|
23956
24706
|
|
|
23957
24707
|
// src/platforms/aws/handlers/ecs-check.ts
|
|
23958
|
-
import { execSync as
|
|
24708
|
+
import { execSync as execSync31 } from "child_process";
|
|
23959
24709
|
import { DescribeServicesCommand } from "@aws-sdk/client-ecs";
|
|
23960
24710
|
import { DescribeTargetHealthCommand } from "@aws-sdk/client-elastic-load-balancing-v2";
|
|
23961
24711
|
import { FilterLogEventsCommand as FilterLogEventsCommand2 } from "@aws-sdk/client-cloudwatch-logs";
|
|
@@ -24006,7 +24756,7 @@ var init_ecs_check = __esm({
|
|
|
24006
24756
|
let imageTag = "unknown";
|
|
24007
24757
|
if (activeDeployment?.taskDefinition) {
|
|
24008
24758
|
try {
|
|
24009
|
-
const taskDefJson =
|
|
24759
|
+
const taskDefJson = execSync31(
|
|
24010
24760
|
`aws ecs describe-task-definition --task-definition ${activeDeployment.taskDefinition} --region ${region} --output json`,
|
|
24011
24761
|
{ encoding: "utf-8" }
|
|
24012
24762
|
);
|
|
@@ -24332,10 +25082,10 @@ var init_rds_check = __esm({
|
|
|
24332
25082
|
});
|
|
24333
25083
|
|
|
24334
25084
|
// src/platforms/aws/handlers/s3-cloudfront-check.ts
|
|
24335
|
-
import { execSync as
|
|
25085
|
+
import { execSync as execSync32 } from "child_process";
|
|
24336
25086
|
async function getCloudFrontDistribution(bucketName, region) {
|
|
24337
25087
|
try {
|
|
24338
|
-
const distributionId =
|
|
25088
|
+
const distributionId = execSync32(
|
|
24339
25089
|
`aws cloudfront list-distributions --query "DistributionList.Items[?Origins.Items[?DomainName=='${bucketName}.s3.amazonaws.com']].Id | [0]" --output text --region ${region}`,
|
|
24340
25090
|
{ encoding: "utf-8" }
|
|
24341
25091
|
).trim();
|
|
@@ -24346,7 +25096,7 @@ async function getCloudFrontDistribution(bucketName, region) {
|
|
|
24346
25096
|
}
|
|
24347
25097
|
async function getCloudFrontStatus(distributionId, region) {
|
|
24348
25098
|
try {
|
|
24349
|
-
const status =
|
|
25099
|
+
const status = execSync32(
|
|
24350
25100
|
`aws cloudfront get-distribution --id ${distributionId} --query 'Distribution.Status' --output text --region ${region}`,
|
|
24351
25101
|
{ encoding: "utf-8" }
|
|
24352
25102
|
).trim();
|
|
@@ -24364,7 +25114,7 @@ var init_s3_cloudfront_check = __esm({
|
|
|
24364
25114
|
const { service, region, resourceName } = context;
|
|
24365
25115
|
const bucketName = `${resourceName}-static`;
|
|
24366
25116
|
try {
|
|
24367
|
-
|
|
25117
|
+
execSync32(`aws s3api head-bucket --bucket ${bucketName} --region ${region} 2>/dev/null`);
|
|
24368
25118
|
const status = "running";
|
|
24369
25119
|
let health;
|
|
24370
25120
|
let distributionId;
|
|
@@ -24588,7 +25338,7 @@ var init_neptune_check = __esm({
|
|
|
24588
25338
|
});
|
|
24589
25339
|
|
|
24590
25340
|
// src/platforms/aws/handlers/ecs-start.ts
|
|
24591
|
-
import { execSync as
|
|
25341
|
+
import { execSync as execSync33 } from "child_process";
|
|
24592
25342
|
var startECSService, ecsFargateStartDescriptor, ecsStartDescriptor;
|
|
24593
25343
|
var init_ecs_start = __esm({
|
|
24594
25344
|
"src/platforms/aws/handlers/ecs-start.ts"() {
|
|
@@ -24602,14 +25352,14 @@ var init_ecs_start = __esm({
|
|
|
24602
25352
|
const serviceName = cfnDiscoveredResources?.serviceName || resourceName;
|
|
24603
25353
|
const desiredCount = requirements.resources?.replicas || 1;
|
|
24604
25354
|
try {
|
|
24605
|
-
|
|
25355
|
+
execSync33(
|
|
24606
25356
|
`aws ecs update-service --cluster ${clusterName} --service ${serviceName} --desired-count ${desiredCount} --region ${region}`,
|
|
24607
25357
|
{ encoding: "utf-8" }
|
|
24608
25358
|
);
|
|
24609
25359
|
let endpoint;
|
|
24610
25360
|
if (requirements.network?.needsLoadBalancer) {
|
|
24611
25361
|
try {
|
|
24612
|
-
const albDns =
|
|
25362
|
+
const albDns = execSync33(
|
|
24613
25363
|
`aws elbv2 describe-load-balancers --names ${serviceName}-alb --query 'LoadBalancers[0].DNSName' --output text --region ${region}`,
|
|
24614
25364
|
{ encoding: "utf-8" }
|
|
24615
25365
|
).trim();
|
|
@@ -24668,7 +25418,7 @@ var init_ecs_start = __esm({
|
|
|
24668
25418
|
});
|
|
24669
25419
|
|
|
24670
25420
|
// src/platforms/aws/handlers/rds-start.ts
|
|
24671
|
-
import { execSync as
|
|
25421
|
+
import { execSync as execSync34 } from "child_process";
|
|
24672
25422
|
var startRDSInstance, rdsStartDescriptor;
|
|
24673
25423
|
var init_rds_start = __esm({
|
|
24674
25424
|
"src/platforms/aws/handlers/rds-start.ts"() {
|
|
@@ -24680,7 +25430,7 @@ var init_rds_start = __esm({
|
|
|
24680
25430
|
const resourceName = `semiont-${service.name}-${service.environment}`;
|
|
24681
25431
|
const instanceId = `${resourceName}-db`;
|
|
24682
25432
|
try {
|
|
24683
|
-
|
|
25433
|
+
execSync34(
|
|
24684
25434
|
`aws rds start-db-instance --db-instance-identifier ${instanceId} --region ${region}`,
|
|
24685
25435
|
{ encoding: "utf-8" }
|
|
24686
25436
|
);
|
|
@@ -24689,7 +25439,7 @@ var init_rds_start = __esm({
|
|
|
24689
25439
|
}
|
|
24690
25440
|
let endpoint;
|
|
24691
25441
|
try {
|
|
24692
|
-
endpoint =
|
|
25442
|
+
endpoint = execSync34(
|
|
24693
25443
|
`aws rds describe-db-instances --db-instance-identifier ${instanceId} --query 'DBInstances[0].Endpoint.Address' --output text --region ${region}`,
|
|
24694
25444
|
{ encoding: "utf-8" }
|
|
24695
25445
|
).trim();
|
|
@@ -24737,8 +25487,8 @@ var init_rds_start = __esm({
|
|
|
24737
25487
|
|
|
24738
25488
|
// src/platforms/aws/handlers/stack-provision.ts
|
|
24739
25489
|
import { spawnSync } from "child_process";
|
|
24740
|
-
import * as
|
|
24741
|
-
import * as
|
|
25490
|
+
import * as path29 from "path";
|
|
25491
|
+
import * as fs33 from "fs";
|
|
24742
25492
|
var provisionStackService, stackProvisionDescriptor;
|
|
24743
25493
|
var init_stack_provision = __esm({
|
|
24744
25494
|
"src/platforms/aws/handlers/stack-provision.ts"() {
|
|
@@ -24807,10 +25557,10 @@ var init_stack_provision = __esm({
|
|
|
24807
25557
|
continue;
|
|
24808
25558
|
}
|
|
24809
25559
|
try {
|
|
24810
|
-
const cdkContextPath =
|
|
24811
|
-
const cdkContext =
|
|
25560
|
+
const cdkContextPath = path29.join(projectRoot, "cdk.context.json");
|
|
25561
|
+
const cdkContext = fs33.existsSync(cdkContextPath) ? JSON.parse(fs33.readFileSync(cdkContextPath, "utf-8")) : {};
|
|
24812
25562
|
cdkContext[`availability-zones:account=${awsConfig.accountId}:region=${awsConfig.region}`] = cdkContext[`availability-zones:account=${awsConfig.accountId}:region=${awsConfig.region}`] || [`${awsConfig.region}a`, `${awsConfig.region}b`];
|
|
24813
|
-
|
|
25563
|
+
fs33.writeFileSync(cdkContextPath, JSON.stringify(cdkContext, null, 2));
|
|
24814
25564
|
const cdkCommand = destroy ? "destroy" : "deploy";
|
|
24815
25565
|
const cdkArgs = [
|
|
24816
25566
|
cdkCommand,
|
|
@@ -24906,9 +25656,9 @@ var init_stack_provision = __esm({
|
|
|
24906
25656
|
});
|
|
24907
25657
|
|
|
24908
25658
|
// src/platforms/aws/handlers/ecs-publish.ts
|
|
24909
|
-
import { execSync as
|
|
24910
|
-
import * as
|
|
24911
|
-
import * as
|
|
25659
|
+
import { execSync as execSync35 } from "child_process";
|
|
25660
|
+
import * as path30 from "path";
|
|
25661
|
+
import * as fs34 from "fs";
|
|
24912
25662
|
async function createNewTaskDefinition(service, imageUri, region, _accountId, cfnDiscoveredResources, resourceName) {
|
|
24913
25663
|
if (!service || !imageUri) return "";
|
|
24914
25664
|
try {
|
|
@@ -24918,7 +25668,7 @@ async function createNewTaskDefinition(service, imageUri, region, _accountId, cf
|
|
|
24918
25668
|
console.warn(` \u26A0\uFE0F Could not find ECS service name for ${service.name}`);
|
|
24919
25669
|
return "";
|
|
24920
25670
|
}
|
|
24921
|
-
const serviceJson =
|
|
25671
|
+
const serviceJson = execSync35(
|
|
24922
25672
|
`aws ecs describe-services --cluster ${clusterName} --services ${serviceName} --region ${region} --output json`,
|
|
24923
25673
|
{ encoding: "utf-8" }
|
|
24924
25674
|
);
|
|
@@ -24928,7 +25678,7 @@ async function createNewTaskDefinition(service, imageUri, region, _accountId, cf
|
|
|
24928
25678
|
console.warn(` \u26A0\uFE0F Could not find task definition for ${serviceName}`);
|
|
24929
25679
|
return "";
|
|
24930
25680
|
}
|
|
24931
|
-
const taskDefJson =
|
|
25681
|
+
const taskDefJson = execSync35(
|
|
24932
25682
|
`aws ecs describe-task-definition --task-definition ${currentTaskDefArn} --region ${region} --output json`,
|
|
24933
25683
|
{ encoding: "utf-8" }
|
|
24934
25684
|
);
|
|
@@ -24953,7 +25703,7 @@ async function createNewTaskDefinition(service, imageUri, region, _accountId, cf
|
|
|
24953
25703
|
memory: taskDef.memory,
|
|
24954
25704
|
runtimePlatform: taskDef.runtimePlatform
|
|
24955
25705
|
};
|
|
24956
|
-
const registerOutput =
|
|
25706
|
+
const registerOutput = execSync35(
|
|
24957
25707
|
`aws ecs register-task-definition --cli-input-json '${JSON.stringify(newTaskDef)}' --region ${region} --output json`,
|
|
24958
25708
|
{ encoding: "utf-8" }
|
|
24959
25709
|
);
|
|
@@ -24986,7 +25736,7 @@ var init_ecs_publish = __esm({
|
|
|
24986
25736
|
const deploymentStrategy = envConfig.deployment?.imageTagStrategy || "mutable";
|
|
24987
25737
|
if (deploymentStrategy === "immutable" || deploymentStrategy === "git-hash") {
|
|
24988
25738
|
try {
|
|
24989
|
-
const gitHash =
|
|
25739
|
+
const gitHash = execSync35("git rev-parse --short HEAD", {
|
|
24990
25740
|
encoding: "utf-8",
|
|
24991
25741
|
cwd: service.config?.semiontRepo || service.projectRoot
|
|
24992
25742
|
}).trim();
|
|
@@ -25006,7 +25756,7 @@ var init_ecs_publish = __esm({
|
|
|
25006
25756
|
const ecrRepo = `semiont-${service.name}`;
|
|
25007
25757
|
const imageUri = `${accountId}.dkr.ecr.${region}.amazonaws.com/${ecrRepo}:${version2}`;
|
|
25008
25758
|
try {
|
|
25009
|
-
|
|
25759
|
+
execSync35(`aws ecr create-repository --repository-name ${ecrRepo} --region ${region}`);
|
|
25010
25760
|
} catch {
|
|
25011
25761
|
}
|
|
25012
25762
|
if (service.verbose) {
|
|
@@ -25043,17 +25793,17 @@ var init_ecs_publish = __esm({
|
|
|
25043
25793
|
}
|
|
25044
25794
|
}
|
|
25045
25795
|
try {
|
|
25046
|
-
const apiTypesPath =
|
|
25047
|
-
if (
|
|
25048
|
-
|
|
25796
|
+
const apiTypesPath = path30.join(buildContext, "packages", "api-types");
|
|
25797
|
+
if (fs34.existsSync(apiTypesPath)) {
|
|
25798
|
+
execSync35("npm run build", {
|
|
25049
25799
|
cwd: apiTypesPath,
|
|
25050
25800
|
env: buildEnv,
|
|
25051
25801
|
stdio: service.verbose ? "inherit" : "pipe"
|
|
25052
25802
|
});
|
|
25053
25803
|
}
|
|
25054
|
-
const appPath =
|
|
25055
|
-
if (
|
|
25056
|
-
|
|
25804
|
+
const appPath = path30.join(buildContext, "apps", service.name);
|
|
25805
|
+
if (fs34.existsSync(appPath)) {
|
|
25806
|
+
execSync35("npm run build", {
|
|
25057
25807
|
cwd: appPath,
|
|
25058
25808
|
env: buildEnv,
|
|
25059
25809
|
stdio: service.verbose ? "inherit" : "pipe"
|
|
@@ -25069,7 +25819,7 @@ var init_ecs_publish = __esm({
|
|
|
25069
25819
|
};
|
|
25070
25820
|
}
|
|
25071
25821
|
try {
|
|
25072
|
-
|
|
25822
|
+
execSync35(
|
|
25073
25823
|
`aws ecr get-login-password --region ${region} | docker login --username AWS --password-stdin ${accountId}.dkr.ecr.${region}.amazonaws.com`,
|
|
25074
25824
|
{ stdio: service.verbose ? "inherit" : "pipe" }
|
|
25075
25825
|
);
|
|
@@ -25079,8 +25829,8 @@ var init_ecs_publish = __esm({
|
|
|
25079
25829
|
if (service.verbose) {
|
|
25080
25830
|
console.log(`[DEBUG] Docker build command: ${buildCommand}`);
|
|
25081
25831
|
}
|
|
25082
|
-
|
|
25083
|
-
|
|
25832
|
+
execSync35(buildCommand, { stdio: service.verbose ? "inherit" : "pipe" });
|
|
25833
|
+
execSync35(`docker push ${imageUri}`, { stdio: service.verbose ? "inherit" : "pipe" });
|
|
25084
25834
|
artifacts.imageTag = version2;
|
|
25085
25835
|
artifacts.imageUrl = imageUri;
|
|
25086
25836
|
const newTaskDefRevision = await createNewTaskDefinition(service, imageUri, region, accountId, cfnDiscoveredResources, resourceName);
|
|
@@ -25142,10 +25892,10 @@ var init_ecs_publish = __esm({
|
|
|
25142
25892
|
});
|
|
25143
25893
|
|
|
25144
25894
|
// src/platforms/aws/handlers/ecs-update.ts
|
|
25145
|
-
import { execSync as
|
|
25895
|
+
import { execSync as execSync36 } from "child_process";
|
|
25146
25896
|
async function getCurrentTaskDefinition(cluster, service, region) {
|
|
25147
25897
|
try {
|
|
25148
|
-
const taskDef =
|
|
25898
|
+
const taskDef = execSync36(
|
|
25149
25899
|
`aws ecs describe-services --cluster ${cluster} --services ${service} --query 'services[0].taskDefinition' --output text --region ${region}`,
|
|
25150
25900
|
{ encoding: "utf-8" }
|
|
25151
25901
|
).trim();
|
|
@@ -25156,7 +25906,7 @@ async function getCurrentTaskDefinition(cluster, service, region) {
|
|
|
25156
25906
|
}
|
|
25157
25907
|
async function getTaskDefinitionFamily(cluster, service, region) {
|
|
25158
25908
|
try {
|
|
25159
|
-
const taskDefArn =
|
|
25909
|
+
const taskDefArn = execSync36(
|
|
25160
25910
|
`aws ecs describe-services --cluster ${cluster} --services ${service} --query 'services[0].taskDefinition' --output text --region ${region}`,
|
|
25161
25911
|
{ encoding: "utf-8" }
|
|
25162
25912
|
).trim();
|
|
@@ -25173,7 +25923,7 @@ async function getLatestTaskDefinitionRevision(cluster, service, region) {
|
|
|
25173
25923
|
try {
|
|
25174
25924
|
const family = await getTaskDefinitionFamily(cluster, service, region);
|
|
25175
25925
|
if (!family) return "";
|
|
25176
|
-
const taskDefArn =
|
|
25926
|
+
const taskDefArn = execSync36(
|
|
25177
25927
|
`aws ecs list-task-definitions --family-prefix ${family} --sort DESC --region ${region} --query 'taskDefinitionArns[0]' --output text`,
|
|
25178
25928
|
{ encoding: "utf-8" }
|
|
25179
25929
|
).trim();
|
|
@@ -25189,7 +25939,7 @@ async function getLatestTaskDefinitionRevision(cluster, service, region) {
|
|
|
25189
25939
|
async function fetchTaskLogs(clusterName, taskArn, region, verbose = false) {
|
|
25190
25940
|
try {
|
|
25191
25941
|
const taskId = taskArn.split("/").pop();
|
|
25192
|
-
const taskDetails =
|
|
25942
|
+
const taskDetails = execSync36(
|
|
25193
25943
|
`aws ecs describe-tasks --cluster ${clusterName} --tasks ${taskArn} --region ${region} --output json`,
|
|
25194
25944
|
{ encoding: "utf-8" }
|
|
25195
25945
|
);
|
|
@@ -25197,7 +25947,7 @@ async function fetchTaskLogs(clusterName, taskArn, region, verbose = false) {
|
|
|
25197
25947
|
if (!task) {
|
|
25198
25948
|
return [];
|
|
25199
25949
|
}
|
|
25200
|
-
const taskDefDetails =
|
|
25950
|
+
const taskDefDetails = execSync36(
|
|
25201
25951
|
`aws ecs describe-task-definition --task-definition ${task.taskDefinitionArn} --region ${region} --output json`,
|
|
25202
25952
|
{ encoding: "utf-8" }
|
|
25203
25953
|
);
|
|
@@ -25214,7 +25964,7 @@ async function fetchTaskLogs(clusterName, taskArn, region, verbose = false) {
|
|
|
25214
25964
|
}
|
|
25215
25965
|
const containerName = mainContainer.name;
|
|
25216
25966
|
const logStream = `${streamPrefix}/${containerName}/${taskId}`;
|
|
25217
|
-
const logsJson =
|
|
25967
|
+
const logsJson = execSync36(
|
|
25218
25968
|
`aws logs filter-log-events --log-group-name ${logGroup} --log-stream-names ${logStream} --limit 20 --region ${region} --output json`,
|
|
25219
25969
|
{ encoding: "utf-8" }
|
|
25220
25970
|
);
|
|
@@ -25239,7 +25989,7 @@ async function waitForECSDeployment(clusterName, serviceName, deploymentId, regi
|
|
|
25239
25989
|
let failedTaskInfo = [];
|
|
25240
25990
|
while (Date.now() - startTime < effectiveTimeout * 1e3) {
|
|
25241
25991
|
try {
|
|
25242
|
-
const serviceData =
|
|
25992
|
+
const serviceData = execSync36(
|
|
25243
25993
|
`aws ecs describe-services --cluster ${clusterName} --services ${serviceName} --region ${region} --output json`,
|
|
25244
25994
|
{ encoding: "utf-8" }
|
|
25245
25995
|
);
|
|
@@ -25280,13 +26030,13 @@ async function waitForECSDeployment(clusterName, serviceName, deploymentId, regi
|
|
|
25280
26030
|
const ourRevision = ourDeployment.taskDefinition?.split(":").pop() || "unknown";
|
|
25281
26031
|
const oldRevisions = /* @__PURE__ */ new Set();
|
|
25282
26032
|
try {
|
|
25283
|
-
const stoppedTasksData =
|
|
26033
|
+
const stoppedTasksData = execSync36(
|
|
25284
26034
|
`aws ecs list-tasks --cluster ${clusterName} --service-name ${serviceName} --desired-status STOPPED --region ${region} --output json`,
|
|
25285
26035
|
{ encoding: "utf-8" }
|
|
25286
26036
|
);
|
|
25287
26037
|
const stoppedTaskArns = JSON.parse(stoppedTasksData).taskArns || [];
|
|
25288
26038
|
if (stoppedTaskArns.length > 0) {
|
|
25289
|
-
const stoppedTasksJson =
|
|
26039
|
+
const stoppedTasksJson = execSync36(
|
|
25290
26040
|
`aws ecs describe-tasks --cluster ${clusterName} --tasks ${stoppedTaskArns.slice(0, 10).join(" ")} --region ${region} --output json`,
|
|
25291
26041
|
{ encoding: "utf-8" }
|
|
25292
26042
|
);
|
|
@@ -25367,13 +26117,13 @@ async function waitForECSDeployment(clusterName, serviceName, deploymentId, regi
|
|
|
25367
26117
|
}
|
|
25368
26118
|
}
|
|
25369
26119
|
try {
|
|
25370
|
-
const tasksData =
|
|
26120
|
+
const tasksData = execSync36(
|
|
25371
26121
|
`aws ecs list-tasks --cluster ${clusterName} --service-name ${serviceName} --desired-status RUNNING --region ${region} --output json`,
|
|
25372
26122
|
{ encoding: "utf-8" }
|
|
25373
26123
|
);
|
|
25374
26124
|
const taskArns = JSON.parse(tasksData).taskArns || [];
|
|
25375
26125
|
if (taskArns.length > 0) {
|
|
25376
|
-
const taskDetailsJson =
|
|
26126
|
+
const taskDetailsJson = execSync36(
|
|
25377
26127
|
`aws ecs describe-tasks --cluster ${clusterName} --tasks ${taskArns.join(" ")} --region ${region} --output json`,
|
|
25378
26128
|
{ encoding: "utf-8" }
|
|
25379
26129
|
);
|
|
@@ -25583,16 +26333,16 @@ var init_ecs_update = __esm({
|
|
|
25583
26333
|
printInfo(`No newer task definition found. Forcing redeployment of current revision ${currentRevision}`);
|
|
25584
26334
|
}
|
|
25585
26335
|
}
|
|
25586
|
-
const updateResult =
|
|
26336
|
+
const updateResult = execSync36(updateCommand2, { encoding: "utf-8" });
|
|
25587
26337
|
if (service.verbose) {
|
|
25588
26338
|
try {
|
|
25589
|
-
const serviceData =
|
|
26339
|
+
const serviceData = execSync36(
|
|
25590
26340
|
`aws ecs describe-services --cluster ${clusterName} --services ${serviceName} --region ${region} --output json`,
|
|
25591
26341
|
{ encoding: "utf-8" }
|
|
25592
26342
|
);
|
|
25593
26343
|
const ecsService = JSON.parse(serviceData).services?.[0];
|
|
25594
26344
|
if (ecsService?.taskDefinition) {
|
|
25595
|
-
const currentTaskDef =
|
|
26345
|
+
const currentTaskDef = execSync36(
|
|
25596
26346
|
`aws ecs describe-task-definition --task-definition ${ecsService.taskDefinition} --region ${region} --output json`,
|
|
25597
26347
|
{ encoding: "utf-8" }
|
|
25598
26348
|
);
|
|
@@ -25720,10 +26470,10 @@ __export(credential_validator_exports, {
|
|
|
25720
26470
|
isAWSCliInstalled: () => isAWSCliInstalled,
|
|
25721
26471
|
validateAWSCredentials: () => validateAWSCredentials
|
|
25722
26472
|
});
|
|
25723
|
-
import { execSync as
|
|
26473
|
+
import { execSync as execSync37 } from "child_process";
|
|
25724
26474
|
async function validateAWSCredentials(_environment) {
|
|
25725
26475
|
try {
|
|
25726
|
-
const output =
|
|
26476
|
+
const output = execSync37(`aws sts get-caller-identity --output json 2>&1`, {
|
|
25727
26477
|
stdio: "pipe",
|
|
25728
26478
|
encoding: "utf8",
|
|
25729
26479
|
env: {
|
|
@@ -25766,7 +26516,7 @@ async function validateAWSCredentials(_environment) {
|
|
|
25766
26516
|
}
|
|
25767
26517
|
function isAWSCliInstalled() {
|
|
25768
26518
|
try {
|
|
25769
|
-
|
|
26519
|
+
execSync37("aws --version", { stdio: "ignore" });
|
|
25770
26520
|
return true;
|
|
25771
26521
|
} catch {
|
|
25772
26522
|
return false;
|
|
@@ -25774,7 +26524,7 @@ function isAWSCliInstalled() {
|
|
|
25774
26524
|
}
|
|
25775
26525
|
function getAWSProfiles() {
|
|
25776
26526
|
try {
|
|
25777
|
-
const output =
|
|
26527
|
+
const output = execSync37("aws configure list-profiles", {
|
|
25778
26528
|
stdio: "pipe",
|
|
25779
26529
|
encoding: "utf8"
|
|
25780
26530
|
});
|
|
@@ -27978,17 +28728,17 @@ var init_headers = __esm({
|
|
|
27978
28728
|
function encodeURIPath(str3) {
|
|
27979
28729
|
return str3.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g, encodeURIComponent);
|
|
27980
28730
|
}
|
|
27981
|
-
var EMPTY, createPathTagFunction,
|
|
28731
|
+
var EMPTY, createPathTagFunction, path31;
|
|
27982
28732
|
var init_path = __esm({
|
|
27983
28733
|
"../../node_modules/@anthropic-ai/sdk/internal/utils/path.mjs"() {
|
|
27984
28734
|
init_error();
|
|
27985
28735
|
EMPTY = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.create(null));
|
|
27986
|
-
createPathTagFunction = (pathEncoder = encodeURIPath) => function
|
|
28736
|
+
createPathTagFunction = (pathEncoder = encodeURIPath) => function path36(statics, ...params) {
|
|
27987
28737
|
if (statics.length === 1)
|
|
27988
28738
|
return statics[0];
|
|
27989
28739
|
let postPath = false;
|
|
27990
28740
|
const invalidSegments = [];
|
|
27991
|
-
const
|
|
28741
|
+
const path37 = statics.reduce((previousValue, currentValue, index) => {
|
|
27992
28742
|
if (/[?#]/.test(currentValue)) {
|
|
27993
28743
|
postPath = true;
|
|
27994
28744
|
}
|
|
@@ -28005,7 +28755,7 @@ var init_path = __esm({
|
|
|
28005
28755
|
}
|
|
28006
28756
|
return previousValue + currentValue + (index === params.length ? "" : encoded);
|
|
28007
28757
|
}, "");
|
|
28008
|
-
const pathOnly =
|
|
28758
|
+
const pathOnly = path37.split(/[?#]/, 1)[0];
|
|
28009
28759
|
const invalidSegmentPattern = /(?<=^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi;
|
|
28010
28760
|
let match;
|
|
28011
28761
|
while ((match = invalidSegmentPattern.exec(pathOnly)) !== null) {
|
|
@@ -28026,12 +28776,12 @@ var init_path = __esm({
|
|
|
28026
28776
|
}, "");
|
|
28027
28777
|
throw new AnthropicError(`Path parameters result in path with invalid segments:
|
|
28028
28778
|
${invalidSegments.map((e) => e.error).join("\n")}
|
|
28029
|
-
${
|
|
28779
|
+
${path37}
|
|
28030
28780
|
${underline}`);
|
|
28031
28781
|
}
|
|
28032
|
-
return
|
|
28782
|
+
return path37;
|
|
28033
28783
|
};
|
|
28034
|
-
|
|
28784
|
+
path31 = /* @__PURE__ */ createPathTagFunction(encodeURIPath);
|
|
28035
28785
|
}
|
|
28036
28786
|
});
|
|
28037
28787
|
|
|
@@ -28079,7 +28829,7 @@ var init_files = __esm({
|
|
|
28079
28829
|
*/
|
|
28080
28830
|
delete(fileID, params = {}, options) {
|
|
28081
28831
|
const { betas } = params ?? {};
|
|
28082
|
-
return this._client.delete(
|
|
28832
|
+
return this._client.delete(path31`/v1/files/${fileID}`, {
|
|
28083
28833
|
...options,
|
|
28084
28834
|
headers: buildHeaders([
|
|
28085
28835
|
{ "anthropic-beta": [...betas ?? [], "files-api-2025-04-14"].toString() },
|
|
@@ -28102,7 +28852,7 @@ var init_files = __esm({
|
|
|
28102
28852
|
*/
|
|
28103
28853
|
download(fileID, params = {}, options) {
|
|
28104
28854
|
const { betas } = params ?? {};
|
|
28105
|
-
return this._client.get(
|
|
28855
|
+
return this._client.get(path31`/v1/files/${fileID}/content`, {
|
|
28106
28856
|
...options,
|
|
28107
28857
|
headers: buildHeaders([
|
|
28108
28858
|
{
|
|
@@ -28125,7 +28875,7 @@ var init_files = __esm({
|
|
|
28125
28875
|
*/
|
|
28126
28876
|
retrieveMetadata(fileID, params = {}, options) {
|
|
28127
28877
|
const { betas } = params ?? {};
|
|
28128
|
-
return this._client.get(
|
|
28878
|
+
return this._client.get(path31`/v1/files/${fileID}`, {
|
|
28129
28879
|
...options,
|
|
28130
28880
|
headers: buildHeaders([
|
|
28131
28881
|
{ "anthropic-beta": [...betas ?? [], "files-api-2025-04-14"].toString() },
|
|
@@ -28182,7 +28932,7 @@ var init_models = __esm({
|
|
|
28182
28932
|
*/
|
|
28183
28933
|
retrieve(modelID, params = {}, options) {
|
|
28184
28934
|
const { betas } = params ?? {};
|
|
28185
|
-
return this._client.get(
|
|
28935
|
+
return this._client.get(path31`/v1/models/${modelID}?beta=true`, {
|
|
28186
28936
|
...options,
|
|
28187
28937
|
headers: buildHeaders([
|
|
28188
28938
|
{ ...betas?.toString() != null ? { "anthropic-beta": betas?.toString() } : void 0 },
|
|
@@ -28335,7 +29085,7 @@ var init_batches = __esm({
|
|
|
28335
29085
|
*/
|
|
28336
29086
|
retrieve(messageBatchID, params = {}, options) {
|
|
28337
29087
|
const { betas } = params ?? {};
|
|
28338
|
-
return this._client.get(
|
|
29088
|
+
return this._client.get(path31`/v1/messages/batches/${messageBatchID}?beta=true`, {
|
|
28339
29089
|
...options,
|
|
28340
29090
|
headers: buildHeaders([
|
|
28341
29091
|
{ "anthropic-beta": [...betas ?? [], "message-batches-2024-09-24"].toString() },
|
|
@@ -28388,7 +29138,7 @@ var init_batches = __esm({
|
|
|
28388
29138
|
*/
|
|
28389
29139
|
delete(messageBatchID, params = {}, options) {
|
|
28390
29140
|
const { betas } = params ?? {};
|
|
28391
|
-
return this._client.delete(
|
|
29141
|
+
return this._client.delete(path31`/v1/messages/batches/${messageBatchID}?beta=true`, {
|
|
28392
29142
|
...options,
|
|
28393
29143
|
headers: buildHeaders([
|
|
28394
29144
|
{ "anthropic-beta": [...betas ?? [], "message-batches-2024-09-24"].toString() },
|
|
@@ -28420,7 +29170,7 @@ var init_batches = __esm({
|
|
|
28420
29170
|
*/
|
|
28421
29171
|
cancel(messageBatchID, params = {}, options) {
|
|
28422
29172
|
const { betas } = params ?? {};
|
|
28423
|
-
return this._client.post(
|
|
29173
|
+
return this._client.post(path31`/v1/messages/batches/${messageBatchID}/cancel?beta=true`, {
|
|
28424
29174
|
...options,
|
|
28425
29175
|
headers: buildHeaders([
|
|
28426
29176
|
{ "anthropic-beta": [...betas ?? [], "message-batches-2024-09-24"].toString() },
|
|
@@ -30324,7 +31074,7 @@ var init_batches2 = __esm({
|
|
|
30324
31074
|
* ```
|
|
30325
31075
|
*/
|
|
30326
31076
|
retrieve(messageBatchID, options) {
|
|
30327
|
-
return this._client.get(
|
|
31077
|
+
return this._client.get(path31`/v1/messages/batches/${messageBatchID}`, options);
|
|
30328
31078
|
}
|
|
30329
31079
|
/**
|
|
30330
31080
|
* List all Message Batches within a Workspace. Most recently created batches are
|
|
@@ -30360,7 +31110,7 @@ var init_batches2 = __esm({
|
|
|
30360
31110
|
* ```
|
|
30361
31111
|
*/
|
|
30362
31112
|
delete(messageBatchID, options) {
|
|
30363
|
-
return this._client.delete(
|
|
31113
|
+
return this._client.delete(path31`/v1/messages/batches/${messageBatchID}`, options);
|
|
30364
31114
|
}
|
|
30365
31115
|
/**
|
|
30366
31116
|
* Batches may be canceled any time before processing ends. Once cancellation is
|
|
@@ -30384,7 +31134,7 @@ var init_batches2 = __esm({
|
|
|
30384
31134
|
* ```
|
|
30385
31135
|
*/
|
|
30386
31136
|
cancel(messageBatchID, options) {
|
|
30387
|
-
return this._client.post(
|
|
31137
|
+
return this._client.post(path31`/v1/messages/batches/${messageBatchID}/cancel`, options);
|
|
30388
31138
|
}
|
|
30389
31139
|
/**
|
|
30390
31140
|
* Streams the results of a Message Batch as a `.jsonl` file.
|
|
@@ -30511,7 +31261,7 @@ var init_models2 = __esm({
|
|
|
30511
31261
|
*/
|
|
30512
31262
|
retrieve(modelID, params = {}, options) {
|
|
30513
31263
|
const { betas } = params ?? {};
|
|
30514
|
-
return this._client.get(
|
|
31264
|
+
return this._client.get(path31`/v1/models/${modelID}`, {
|
|
30515
31265
|
...options,
|
|
30516
31266
|
headers: buildHeaders([
|
|
30517
31267
|
{ ...betas?.toString() != null ? { "anthropic-beta": betas?.toString() } : void 0 },
|
|
@@ -30712,9 +31462,9 @@ var init_client = __esm({
|
|
|
30712
31462
|
makeStatusError(status, error46, message, headers) {
|
|
30713
31463
|
return APIError.generate(status, error46, message, headers);
|
|
30714
31464
|
}
|
|
30715
|
-
buildURL(
|
|
31465
|
+
buildURL(path36, query, defaultBaseURL) {
|
|
30716
31466
|
const baseURL = !__classPrivateFieldGet(this, _BaseAnthropic_instances, "m", _BaseAnthropic_baseURLOverridden).call(this) && defaultBaseURL || this.baseURL;
|
|
30717
|
-
const url2 = isAbsoluteURL(
|
|
31467
|
+
const url2 = isAbsoluteURL(path36) ? new URL(path36) : new URL(baseURL + (baseURL.endsWith("/") && path36.startsWith("/") ? path36.slice(1) : path36));
|
|
30718
31468
|
const defaultQuery = this.defaultQuery();
|
|
30719
31469
|
if (!isEmptyObj(defaultQuery)) {
|
|
30720
31470
|
query = { ...defaultQuery, ...query };
|
|
@@ -30745,24 +31495,24 @@ var init_client = __esm({
|
|
|
30745
31495
|
*/
|
|
30746
31496
|
async prepareRequest(request, { url: url2, options }) {
|
|
30747
31497
|
}
|
|
30748
|
-
get(
|
|
30749
|
-
return this.methodRequest("get",
|
|
31498
|
+
get(path36, opts) {
|
|
31499
|
+
return this.methodRequest("get", path36, opts);
|
|
30750
31500
|
}
|
|
30751
|
-
post(
|
|
30752
|
-
return this.methodRequest("post",
|
|
31501
|
+
post(path36, opts) {
|
|
31502
|
+
return this.methodRequest("post", path36, opts);
|
|
30753
31503
|
}
|
|
30754
|
-
patch(
|
|
30755
|
-
return this.methodRequest("patch",
|
|
31504
|
+
patch(path36, opts) {
|
|
31505
|
+
return this.methodRequest("patch", path36, opts);
|
|
30756
31506
|
}
|
|
30757
|
-
put(
|
|
30758
|
-
return this.methodRequest("put",
|
|
31507
|
+
put(path36, opts) {
|
|
31508
|
+
return this.methodRequest("put", path36, opts);
|
|
30759
31509
|
}
|
|
30760
|
-
delete(
|
|
30761
|
-
return this.methodRequest("delete",
|
|
31510
|
+
delete(path36, opts) {
|
|
31511
|
+
return this.methodRequest("delete", path36, opts);
|
|
30762
31512
|
}
|
|
30763
|
-
methodRequest(method,
|
|
31513
|
+
methodRequest(method, path36, opts) {
|
|
30764
31514
|
return this.request(Promise.resolve(opts).then((opts2) => {
|
|
30765
|
-
return { method, path:
|
|
31515
|
+
return { method, path: path36, ...opts2 };
|
|
30766
31516
|
}));
|
|
30767
31517
|
}
|
|
30768
31518
|
request(options, remainingRetries = null) {
|
|
@@ -30866,8 +31616,8 @@ var init_client = __esm({
|
|
|
30866
31616
|
}));
|
|
30867
31617
|
return { response, options, controller, requestLogID, retryOfRequestLogID, startTime };
|
|
30868
31618
|
}
|
|
30869
|
-
getAPIList(
|
|
30870
|
-
return this.requestAPIList(Page3, { method: "get", path:
|
|
31619
|
+
getAPIList(path36, Page3, opts) {
|
|
31620
|
+
return this.requestAPIList(Page3, { method: "get", path: path36, ...opts });
|
|
30871
31621
|
}
|
|
30872
31622
|
requestAPIList(Page3, options) {
|
|
30873
31623
|
const request = this.makeRequest(options, null, void 0);
|
|
@@ -30954,8 +31704,8 @@ var init_client = __esm({
|
|
|
30954
31704
|
}
|
|
30955
31705
|
async buildRequest(inputOptions, { retryCount = 0 } = {}) {
|
|
30956
31706
|
const options = { ...inputOptions };
|
|
30957
|
-
const { method, path:
|
|
30958
|
-
const url2 = this.buildURL(
|
|
31707
|
+
const { method, path: path36, query, defaultBaseURL } = options;
|
|
31708
|
+
const url2 = this.buildURL(path36, query, defaultBaseURL);
|
|
30959
31709
|
if ("timeout" in options)
|
|
30960
31710
|
validatePositiveInteger("timeout", options.timeout);
|
|
30961
31711
|
options.timeout = options.timeout ?? this.timeout;
|
|
@@ -32828,17 +33578,17 @@ var init_resource2 = __esm({
|
|
|
32828
33578
|
function encodeURIPath2(str3) {
|
|
32829
33579
|
return str3.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g, encodeURIComponent);
|
|
32830
33580
|
}
|
|
32831
|
-
var EMPTY2, createPathTagFunction2,
|
|
33581
|
+
var EMPTY2, createPathTagFunction2, path32;
|
|
32832
33582
|
var init_path2 = __esm({
|
|
32833
33583
|
"../../node_modules/openai/internal/utils/path.mjs"() {
|
|
32834
33584
|
init_error3();
|
|
32835
33585
|
EMPTY2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.create(null));
|
|
32836
|
-
createPathTagFunction2 = (pathEncoder = encodeURIPath2) => function
|
|
33586
|
+
createPathTagFunction2 = (pathEncoder = encodeURIPath2) => function path36(statics, ...params) {
|
|
32837
33587
|
if (statics.length === 1)
|
|
32838
33588
|
return statics[0];
|
|
32839
33589
|
let postPath = false;
|
|
32840
33590
|
const invalidSegments = [];
|
|
32841
|
-
const
|
|
33591
|
+
const path37 = statics.reduce((previousValue, currentValue, index) => {
|
|
32842
33592
|
if (/[?#]/.test(currentValue)) {
|
|
32843
33593
|
postPath = true;
|
|
32844
33594
|
}
|
|
@@ -32855,7 +33605,7 @@ var init_path2 = __esm({
|
|
|
32855
33605
|
}
|
|
32856
33606
|
return previousValue + currentValue + (index === params.length ? "" : encoded);
|
|
32857
33607
|
}, "");
|
|
32858
|
-
const pathOnly =
|
|
33608
|
+
const pathOnly = path37.split(/[?#]/, 1)[0];
|
|
32859
33609
|
const invalidSegmentPattern = /(?<=^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi;
|
|
32860
33610
|
let match;
|
|
32861
33611
|
while ((match = invalidSegmentPattern.exec(pathOnly)) !== null) {
|
|
@@ -32876,12 +33626,12 @@ var init_path2 = __esm({
|
|
|
32876
33626
|
}, "");
|
|
32877
33627
|
throw new OpenAIError(`Path parameters result in path with invalid segments:
|
|
32878
33628
|
${invalidSegments.map((e) => e.error).join("\n")}
|
|
32879
|
-
${
|
|
33629
|
+
${path37}
|
|
32880
33630
|
${underline}`);
|
|
32881
33631
|
}
|
|
32882
|
-
return
|
|
33632
|
+
return path37;
|
|
32883
33633
|
};
|
|
32884
|
-
|
|
33634
|
+
path32 = /* @__PURE__ */ createPathTagFunction2(encodeURIPath2);
|
|
32885
33635
|
}
|
|
32886
33636
|
});
|
|
32887
33637
|
|
|
@@ -32908,7 +33658,7 @@ var init_messages3 = __esm({
|
|
|
32908
33658
|
* ```
|
|
32909
33659
|
*/
|
|
32910
33660
|
list(completionID, query = {}, options) {
|
|
32911
|
-
return this._client.getAPIList(
|
|
33661
|
+
return this._client.getAPIList(path32`/chat/completions/${completionID}/messages`, CursorPage, { query, ...options });
|
|
32912
33662
|
}
|
|
32913
33663
|
};
|
|
32914
33664
|
}
|
|
@@ -34303,7 +35053,7 @@ var init_completions2 = __esm({
|
|
|
34303
35053
|
* ```
|
|
34304
35054
|
*/
|
|
34305
35055
|
retrieve(completionID, options) {
|
|
34306
|
-
return this._client.get(
|
|
35056
|
+
return this._client.get(path32`/chat/completions/${completionID}`, options);
|
|
34307
35057
|
}
|
|
34308
35058
|
/**
|
|
34309
35059
|
* Modify a stored chat completion. Only Chat Completions that have been created
|
|
@@ -34319,7 +35069,7 @@ var init_completions2 = __esm({
|
|
|
34319
35069
|
* ```
|
|
34320
35070
|
*/
|
|
34321
35071
|
update(completionID, body, options) {
|
|
34322
|
-
return this._client.post(
|
|
35072
|
+
return this._client.post(path32`/chat/completions/${completionID}`, { body, ...options });
|
|
34323
35073
|
}
|
|
34324
35074
|
/**
|
|
34325
35075
|
* List stored Chat Completions. Only Chat Completions that have been stored with
|
|
@@ -34347,7 +35097,7 @@ var init_completions2 = __esm({
|
|
|
34347
35097
|
* ```
|
|
34348
35098
|
*/
|
|
34349
35099
|
delete(completionID, options) {
|
|
34350
|
-
return this._client.delete(
|
|
35100
|
+
return this._client.delete(path32`/chat/completions/${completionID}`, options);
|
|
34351
35101
|
}
|
|
34352
35102
|
parse(body, options) {
|
|
34353
35103
|
validateInputTools(body.tools);
|
|
@@ -34595,7 +35345,7 @@ var init_batches3 = __esm({
|
|
|
34595
35345
|
* Retrieves a batch.
|
|
34596
35346
|
*/
|
|
34597
35347
|
retrieve(batchID, options) {
|
|
34598
|
-
return this._client.get(
|
|
35348
|
+
return this._client.get(path32`/batches/${batchID}`, options);
|
|
34599
35349
|
}
|
|
34600
35350
|
/**
|
|
34601
35351
|
* List your organization's batches.
|
|
@@ -34609,7 +35359,7 @@ var init_batches3 = __esm({
|
|
|
34609
35359
|
* (if any) available in the output file.
|
|
34610
35360
|
*/
|
|
34611
35361
|
cancel(batchID, options) {
|
|
34612
|
-
return this._client.post(
|
|
35362
|
+
return this._client.post(path32`/batches/${batchID}/cancel`, options);
|
|
34613
35363
|
}
|
|
34614
35364
|
};
|
|
34615
35365
|
}
|
|
@@ -34652,7 +35402,7 @@ var init_assistants = __esm({
|
|
|
34652
35402
|
* ```
|
|
34653
35403
|
*/
|
|
34654
35404
|
retrieve(assistantID, options) {
|
|
34655
|
-
return this._client.get(
|
|
35405
|
+
return this._client.get(path32`/assistants/${assistantID}`, {
|
|
34656
35406
|
...options,
|
|
34657
35407
|
headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
|
|
34658
35408
|
});
|
|
@@ -34668,7 +35418,7 @@ var init_assistants = __esm({
|
|
|
34668
35418
|
* ```
|
|
34669
35419
|
*/
|
|
34670
35420
|
update(assistantID, body, options) {
|
|
34671
|
-
return this._client.post(
|
|
35421
|
+
return this._client.post(path32`/assistants/${assistantID}`, {
|
|
34672
35422
|
body,
|
|
34673
35423
|
...options,
|
|
34674
35424
|
headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
|
|
@@ -34702,7 +35452,7 @@ var init_assistants = __esm({
|
|
|
34702
35452
|
* ```
|
|
34703
35453
|
*/
|
|
34704
35454
|
delete(assistantID, options) {
|
|
34705
|
-
return this._client.delete(
|
|
35455
|
+
return this._client.delete(path32`/assistants/${assistantID}`, {
|
|
34706
35456
|
...options,
|
|
34707
35457
|
headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
|
|
34708
35458
|
});
|
|
@@ -34813,7 +35563,7 @@ var init_messages4 = __esm({
|
|
|
34813
35563
|
* @deprecated The Assistants API is deprecated in favor of the Responses API
|
|
34814
35564
|
*/
|
|
34815
35565
|
create(threadID, body, options) {
|
|
34816
|
-
return this._client.post(
|
|
35566
|
+
return this._client.post(path32`/threads/${threadID}/messages`, {
|
|
34817
35567
|
body,
|
|
34818
35568
|
...options,
|
|
34819
35569
|
headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
|
|
@@ -34826,7 +35576,7 @@ var init_messages4 = __esm({
|
|
|
34826
35576
|
*/
|
|
34827
35577
|
retrieve(messageID, params, options) {
|
|
34828
35578
|
const { thread_id } = params;
|
|
34829
|
-
return this._client.get(
|
|
35579
|
+
return this._client.get(path32`/threads/${thread_id}/messages/${messageID}`, {
|
|
34830
35580
|
...options,
|
|
34831
35581
|
headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
|
|
34832
35582
|
});
|
|
@@ -34838,7 +35588,7 @@ var init_messages4 = __esm({
|
|
|
34838
35588
|
*/
|
|
34839
35589
|
update(messageID, params, options) {
|
|
34840
35590
|
const { thread_id, ...body } = params;
|
|
34841
|
-
return this._client.post(
|
|
35591
|
+
return this._client.post(path32`/threads/${thread_id}/messages/${messageID}`, {
|
|
34842
35592
|
body,
|
|
34843
35593
|
...options,
|
|
34844
35594
|
headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
|
|
@@ -34850,7 +35600,7 @@ var init_messages4 = __esm({
|
|
|
34850
35600
|
* @deprecated The Assistants API is deprecated in favor of the Responses API
|
|
34851
35601
|
*/
|
|
34852
35602
|
list(threadID, query = {}, options) {
|
|
34853
|
-
return this._client.getAPIList(
|
|
35603
|
+
return this._client.getAPIList(path32`/threads/${threadID}/messages`, CursorPage, {
|
|
34854
35604
|
query,
|
|
34855
35605
|
...options,
|
|
34856
35606
|
headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
|
|
@@ -34863,7 +35613,7 @@ var init_messages4 = __esm({
|
|
|
34863
35613
|
*/
|
|
34864
35614
|
delete(messageID, params, options) {
|
|
34865
35615
|
const { thread_id } = params;
|
|
34866
|
-
return this._client.delete(
|
|
35616
|
+
return this._client.delete(path32`/threads/${thread_id}/messages/${messageID}`, {
|
|
34867
35617
|
...options,
|
|
34868
35618
|
headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
|
|
34869
35619
|
});
|
|
@@ -34888,7 +35638,7 @@ var init_steps = __esm({
|
|
|
34888
35638
|
*/
|
|
34889
35639
|
retrieve(stepID, params, options) {
|
|
34890
35640
|
const { thread_id, run_id, ...query } = params;
|
|
34891
|
-
return this._client.get(
|
|
35641
|
+
return this._client.get(path32`/threads/${thread_id}/runs/${run_id}/steps/${stepID}`, {
|
|
34892
35642
|
query,
|
|
34893
35643
|
...options,
|
|
34894
35644
|
headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
|
|
@@ -34901,7 +35651,7 @@ var init_steps = __esm({
|
|
|
34901
35651
|
*/
|
|
34902
35652
|
list(runID, params, options) {
|
|
34903
35653
|
const { thread_id, ...query } = params;
|
|
34904
|
-
return this._client.getAPIList(
|
|
35654
|
+
return this._client.getAPIList(path32`/threads/${thread_id}/runs/${runID}/steps`, CursorPage, {
|
|
34905
35655
|
query,
|
|
34906
35656
|
...options,
|
|
34907
35657
|
headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
|
|
@@ -35507,7 +36257,7 @@ var init_runs = __esm({
|
|
|
35507
36257
|
}
|
|
35508
36258
|
create(threadID, params, options) {
|
|
35509
36259
|
const { include, ...body } = params;
|
|
35510
|
-
return this._client.post(
|
|
36260
|
+
return this._client.post(path32`/threads/${threadID}/runs`, {
|
|
35511
36261
|
query: { include },
|
|
35512
36262
|
body,
|
|
35513
36263
|
...options,
|
|
@@ -35522,7 +36272,7 @@ var init_runs = __esm({
|
|
|
35522
36272
|
*/
|
|
35523
36273
|
retrieve(runID, params, options) {
|
|
35524
36274
|
const { thread_id } = params;
|
|
35525
|
-
return this._client.get(
|
|
36275
|
+
return this._client.get(path32`/threads/${thread_id}/runs/${runID}`, {
|
|
35526
36276
|
...options,
|
|
35527
36277
|
headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
|
|
35528
36278
|
});
|
|
@@ -35534,7 +36284,7 @@ var init_runs = __esm({
|
|
|
35534
36284
|
*/
|
|
35535
36285
|
update(runID, params, options) {
|
|
35536
36286
|
const { thread_id, ...body } = params;
|
|
35537
|
-
return this._client.post(
|
|
36287
|
+
return this._client.post(path32`/threads/${thread_id}/runs/${runID}`, {
|
|
35538
36288
|
body,
|
|
35539
36289
|
...options,
|
|
35540
36290
|
headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
|
|
@@ -35546,7 +36296,7 @@ var init_runs = __esm({
|
|
|
35546
36296
|
* @deprecated The Assistants API is deprecated in favor of the Responses API
|
|
35547
36297
|
*/
|
|
35548
36298
|
list(threadID, query = {}, options) {
|
|
35549
|
-
return this._client.getAPIList(
|
|
36299
|
+
return this._client.getAPIList(path32`/threads/${threadID}/runs`, CursorPage, {
|
|
35550
36300
|
query,
|
|
35551
36301
|
...options,
|
|
35552
36302
|
headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
|
|
@@ -35559,7 +36309,7 @@ var init_runs = __esm({
|
|
|
35559
36309
|
*/
|
|
35560
36310
|
cancel(runID, params, options) {
|
|
35561
36311
|
const { thread_id } = params;
|
|
35562
|
-
return this._client.post(
|
|
36312
|
+
return this._client.post(path32`/threads/${thread_id}/runs/${runID}/cancel`, {
|
|
35563
36313
|
...options,
|
|
35564
36314
|
headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
|
|
35565
36315
|
});
|
|
@@ -35637,7 +36387,7 @@ var init_runs = __esm({
|
|
|
35637
36387
|
}
|
|
35638
36388
|
submitToolOutputs(runID, params, options) {
|
|
35639
36389
|
const { thread_id, ...body } = params;
|
|
35640
|
-
return this._client.post(
|
|
36390
|
+
return this._client.post(path32`/threads/${thread_id}/runs/${runID}/submit_tool_outputs`, {
|
|
35641
36391
|
body,
|
|
35642
36392
|
...options,
|
|
35643
36393
|
headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
|
|
@@ -35702,7 +36452,7 @@ var init_threads = __esm({
|
|
|
35702
36452
|
* @deprecated The Assistants API is deprecated in favor of the Responses API
|
|
35703
36453
|
*/
|
|
35704
36454
|
retrieve(threadID, options) {
|
|
35705
|
-
return this._client.get(
|
|
36455
|
+
return this._client.get(path32`/threads/${threadID}`, {
|
|
35706
36456
|
...options,
|
|
35707
36457
|
headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
|
|
35708
36458
|
});
|
|
@@ -35713,7 +36463,7 @@ var init_threads = __esm({
|
|
|
35713
36463
|
* @deprecated The Assistants API is deprecated in favor of the Responses API
|
|
35714
36464
|
*/
|
|
35715
36465
|
update(threadID, body, options) {
|
|
35716
|
-
return this._client.post(
|
|
36466
|
+
return this._client.post(path32`/threads/${threadID}`, {
|
|
35717
36467
|
body,
|
|
35718
36468
|
...options,
|
|
35719
36469
|
headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
|
|
@@ -35725,7 +36475,7 @@ var init_threads = __esm({
|
|
|
35725
36475
|
* @deprecated The Assistants API is deprecated in favor of the Responses API
|
|
35726
36476
|
*/
|
|
35727
36477
|
delete(threadID, options) {
|
|
35728
|
-
return this._client.delete(
|
|
36478
|
+
return this._client.delete(path32`/threads/${threadID}`, {
|
|
35729
36479
|
...options,
|
|
35730
36480
|
headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
|
|
35731
36481
|
});
|
|
@@ -35810,7 +36560,7 @@ var init_content = __esm({
|
|
|
35810
36560
|
*/
|
|
35811
36561
|
retrieve(fileID, params, options) {
|
|
35812
36562
|
const { container_id } = params;
|
|
35813
|
-
return this._client.get(
|
|
36563
|
+
return this._client.get(path32`/containers/${container_id}/files/${fileID}/content`, {
|
|
35814
36564
|
...options,
|
|
35815
36565
|
headers: buildHeaders2([{ Accept: "application/binary" }, options?.headers]),
|
|
35816
36566
|
__binaryResponse: true
|
|
@@ -35843,20 +36593,20 @@ var init_files2 = __esm({
|
|
|
35843
36593
|
* a JSON request with a file ID.
|
|
35844
36594
|
*/
|
|
35845
36595
|
create(containerID, body, options) {
|
|
35846
|
-
return this._client.post(
|
|
36596
|
+
return this._client.post(path32`/containers/${containerID}/files`, multipartFormRequestOptions2({ body, ...options }, this._client));
|
|
35847
36597
|
}
|
|
35848
36598
|
/**
|
|
35849
36599
|
* Retrieve Container File
|
|
35850
36600
|
*/
|
|
35851
36601
|
retrieve(fileID, params, options) {
|
|
35852
36602
|
const { container_id } = params;
|
|
35853
|
-
return this._client.get(
|
|
36603
|
+
return this._client.get(path32`/containers/${container_id}/files/${fileID}`, options);
|
|
35854
36604
|
}
|
|
35855
36605
|
/**
|
|
35856
36606
|
* List Container files
|
|
35857
36607
|
*/
|
|
35858
36608
|
list(containerID, query = {}, options) {
|
|
35859
|
-
return this._client.getAPIList(
|
|
36609
|
+
return this._client.getAPIList(path32`/containers/${containerID}/files`, CursorPage, {
|
|
35860
36610
|
query,
|
|
35861
36611
|
...options
|
|
35862
36612
|
});
|
|
@@ -35866,7 +36616,7 @@ var init_files2 = __esm({
|
|
|
35866
36616
|
*/
|
|
35867
36617
|
delete(fileID, params, options) {
|
|
35868
36618
|
const { container_id } = params;
|
|
35869
|
-
return this._client.delete(
|
|
36619
|
+
return this._client.delete(path32`/containers/${container_id}/files/${fileID}`, {
|
|
35870
36620
|
...options,
|
|
35871
36621
|
headers: buildHeaders2([{ Accept: "*/*" }, options?.headers])
|
|
35872
36622
|
});
|
|
@@ -35901,7 +36651,7 @@ var init_containers = __esm({
|
|
|
35901
36651
|
* Retrieve Container
|
|
35902
36652
|
*/
|
|
35903
36653
|
retrieve(containerID, options) {
|
|
35904
|
-
return this._client.get(
|
|
36654
|
+
return this._client.get(path32`/containers/${containerID}`, options);
|
|
35905
36655
|
}
|
|
35906
36656
|
/**
|
|
35907
36657
|
* List Containers
|
|
@@ -35913,7 +36663,7 @@ var init_containers = __esm({
|
|
|
35913
36663
|
* Delete Container
|
|
35914
36664
|
*/
|
|
35915
36665
|
delete(containerID, options) {
|
|
35916
|
-
return this._client.delete(
|
|
36666
|
+
return this._client.delete(path32`/containers/${containerID}`, {
|
|
35917
36667
|
...options,
|
|
35918
36668
|
headers: buildHeaders2([{ Accept: "*/*" }, options?.headers])
|
|
35919
36669
|
});
|
|
@@ -35936,7 +36686,7 @@ var init_items = __esm({
|
|
|
35936
36686
|
*/
|
|
35937
36687
|
create(conversationID, params, options) {
|
|
35938
36688
|
const { include, ...body } = params;
|
|
35939
|
-
return this._client.post(
|
|
36689
|
+
return this._client.post(path32`/conversations/${conversationID}/items`, {
|
|
35940
36690
|
query: { include },
|
|
35941
36691
|
body,
|
|
35942
36692
|
...options
|
|
@@ -35947,20 +36697,20 @@ var init_items = __esm({
|
|
|
35947
36697
|
*/
|
|
35948
36698
|
retrieve(itemID, params, options) {
|
|
35949
36699
|
const { conversation_id, ...query } = params;
|
|
35950
|
-
return this._client.get(
|
|
36700
|
+
return this._client.get(path32`/conversations/${conversation_id}/items/${itemID}`, { query, ...options });
|
|
35951
36701
|
}
|
|
35952
36702
|
/**
|
|
35953
36703
|
* List all items for a conversation with the given ID.
|
|
35954
36704
|
*/
|
|
35955
36705
|
list(conversationID, query = {}, options) {
|
|
35956
|
-
return this._client.getAPIList(
|
|
36706
|
+
return this._client.getAPIList(path32`/conversations/${conversationID}/items`, ConversationCursorPage, { query, ...options });
|
|
35957
36707
|
}
|
|
35958
36708
|
/**
|
|
35959
36709
|
* Delete an item from a conversation with the given IDs.
|
|
35960
36710
|
*/
|
|
35961
36711
|
delete(itemID, params, options) {
|
|
35962
36712
|
const { conversation_id } = params;
|
|
35963
|
-
return this._client.delete(
|
|
36713
|
+
return this._client.delete(path32`/conversations/${conversation_id}/items/${itemID}`, options);
|
|
35964
36714
|
}
|
|
35965
36715
|
};
|
|
35966
36716
|
}
|
|
@@ -35989,19 +36739,19 @@ var init_conversations = __esm({
|
|
|
35989
36739
|
* Get a conversation
|
|
35990
36740
|
*/
|
|
35991
36741
|
retrieve(conversationID, options) {
|
|
35992
|
-
return this._client.get(
|
|
36742
|
+
return this._client.get(path32`/conversations/${conversationID}`, options);
|
|
35993
36743
|
}
|
|
35994
36744
|
/**
|
|
35995
36745
|
* Update a conversation
|
|
35996
36746
|
*/
|
|
35997
36747
|
update(conversationID, body, options) {
|
|
35998
|
-
return this._client.post(
|
|
36748
|
+
return this._client.post(path32`/conversations/${conversationID}`, { body, ...options });
|
|
35999
36749
|
}
|
|
36000
36750
|
/**
|
|
36001
36751
|
* Delete a conversation. Items in the conversation will not be deleted.
|
|
36002
36752
|
*/
|
|
36003
36753
|
delete(conversationID, options) {
|
|
36004
|
-
return this._client.delete(
|
|
36754
|
+
return this._client.delete(path32`/conversations/${conversationID}`, options);
|
|
36005
36755
|
}
|
|
36006
36756
|
};
|
|
36007
36757
|
Conversations.Items = Items;
|
|
@@ -36071,14 +36821,14 @@ var init_output_items = __esm({
|
|
|
36071
36821
|
*/
|
|
36072
36822
|
retrieve(outputItemID, params, options) {
|
|
36073
36823
|
const { eval_id, run_id } = params;
|
|
36074
|
-
return this._client.get(
|
|
36824
|
+
return this._client.get(path32`/evals/${eval_id}/runs/${run_id}/output_items/${outputItemID}`, options);
|
|
36075
36825
|
}
|
|
36076
36826
|
/**
|
|
36077
36827
|
* Get a list of output items for an evaluation run.
|
|
36078
36828
|
*/
|
|
36079
36829
|
list(runID, params, options) {
|
|
36080
36830
|
const { eval_id, ...query } = params;
|
|
36081
|
-
return this._client.getAPIList(
|
|
36831
|
+
return this._client.getAPIList(path32`/evals/${eval_id}/runs/${runID}/output_items`, CursorPage, { query, ...options });
|
|
36082
36832
|
}
|
|
36083
36833
|
};
|
|
36084
36834
|
}
|
|
@@ -36104,20 +36854,20 @@ var init_runs2 = __esm({
|
|
|
36104
36854
|
* schema specified in the config of the evaluation.
|
|
36105
36855
|
*/
|
|
36106
36856
|
create(evalID, body, options) {
|
|
36107
|
-
return this._client.post(
|
|
36857
|
+
return this._client.post(path32`/evals/${evalID}/runs`, { body, ...options });
|
|
36108
36858
|
}
|
|
36109
36859
|
/**
|
|
36110
36860
|
* Get an evaluation run by ID.
|
|
36111
36861
|
*/
|
|
36112
36862
|
retrieve(runID, params, options) {
|
|
36113
36863
|
const { eval_id } = params;
|
|
36114
|
-
return this._client.get(
|
|
36864
|
+
return this._client.get(path32`/evals/${eval_id}/runs/${runID}`, options);
|
|
36115
36865
|
}
|
|
36116
36866
|
/**
|
|
36117
36867
|
* Get a list of runs for an evaluation.
|
|
36118
36868
|
*/
|
|
36119
36869
|
list(evalID, query = {}, options) {
|
|
36120
|
-
return this._client.getAPIList(
|
|
36870
|
+
return this._client.getAPIList(path32`/evals/${evalID}/runs`, CursorPage, {
|
|
36121
36871
|
query,
|
|
36122
36872
|
...options
|
|
36123
36873
|
});
|
|
@@ -36127,14 +36877,14 @@ var init_runs2 = __esm({
|
|
|
36127
36877
|
*/
|
|
36128
36878
|
delete(runID, params, options) {
|
|
36129
36879
|
const { eval_id } = params;
|
|
36130
|
-
return this._client.delete(
|
|
36880
|
+
return this._client.delete(path32`/evals/${eval_id}/runs/${runID}`, options);
|
|
36131
36881
|
}
|
|
36132
36882
|
/**
|
|
36133
36883
|
* Cancel an ongoing evaluation run.
|
|
36134
36884
|
*/
|
|
36135
36885
|
cancel(runID, params, options) {
|
|
36136
36886
|
const { eval_id } = params;
|
|
36137
|
-
return this._client.post(
|
|
36887
|
+
return this._client.post(path32`/evals/${eval_id}/runs/${runID}`, options);
|
|
36138
36888
|
}
|
|
36139
36889
|
};
|
|
36140
36890
|
Runs2.OutputItems = OutputItems;
|
|
@@ -36170,13 +36920,13 @@ var init_evals = __esm({
|
|
|
36170
36920
|
* Get an evaluation by ID.
|
|
36171
36921
|
*/
|
|
36172
36922
|
retrieve(evalID, options) {
|
|
36173
|
-
return this._client.get(
|
|
36923
|
+
return this._client.get(path32`/evals/${evalID}`, options);
|
|
36174
36924
|
}
|
|
36175
36925
|
/**
|
|
36176
36926
|
* Update certain properties of an evaluation.
|
|
36177
36927
|
*/
|
|
36178
36928
|
update(evalID, body, options) {
|
|
36179
|
-
return this._client.post(
|
|
36929
|
+
return this._client.post(path32`/evals/${evalID}`, { body, ...options });
|
|
36180
36930
|
}
|
|
36181
36931
|
/**
|
|
36182
36932
|
* List evaluations for a project.
|
|
@@ -36188,7 +36938,7 @@ var init_evals = __esm({
|
|
|
36188
36938
|
* Delete an evaluation.
|
|
36189
36939
|
*/
|
|
36190
36940
|
delete(evalID, options) {
|
|
36191
|
-
return this._client.delete(
|
|
36941
|
+
return this._client.delete(path32`/evals/${evalID}`, options);
|
|
36192
36942
|
}
|
|
36193
36943
|
};
|
|
36194
36944
|
Evals.Runs = Runs2;
|
|
@@ -36237,7 +36987,7 @@ var init_files3 = __esm({
|
|
|
36237
36987
|
* Returns information about a specific file.
|
|
36238
36988
|
*/
|
|
36239
36989
|
retrieve(fileID, options) {
|
|
36240
|
-
return this._client.get(
|
|
36990
|
+
return this._client.get(path32`/files/${fileID}`, options);
|
|
36241
36991
|
}
|
|
36242
36992
|
/**
|
|
36243
36993
|
* Returns a list of files.
|
|
@@ -36249,13 +36999,13 @@ var init_files3 = __esm({
|
|
|
36249
36999
|
* Delete a file.
|
|
36250
37000
|
*/
|
|
36251
37001
|
delete(fileID, options) {
|
|
36252
|
-
return this._client.delete(
|
|
37002
|
+
return this._client.delete(path32`/files/${fileID}`, options);
|
|
36253
37003
|
}
|
|
36254
37004
|
/**
|
|
36255
37005
|
* Returns the contents of the specified file.
|
|
36256
37006
|
*/
|
|
36257
37007
|
content(fileID, options) {
|
|
36258
|
-
return this._client.get(
|
|
37008
|
+
return this._client.get(path32`/files/${fileID}/content`, {
|
|
36259
37009
|
...options,
|
|
36260
37010
|
headers: buildHeaders2([{ Accept: "application/binary" }, options?.headers]),
|
|
36261
37011
|
__binaryResponse: true
|
|
@@ -36386,7 +37136,7 @@ var init_permissions = __esm({
|
|
|
36386
37136
|
* ```
|
|
36387
37137
|
*/
|
|
36388
37138
|
create(fineTunedModelCheckpoint, body, options) {
|
|
36389
|
-
return this._client.getAPIList(
|
|
37139
|
+
return this._client.getAPIList(path32`/fine_tuning/checkpoints/${fineTunedModelCheckpoint}/permissions`, Page2, { body, method: "post", ...options });
|
|
36390
37140
|
}
|
|
36391
37141
|
/**
|
|
36392
37142
|
* **NOTE:** This endpoint requires an [admin API key](../admin-api-keys).
|
|
@@ -36403,7 +37153,7 @@ var init_permissions = __esm({
|
|
|
36403
37153
|
* ```
|
|
36404
37154
|
*/
|
|
36405
37155
|
retrieve(fineTunedModelCheckpoint, query = {}, options) {
|
|
36406
|
-
return this._client.get(
|
|
37156
|
+
return this._client.get(path32`/fine_tuning/checkpoints/${fineTunedModelCheckpoint}/permissions`, {
|
|
36407
37157
|
query,
|
|
36408
37158
|
...options
|
|
36409
37159
|
});
|
|
@@ -36428,7 +37178,7 @@ var init_permissions = __esm({
|
|
|
36428
37178
|
*/
|
|
36429
37179
|
delete(permissionID, params, options) {
|
|
36430
37180
|
const { fine_tuned_model_checkpoint } = params;
|
|
36431
|
-
return this._client.delete(
|
|
37181
|
+
return this._client.delete(path32`/fine_tuning/checkpoints/${fine_tuned_model_checkpoint}/permissions/${permissionID}`, options);
|
|
36432
37182
|
}
|
|
36433
37183
|
};
|
|
36434
37184
|
}
|
|
@@ -36473,7 +37223,7 @@ var init_checkpoints2 = __esm({
|
|
|
36473
37223
|
* ```
|
|
36474
37224
|
*/
|
|
36475
37225
|
list(fineTuningJobID, query = {}, options) {
|
|
36476
|
-
return this._client.getAPIList(
|
|
37226
|
+
return this._client.getAPIList(path32`/fine_tuning/jobs/${fineTuningJobID}/checkpoints`, CursorPage, { query, ...options });
|
|
36477
37227
|
}
|
|
36478
37228
|
};
|
|
36479
37229
|
}
|
|
@@ -36526,7 +37276,7 @@ var init_jobs = __esm({
|
|
|
36526
37276
|
* ```
|
|
36527
37277
|
*/
|
|
36528
37278
|
retrieve(fineTuningJobID, options) {
|
|
36529
|
-
return this._client.get(
|
|
37279
|
+
return this._client.get(path32`/fine_tuning/jobs/${fineTuningJobID}`, options);
|
|
36530
37280
|
}
|
|
36531
37281
|
/**
|
|
36532
37282
|
* List your organization's fine-tuning jobs
|
|
@@ -36553,7 +37303,7 @@ var init_jobs = __esm({
|
|
|
36553
37303
|
* ```
|
|
36554
37304
|
*/
|
|
36555
37305
|
cancel(fineTuningJobID, options) {
|
|
36556
|
-
return this._client.post(
|
|
37306
|
+
return this._client.post(path32`/fine_tuning/jobs/${fineTuningJobID}/cancel`, options);
|
|
36557
37307
|
}
|
|
36558
37308
|
/**
|
|
36559
37309
|
* Get status updates for a fine-tuning job.
|
|
@@ -36569,7 +37319,7 @@ var init_jobs = __esm({
|
|
|
36569
37319
|
* ```
|
|
36570
37320
|
*/
|
|
36571
37321
|
listEvents(fineTuningJobID, query = {}, options) {
|
|
36572
|
-
return this._client.getAPIList(
|
|
37322
|
+
return this._client.getAPIList(path32`/fine_tuning/jobs/${fineTuningJobID}/events`, CursorPage, { query, ...options });
|
|
36573
37323
|
}
|
|
36574
37324
|
/**
|
|
36575
37325
|
* Pause a fine-tune job.
|
|
@@ -36582,7 +37332,7 @@ var init_jobs = __esm({
|
|
|
36582
37332
|
* ```
|
|
36583
37333
|
*/
|
|
36584
37334
|
pause(fineTuningJobID, options) {
|
|
36585
|
-
return this._client.post(
|
|
37335
|
+
return this._client.post(path32`/fine_tuning/jobs/${fineTuningJobID}/pause`, options);
|
|
36586
37336
|
}
|
|
36587
37337
|
/**
|
|
36588
37338
|
* Resume a fine-tune job.
|
|
@@ -36595,7 +37345,7 @@ var init_jobs = __esm({
|
|
|
36595
37345
|
* ```
|
|
36596
37346
|
*/
|
|
36597
37347
|
resume(fineTuningJobID, options) {
|
|
36598
|
-
return this._client.post(
|
|
37348
|
+
return this._client.post(path32`/fine_tuning/jobs/${fineTuningJobID}/resume`, options);
|
|
36599
37349
|
}
|
|
36600
37350
|
};
|
|
36601
37351
|
Jobs.Checkpoints = Checkpoints2;
|
|
@@ -36701,7 +37451,7 @@ var init_models3 = __esm({
|
|
|
36701
37451
|
* the owner and permissioning.
|
|
36702
37452
|
*/
|
|
36703
37453
|
retrieve(model, options) {
|
|
36704
|
-
return this._client.get(
|
|
37454
|
+
return this._client.get(path32`/models/${model}`, options);
|
|
36705
37455
|
}
|
|
36706
37456
|
/**
|
|
36707
37457
|
* Lists the currently available models, and provides basic information about each
|
|
@@ -36715,7 +37465,7 @@ var init_models3 = __esm({
|
|
|
36715
37465
|
* delete a model.
|
|
36716
37466
|
*/
|
|
36717
37467
|
delete(model, options) {
|
|
36718
|
-
return this._client.delete(
|
|
37468
|
+
return this._client.delete(path32`/models/${model}`, options);
|
|
36719
37469
|
}
|
|
36720
37470
|
};
|
|
36721
37471
|
}
|
|
@@ -37183,7 +37933,7 @@ var init_input_items = __esm({
|
|
|
37183
37933
|
* ```
|
|
37184
37934
|
*/
|
|
37185
37935
|
list(responseID, query = {}, options) {
|
|
37186
|
-
return this._client.getAPIList(
|
|
37936
|
+
return this._client.getAPIList(path32`/responses/${responseID}/input_items`, CursorPage, { query, ...options });
|
|
37187
37937
|
}
|
|
37188
37938
|
};
|
|
37189
37939
|
}
|
|
@@ -37214,7 +37964,7 @@ var init_responses = __esm({
|
|
|
37214
37964
|
});
|
|
37215
37965
|
}
|
|
37216
37966
|
retrieve(responseID, query = {}, options) {
|
|
37217
|
-
return this._client.get(
|
|
37967
|
+
return this._client.get(path32`/responses/${responseID}`, {
|
|
37218
37968
|
query,
|
|
37219
37969
|
...options,
|
|
37220
37970
|
stream: query?.stream ?? false
|
|
@@ -37236,7 +37986,7 @@ var init_responses = __esm({
|
|
|
37236
37986
|
* ```
|
|
37237
37987
|
*/
|
|
37238
37988
|
delete(responseID, options) {
|
|
37239
|
-
return this._client.delete(
|
|
37989
|
+
return this._client.delete(path32`/responses/${responseID}`, {
|
|
37240
37990
|
...options,
|
|
37241
37991
|
headers: buildHeaders2([{ Accept: "*/*" }, options?.headers])
|
|
37242
37992
|
});
|
|
@@ -37263,7 +38013,7 @@ var init_responses = __esm({
|
|
|
37263
38013
|
* ```
|
|
37264
38014
|
*/
|
|
37265
38015
|
cancel(responseID, options) {
|
|
37266
|
-
return this._client.post(
|
|
38016
|
+
return this._client.post(path32`/responses/${responseID}/cancel`, options);
|
|
37267
38017
|
}
|
|
37268
38018
|
};
|
|
37269
38019
|
Responses.InputItems = InputItems;
|
|
@@ -37292,7 +38042,7 @@ var init_parts = __esm({
|
|
|
37292
38042
|
* [complete the Upload](https://platform.openai.com/docs/api-reference/uploads/complete).
|
|
37293
38043
|
*/
|
|
37294
38044
|
create(uploadID, body, options) {
|
|
37295
|
-
return this._client.post(
|
|
38045
|
+
return this._client.post(path32`/uploads/${uploadID}/parts`, multipartFormRequestOptions2({ body, ...options }, this._client));
|
|
37296
38046
|
}
|
|
37297
38047
|
};
|
|
37298
38048
|
}
|
|
@@ -37339,7 +38089,7 @@ var init_uploads5 = __esm({
|
|
|
37339
38089
|
* Cancels the Upload. No Parts may be added after an Upload is cancelled.
|
|
37340
38090
|
*/
|
|
37341
38091
|
cancel(uploadID, options) {
|
|
37342
|
-
return this._client.post(
|
|
38092
|
+
return this._client.post(path32`/uploads/${uploadID}/cancel`, options);
|
|
37343
38093
|
}
|
|
37344
38094
|
/**
|
|
37345
38095
|
* Completes the
|
|
@@ -37357,7 +38107,7 @@ var init_uploads5 = __esm({
|
|
|
37357
38107
|
* an Upload is completed.
|
|
37358
38108
|
*/
|
|
37359
38109
|
complete(uploadID, body, options) {
|
|
37360
|
-
return this._client.post(
|
|
38110
|
+
return this._client.post(path32`/uploads/${uploadID}/complete`, { body, ...options });
|
|
37361
38111
|
}
|
|
37362
38112
|
};
|
|
37363
38113
|
Uploads.Parts = Parts;
|
|
@@ -37403,7 +38153,7 @@ var init_file_batches = __esm({
|
|
|
37403
38153
|
* Create a vector store file batch.
|
|
37404
38154
|
*/
|
|
37405
38155
|
create(vectorStoreID, body, options) {
|
|
37406
|
-
return this._client.post(
|
|
38156
|
+
return this._client.post(path32`/vector_stores/${vectorStoreID}/file_batches`, {
|
|
37407
38157
|
body,
|
|
37408
38158
|
...options,
|
|
37409
38159
|
headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
|
|
@@ -37414,7 +38164,7 @@ var init_file_batches = __esm({
|
|
|
37414
38164
|
*/
|
|
37415
38165
|
retrieve(batchID, params, options) {
|
|
37416
38166
|
const { vector_store_id } = params;
|
|
37417
|
-
return this._client.get(
|
|
38167
|
+
return this._client.get(path32`/vector_stores/${vector_store_id}/file_batches/${batchID}`, {
|
|
37418
38168
|
...options,
|
|
37419
38169
|
headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
|
|
37420
38170
|
});
|
|
@@ -37425,7 +38175,7 @@ var init_file_batches = __esm({
|
|
|
37425
38175
|
*/
|
|
37426
38176
|
cancel(batchID, params, options) {
|
|
37427
38177
|
const { vector_store_id } = params;
|
|
37428
|
-
return this._client.post(
|
|
38178
|
+
return this._client.post(path32`/vector_stores/${vector_store_id}/file_batches/${batchID}/cancel`, {
|
|
37429
38179
|
...options,
|
|
37430
38180
|
headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
|
|
37431
38181
|
});
|
|
@@ -37442,7 +38192,7 @@ var init_file_batches = __esm({
|
|
|
37442
38192
|
*/
|
|
37443
38193
|
listFiles(batchID, params, options) {
|
|
37444
38194
|
const { vector_store_id, ...query } = params;
|
|
37445
|
-
return this._client.getAPIList(
|
|
38195
|
+
return this._client.getAPIList(path32`/vector_stores/${vector_store_id}/file_batches/${batchID}/files`, CursorPage, { query, ...options, headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]) });
|
|
37446
38196
|
}
|
|
37447
38197
|
/**
|
|
37448
38198
|
* Wait for the given file batch to be processed.
|
|
@@ -37532,7 +38282,7 @@ var init_files4 = __esm({
|
|
|
37532
38282
|
* [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object).
|
|
37533
38283
|
*/
|
|
37534
38284
|
create(vectorStoreID, body, options) {
|
|
37535
|
-
return this._client.post(
|
|
38285
|
+
return this._client.post(path32`/vector_stores/${vectorStoreID}/files`, {
|
|
37536
38286
|
body,
|
|
37537
38287
|
...options,
|
|
37538
38288
|
headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
|
|
@@ -37543,7 +38293,7 @@ var init_files4 = __esm({
|
|
|
37543
38293
|
*/
|
|
37544
38294
|
retrieve(fileID, params, options) {
|
|
37545
38295
|
const { vector_store_id } = params;
|
|
37546
|
-
return this._client.get(
|
|
38296
|
+
return this._client.get(path32`/vector_stores/${vector_store_id}/files/${fileID}`, {
|
|
37547
38297
|
...options,
|
|
37548
38298
|
headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
|
|
37549
38299
|
});
|
|
@@ -37553,7 +38303,7 @@ var init_files4 = __esm({
|
|
|
37553
38303
|
*/
|
|
37554
38304
|
update(fileID, params, options) {
|
|
37555
38305
|
const { vector_store_id, ...body } = params;
|
|
37556
|
-
return this._client.post(
|
|
38306
|
+
return this._client.post(path32`/vector_stores/${vector_store_id}/files/${fileID}`, {
|
|
37557
38307
|
body,
|
|
37558
38308
|
...options,
|
|
37559
38309
|
headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
|
|
@@ -37563,7 +38313,7 @@ var init_files4 = __esm({
|
|
|
37563
38313
|
* Returns a list of vector store files.
|
|
37564
38314
|
*/
|
|
37565
38315
|
list(vectorStoreID, query = {}, options) {
|
|
37566
|
-
return this._client.getAPIList(
|
|
38316
|
+
return this._client.getAPIList(path32`/vector_stores/${vectorStoreID}/files`, CursorPage, {
|
|
37567
38317
|
query,
|
|
37568
38318
|
...options,
|
|
37569
38319
|
headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
|
|
@@ -37577,7 +38327,7 @@ var init_files4 = __esm({
|
|
|
37577
38327
|
*/
|
|
37578
38328
|
delete(fileID, params, options) {
|
|
37579
38329
|
const { vector_store_id } = params;
|
|
37580
|
-
return this._client.delete(
|
|
38330
|
+
return this._client.delete(path32`/vector_stores/${vector_store_id}/files/${fileID}`, {
|
|
37581
38331
|
...options,
|
|
37582
38332
|
headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
|
|
37583
38333
|
});
|
|
@@ -37652,7 +38402,7 @@ var init_files4 = __esm({
|
|
|
37652
38402
|
*/
|
|
37653
38403
|
content(fileID, params, options) {
|
|
37654
38404
|
const { vector_store_id } = params;
|
|
37655
|
-
return this._client.getAPIList(
|
|
38405
|
+
return this._client.getAPIList(path32`/vector_stores/${vector_store_id}/files/${fileID}/content`, Page2, { ...options, headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]) });
|
|
37656
38406
|
}
|
|
37657
38407
|
};
|
|
37658
38408
|
}
|
|
@@ -37690,7 +38440,7 @@ var init_vector_stores = __esm({
|
|
|
37690
38440
|
* Retrieves a vector store.
|
|
37691
38441
|
*/
|
|
37692
38442
|
retrieve(vectorStoreID, options) {
|
|
37693
|
-
return this._client.get(
|
|
38443
|
+
return this._client.get(path32`/vector_stores/${vectorStoreID}`, {
|
|
37694
38444
|
...options,
|
|
37695
38445
|
headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
|
|
37696
38446
|
});
|
|
@@ -37699,7 +38449,7 @@ var init_vector_stores = __esm({
|
|
|
37699
38449
|
* Modifies a vector store.
|
|
37700
38450
|
*/
|
|
37701
38451
|
update(vectorStoreID, body, options) {
|
|
37702
|
-
return this._client.post(
|
|
38452
|
+
return this._client.post(path32`/vector_stores/${vectorStoreID}`, {
|
|
37703
38453
|
body,
|
|
37704
38454
|
...options,
|
|
37705
38455
|
headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
|
|
@@ -37719,7 +38469,7 @@ var init_vector_stores = __esm({
|
|
|
37719
38469
|
* Delete a vector store.
|
|
37720
38470
|
*/
|
|
37721
38471
|
delete(vectorStoreID, options) {
|
|
37722
|
-
return this._client.delete(
|
|
38472
|
+
return this._client.delete(path32`/vector_stores/${vectorStoreID}`, {
|
|
37723
38473
|
...options,
|
|
37724
38474
|
headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
|
|
37725
38475
|
});
|
|
@@ -37729,7 +38479,7 @@ var init_vector_stores = __esm({
|
|
|
37729
38479
|
* filter.
|
|
37730
38480
|
*/
|
|
37731
38481
|
search(vectorStoreID, body, options) {
|
|
37732
|
-
return this._client.getAPIList(
|
|
38482
|
+
return this._client.getAPIList(path32`/vector_stores/${vectorStoreID}/search`, Page2, {
|
|
37733
38483
|
body,
|
|
37734
38484
|
method: "post",
|
|
37735
38485
|
...options,
|
|
@@ -38032,9 +38782,9 @@ var init_client2 = __esm({
|
|
|
38032
38782
|
this.apiKey = token;
|
|
38033
38783
|
return true;
|
|
38034
38784
|
}
|
|
38035
|
-
buildURL(
|
|
38785
|
+
buildURL(path36, query, defaultBaseURL) {
|
|
38036
38786
|
const baseURL = !__classPrivateFieldGet2(this, _OpenAI_instances, "m", _OpenAI_baseURLOverridden).call(this) && defaultBaseURL || this.baseURL;
|
|
38037
|
-
const url2 = isAbsoluteURL2(
|
|
38787
|
+
const url2 = isAbsoluteURL2(path36) ? new URL(path36) : new URL(baseURL + (baseURL.endsWith("/") && path36.startsWith("/") ? path36.slice(1) : path36));
|
|
38038
38788
|
const defaultQuery = this.defaultQuery();
|
|
38039
38789
|
if (!isEmptyObj2(defaultQuery)) {
|
|
38040
38790
|
query = { ...defaultQuery, ...query };
|
|
@@ -38058,24 +38808,24 @@ var init_client2 = __esm({
|
|
|
38058
38808
|
*/
|
|
38059
38809
|
async prepareRequest(request, { url: url2, options }) {
|
|
38060
38810
|
}
|
|
38061
|
-
get(
|
|
38062
|
-
return this.methodRequest("get",
|
|
38811
|
+
get(path36, opts) {
|
|
38812
|
+
return this.methodRequest("get", path36, opts);
|
|
38063
38813
|
}
|
|
38064
|
-
post(
|
|
38065
|
-
return this.methodRequest("post",
|
|
38814
|
+
post(path36, opts) {
|
|
38815
|
+
return this.methodRequest("post", path36, opts);
|
|
38066
38816
|
}
|
|
38067
|
-
patch(
|
|
38068
|
-
return this.methodRequest("patch",
|
|
38817
|
+
patch(path36, opts) {
|
|
38818
|
+
return this.methodRequest("patch", path36, opts);
|
|
38069
38819
|
}
|
|
38070
|
-
put(
|
|
38071
|
-
return this.methodRequest("put",
|
|
38820
|
+
put(path36, opts) {
|
|
38821
|
+
return this.methodRequest("put", path36, opts);
|
|
38072
38822
|
}
|
|
38073
|
-
delete(
|
|
38074
|
-
return this.methodRequest("delete",
|
|
38823
|
+
delete(path36, opts) {
|
|
38824
|
+
return this.methodRequest("delete", path36, opts);
|
|
38075
38825
|
}
|
|
38076
|
-
methodRequest(method,
|
|
38826
|
+
methodRequest(method, path36, opts) {
|
|
38077
38827
|
return this.request(Promise.resolve(opts).then((opts2) => {
|
|
38078
|
-
return { method, path:
|
|
38828
|
+
return { method, path: path36, ...opts2 };
|
|
38079
38829
|
}));
|
|
38080
38830
|
}
|
|
38081
38831
|
request(options, remainingRetries = null) {
|
|
@@ -38179,8 +38929,8 @@ var init_client2 = __esm({
|
|
|
38179
38929
|
}));
|
|
38180
38930
|
return { response, options, controller, requestLogID, retryOfRequestLogID, startTime };
|
|
38181
38931
|
}
|
|
38182
|
-
getAPIList(
|
|
38183
|
-
return this.requestAPIList(Page3, { method: "get", path:
|
|
38932
|
+
getAPIList(path36, Page3, opts) {
|
|
38933
|
+
return this.requestAPIList(Page3, { method: "get", path: path36, ...opts });
|
|
38184
38934
|
}
|
|
38185
38935
|
requestAPIList(Page3, options) {
|
|
38186
38936
|
const request = this.makeRequest(options, null, void 0);
|
|
@@ -38258,8 +39008,8 @@ var init_client2 = __esm({
|
|
|
38258
39008
|
}
|
|
38259
39009
|
async buildRequest(inputOptions, { retryCount = 0 } = {}) {
|
|
38260
39010
|
const options = { ...inputOptions };
|
|
38261
|
-
const { method, path:
|
|
38262
|
-
const url2 = this.buildURL(
|
|
39011
|
+
const { method, path: path36, query, defaultBaseURL } = options;
|
|
39012
|
+
const url2 = this.buildURL(path36, query, defaultBaseURL);
|
|
38263
39013
|
if ("timeout" in options)
|
|
38264
39014
|
validatePositiveInteger2("timeout", options.timeout);
|
|
38265
39015
|
options.timeout = options.timeout ?? this.timeout;
|
|
@@ -39932,17 +40682,17 @@ __export(web_dashboard_server_exports, {
|
|
|
39932
40682
|
import express from "express";
|
|
39933
40683
|
import { createServer as createServer3 } from "http";
|
|
39934
40684
|
import { Server as SocketIOServer } from "socket.io";
|
|
39935
|
-
import { fileURLToPath as
|
|
39936
|
-
import { dirname as
|
|
39937
|
-
import
|
|
40685
|
+
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
40686
|
+
import { dirname as dirname8, join as join31 } from "path";
|
|
40687
|
+
import fs35 from "fs";
|
|
39938
40688
|
var __filename, __dirname, embeddedJS, embeddedCSS, WebDashboardServer;
|
|
39939
40689
|
var init_web_dashboard_server = __esm({
|
|
39940
40690
|
"src/core/dashboard/web-dashboard-server.ts"() {
|
|
39941
40691
|
"use strict";
|
|
39942
40692
|
init_dashboard_data();
|
|
39943
40693
|
init_embedded_assets();
|
|
39944
|
-
__filename =
|
|
39945
|
-
__dirname =
|
|
40694
|
+
__filename = fileURLToPath3(import.meta.url);
|
|
40695
|
+
__dirname = dirname8(__filename);
|
|
39946
40696
|
embeddedJS = dashboardAssetsEmbedded ? embeddedDashboardJS : void 0;
|
|
39947
40697
|
embeddedCSS = dashboardAssetsEmbedded ? embeddedDashboardCSS : void 0;
|
|
39948
40698
|
WebDashboardServer = class {
|
|
@@ -39984,15 +40734,15 @@ var init_web_dashboard_server = __esm({
|
|
|
39984
40734
|
});
|
|
39985
40735
|
} else {
|
|
39986
40736
|
const possibleDirs = [
|
|
39987
|
-
|
|
39988
|
-
|
|
39989
|
-
|
|
39990
|
-
|
|
39991
|
-
|
|
40737
|
+
join31(__dirname, "..", "..", "..", "dist", "dashboard"),
|
|
40738
|
+
join31(__dirname, "dashboard"),
|
|
40739
|
+
join31(__dirname, "..", "dashboard"),
|
|
40740
|
+
join31(process.cwd(), "dist", "dashboard"),
|
|
40741
|
+
join31(process.cwd(), "apps", "cli", "dist", "dashboard")
|
|
39992
40742
|
];
|
|
39993
40743
|
let distDir = null;
|
|
39994
40744
|
for (const dir of possibleDirs) {
|
|
39995
|
-
if (
|
|
40745
|
+
if (fs35.existsSync(join31(dir, "dashboard.js"))) {
|
|
39996
40746
|
distDir = dir;
|
|
39997
40747
|
bundleExists = true;
|
|
39998
40748
|
console.log(`Found dashboard bundle at: ${dir}`);
|
|
@@ -41792,8 +42542,8 @@ function isCommandDefinition(obj) {
|
|
|
41792
42542
|
}
|
|
41793
42543
|
|
|
41794
42544
|
// src/core/service-discovery.ts
|
|
41795
|
-
import * as
|
|
41796
|
-
import * as
|
|
42545
|
+
import * as path33 from "path";
|
|
42546
|
+
import * as fs36 from "fs";
|
|
41797
42547
|
import { findProjectRoot } from "@semiont/core";
|
|
41798
42548
|
var BUILT_IN_SERVICES = ["frontend", "backend", "database", "filesystem"];
|
|
41799
42549
|
var environmentServicesCache = /* @__PURE__ */ new Map();
|
|
@@ -41803,11 +42553,11 @@ async function loadEnvironmentServices(environment) {
|
|
|
41803
42553
|
}
|
|
41804
42554
|
try {
|
|
41805
42555
|
const PROJECT_ROOT = findProjectRoot();
|
|
41806
|
-
const configPath =
|
|
41807
|
-
if (!
|
|
42556
|
+
const configPath = path33.join(PROJECT_ROOT, "environments", `${environment}.json`);
|
|
42557
|
+
if (!fs36.existsSync(configPath)) {
|
|
41808
42558
|
return [...BUILT_IN_SERVICES];
|
|
41809
42559
|
}
|
|
41810
|
-
const jsonContent =
|
|
42560
|
+
const jsonContent = fs36.readFileSync(configPath, "utf-8");
|
|
41811
42561
|
const config2 = JSON.parse(jsonContent);
|
|
41812
42562
|
const services = config2.services ? Object.keys(config2.services) : [];
|
|
41813
42563
|
environmentServicesCache.set(environment, services);
|
|
@@ -41838,7 +42588,7 @@ async function isValidService(service, environment) {
|
|
|
41838
42588
|
import { parseEnvironment as parseEnvironment2 } from "@semiont/core";
|
|
41839
42589
|
|
|
41840
42590
|
// src/core/service-resolver.ts
|
|
41841
|
-
import * as
|
|
42591
|
+
import * as path34 from "path";
|
|
41842
42592
|
import { ConfigurationError } from "@semiont/core";
|
|
41843
42593
|
function getServicePlatform(serviceName, config2) {
|
|
41844
42594
|
const environment = config2._metadata?.environment;
|
|
@@ -41886,7 +42636,7 @@ function resolveServiceDeployments(serviceNames, config2) {
|
|
|
41886
42636
|
const serviceConfig = config2.services?.[serviceName];
|
|
41887
42637
|
if (!serviceConfig) {
|
|
41888
42638
|
const availableServices = Object.keys(config2.services || {});
|
|
41889
|
-
const configPath =
|
|
42639
|
+
const configPath = path34.join(projectRoot, "environments", `${environment}.json`);
|
|
41890
42640
|
console.warn(`\u274C Service '${serviceName}' not found in environment '${environment}'`);
|
|
41891
42641
|
if (availableServices.length > 0) {
|
|
41892
42642
|
console.warn(` Available services: ${availableServices.join(", ")}`);
|
|
@@ -41925,7 +42675,7 @@ function resolveServiceDeployments(serviceNames, config2) {
|
|
|
41925
42675
|
// src/core/command-service-matcher.ts
|
|
41926
42676
|
init_service_factory();
|
|
41927
42677
|
init_service_command_capabilities();
|
|
41928
|
-
import * as
|
|
42678
|
+
import * as path35 from "path";
|
|
41929
42679
|
async function checkServiceSupportsCommand(serviceName, command, envConfig) {
|
|
41930
42680
|
try {
|
|
41931
42681
|
const projectRoot = envConfig._metadata?.projectRoot;
|
|
@@ -42007,7 +42757,7 @@ async function resolveServiceSelector(selector, capability, envConfig) {
|
|
|
42007
42757
|
if (!projectRoot) {
|
|
42008
42758
|
throw new Error("Project root is required in envConfig._metadata");
|
|
42009
42759
|
}
|
|
42010
|
-
const configPath =
|
|
42760
|
+
const configPath = path35.join(projectRoot, "environments", `${environment}.json`);
|
|
42011
42761
|
const errorMessage = [
|
|
42012
42762
|
`Unknown service '${selector}' in environment '${environment}'`,
|
|
42013
42763
|
`Available services: ${availableServices.join(", ")}`,
|
|
@@ -42503,14 +43253,14 @@ var OutputFormatter = class {
|
|
|
42503
43253
|
/**
|
|
42504
43254
|
* Get nested value from object using dot notation
|
|
42505
43255
|
*/
|
|
42506
|
-
static getNestedValue(obj,
|
|
42507
|
-
return
|
|
43256
|
+
static getNestedValue(obj, path36) {
|
|
43257
|
+
return path36.split(".").reduce((current, key) => current?.[key], obj);
|
|
42508
43258
|
}
|
|
42509
43259
|
/**
|
|
42510
43260
|
* Set nested value in object using dot notation
|
|
42511
43261
|
*/
|
|
42512
|
-
static setNestedValue(obj,
|
|
42513
|
-
const keys =
|
|
43262
|
+
static setNestedValue(obj, path36, value) {
|
|
43263
|
+
const keys = path36.split(".");
|
|
42514
43264
|
const lastKey = keys.pop();
|
|
42515
43265
|
const target = keys.reduce((current, key) => {
|
|
42516
43266
|
if (!(key in current)) {
|