@certalis/agent-smith 0.1.14 → 0.1.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -11
- package/dist/bin.js +180 -18
- package/dist/client-launcher.js +2295 -0
- package/dist/https.js +3 -1
- package/dist/pool.js +28 -9
- package/dist/post-processor.worker.js +27 -8
- package/dist/server.js +27 -8
- package/package.json +1 -1
package/dist/https.js
CHANGED
|
@@ -64,6 +64,7 @@ function readStandaloneOptions(env) {
|
|
|
64
64
|
port,
|
|
65
65
|
poolPort,
|
|
66
66
|
poolHost: env.AGENT_SMITH_POOL_HOST ?? "127.0.0.1",
|
|
67
|
+
dashboard: env.AGENT_SMITH_POOL_DASHBOARD === "1",
|
|
67
68
|
...paths,
|
|
68
69
|
adminKey: keys.adminKey,
|
|
69
70
|
proxyKey: keys.proxyKey
|
|
@@ -76,7 +77,8 @@ function poolEnvironment(options, env) {
|
|
|
76
77
|
AGENT_SMITH_POOL_PORT: String(options.poolPort),
|
|
77
78
|
AGENT_SMITH_HOST: options.poolHost,
|
|
78
79
|
AGENT_SMITH_STATE_DIR: options.stateDir,
|
|
79
|
-
|
|
80
|
+
AGENT_SMITH_POOL_DASHBOARD: options.dashboard ? "1" : "0",
|
|
81
|
+
AGENT_SMITH_TRUST_LOOPBACK: options.dashboard ? "true" : "false",
|
|
80
82
|
AGENT_SMITH_CONFIG_PATH: options.configPath,
|
|
81
83
|
AGENT_SMITH_DB_PATH: options.dbPath,
|
|
82
84
|
AGENT_SMITH_CLIENT_KEYS_FILE: options.clientKeysFile,
|
package/dist/pool.js
CHANGED
|
@@ -4009,6 +4009,9 @@ function sanitizeClientRouting(value) {
|
|
|
4009
4009
|
if (typeof value.proxy_key_file === "string" && (value.proxy_key_file.startsWith("/") || value.proxy_key_file.startsWith("~/")) && value.proxy_key_file.length <= 1024) {
|
|
4010
4010
|
client2.proxy_key_file = value.proxy_key_file;
|
|
4011
4011
|
}
|
|
4012
|
+
if (typeof value.keep_claude_login === "boolean") {
|
|
4013
|
+
client2.keep_claude_login = value.keep_claude_login;
|
|
4014
|
+
}
|
|
4012
4015
|
return Object.keys(client2).length > 0 ? client2 : undefined;
|
|
4013
4016
|
}
|
|
4014
4017
|
function sanitizeProviderModels(value) {
|
|
@@ -4099,6 +4102,26 @@ function sanitizeTeamRouting(value) {
|
|
|
4099
4102
|
}
|
|
4100
4103
|
return result;
|
|
4101
4104
|
}
|
|
4105
|
+
function readClientRouting(configPath = resolveConfigPath()) {
|
|
4106
|
+
let data;
|
|
4107
|
+
try {
|
|
4108
|
+
data = JSON.parse(readFileSync(configPath, "utf8"));
|
|
4109
|
+
} catch {
|
|
4110
|
+
throw new Error("Agent Smith client config could not be read");
|
|
4111
|
+
}
|
|
4112
|
+
if (!isRecord(data) || data.client !== undefined && !isRecord(data.client) || isRecord(data.client) && data.client.enabled !== undefined && typeof data.client.enabled !== "boolean") {
|
|
4113
|
+
throw new Error("Agent Smith client config is invalid");
|
|
4114
|
+
}
|
|
4115
|
+
return clientRouting(sanitizeClientRouting(data.client));
|
|
4116
|
+
}
|
|
4117
|
+
function clientRouting(client2) {
|
|
4118
|
+
return {
|
|
4119
|
+
enabled: client2?.enabled === true,
|
|
4120
|
+
...client2?.base_url && { baseUrl: client2.base_url },
|
|
4121
|
+
...client2?.proxy_key_file && { proxyKeyFile: client2.proxy_key_file },
|
|
4122
|
+
...client2?.keep_claude_login === true && { keepClaudeLogin: true }
|
|
4123
|
+
};
|
|
4124
|
+
}
|
|
4102
4125
|
var log6, PROVIDER_STRATEGIES, BUILTIN_PROVIDER_CONFIGS, BUILTIN_PROVIDER_CONFIG_BY_NAME, PROVIDER_NAME_PATTERN, TEAM_ROUTING_DEFAULTS, MAX_ENROLLMENT_EMAILS = 200, MAX_ALERT_VALUE_LENGTH = 512, Config;
|
|
4103
4126
|
var init_src7 = __esm(() => {
|
|
4104
4127
|
init_src2();
|
|
@@ -4301,14 +4324,10 @@ var init_src7 = __esm(() => {
|
|
|
4301
4324
|
};
|
|
4302
4325
|
}
|
|
4303
4326
|
getClientRouting() {
|
|
4304
|
-
|
|
4305
|
-
|
|
4306
|
-
|
|
4307
|
-
|
|
4308
|
-
...client2?.proxy_key_file && {
|
|
4309
|
-
proxyKeyFile: client2.proxy_key_file
|
|
4310
|
-
}
|
|
4311
|
-
};
|
|
4327
|
+
return clientRouting(this.data.client);
|
|
4328
|
+
}
|
|
4329
|
+
setClientRoutingEnabled(enabled) {
|
|
4330
|
+
this.persistStrictly("client", { ...this.data.client, enabled });
|
|
4312
4331
|
}
|
|
4313
4332
|
getBlockWhenAllFull() {
|
|
4314
4333
|
return this.data.block_when_all_full !== false;
|
|
@@ -12551,7 +12570,7 @@ init_src11();
|
|
|
12551
12570
|
process.umask(63);
|
|
12552
12571
|
var server = startServer({
|
|
12553
12572
|
port: Number(process.env.AGENT_SMITH_POOL_PORT),
|
|
12554
|
-
withDashboard:
|
|
12573
|
+
withDashboard: process.env.AGENT_SMITH_POOL_DASHBOARD === "1",
|
|
12555
12574
|
additionalUnixSocket: process.env.AGENT_SMITH_STATE_DIR ? `${process.env.AGENT_SMITH_STATE_DIR}/control.sock` : "/var/data/agent-smith/state/control.sock"
|
|
12556
12575
|
});
|
|
12557
12576
|
process.on("disconnect", () => {
|
|
@@ -1488,6 +1488,9 @@ function sanitizeClientRouting(value) {
|
|
|
1488
1488
|
if (typeof value.proxy_key_file === "string" && (value.proxy_key_file.startsWith("/") || value.proxy_key_file.startsWith("~/")) && value.proxy_key_file.length <= 1024) {
|
|
1489
1489
|
client.proxy_key_file = value.proxy_key_file;
|
|
1490
1490
|
}
|
|
1491
|
+
if (typeof value.keep_claude_login === "boolean") {
|
|
1492
|
+
client.keep_claude_login = value.keep_claude_login;
|
|
1493
|
+
}
|
|
1491
1494
|
return Object.keys(client).length > 0 ? client : undefined;
|
|
1492
1495
|
}
|
|
1493
1496
|
function sanitizeProviderModels(value) {
|
|
@@ -1578,6 +1581,26 @@ function sanitizeTeamRouting(value) {
|
|
|
1578
1581
|
}
|
|
1579
1582
|
return result;
|
|
1580
1583
|
}
|
|
1584
|
+
function readClientRouting(configPath = resolveConfigPath()) {
|
|
1585
|
+
let data;
|
|
1586
|
+
try {
|
|
1587
|
+
data = JSON.parse(readFileSync(configPath, "utf8"));
|
|
1588
|
+
} catch {
|
|
1589
|
+
throw new Error("Agent Smith client config could not be read");
|
|
1590
|
+
}
|
|
1591
|
+
if (!isRecord(data) || data.client !== undefined && !isRecord(data.client) || isRecord(data.client) && data.client.enabled !== undefined && typeof data.client.enabled !== "boolean") {
|
|
1592
|
+
throw new Error("Agent Smith client config is invalid");
|
|
1593
|
+
}
|
|
1594
|
+
return clientRouting(sanitizeClientRouting(data.client));
|
|
1595
|
+
}
|
|
1596
|
+
function clientRouting(client) {
|
|
1597
|
+
return {
|
|
1598
|
+
enabled: client?.enabled === true,
|
|
1599
|
+
...client?.base_url && { baseUrl: client.base_url },
|
|
1600
|
+
...client?.proxy_key_file && { proxyKeyFile: client.proxy_key_file },
|
|
1601
|
+
...client?.keep_claude_login === true && { keepClaudeLogin: true }
|
|
1602
|
+
};
|
|
1603
|
+
}
|
|
1581
1604
|
var log2, PROVIDER_STRATEGIES, BUILTIN_PROVIDER_CONFIGS, BUILTIN_PROVIDER_CONFIG_BY_NAME, PROVIDER_NAME_PATTERN, TEAM_ROUTING_DEFAULTS, MAX_ENROLLMENT_EMAILS = 200, MAX_ALERT_VALUE_LENGTH = 512, Config;
|
|
1582
1605
|
var init_src4 = __esm(() => {
|
|
1583
1606
|
init_src2();
|
|
@@ -1780,14 +1803,10 @@ var init_src4 = __esm(() => {
|
|
|
1780
1803
|
};
|
|
1781
1804
|
}
|
|
1782
1805
|
getClientRouting() {
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
...client?.proxy_key_file && {
|
|
1788
|
-
proxyKeyFile: client.proxy_key_file
|
|
1789
|
-
}
|
|
1790
|
-
};
|
|
1806
|
+
return clientRouting(this.data.client);
|
|
1807
|
+
}
|
|
1808
|
+
setClientRoutingEnabled(enabled) {
|
|
1809
|
+
this.persistStrictly("client", { ...this.data.client, enabled });
|
|
1791
1810
|
}
|
|
1792
1811
|
getBlockWhenAllFull() {
|
|
1793
1812
|
return this.data.block_when_all_full !== false;
|
package/dist/server.js
CHANGED
|
@@ -4009,6 +4009,9 @@ function sanitizeClientRouting(value) {
|
|
|
4009
4009
|
if (typeof value.proxy_key_file === "string" && (value.proxy_key_file.startsWith("/") || value.proxy_key_file.startsWith("~/")) && value.proxy_key_file.length <= 1024) {
|
|
4010
4010
|
client2.proxy_key_file = value.proxy_key_file;
|
|
4011
4011
|
}
|
|
4012
|
+
if (typeof value.keep_claude_login === "boolean") {
|
|
4013
|
+
client2.keep_claude_login = value.keep_claude_login;
|
|
4014
|
+
}
|
|
4012
4015
|
return Object.keys(client2).length > 0 ? client2 : undefined;
|
|
4013
4016
|
}
|
|
4014
4017
|
function sanitizeProviderModels(value) {
|
|
@@ -4099,6 +4102,26 @@ function sanitizeTeamRouting(value) {
|
|
|
4099
4102
|
}
|
|
4100
4103
|
return result;
|
|
4101
4104
|
}
|
|
4105
|
+
function readClientRouting(configPath = resolveConfigPath()) {
|
|
4106
|
+
let data;
|
|
4107
|
+
try {
|
|
4108
|
+
data = JSON.parse(readFileSync(configPath, "utf8"));
|
|
4109
|
+
} catch {
|
|
4110
|
+
throw new Error("Agent Smith client config could not be read");
|
|
4111
|
+
}
|
|
4112
|
+
if (!isRecord(data) || data.client !== undefined && !isRecord(data.client) || isRecord(data.client) && data.client.enabled !== undefined && typeof data.client.enabled !== "boolean") {
|
|
4113
|
+
throw new Error("Agent Smith client config is invalid");
|
|
4114
|
+
}
|
|
4115
|
+
return clientRouting(sanitizeClientRouting(data.client));
|
|
4116
|
+
}
|
|
4117
|
+
function clientRouting(client2) {
|
|
4118
|
+
return {
|
|
4119
|
+
enabled: client2?.enabled === true,
|
|
4120
|
+
...client2?.base_url && { baseUrl: client2.base_url },
|
|
4121
|
+
...client2?.proxy_key_file && { proxyKeyFile: client2.proxy_key_file },
|
|
4122
|
+
...client2?.keep_claude_login === true && { keepClaudeLogin: true }
|
|
4123
|
+
};
|
|
4124
|
+
}
|
|
4102
4125
|
var log6, PROVIDER_STRATEGIES, BUILTIN_PROVIDER_CONFIGS, BUILTIN_PROVIDER_CONFIG_BY_NAME, PROVIDER_NAME_PATTERN, TEAM_ROUTING_DEFAULTS, MAX_ENROLLMENT_EMAILS = 200, MAX_ALERT_VALUE_LENGTH = 512, Config;
|
|
4103
4126
|
var init_src7 = __esm(() => {
|
|
4104
4127
|
init_src2();
|
|
@@ -4301,14 +4324,10 @@ var init_src7 = __esm(() => {
|
|
|
4301
4324
|
};
|
|
4302
4325
|
}
|
|
4303
4326
|
getClientRouting() {
|
|
4304
|
-
|
|
4305
|
-
|
|
4306
|
-
|
|
4307
|
-
|
|
4308
|
-
...client2?.proxy_key_file && {
|
|
4309
|
-
proxyKeyFile: client2.proxy_key_file
|
|
4310
|
-
}
|
|
4311
|
-
};
|
|
4327
|
+
return clientRouting(this.data.client);
|
|
4328
|
+
}
|
|
4329
|
+
setClientRoutingEnabled(enabled) {
|
|
4330
|
+
this.persistStrictly("client", { ...this.data.client, enabled });
|
|
4312
4331
|
}
|
|
4313
4332
|
getBlockWhenAllFull() {
|
|
4314
4333
|
return this.data.block_when_all_full !== false;
|
package/package.json
CHANGED