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.
Files changed (152) hide show
  1. package/README.md +2 -2
  2. package/dist/cli.compile-check.js +1 -0
  3. package/dist/cli.d.ts +1 -0
  4. package/dist/cli.js +50 -13
  5. package/dist/error-report.js +32 -3
  6. package/dist/human-in-loop/approval-tasks.d.ts +1 -0
  7. package/dist/human-in-loop/approval-tasks.js +7 -5
  8. package/dist/human-in-loop/approvals-commands.js +51 -8
  9. package/dist/human-in-loop/runner.js +24 -19
  10. package/dist/human-in-loop/state-machine.d.ts +3 -3
  11. package/dist/human-in-loop/state-machine.js +13 -5
  12. package/dist/index.d.ts +5 -0
  13. package/dist/index.js +6 -1
  14. package/dist/mcp-proxy.js +85 -19
  15. package/dist/mcp.compile-check.js +1 -0
  16. package/dist/mcp.d.ts +1 -0
  17. package/dist/mcp.js +50 -8
  18. package/dist/renderer.js +119 -13
  19. package/dist/sdk.compile-check.js +1 -0
  20. package/dist/sdk.d.ts +1 -0
  21. package/dist/sdk.js +56 -11
  22. package/node_modules/@poe-code/agent-defs/dist/registry.d.ts +1 -1
  23. package/node_modules/@poe-code/agent-defs/dist/registry.js +22 -11
  24. package/node_modules/@poe-code/agent-defs/package.json +1 -1
  25. package/node_modules/@poe-code/agent-human-in-loop/dist/providers/osascript-script.js +5 -1
  26. package/node_modules/@poe-code/agent-human-in-loop/dist/providers/osascript.js +1 -1
  27. package/node_modules/@poe-code/agent-human-in-loop/package.json +1 -1
  28. package/node_modules/@poe-code/agent-mcp-config/dist/apply.d.ts +1 -1
  29. package/node_modules/@poe-code/agent-mcp-config/dist/apply.js +41 -92
  30. package/node_modules/@poe-code/agent-mcp-config/dist/configs.js +4 -1
  31. package/node_modules/@poe-code/agent-mcp-config/dist/shapes.d.ts +14 -2
  32. package/node_modules/@poe-code/agent-mcp-config/dist/shapes.js +11 -4
  33. package/node_modules/@poe-code/agent-mcp-config/package.json +1 -1
  34. package/node_modules/@poe-code/config-mutations/dist/execution/apply-mutation.js +200 -22
  35. package/node_modules/@poe-code/config-mutations/dist/execution/path-utils.js +7 -1
  36. package/node_modules/@poe-code/config-mutations/dist/formats/index.js +1 -1
  37. package/node_modules/@poe-code/config-mutations/dist/formats/json.js +11 -7
  38. package/node_modules/@poe-code/config-mutations/dist/formats/object.d.ts +4 -0
  39. package/node_modules/@poe-code/config-mutations/dist/formats/object.js +27 -0
  40. package/node_modules/@poe-code/config-mutations/dist/formats/toml.js +12 -9
  41. package/node_modules/@poe-code/config-mutations/dist/formats/yaml.js +12 -9
  42. package/node_modules/@poe-code/config-mutations/dist/mutations/file-mutation.d.ts +11 -1
  43. package/node_modules/@poe-code/config-mutations/dist/mutations/file-mutation.js +10 -1
  44. package/node_modules/@poe-code/config-mutations/dist/testing/mock-fs.js +25 -1
  45. package/node_modules/@poe-code/config-mutations/dist/types.d.ts +12 -2
  46. package/node_modules/@poe-code/config-mutations/package.json +1 -1
  47. package/node_modules/@poe-code/design-system/dist/acp/components.js +3 -1
  48. package/node_modules/@poe-code/design-system/dist/components/browser.d.ts +1 -1
  49. package/node_modules/@poe-code/design-system/dist/components/browser.js +6 -1
  50. package/node_modules/@poe-code/design-system/dist/components/color.js +9 -8
  51. package/node_modules/@poe-code/design-system/dist/components/command-errors.js +3 -2
  52. package/node_modules/@poe-code/design-system/dist/components/detail-card.d.ts +22 -0
  53. package/node_modules/@poe-code/design-system/dist/components/detail-card.js +69 -0
  54. package/node_modules/@poe-code/design-system/dist/components/help-formatter.js +88 -11
  55. package/node_modules/@poe-code/design-system/dist/components/index.d.ts +1 -1
  56. package/node_modules/@poe-code/design-system/dist/components/index.js +1 -1
  57. package/node_modules/@poe-code/design-system/dist/components/table.d.ts +2 -0
  58. package/node_modules/@poe-code/design-system/dist/components/table.js +82 -5
  59. package/node_modules/@poe-code/design-system/dist/components/template.d.ts +4 -0
  60. package/node_modules/@poe-code/design-system/dist/components/template.js +198 -32
  61. package/node_modules/@poe-code/design-system/dist/components/text.js +29 -5
  62. package/node_modules/@poe-code/design-system/dist/dashboard/ansi.d.ts +2 -2
  63. package/node_modules/@poe-code/design-system/dist/dashboard/ansi.js +77 -32
  64. package/node_modules/@poe-code/design-system/dist/dashboard/buffer.js +28 -5
  65. package/node_modules/@poe-code/design-system/dist/dashboard/components/output-pane.js +45 -28
  66. package/node_modules/@poe-code/design-system/dist/dashboard/terminal-width.d.ts +4 -0
  67. package/node_modules/@poe-code/design-system/dist/dashboard/terminal-width.js +71 -0
  68. package/node_modules/@poe-code/design-system/dist/dashboard/types.d.ts +1 -0
  69. package/node_modules/@poe-code/design-system/dist/explorer/events.d.ts +6 -0
  70. package/node_modules/@poe-code/design-system/dist/explorer/reducer.js +32 -10
  71. package/node_modules/@poe-code/design-system/dist/explorer/render/detail.js +3 -0
  72. package/node_modules/@poe-code/design-system/dist/explorer/runtime.js +57 -6
  73. package/node_modules/@poe-code/design-system/dist/explorer/state.d.ts +1 -0
  74. package/node_modules/@poe-code/design-system/dist/explorer/state.js +12 -15
  75. package/node_modules/@poe-code/design-system/dist/index.d.ts +3 -1
  76. package/node_modules/@poe-code/design-system/dist/index.js +2 -1
  77. package/node_modules/@poe-code/design-system/dist/prompts/primitives/intro.js +2 -1
  78. package/node_modules/@poe-code/design-system/dist/prompts/primitives/log.js +8 -5
  79. package/node_modules/@poe-code/design-system/dist/prompts/primitives/note.js +1 -1
  80. package/node_modules/@poe-code/design-system/dist/static/menu.js +8 -2
  81. package/node_modules/@poe-code/design-system/dist/static/spinner.js +10 -4
  82. package/node_modules/@poe-code/design-system/dist/terminal-markdown/parser/frontmatter.js +9 -2
  83. package/node_modules/@poe-code/design-system/dist/terminal-markdown/renderer.js +19 -2
  84. package/node_modules/@poe-code/design-system/package.json +2 -1
  85. package/node_modules/@poe-code/process-runner/dist/docker/args.d.ts +1 -0
  86. package/node_modules/@poe-code/process-runner/dist/docker/args.js +11 -3
  87. package/node_modules/@poe-code/process-runner/dist/docker/docker-execution-env.js +377 -130
  88. package/node_modules/@poe-code/process-runner/dist/docker/docker-runner.js +78 -10
  89. package/node_modules/@poe-code/process-runner/dist/docker/env-file.d.ts +6 -0
  90. package/node_modules/@poe-code/process-runner/dist/docker/env-file.js +49 -0
  91. package/node_modules/@poe-code/process-runner/dist/host/host-execution-env.js +3 -2
  92. package/node_modules/@poe-code/process-runner/dist/host/host-runner.js +21 -5
  93. package/node_modules/@poe-code/process-runner/dist/index.d.ts +1 -0
  94. package/node_modules/@poe-code/process-runner/dist/index.js +1 -0
  95. package/node_modules/@poe-code/process-runner/dist/testing/mock-runner.js +30 -8
  96. package/node_modules/@poe-code/process-runner/dist/types.d.ts +6 -0
  97. package/node_modules/@poe-code/process-runner/dist/workspace-transfer.d.ts +61 -0
  98. package/node_modules/@poe-code/process-runner/dist/workspace-transfer.js +503 -0
  99. package/node_modules/@poe-code/process-runner/package.json +1 -1
  100. package/node_modules/@poe-code/task-list/README.md +0 -2
  101. package/node_modules/@poe-code/task-list/dist/backends/gh-issues-client.js +3 -0
  102. package/node_modules/@poe-code/task-list/dist/backends/gh-issues-sync.js +89 -59
  103. package/node_modules/@poe-code/task-list/dist/backends/gh-issues.d.ts +9 -3
  104. package/node_modules/@poe-code/task-list/dist/backends/gh-issues.js +460 -99
  105. package/node_modules/@poe-code/task-list/dist/backends/markdown-dir.js +156 -154
  106. package/node_modules/@poe-code/task-list/dist/backends/utils.d.ts +2 -0
  107. package/node_modules/@poe-code/task-list/dist/backends/utils.js +79 -0
  108. package/node_modules/@poe-code/task-list/dist/backends/yaml-file.js +120 -132
  109. package/node_modules/@poe-code/task-list/dist/index.d.ts +3 -1
  110. package/node_modules/@poe-code/task-list/dist/index.js +2 -0
  111. package/node_modules/@poe-code/task-list/dist/move.d.ts +2 -0
  112. package/node_modules/@poe-code/task-list/dist/move.js +215 -0
  113. package/node_modules/@poe-code/task-list/dist/open.js +3 -4
  114. package/node_modules/@poe-code/task-list/dist/state-machine.js +3 -1
  115. package/node_modules/@poe-code/task-list/dist/state.js +9 -0
  116. package/node_modules/@poe-code/task-list/dist/types.d.ts +48 -13
  117. package/node_modules/@poe-code/task-list/package.json +1 -2
  118. package/node_modules/auth-store/dist/create-secret-store.js +4 -1
  119. package/node_modules/auth-store/dist/encrypted-file-store.d.ts +8 -0
  120. package/node_modules/auth-store/dist/encrypted-file-store.js +104 -8
  121. package/node_modules/auth-store/dist/index.d.ts +1 -1
  122. package/node_modules/auth-store/dist/keychain-store.d.ts +4 -1
  123. package/node_modules/auth-store/dist/keychain-store.js +18 -16
  124. package/node_modules/auth-store/dist/provider-store.d.ts +5 -1
  125. package/node_modules/auth-store/dist/provider-store.js +55 -7
  126. package/node_modules/auth-store/dist/types.d.ts +3 -1
  127. package/node_modules/auth-store/package.json +2 -1
  128. package/node_modules/mcp-oauth/dist/client/default-oauth-client-provider.js +46 -15
  129. package/node_modules/mcp-oauth/dist/client/loopback-authorization.js +49 -12
  130. package/node_modules/mcp-oauth/dist/client/token-endpoint.js +6 -1
  131. package/node_modules/mcp-oauth/dist/server/jwks-token-verifier.js +1 -1
  132. package/node_modules/mcp-oauth/package.json +1 -0
  133. package/node_modules/tiny-mcp-client/.turbo/turbo-build.log +1 -1
  134. package/node_modules/tiny-mcp-client/dist/internal.d.ts +9 -4
  135. package/node_modules/tiny-mcp-client/dist/internal.js +244 -66
  136. package/node_modules/tiny-mcp-client/dist/oauth-discovery.d.ts +1 -1
  137. package/node_modules/tiny-mcp-client/dist/oauth-discovery.js +4 -7
  138. package/node_modules/tiny-mcp-client/package.json +2 -1
  139. package/node_modules/tiny-mcp-client/src/http-oauth.integration.test.ts +1 -1
  140. package/node_modules/tiny-mcp-client/src/http-oauth.test.ts +46 -0
  141. package/node_modules/tiny-mcp-client/src/internal.ts +287 -76
  142. package/node_modules/tiny-mcp-client/src/mcp-client-sdk.test.ts +32 -0
  143. package/node_modules/tiny-mcp-client/src/mcp-client-tiny-stdio-test-server-tools.test.ts +1 -1
  144. package/node_modules/tiny-mcp-client/src/oauth-discovery.ts +5 -10
  145. package/node_modules/tiny-mcp-client/src/transports.test.ts +588 -6
  146. package/package.json +10 -12
  147. package/node_modules/@poe-code/file-lock/README.md +0 -52
  148. package/node_modules/@poe-code/file-lock/dist/index.d.ts +0 -1
  149. package/node_modules/@poe-code/file-lock/dist/index.js +0 -1
  150. package/node_modules/@poe-code/file-lock/dist/lock.d.ts +0 -27
  151. package/node_modules/@poe-code/file-lock/dist/lock.js +0 -203
  152. 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
- export const allAgents = [
3
- claudeCodeAgent,
4
- claudeDesktopAgent,
5
- codexAgent,
6
- geminiCliAgent,
7
- openCodeAgent,
8
- kimiAgent,
9
- gooseAgent,
10
- poeAgentAgent
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
  }
@@ -12,7 +12,7 @@
12
12
  }
13
13
  },
14
14
  "scripts": {
15
- "build": "tsc"
15
+ "build": "node ../../scripts/guard-package-dist.mjs && tsc"
16
16
  },
17
17
  "files": [
18
18
  "dist"
@@ -20,7 +20,11 @@ on error number -128
20
20
  end try`;
21
21
  }
22
22
  export function parseStdout(out) {
23
- const value = out.replace(/\n+$/u, "");
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 `${message}\n${stderr}`.includes("(-128)");
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";
@@ -12,7 +12,7 @@
12
12
  }
13
13
  },
14
14
  "scripts": {
15
- "build": "tsc",
15
+ "build": "node ../../scripts/guard-package-dist.mjs && tsc",
16
16
  "test": "cd ../.. && vitest run --passWithNoTests packages/agent-human-in-loop",
17
17
  "typecheck": "tsc --noEmit",
18
18
  "dev": "tsx example.ts"
@@ -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, serverName: string, options: ApplyOptions): Promise<void>;
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 { parse as parseYaml, stringify as stringifyYaml } from "yaml";
3
- import { runMutations, configMutation, fileMutation, readFileIfExists } from "@poe-code/config-mutations";
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
- return isConfigObject(value) ? value : {};
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(parsed)) {
46
- throw new Error("Expected YAML document to be an object.");
23
+ if (!isConfigObject(value)) {
24
+ throw new Error(`Expected ${configKey} to be an object.`);
47
25
  }
48
- return parsed;
26
+ return value;
49
27
  }
50
- function serializeYamlDocument(document) {
51
- const serialized = stringifyYaml(document);
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]: shaped
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, serverName, options) {
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
- if (config.format === "yaml") {
150
- const document = await readYamlConfig(configPath, options);
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.prune({
93
+ configMutation.transform({
160
94
  target: configPath,
161
95
  format: config.format,
162
- shape: {
163
- [config.configKey]: {
164
- [serverName]: {}
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 OpencodeShapeOutput {
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
- command: entry.config.url
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: "local",
49
- command: [entry.config.url],
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) {
@@ -12,7 +12,7 @@
12
12
  }
13
13
  },
14
14
  "scripts": {
15
- "build": "tsc"
15
+ "build": "node ../../scripts/guard-package-dist.mjs && tsc"
16
16
  },
17
17
  "files": [
18
18
  "dist"