toolcraft 0.0.23 → 0.0.25
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 +2 -2
- package/dist/cli.compile-check.js +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +50 -13
- package/dist/error-report.js +32 -3
- package/dist/human-in-loop/approval-tasks.d.ts +1 -0
- package/dist/human-in-loop/approval-tasks.js +7 -5
- package/dist/human-in-loop/approvals-commands.js +51 -8
- package/dist/human-in-loop/runner.js +24 -19
- package/dist/human-in-loop/state-machine.d.ts +3 -3
- package/dist/human-in-loop/state-machine.js +13 -5
- package/dist/index.d.ts +5 -0
- package/dist/index.js +6 -1
- package/dist/mcp-proxy.js +85 -19
- package/dist/mcp.compile-check.js +1 -0
- package/dist/mcp.d.ts +1 -0
- package/dist/mcp.js +50 -8
- package/dist/renderer.js +119 -13
- package/dist/sdk.compile-check.js +1 -0
- package/dist/sdk.d.ts +1 -0
- package/dist/sdk.js +56 -11
- package/node_modules/@poe-code/agent-defs/dist/registry.d.ts +1 -1
- package/node_modules/@poe-code/agent-defs/dist/registry.js +22 -11
- package/node_modules/@poe-code/agent-defs/package.json +1 -1
- package/node_modules/@poe-code/agent-human-in-loop/dist/providers/osascript-script.js +5 -1
- package/node_modules/@poe-code/agent-human-in-loop/dist/providers/osascript.js +1 -1
- package/node_modules/@poe-code/agent-human-in-loop/package.json +1 -1
- package/node_modules/@poe-code/agent-mcp-config/dist/apply.d.ts +1 -1
- package/node_modules/@poe-code/agent-mcp-config/dist/apply.js +41 -92
- package/node_modules/@poe-code/agent-mcp-config/dist/configs.js +4 -1
- package/node_modules/@poe-code/agent-mcp-config/dist/shapes.d.ts +14 -2
- package/node_modules/@poe-code/agent-mcp-config/dist/shapes.js +11 -4
- package/node_modules/@poe-code/agent-mcp-config/package.json +1 -1
- package/node_modules/@poe-code/config-mutations/dist/execution/apply-mutation.js +200 -22
- package/node_modules/@poe-code/config-mutations/dist/execution/path-utils.js +7 -1
- package/node_modules/@poe-code/config-mutations/dist/formats/index.js +1 -1
- package/node_modules/@poe-code/config-mutations/dist/formats/json.js +11 -7
- package/node_modules/@poe-code/config-mutations/dist/formats/object.d.ts +4 -0
- package/node_modules/@poe-code/config-mutations/dist/formats/object.js +27 -0
- package/node_modules/@poe-code/config-mutations/dist/formats/toml.js +12 -9
- package/node_modules/@poe-code/config-mutations/dist/formats/yaml.js +12 -9
- package/node_modules/@poe-code/config-mutations/dist/mutations/file-mutation.d.ts +11 -1
- package/node_modules/@poe-code/config-mutations/dist/mutations/file-mutation.js +10 -1
- package/node_modules/@poe-code/config-mutations/dist/testing/mock-fs.js +25 -1
- package/node_modules/@poe-code/config-mutations/dist/types.d.ts +12 -2
- package/node_modules/@poe-code/config-mutations/package.json +1 -1
- package/node_modules/@poe-code/design-system/dist/acp/components.js +3 -1
- package/node_modules/@poe-code/design-system/dist/components/browser.d.ts +1 -1
- package/node_modules/@poe-code/design-system/dist/components/browser.js +6 -1
- package/node_modules/@poe-code/design-system/dist/components/color.js +9 -8
- package/node_modules/@poe-code/design-system/dist/components/command-errors.js +3 -2
- package/node_modules/@poe-code/design-system/dist/components/detail-card.d.ts +22 -0
- package/node_modules/@poe-code/design-system/dist/components/detail-card.js +69 -0
- package/node_modules/@poe-code/design-system/dist/components/help-formatter.js +88 -11
- package/node_modules/@poe-code/design-system/dist/components/index.d.ts +1 -1
- package/node_modules/@poe-code/design-system/dist/components/index.js +1 -1
- package/node_modules/@poe-code/design-system/dist/components/table.d.ts +2 -0
- package/node_modules/@poe-code/design-system/dist/components/table.js +82 -5
- package/node_modules/@poe-code/design-system/dist/components/template.d.ts +4 -0
- package/node_modules/@poe-code/design-system/dist/components/template.js +198 -32
- package/node_modules/@poe-code/design-system/dist/components/text.js +29 -5
- package/node_modules/@poe-code/design-system/dist/dashboard/ansi.d.ts +2 -2
- package/node_modules/@poe-code/design-system/dist/dashboard/ansi.js +77 -32
- package/node_modules/@poe-code/design-system/dist/dashboard/buffer.js +28 -5
- package/node_modules/@poe-code/design-system/dist/dashboard/components/output-pane.js +45 -28
- package/node_modules/@poe-code/design-system/dist/dashboard/terminal-width.d.ts +4 -0
- package/node_modules/@poe-code/design-system/dist/dashboard/terminal-width.js +71 -0
- package/node_modules/@poe-code/design-system/dist/dashboard/types.d.ts +1 -0
- package/node_modules/@poe-code/design-system/dist/explorer/events.d.ts +6 -0
- package/node_modules/@poe-code/design-system/dist/explorer/reducer.js +32 -10
- package/node_modules/@poe-code/design-system/dist/explorer/render/detail.js +3 -0
- package/node_modules/@poe-code/design-system/dist/explorer/runtime.js +57 -6
- package/node_modules/@poe-code/design-system/dist/explorer/state.d.ts +1 -0
- package/node_modules/@poe-code/design-system/dist/explorer/state.js +12 -15
- package/node_modules/@poe-code/design-system/dist/index.d.ts +3 -1
- package/node_modules/@poe-code/design-system/dist/index.js +2 -1
- package/node_modules/@poe-code/design-system/dist/prompts/primitives/intro.js +2 -1
- package/node_modules/@poe-code/design-system/dist/prompts/primitives/log.js +8 -5
- package/node_modules/@poe-code/design-system/dist/prompts/primitives/note.js +1 -1
- package/node_modules/@poe-code/design-system/dist/static/menu.js +8 -2
- package/node_modules/@poe-code/design-system/dist/static/spinner.js +10 -4
- package/node_modules/@poe-code/design-system/dist/terminal-markdown/parser/frontmatter.js +9 -2
- package/node_modules/@poe-code/design-system/dist/terminal-markdown/renderer.js +19 -2
- package/node_modules/@poe-code/design-system/package.json +2 -1
- package/node_modules/@poe-code/process-runner/dist/docker/args.d.ts +1 -0
- package/node_modules/@poe-code/process-runner/dist/docker/args.js +11 -3
- package/node_modules/@poe-code/process-runner/dist/docker/docker-execution-env.js +377 -130
- package/node_modules/@poe-code/process-runner/dist/docker/docker-runner.js +78 -10
- package/node_modules/@poe-code/process-runner/dist/docker/env-file.d.ts +6 -0
- package/node_modules/@poe-code/process-runner/dist/docker/env-file.js +49 -0
- package/node_modules/@poe-code/process-runner/dist/host/host-execution-env.js +3 -2
- package/node_modules/@poe-code/process-runner/dist/host/host-runner.js +21 -5
- package/node_modules/@poe-code/process-runner/dist/index.d.ts +1 -0
- package/node_modules/@poe-code/process-runner/dist/index.js +1 -0
- package/node_modules/@poe-code/process-runner/dist/testing/mock-runner.js +30 -8
- package/node_modules/@poe-code/process-runner/dist/types.d.ts +6 -0
- package/node_modules/@poe-code/process-runner/dist/workspace-transfer.d.ts +61 -0
- package/node_modules/@poe-code/process-runner/dist/workspace-transfer.js +503 -0
- package/node_modules/@poe-code/process-runner/package.json +1 -1
- package/node_modules/@poe-code/task-list/README.md +0 -2
- package/node_modules/@poe-code/task-list/dist/backends/gh-issues-client.js +3 -0
- package/node_modules/@poe-code/task-list/dist/backends/gh-issues-sync.js +89 -59
- package/node_modules/@poe-code/task-list/dist/backends/gh-issues.d.ts +9 -3
- package/node_modules/@poe-code/task-list/dist/backends/gh-issues.js +460 -99
- package/node_modules/@poe-code/task-list/dist/backends/markdown-dir.js +156 -154
- package/node_modules/@poe-code/task-list/dist/backends/utils.d.ts +2 -0
- package/node_modules/@poe-code/task-list/dist/backends/utils.js +79 -0
- package/node_modules/@poe-code/task-list/dist/backends/yaml-file.js +120 -132
- package/node_modules/@poe-code/task-list/dist/index.d.ts +3 -1
- package/node_modules/@poe-code/task-list/dist/index.js +2 -0
- package/node_modules/@poe-code/task-list/dist/move.d.ts +2 -0
- package/node_modules/@poe-code/task-list/dist/move.js +215 -0
- package/node_modules/@poe-code/task-list/dist/open.js +3 -4
- package/node_modules/@poe-code/task-list/dist/state-machine.js +3 -1
- package/node_modules/@poe-code/task-list/dist/state.js +9 -0
- package/node_modules/@poe-code/task-list/dist/types.d.ts +48 -13
- package/node_modules/@poe-code/task-list/package.json +1 -2
- package/node_modules/auth-store/dist/create-secret-store.js +4 -1
- package/node_modules/auth-store/dist/encrypted-file-store.d.ts +8 -0
- package/node_modules/auth-store/dist/encrypted-file-store.js +104 -8
- package/node_modules/auth-store/dist/index.d.ts +1 -1
- package/node_modules/auth-store/dist/keychain-store.d.ts +4 -1
- package/node_modules/auth-store/dist/keychain-store.js +18 -16
- package/node_modules/auth-store/dist/provider-store.d.ts +5 -1
- package/node_modules/auth-store/dist/provider-store.js +55 -7
- package/node_modules/auth-store/dist/types.d.ts +3 -1
- package/node_modules/auth-store/package.json +2 -1
- package/node_modules/mcp-oauth/dist/client/default-oauth-client-provider.js +46 -15
- package/node_modules/mcp-oauth/dist/client/loopback-authorization.js +49 -12
- package/node_modules/mcp-oauth/dist/client/token-endpoint.js +6 -1
- package/node_modules/mcp-oauth/dist/server/jwks-token-verifier.js +1 -1
- package/node_modules/mcp-oauth/package.json +1 -0
- package/node_modules/tiny-mcp-client/.turbo/turbo-build.log +1 -1
- package/node_modules/tiny-mcp-client/dist/internal.d.ts +9 -4
- package/node_modules/tiny-mcp-client/dist/internal.js +244 -66
- package/node_modules/tiny-mcp-client/dist/oauth-discovery.d.ts +1 -1
- package/node_modules/tiny-mcp-client/dist/oauth-discovery.js +4 -7
- package/node_modules/tiny-mcp-client/package.json +2 -1
- package/node_modules/tiny-mcp-client/src/http-oauth.integration.test.ts +1 -1
- package/node_modules/tiny-mcp-client/src/http-oauth.test.ts +46 -0
- package/node_modules/tiny-mcp-client/src/internal.ts +287 -76
- package/node_modules/tiny-mcp-client/src/mcp-client-sdk.test.ts +32 -0
- package/node_modules/tiny-mcp-client/src/mcp-client-tiny-stdio-test-server-tools.test.ts +1 -1
- package/node_modules/tiny-mcp-client/src/oauth-discovery.ts +5 -10
- package/node_modules/tiny-mcp-client/src/transports.test.ts +588 -6
- package/package.json +10 -12
- package/node_modules/@poe-code/file-lock/README.md +0 -52
- package/node_modules/@poe-code/file-lock/dist/index.d.ts +0 -1
- package/node_modules/@poe-code/file-lock/dist/index.js +0 -1
- package/node_modules/@poe-code/file-lock/dist/lock.d.ts +0 -27
- package/node_modules/@poe-code/file-lock/dist/lock.js +0 -203
- package/node_modules/@poe-code/file-lock/package.json +0 -23
|
@@ -1,14 +1,25 @@
|
|
|
1
1
|
import { claudeCodeAgent, claudeDesktopAgent, codexAgent, geminiCliAgent, openCodeAgent, kimiAgent, gooseAgent, poeAgentAgent } from "./agents/index.js";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
function freezeAgent(agent) {
|
|
3
|
+
if (agent.aliases !== undefined) {
|
|
4
|
+
Object.freeze(agent.aliases);
|
|
5
|
+
}
|
|
6
|
+
if (agent.apiShapes !== undefined) {
|
|
7
|
+
Object.freeze(agent.apiShapes);
|
|
8
|
+
}
|
|
9
|
+
Object.freeze(agent.branding.colors);
|
|
10
|
+
Object.freeze(agent.branding);
|
|
11
|
+
return Object.freeze(agent);
|
|
12
|
+
}
|
|
13
|
+
export const allAgents = Object.freeze([
|
|
14
|
+
freezeAgent(claudeCodeAgent),
|
|
15
|
+
freezeAgent(claudeDesktopAgent),
|
|
16
|
+
freezeAgent(codexAgent),
|
|
17
|
+
freezeAgent(geminiCliAgent),
|
|
18
|
+
freezeAgent(openCodeAgent),
|
|
19
|
+
freezeAgent(kimiAgent),
|
|
20
|
+
freezeAgent(gooseAgent),
|
|
21
|
+
freezeAgent(poeAgentAgent)
|
|
22
|
+
]);
|
|
12
23
|
const lookup = new Map();
|
|
13
24
|
for (const agent of allAgents) {
|
|
14
25
|
const values = [agent.id, agent.name, ...(agent.aliases ?? [])];
|
|
@@ -23,5 +34,5 @@ export function resolveAgentId(input) {
|
|
|
23
34
|
if (!input) {
|
|
24
35
|
return undefined;
|
|
25
36
|
}
|
|
26
|
-
return lookup.get(input.toLowerCase());
|
|
37
|
+
return lookup.get(input.trim().toLowerCase());
|
|
27
38
|
}
|
|
@@ -20,7 +20,11 @@ on error number -128
|
|
|
20
20
|
end try`;
|
|
21
21
|
}
|
|
22
22
|
export function parseStdout(out) {
|
|
23
|
-
const value = out.
|
|
23
|
+
const value = out.endsWith("\r\n")
|
|
24
|
+
? out.slice(0, -2)
|
|
25
|
+
: out.endsWith("\n")
|
|
26
|
+
? out.slice(0, -1)
|
|
27
|
+
: out;
|
|
24
28
|
switch (value) {
|
|
25
29
|
case "Approve":
|
|
26
30
|
case "APPROVED":
|
|
@@ -5,7 +5,7 @@ const execFileAsync = promisify(execFile);
|
|
|
5
5
|
function isUserCanceled(error) {
|
|
6
6
|
const message = error instanceof Error ? error.message : error === undefined ? "" : String(error);
|
|
7
7
|
const stderr = error?.stderr ?? "";
|
|
8
|
-
return
|
|
8
|
+
return [message, stderr].some((value) => value.includes("User canceled. (-128)"));
|
|
9
9
|
}
|
|
10
10
|
export function osascriptProvider(options = {}) {
|
|
11
11
|
const title = options.title ?? "Approval needed";
|
|
@@ -3,4 +3,4 @@ export declare class UnsupportedAgentError extends Error {
|
|
|
3
3
|
constructor(agentId: string);
|
|
4
4
|
}
|
|
5
5
|
export declare function configure(agentId: string, server: McpServerEntry, options: ApplyOptions): Promise<void>;
|
|
6
|
-
export declare function unconfigure(agentId: string,
|
|
6
|
+
export declare function unconfigure(agentId: string, server: string | McpServerEntry, options: ApplyOptions): Promise<void>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
-
import {
|
|
3
|
-
import { runMutations, configMutation, fileMutation
|
|
2
|
+
import { isDeepStrictEqual } from "node:util";
|
|
3
|
+
import { runMutations, configMutation, fileMutation } from "@poe-code/config-mutations";
|
|
4
4
|
import { getAgentConfig, resolveConfigPath, isSupported } from "./configs.js";
|
|
5
5
|
import { getShapeTransformer } from "./shapes.js";
|
|
6
6
|
function getConfigDirectory(configPath) {
|
|
@@ -17,75 +17,16 @@ function isConfigObject(value) {
|
|
|
17
17
|
}
|
|
18
18
|
function resolveServerMap(document, configKey) {
|
|
19
19
|
const value = document[configKey];
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
function mergeServerMap(document, configKey, servers) {
|
|
23
|
-
return { ...document, [configKey]: servers };
|
|
24
|
-
}
|
|
25
|
-
function expandHomePath(configPath, homeDir) {
|
|
26
|
-
if (!configPath.startsWith("~")) {
|
|
27
|
-
return configPath;
|
|
28
|
-
}
|
|
29
|
-
if (configPath === "~") {
|
|
30
|
-
return homeDir;
|
|
31
|
-
}
|
|
32
|
-
if (configPath.startsWith("~/")) {
|
|
33
|
-
return path.join(homeDir, configPath.slice(2));
|
|
34
|
-
}
|
|
35
|
-
return path.join(homeDir, configPath.slice(1));
|
|
36
|
-
}
|
|
37
|
-
function parseYamlDocument(content) {
|
|
38
|
-
if (content.trim() === "") {
|
|
39
|
-
return {};
|
|
40
|
-
}
|
|
41
|
-
const parsed = parseYaml(content);
|
|
42
|
-
if (parsed === null || parsed === undefined) {
|
|
20
|
+
if (value === undefined) {
|
|
43
21
|
return {};
|
|
44
22
|
}
|
|
45
|
-
if (!isConfigObject(
|
|
46
|
-
throw new Error(
|
|
23
|
+
if (!isConfigObject(value)) {
|
|
24
|
+
throw new Error(`Expected ${configKey} to be an object.`);
|
|
47
25
|
}
|
|
48
|
-
return
|
|
26
|
+
return value;
|
|
49
27
|
}
|
|
50
|
-
function
|
|
51
|
-
|
|
52
|
-
return serialized.endsWith("\n") ? serialized : `${serialized}\n`;
|
|
53
|
-
}
|
|
54
|
-
async function readYamlConfig(configPath, options) {
|
|
55
|
-
const absolutePath = expandHomePath(configPath, options.homeDir);
|
|
56
|
-
const existingContent = await readFileIfExists(options.fs, absolutePath);
|
|
57
|
-
if (existingContent === null) {
|
|
58
|
-
return {};
|
|
59
|
-
}
|
|
60
|
-
return parseYamlDocument(existingContent);
|
|
61
|
-
}
|
|
62
|
-
async function writeYamlConfig(configPath, document, options) {
|
|
63
|
-
if (options.dryRun) {
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
const absolutePath = expandHomePath(configPath, options.homeDir);
|
|
67
|
-
const configDir = path.dirname(absolutePath);
|
|
68
|
-
await options.fs.mkdir(configDir, { recursive: true });
|
|
69
|
-
await options.fs.writeFile(absolutePath, serializeYamlDocument(document), {
|
|
70
|
-
encoding: "utf8"
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
function removeServer(document, configKey, serverName) {
|
|
74
|
-
const servers = resolveServerMap(document, configKey);
|
|
75
|
-
if (!(serverName in servers)) {
|
|
76
|
-
return { changed: false, content: document };
|
|
77
|
-
}
|
|
78
|
-
const nextServers = { ...servers };
|
|
79
|
-
delete nextServers[serverName];
|
|
80
|
-
if (Object.keys(nextServers).length === 0) {
|
|
81
|
-
const nextDocument = { ...document };
|
|
82
|
-
delete nextDocument[configKey];
|
|
83
|
-
return { changed: true, content: nextDocument };
|
|
84
|
-
}
|
|
85
|
-
return {
|
|
86
|
-
changed: true,
|
|
87
|
-
content: mergeServerMap(document, configKey, nextServers)
|
|
88
|
-
};
|
|
28
|
+
function mergeServerMap(document, configKey, servers) {
|
|
29
|
+
return { ...document, [configKey]: servers };
|
|
89
30
|
}
|
|
90
31
|
export async function configure(agentId, server, options) {
|
|
91
32
|
if (!isSupported(agentId)) {
|
|
@@ -99,16 +40,6 @@ export async function configure(agentId, server, options) {
|
|
|
99
40
|
await unconfigure(agentId, server.name, options);
|
|
100
41
|
return;
|
|
101
42
|
}
|
|
102
|
-
if (config.format === "yaml") {
|
|
103
|
-
const document = await readYamlConfig(configPath, options);
|
|
104
|
-
const servers = resolveServerMap(document, config.configKey);
|
|
105
|
-
const nextDocument = mergeServerMap(document, config.configKey, {
|
|
106
|
-
...servers,
|
|
107
|
-
[server.name]: shaped
|
|
108
|
-
});
|
|
109
|
-
await writeYamlConfig(configPath, nextDocument, options);
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
43
|
const configDir = getConfigDirectory(configPath);
|
|
113
44
|
await runMutations([
|
|
114
45
|
fileMutation.ensureDirectory({
|
|
@@ -122,9 +53,19 @@ export async function configure(agentId, server, options) {
|
|
|
122
53
|
format: config.format,
|
|
123
54
|
transform: (document) => {
|
|
124
55
|
const servers = resolveServerMap(document, config.configKey);
|
|
56
|
+
const existingServer = Object.hasOwn(servers, server.name)
|
|
57
|
+
? servers[server.name]
|
|
58
|
+
: undefined;
|
|
59
|
+
const shapedServer = shaped;
|
|
60
|
+
if (existingServer !== undefined && isDeepStrictEqual(existingServer, shapedServer)) {
|
|
61
|
+
return { changed: false, content: document };
|
|
62
|
+
}
|
|
63
|
+
if (existingServer !== undefined && server.enabled !== false) {
|
|
64
|
+
throw new Error(`MCP server "${server.name}" already exists with different configuration in ${configPath}.`);
|
|
65
|
+
}
|
|
125
66
|
const newServers = {
|
|
126
67
|
...servers,
|
|
127
|
-
[server.name]:
|
|
68
|
+
[server.name]: shapedServer
|
|
128
69
|
};
|
|
129
70
|
return {
|
|
130
71
|
changed: true,
|
|
@@ -140,29 +81,37 @@ export async function configure(agentId, server, options) {
|
|
|
140
81
|
observers: options.observers
|
|
141
82
|
});
|
|
142
83
|
}
|
|
143
|
-
export async function unconfigure(agentId,
|
|
84
|
+
export async function unconfigure(agentId, server, options) {
|
|
144
85
|
if (!isSupported(agentId)) {
|
|
145
86
|
throw new UnsupportedAgentError(agentId);
|
|
146
87
|
}
|
|
147
88
|
const config = getAgentConfig(agentId);
|
|
148
89
|
const configPath = resolveConfigPath(config, options.platform);
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
const { changed, content } = removeServer(document, config.configKey, serverName);
|
|
152
|
-
if (!changed) {
|
|
153
|
-
return;
|
|
154
|
-
}
|
|
155
|
-
await writeYamlConfig(configPath, content, options);
|
|
156
|
-
return;
|
|
157
|
-
}
|
|
90
|
+
const serverName = typeof server === "string" ? server : server.name;
|
|
91
|
+
const expectedServer = typeof server === "string" ? undefined : getShapeTransformer(config.shape)(server);
|
|
158
92
|
await runMutations([
|
|
159
|
-
configMutation.
|
|
93
|
+
configMutation.transform({
|
|
160
94
|
target: configPath,
|
|
161
95
|
format: config.format,
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
96
|
+
transform: (document) => {
|
|
97
|
+
const servers = resolveServerMap(document, config.configKey);
|
|
98
|
+
if (!Object.hasOwn(servers, serverName)) {
|
|
99
|
+
return { changed: false, content: document };
|
|
100
|
+
}
|
|
101
|
+
if (expectedServer !== undefined && !isDeepStrictEqual(servers[serverName], expectedServer)) {
|
|
102
|
+
return { changed: false, content: document };
|
|
103
|
+
}
|
|
104
|
+
const newServers = { ...servers };
|
|
105
|
+
delete newServers[serverName];
|
|
106
|
+
if (Object.keys(newServers).length === 0) {
|
|
107
|
+
const newDocument = { ...document };
|
|
108
|
+
delete newDocument[config.configKey];
|
|
109
|
+
return { changed: true, content: newDocument };
|
|
165
110
|
}
|
|
111
|
+
return {
|
|
112
|
+
changed: true,
|
|
113
|
+
content: mergeServerMap(document, config.configKey, newServers)
|
|
114
|
+
};
|
|
166
115
|
},
|
|
167
116
|
label: `Remove ${serverName} from ${configPath}`
|
|
168
117
|
})
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { resolveAgentId } from "@poe-code/agent-defs";
|
|
2
|
+
function snapshotConfig(config) {
|
|
3
|
+
return { ...config };
|
|
4
|
+
}
|
|
2
5
|
const agentMcpConfigs = {
|
|
3
6
|
"claude-code": {
|
|
4
7
|
configFile: "~/.claude.json",
|
|
@@ -57,7 +60,7 @@ export function resolveAgentSupport(input, registry = agentMcpConfigs) {
|
|
|
57
60
|
if (!config) {
|
|
58
61
|
return { status: "unsupported", input, id: resolvedId };
|
|
59
62
|
}
|
|
60
|
-
return { status: "supported", input, id: resolvedId, config };
|
|
63
|
+
return { status: "supported", input, id: resolvedId, config: snapshotConfig(config) };
|
|
61
64
|
}
|
|
62
65
|
export function isSupported(agentId) {
|
|
63
66
|
return resolveAgentSupport(agentId).status === "supported";
|
|
@@ -5,12 +5,24 @@ export interface StandardShapeOutput {
|
|
|
5
5
|
args?: string[];
|
|
6
6
|
env?: Record<string, string>;
|
|
7
7
|
}
|
|
8
|
-
export interface
|
|
8
|
+
export interface StandardHttpShapeOutput {
|
|
9
|
+
type: "http";
|
|
10
|
+
url: string;
|
|
11
|
+
headers?: Record<string, string>;
|
|
12
|
+
}
|
|
13
|
+
export interface OpencodeLocalShapeOutput {
|
|
9
14
|
type: "local";
|
|
10
15
|
command: string[];
|
|
11
16
|
env?: Record<string, string>;
|
|
12
17
|
enabled: boolean;
|
|
13
18
|
}
|
|
19
|
+
export interface OpencodeRemoteShapeOutput {
|
|
20
|
+
type: "remote";
|
|
21
|
+
url: string;
|
|
22
|
+
headers?: Record<string, string>;
|
|
23
|
+
enabled: boolean;
|
|
24
|
+
}
|
|
25
|
+
export type OpencodeShapeOutput = OpencodeLocalShapeOutput | OpencodeRemoteShapeOutput;
|
|
14
26
|
export interface GooseStdioShapeOutput {
|
|
15
27
|
type: "stdio";
|
|
16
28
|
cmd: string;
|
|
@@ -23,7 +35,7 @@ export interface GooseHttpShapeOutput {
|
|
|
23
35
|
headers?: Record<string, string>;
|
|
24
36
|
}
|
|
25
37
|
export type GooseShapeOutput = GooseStdioShapeOutput | GooseHttpShapeOutput;
|
|
26
|
-
export type ShapeOutput = StandardShapeOutput | OpencodeShapeOutput | GooseShapeOutput;
|
|
38
|
+
export type ShapeOutput = StandardShapeOutput | StandardHttpShapeOutput | OpencodeShapeOutput | GooseShapeOutput;
|
|
27
39
|
export type ShapeTransformer = (entry: McpServerEntry) => ShapeOutput | undefined;
|
|
28
40
|
export declare function standardShape(entry: McpServerEntry): ShapeOutput | undefined;
|
|
29
41
|
export declare function opencodeShape(entry: McpServerEntry): OpencodeShapeOutput;
|
|
@@ -22,7 +22,11 @@ export function standardShape(entry) {
|
|
|
22
22
|
return undefined;
|
|
23
23
|
}
|
|
24
24
|
return {
|
|
25
|
-
|
|
25
|
+
type: "http",
|
|
26
|
+
url: entry.config.url,
|
|
27
|
+
...(entry.config.headers && Object.keys(entry.config.headers).length > 0
|
|
28
|
+
? { headers: entry.config.headers }
|
|
29
|
+
: {})
|
|
26
30
|
};
|
|
27
31
|
}
|
|
28
32
|
function transformStdioServerOpencode(config, enabled) {
|
|
@@ -45,9 +49,12 @@ export function opencodeShape(entry) {
|
|
|
45
49
|
return transformStdioServerOpencode(entry.config, enabled);
|
|
46
50
|
}
|
|
47
51
|
return {
|
|
48
|
-
type: "
|
|
49
|
-
|
|
50
|
-
enabled
|
|
52
|
+
type: "remote",
|
|
53
|
+
url: entry.config.url,
|
|
54
|
+
enabled,
|
|
55
|
+
...(entry.config.headers && Object.keys(entry.config.headers).length > 0
|
|
56
|
+
? { headers: entry.config.headers }
|
|
57
|
+
: {})
|
|
51
58
|
};
|
|
52
59
|
}
|
|
53
60
|
export function gooseShape(entry) {
|