poe-code 3.0.273 → 3.0.274
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js
CHANGED
|
@@ -94861,6 +94861,31 @@ function getConfigDirectory(configPath) {
|
|
|
94861
94861
|
function isConfigObject6(value) {
|
|
94862
94862
|
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
94863
94863
|
}
|
|
94864
|
+
function assertNonEmptyString(value, message2) {
|
|
94865
|
+
if (typeof value !== "string" || value.trim().length === 0) {
|
|
94866
|
+
throw new Error(message2);
|
|
94867
|
+
}
|
|
94868
|
+
}
|
|
94869
|
+
function assertHttpUrl(value) {
|
|
94870
|
+
assertNonEmptyString(value, "MCP HTTP URL must be a valid http or https URL.");
|
|
94871
|
+
let parsed;
|
|
94872
|
+
try {
|
|
94873
|
+
parsed = new URL(value);
|
|
94874
|
+
} catch {
|
|
94875
|
+
throw new Error("MCP HTTP URL must be a valid http or https URL.");
|
|
94876
|
+
}
|
|
94877
|
+
if (parsed.protocol !== "http:" && parsed.protocol !== "https:") {
|
|
94878
|
+
throw new Error("MCP HTTP URL must be a valid http or https URL.");
|
|
94879
|
+
}
|
|
94880
|
+
}
|
|
94881
|
+
function validateServerEntry(server) {
|
|
94882
|
+
assertNonEmptyString(server.name, "MCP server name must be a non-empty string.");
|
|
94883
|
+
if (server.config.transport === "stdio") {
|
|
94884
|
+
assertNonEmptyString(server.config.command, "MCP stdio command must be a non-empty string.");
|
|
94885
|
+
return;
|
|
94886
|
+
}
|
|
94887
|
+
assertHttpUrl(server.config.url);
|
|
94888
|
+
}
|
|
94864
94889
|
function resolveServerMap(document, configKey) {
|
|
94865
94890
|
const value = document[configKey];
|
|
94866
94891
|
if (value === void 0) {
|
|
@@ -94878,12 +94903,15 @@ async function configure2(agentId, server, options) {
|
|
|
94878
94903
|
if (!isSupported(agentId)) {
|
|
94879
94904
|
throw new UnsupportedAgentError2(agentId);
|
|
94880
94905
|
}
|
|
94906
|
+
validateServerEntry(server);
|
|
94881
94907
|
const config2 = getAgentConfig3(agentId);
|
|
94882
94908
|
const configPath = resolveConfigPath2(config2, options.platform);
|
|
94883
94909
|
const shapeTransformer = getShapeTransformer(config2.shape);
|
|
94884
94910
|
const shaped = shapeTransformer(server);
|
|
94911
|
+
const enabledServer = { ...server, enabled: true };
|
|
94912
|
+
const enabledShaped = shapeTransformer(enabledServer);
|
|
94885
94913
|
if (shaped === void 0) {
|
|
94886
|
-
await unconfigure2(agentId,
|
|
94914
|
+
await unconfigure2(agentId, enabledServer, options);
|
|
94887
94915
|
return;
|
|
94888
94916
|
}
|
|
94889
94917
|
const configDir = getConfigDirectory(configPath);
|
|
@@ -94902,10 +94930,11 @@ async function configure2(agentId, server, options) {
|
|
|
94902
94930
|
const servers = resolveServerMap(document, config2.configKey);
|
|
94903
94931
|
const existingServer = Object.hasOwn(servers, server.name) ? servers[server.name] : void 0;
|
|
94904
94932
|
const shapedServer = shaped;
|
|
94933
|
+
const enabledShapedServer = enabledShaped;
|
|
94905
94934
|
if (existingServer !== void 0 && isDeepStrictEqual(existingServer, shapedServer)) {
|
|
94906
94935
|
return { changed: false, content: document };
|
|
94907
94936
|
}
|
|
94908
|
-
if (existingServer !== void 0 &&
|
|
94937
|
+
if (existingServer !== void 0 && (enabledShapedServer === void 0 || !isDeepStrictEqual(existingServer, enabledShapedServer))) {
|
|
94909
94938
|
throw new Error(
|
|
94910
94939
|
`MCP server "${server.name}" already exists with different configuration in ${configPath}.`
|
|
94911
94940
|
);
|
|
@@ -136445,7 +136474,7 @@ var init_package2 = __esm({
|
|
|
136445
136474
|
"package.json"() {
|
|
136446
136475
|
package_default2 = {
|
|
136447
136476
|
name: "poe-code",
|
|
136448
|
-
version: "3.0.
|
|
136477
|
+
version: "3.0.274",
|
|
136449
136478
|
description: "CLI tool to configure Poe API for developer workflows.",
|
|
136450
136479
|
type: "module",
|
|
136451
136480
|
main: "./dist/index.js",
|