@humain/terminal 0.0.3-beta.0 → 0.0.3-beta.2

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 (70) hide show
  1. package/CHANGELOG.md +13 -1
  2. package/dist/config.d.ts.map +1 -1
  3. package/dist/config.js +4 -3
  4. package/dist/config.js.map +1 -1
  5. package/dist/humain/mcp-adapter/vendor/CHANGELOG.md +13 -0
  6. package/dist/humain/mcp-adapter/vendor/README.md +4 -1
  7. package/dist/humain/mcp-adapter/vendor/agent-dir.ts +12 -4
  8. package/dist/humain/mcp-adapter/vendor/cli.js +25 -4
  9. package/dist/humain/mcp-adapter/vendor/config.ts +4 -4
  10. package/dist/humain/mcp-adapter/vendor/direct-tools.ts +18 -15
  11. package/dist/humain/mcp-adapter/vendor/index.bundle.mjs +416 -60
  12. package/dist/humain/mcp-adapter/vendor/mcp-setup-panel.ts +2 -1
  13. package/dist/humain/mcp-adapter/vendor/metadata-cache.ts +18 -8
  14. package/dist/humain/mcp-adapter/vendor/package.json +177 -176
  15. package/dist/humain/mcp-adapter/vendor/request-headers-command.ts +336 -0
  16. package/dist/humain/mcp-adapter/vendor/server-manager.ts +5 -0
  17. package/dist/humain/mcp-adapter/vendor/tool-metadata.ts +38 -18
  18. package/dist/humain/mcp-adapter/vendor/types.ts +93 -10
  19. package/dist/humain/web-access/vendor/auth-fetch.d.ts +13 -0
  20. package/dist/humain/web-access/vendor/auth-fetch.d.ts.map +1 -0
  21. package/dist/humain/web-access/vendor/auth-fetch.js +134 -0
  22. package/dist/humain/web-access/vendor/auth-fetch.js.map +1 -0
  23. package/dist/humain/web-access/vendor/chrome-cookies.d.ts +13 -0
  24. package/dist/humain/web-access/vendor/chrome-cookies.d.ts.map +1 -1
  25. package/dist/humain/web-access/vendor/chrome-cookies.js +106 -22
  26. package/dist/humain/web-access/vendor/chrome-cookies.js.map +1 -1
  27. package/dist/humain/web-access/vendor/curator-page.d.ts +1 -0
  28. package/dist/humain/web-access/vendor/curator-page.d.ts.map +1 -1
  29. package/dist/humain/web-access/vendor/curator-page.js +3 -1
  30. package/dist/humain/web-access/vendor/curator-page.js.map +1 -1
  31. package/dist/humain/web-access/vendor/curator-server.d.ts +1 -0
  32. package/dist/humain/web-access/vendor/curator-server.d.ts.map +1 -1
  33. package/dist/humain/web-access/vendor/curator-server.js +2 -0
  34. package/dist/humain/web-access/vendor/curator-server.js.map +1 -1
  35. package/dist/humain/web-access/vendor/extract.d.ts +2 -0
  36. package/dist/humain/web-access/vendor/extract.d.ts.map +1 -1
  37. package/dist/humain/web-access/vendor/extract.js +79 -17
  38. package/dist/humain/web-access/vendor/extract.js.map +1 -1
  39. package/dist/humain/web-access/vendor/fetch-params.d.ts +2 -0
  40. package/dist/humain/web-access/vendor/fetch-params.d.ts.map +1 -1
  41. package/dist/humain/web-access/vendor/fetch-params.js +17 -3
  42. package/dist/humain/web-access/vendor/fetch-params.js.map +1 -1
  43. package/dist/humain/web-access/vendor/firecrawl.d.ts +7 -0
  44. package/dist/humain/web-access/vendor/firecrawl.d.ts.map +1 -1
  45. package/dist/humain/web-access/vendor/firecrawl.js +141 -10
  46. package/dist/humain/web-access/vendor/firecrawl.js.map +1 -1
  47. package/dist/humain/web-access/vendor/gemini-search.d.ts +2 -2
  48. package/dist/humain/web-access/vendor/gemini-search.d.ts.map +1 -1
  49. package/dist/humain/web-access/vendor/gemini-search.js +22 -4
  50. package/dist/humain/web-access/vendor/gemini-search.js.map +1 -1
  51. package/dist/humain/web-access/vendor/index.d.ts.map +1 -1
  52. package/dist/humain/web-access/vendor/index.js +122 -48
  53. package/dist/humain/web-access/vendor/index.js.map +1 -1
  54. package/dist/humain/web-access/vendor/summary-review.d.ts +3 -1
  55. package/dist/humain/web-access/vendor/summary-review.d.ts.map +1 -1
  56. package/dist/humain/web-access/vendor/summary-review.js +6 -3
  57. package/dist/humain/web-access/vendor/summary-review.js.map +1 -1
  58. package/dist/humain/web-access/vendor/youtube-extract.d.ts.map +1 -1
  59. package/dist/humain/web-access/vendor/youtube-extract.js +2 -2
  60. package/dist/humain/web-access/vendor/youtube-extract.js.map +1 -1
  61. package/dist/utils/clipboard-image.d.ts.map +1 -1
  62. package/dist/utils/clipboard-image.js +2 -0
  63. package/dist/utils/clipboard-image.js.map +1 -1
  64. package/npm-shrinkwrap.json +7 -7
  65. package/package.json +6 -6
  66. package/src/humain/mcp-adapter/UPSTREAM.md +1 -1
  67. package/src/humain/mcp-adapter/upstream.json +3 -3
  68. package/src/humain/mcp-adapter/vendor/CHANGELOG.md +13 -0
  69. package/src/humain/web-access/UPSTREAM.md +1 -1
  70. package/src/humain/web-access/upstream.json +4 -4
@@ -11,7 +11,7 @@ import { formatSchema } from "./tool-metadata.ts";
11
11
  import { resolveMcpResultContent, transformMcpContent, transformMcpResourceContents } from "./tool-registrar.ts";
12
12
  import { guardMcpOutput, guardedMcpDetails, resolveMcpOutputGuardOptions } from "./mcp-output-guard.ts";
13
13
  import { maybeStartUiSession, summarizeUiSessionResult, type UiSessionRuntime } from "./ui-session.ts";
14
- import { formatToolName, getToolNameCandidates, isServerDisabled, isToolAllowed, resolveToolPrefix } from "./types.ts";
14
+ import { createToolSelectorCandidateIndex, formatToolName, getToolNameCandidates, isServerDisabled, isToolAllowed, resolveToolPrefix } from "./types.ts";
15
15
  import { isUiToolVisibleToModel } from "./ui-tool-visibility.ts";
16
16
  import { resourceNameToToolName } from "./resource-tools.ts";
17
17
  import { authenticate, supportsOAuth } from "./mcp-auth-flow.ts";
@@ -150,7 +150,10 @@ export function resolveDirectTools(
150
150
  if (!toolFilter) continue;
151
151
 
152
152
  const effectivePrefix = resolveToolPrefix(definition, prefix);
153
- const getOtherCurrentCandidates = (toolName: string): Set<string> => {
153
+ const hasToolFilters =
154
+ (Array.isArray(definition.includeTools) && definition.includeTools.length > 0) ||
155
+ (Array.isArray(definition.excludeTools) && definition.excludeTools.length > 0);
156
+ const selectorCandidateIndex = hasToolFilters ? (() => {
154
157
  const candidates = new Set<string>();
155
158
  for (const [otherServerName, otherDefinition] of Object.entries(config.mcpServers)) {
156
159
  const otherCache = cache.servers[otherServerName];
@@ -167,14 +170,13 @@ export function resolveDirectTools(
167
170
  }
168
171
  }
169
172
  }
170
- for (const candidate of getToolNameCandidates(toolName, serverName, effectivePrefix, false)) candidates.delete(candidate);
171
- return candidates;
172
- };
173
+ return createToolSelectorCandidateIndex(candidates);
174
+ })() : undefined;
173
175
 
174
176
  for (const tool of serverCache.tools ?? []) {
175
177
  if (!isUiToolVisibleToModel(tool.uiVisibility)) continue;
176
178
  if (toolFilter !== true && !toolFilter.includes(tool.name)) continue;
177
- if (!isToolAllowed(tool.name, serverName, effectivePrefix, definition.includeTools, definition.excludeTools, getOtherCurrentCandidates(tool.name))) continue;
179
+ if (!isToolAllowed(tool.name, serverName, effectivePrefix, definition.includeTools, definition.excludeTools, selectorCandidateIndex)) continue;
178
180
  const prefixedName = formatToolName(tool.name, serverName, effectivePrefix);
179
181
  if (BUILTIN_NAMES.has(prefixedName)) {
180
182
  console.warn(`MCP: skipping direct tool "${prefixedName}" (collides with builtin)`);
@@ -200,7 +202,7 @@ export function resolveDirectTools(
200
202
  for (const resource of serverCache.resources ?? []) {
201
203
  const baseName = `read_${resourceNameToToolName(resource.name)}`;
202
204
  if (toolFilter !== true && !toolFilter.includes(baseName)) continue;
203
- if (!isToolAllowed(baseName, serverName, effectivePrefix, definition.includeTools, definition.excludeTools, getOtherCurrentCandidates(baseName))) continue;
205
+ if (!isToolAllowed(baseName, serverName, effectivePrefix, definition.includeTools, definition.excludeTools, selectorCandidateIndex)) continue;
204
206
  const prefixedName = formatToolName(baseName, serverName, effectivePrefix);
205
207
  if (BUILTIN_NAMES.has(prefixedName)) {
206
208
  console.warn(`MCP: skipping direct resource tool "${prefixedName}" (collides with builtin)`);
@@ -222,7 +224,7 @@ export function resolveDirectTools(
222
224
  }
223
225
  }
224
226
 
225
- if (specs.length >= DIRECT_TOOLS_ADVISORY_THRESHOLD) {
227
+ if (config.settings?.warnOnLargeDirectTools !== false && specs.length >= DIRECT_TOOLS_ADVISORY_THRESHOLD) {
226
228
  console.warn(`MCP: ${specs.length} direct tools resolved. Each direct tool adds prompt context; README guidance recommends targeted sets of 5-20 tools and using the proxy or an explicit string[] when 75+ direct tools would be registered.`);
227
229
  }
228
230
 
@@ -255,8 +257,10 @@ export function buildProxyDescription(
255
257
  const cachedEntry = cache?.servers?.[serverName];
256
258
  const entry = cachedEntry && isServerCacheValid(cachedEntry, definition) ? cachedEntry : undefined;
257
259
  const effectivePrefix = resolveToolPrefix(definition, prefix);
258
- const getOtherCurrentCandidates = (toolName: string): Set<string> | undefined => {
259
- if (!cache) return undefined;
260
+ const hasToolFilters =
261
+ (Array.isArray(definition.includeTools) && definition.includeTools.length > 0) ||
262
+ (Array.isArray(definition.excludeTools) && definition.excludeTools.length > 0);
263
+ const selectorCandidateIndex = hasToolFilters && cache ? (() => {
260
264
  const candidates = new Set<string>();
261
265
  for (const [otherServerName, otherDefinition] of Object.entries(config.mcpServers)) {
262
266
  const otherEntry = cache.servers[otherServerName];
@@ -273,17 +277,16 @@ export function buildProxyDescription(
273
277
  }
274
278
  }
275
279
  }
276
- for (const candidate of getToolNameCandidates(toolName, serverName, effectivePrefix, false)) candidates.delete(candidate);
277
- return candidates;
278
- };
280
+ return createToolSelectorCandidateIndex(candidates);
281
+ })() : undefined;
279
282
  const toolCount = (entry?.tools ?? []).filter(
280
283
  (tool) => isUiToolVisibleToModel(tool.uiVisibility)
281
- && isToolAllowed(tool.name, serverName, effectivePrefix, definition.includeTools, definition.excludeTools, getOtherCurrentCandidates(tool.name)),
284
+ && isToolAllowed(tool.name, serverName, effectivePrefix, definition.includeTools, definition.excludeTools, selectorCandidateIndex),
282
285
  ).length;
283
286
  const resourceCount = definition?.exposeResources !== false
284
287
  ? (entry?.resources ?? []).filter((resource) => {
285
288
  const baseName = `read_${resourceNameToToolName(resource.name)}`;
286
- return isToolAllowed(baseName, serverName, effectivePrefix, definition.includeTools, definition.excludeTools, getOtherCurrentCandidates(baseName));
289
+ return isToolAllowed(baseName, serverName, effectivePrefix, definition.includeTools, definition.excludeTools, selectorCandidateIndex);
287
290
  }).length
288
291
  : 0;
289
292
  const totalItems = toolCount + resourceCount;