aai-gateway 1.1.1 → 1.1.3

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/cli.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { n as createGatewayServer } from "./server-BNj-vVwq.js";
2
+ import { n as createGatewayServer } from "./server-W20IjmvB.js";
3
3
  import { o as AAI_GATEWAY_VERSION, s as logger } from "./acp-DWqg7EhR.js";
4
4
  //#region src/cli.ts
5
5
  async function main() {
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { a as GuideService, c as getSkillExecutor, d as getMcpExecutor, i as ImportService, l as AppRegistry, n as createGatewayServer, o as ExecutionCoordinator, r as Gateway, s as SkillExecutor, t as AaiGatewayServer, u as McpExecutor } from "./server-BNj-vVwq.js";
1
+ import { a as GuideService, c as getSkillExecutor, d as getMcpExecutor, i as ImportService, l as AppRegistry, n as createGatewayServer, o as ExecutionCoordinator, r as Gateway, s as SkillExecutor, t as AaiGatewayServer, u as McpExecutor } from "./server-W20IjmvB.js";
2
2
  import { t as AaiError } from "./errors-C3N_hrpx.js";
3
3
  import { n as getAcpExecutor, s as logger, t as AcpExecutor } from "./acp-DWqg7EhR.js";
4
4
  import { a as FileRegistry, c as parseAaiJson } from "./mcp-registry-CuVFEyIP.js";
@@ -1116,6 +1116,16 @@ For Skill candidates, also collect:
1116
1116
  - Whether the whole skill directory must be downloaded
1117
1117
  - The source page that shows the download path or repository path
1118
1118
 
1119
+ ## How to Search Efficiently
1120
+
1121
+ Web pages like GitHub repositories and registry listings can be very large. Use these strategies to save tokens:
1122
+
1123
+ 1. **Small pages**: Read directly if the page is short.
1124
+ 2. **Large pages with grep support**: If your web/fetch tool supports content filtering (e.g. grep, query, selector), use it to extract only the relevant sections (install config, package name, command examples).
1125
+ 3. **Large pages without grep support**: Fetch the page to a temporary file, then use shell \`grep\` to search for relevant keywords.
1126
+ 4. **GitHub repos**: Prefer reading \`README.md\` raw content directly. For registry repos with many entries, grep for the tool name or category instead of reading the full file list.
1127
+ 5. **Expand keywords before searching**: Don't rely on a single keyword. Think of synonyms, related terms, and alternative names. For example, when searching for a "web search" tool, also try "search engine", "google", "bing", "brave", "websearch", "web-search", etc. This avoids missing results due to naming variations.
1128
+
1119
1129
  ## How to Evaluate Candidates
1120
1130
 
1121
1131
  When comparing candidates, consider:
@@ -1406,7 +1416,7 @@ function buildGatewayToolDefinitions() {
1406
1416
  return [
1407
1417
  {
1408
1418
  name: "aai:exec",
1409
- description: "Execute a tool. Read the guide first (e.g. app:*, mcp:import) — it contains the full schema.",
1419
+ description: "Execute any AAI tool action. Read the guide first (call app:*, mcp:import, skill:import, or search:discover) — it contains the required schema and parameters.",
1410
1420
  inputSchema: {
1411
1421
  type: "object",
1412
1422
  properties: {
@@ -1429,7 +1439,7 @@ function buildGatewayToolDefinitions() {
1429
1439
  },
1430
1440
  {
1431
1441
  name: "mcp:import",
1432
- description: "Call this to import an MCP server. Returns the import workflow and parameters.",
1442
+ description: "Import an MCP server as a new app. Call this first to get the import guide, then use aai:exec to perform the import.",
1433
1443
  inputSchema: {
1434
1444
  type: "object",
1435
1445
  properties: {
@@ -1520,7 +1530,7 @@ function buildGatewayToolDefinitions() {
1520
1530
  },
1521
1531
  {
1522
1532
  name: "skill:import",
1523
- description: "Call this to import a skill. Returns the import workflow and parameters.",
1533
+ description: "Import a local skill as a new app. Call this first to get the import guide, then use aai:exec to perform the import.",
1524
1534
  inputSchema: {
1525
1535
  type: "object",
1526
1536
  properties: { path: {
@@ -1533,7 +1543,7 @@ function buildGatewayToolDefinitions() {
1533
1543
  },
1534
1544
  {
1535
1545
  name: "listAllAaiApps",
1536
- description: "List all apps available to the current agent, excluding AAI Gateway built-in management tools.",
1546
+ description: "List imported apps (MCP servers and skills) for the current agent. This does not include built-in tools like search:discover, mcp:import, or skill:import — those are always available.",
1537
1547
  inputSchema: {
1538
1548
  type: "object",
1539
1549
  properties: {},
@@ -1584,7 +1594,7 @@ function buildGatewayToolDefinitions() {
1584
1594
  },
1585
1595
  {
1586
1596
  name: SEARCH_DISCOVER_TOOL_NAME,
1587
- description: "Call this to search for MCP servers or skills. Returns search instructions.",
1597
+ description: "Find and install new tools. Call this when the user wants to search for, discover, or add MCP servers or skills.",
1588
1598
  inputSchema: searchDiscoverInputSchema,
1589
1599
  listInputSchema: buildGuideOnlyInputSchema()
1590
1600
  }
@@ -2931,6 +2941,8 @@ var Gateway = class {
2931
2941
  if (toolName === "disableApp") return this.handleDisableApp(args, caller);
2932
2942
  if (toolName === "enableApp") return this.handleEnableApp(args, caller);
2933
2943
  if (toolName === "removeApp") return this.handleRemoveApp(args, caller);
2944
+ if (toolName === "mcp:import") return this.handleMcpImport(parseMcpImportArguments(args), args, caller);
2945
+ if (toolName === "skill:import") return this.handleSkillImport(parseSkillImportArguments(args), args, caller);
2934
2946
  throw new AaiError("UNKNOWN_TOOL", `Unknown tool: ${toolName}`);
2935
2947
  }
2936
2948
  async resolveManagedApp(appId, caller) {
@@ -3062,6 +3074,13 @@ function buildMissingEnvVarsResult(err) {
3062
3074
  * Thin protocol layer — handles MCP request/response serialization
3063
3075
  * and delegates all business logic to Gateway (core/gateway.ts).
3064
3076
  */
3077
+ var TOOLS_CHANGING_OPERATIONS = new Set([
3078
+ "mcp:import",
3079
+ "skill:import",
3080
+ "disableApp",
3081
+ "enableApp",
3082
+ "removeApp"
3083
+ ]);
3065
3084
  var AaiGatewayServer = class {
3066
3085
  server;
3067
3086
  gateway = new Gateway();
@@ -3101,24 +3120,11 @@ var AaiGatewayServer = class {
3101
3120
  if (name.startsWith("app:")) return this.toCallToolResult(await this.gateway.handleAppGuide(name.slice(4), caller));
3102
3121
  if (name === "aai:exec") {
3103
3122
  const payload = args;
3104
- return this.toCallToolResult(await this.gateway.handleExec(extra.requestId, payload.app, payload.tool, payload.args ?? {}, caller));
3105
- }
3106
- if (name === "mcp:import") {
3107
- const rawMap = args;
3108
- if (!rawMap || Object.keys(rawMap).length === 0) return this.toCallToolResult(this.gateway.handleGatewayToolGuide(name));
3109
- const parsed = parseMcpImportArguments(rawMap);
3110
- const result = await this.gateway.handleMcpImport(parsed, rawMap, caller);
3111
- if (!result.isError) await this.notifyToolsListChanged();
3112
- return this.toCallToolResult(result);
3113
- }
3114
- if (name === "skill:import") {
3115
- const rawMap = args;
3116
- if (!rawMap || Object.keys(rawMap).length === 0) return this.toCallToolResult(this.gateway.handleGatewayToolGuide(name));
3117
- const parsed = parseSkillImportArguments(rawMap);
3118
- const result = await this.gateway.handleSkillImport(parsed, rawMap, caller);
3119
- if (!result.isError) await this.notifyToolsListChanged();
3123
+ const result = await this.gateway.handleExec(extra.requestId, payload.app, payload.tool, payload.args ?? {}, caller);
3124
+ if (TOOLS_CHANGING_OPERATIONS.has(payload.tool) && !result.isError) await this.notifyToolsListChanged();
3120
3125
  return this.toCallToolResult(result);
3121
3126
  }
3127
+ if (name === "mcp:import" || name === "skill:import") return this.toCallToolResult(this.gateway.handleGatewayToolGuide(name));
3122
3128
  if (name === "search:discover" || name === "listAllAaiApps" || name === "disableApp" || name === "enableApp" || name === "removeApp") {
3123
3129
  const toolArgs = args ?? {};
3124
3130
  let result;
@@ -3182,4 +3188,4 @@ async function createGatewayServer() {
3182
3188
  //#endregion
3183
3189
  export { GuideService as a, getSkillExecutor as c, getMcpExecutor as d, ImportService as i, AppRegistry as l, createGatewayServer as n, ExecutionCoordinator as o, Gateway as r, SkillExecutor as s, AaiGatewayServer as t, McpExecutor as u };
3184
3190
 
3185
- //# sourceMappingURL=server-BNj-vVwq.js.map
3191
+ //# sourceMappingURL=server-W20IjmvB.js.map