@defai.digital/automatosx 12.0.1 → 12.1.1

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/mcp/index.js CHANGED
@@ -26,12 +26,6 @@ import { gzipSync, gunzipSync } from 'zlib';
26
26
 
27
27
  var __defProp = Object.defineProperty;
28
28
  var __getOwnPropNames = Object.getOwnPropertyNames;
29
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
30
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
31
- }) : x)(function(x) {
32
- if (typeof require !== "undefined") return require.apply(this, arguments);
33
- throw Error('Dynamic require of "' + x + '" is not supported');
34
- });
35
29
  var __esm = (fn, res) => function __init() {
36
30
  return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
37
31
  };
@@ -4122,8 +4116,12 @@ function isSDKModeAvailable() {
4122
4116
  const hasAPIKey = !!process.env.OPENAI_API_KEY;
4123
4117
  let hasSDK = false;
4124
4118
  try {
4125
- __require.resolve("openai");
4126
- hasSDK = true;
4119
+ if (typeof import.meta.resolve === "function") {
4120
+ import.meta.resolve("openai");
4121
+ hasSDK = true;
4122
+ } else {
4123
+ hasSDK = true;
4124
+ }
4127
4125
  } catch {
4128
4126
  hasSDK = false;
4129
4127
  }
@@ -4164,6 +4162,8 @@ function getVersion() {
4164
4162
  const possiblePaths = [
4165
4163
  join(__dirname$1, "../../../package.json"),
4166
4164
  // From src/shared/helpers
4165
+ join(__dirname$1, "../../package.json"),
4166
+ // From dist/mcp (bundled MCP entry)
4167
4167
  join(__dirname$1, "../package.json")
4168
4168
  // From dist
4169
4169
  ];
@@ -5156,58 +5156,6 @@ var PRECOMPILED_CONFIG = {
5156
5156
  "window": "daily",
5157
5157
  "resetHourUtc": 0
5158
5158
  }
5159
- },
5160
- "glm": {
5161
- "enabled": true,
5162
- "priority": 4,
5163
- "timeout": 12e4,
5164
- "command": "ax-glm",
5165
- "model": "glm-4",
5166
- "healthCheck": {
5167
- "enabled": true,
5168
- "interval": 3e5,
5169
- "timeout": 5e3
5170
- },
5171
- "circuitBreaker": {
5172
- "enabled": true,
5173
- "failureThreshold": 3,
5174
- "recoveryTimeout": 6e4
5175
- },
5176
- "processManagement": {
5177
- "gracefulShutdownTimeout": 5e3,
5178
- "forceKillDelay": 1e3
5179
- },
5180
- "versionDetection": {
5181
- "timeout": 5e3,
5182
- "forceKillDelay": 1e3,
5183
- "cacheEnabled": true
5184
- }
5185
- },
5186
- "grok": {
5187
- "enabled": true,
5188
- "priority": 5,
5189
- "timeout": 12e4,
5190
- "command": "ax-grok",
5191
- "model": "grok-3",
5192
- "healthCheck": {
5193
- "enabled": true,
5194
- "interval": 3e5,
5195
- "timeout": 5e3
5196
- },
5197
- "circuitBreaker": {
5198
- "enabled": true,
5199
- "failureThreshold": 3,
5200
- "recoveryTimeout": 6e4
5201
- },
5202
- "processManagement": {
5203
- "gracefulShutdownTimeout": 5e3,
5204
- "forceKillDelay": 1e3
5205
- },
5206
- "versionDetection": {
5207
- "timeout": 5e3,
5208
- "forceKillDelay": 1e3,
5209
- "cacheEnabled": true
5210
- }
5211
5159
  }
5212
5160
  },
5213
5161
  "execution": {
@@ -5419,15 +5367,7 @@ var PRECOMPILED_CONFIG = {
5419
5367
  "enableFreeTierPrioritization": true,
5420
5368
  "enableWorkloadAwareRouting": true
5421
5369
  },
5422
- "featureFlags": {
5423
- "sdkFirstMode": false,
5424
- "mcpBidirectional": false,
5425
- "autoInjectMCPConfig": false,
5426
- "sdkFallbackEnabled": true,
5427
- "deprecationWarnings": true,
5428
- "providerMetrics": true
5429
- },
5430
- "version": "12.0.1"
5370
+ "version": "12.1.1"
5431
5371
  };
5432
5372
 
5433
5373
  // src/core/config/schemas.ts
@@ -18164,6 +18104,126 @@ Task: ${task}`;
18164
18104
  };
18165
18105
  }
18166
18106
 
18107
+ // src/mcp/tools/get-capabilities.ts
18108
+ init_esm_shims();
18109
+ init_logger();
18110
+ function categorizeTools(name) {
18111
+ if (name.startsWith("memory_") || name === "search_memory") return "memory";
18112
+ if (name.startsWith("session_")) return "session";
18113
+ if (name.startsWith("create_task") || name.startsWith("run_task") || name.startsWith("get_task") || name.startsWith("list_task") || name.startsWith("delete_task")) return "task";
18114
+ if (name === "get_capabilities" || name === "list_agents" || name === "get_status" || name === "get_agent_context") return "discovery";
18115
+ if (name.includes("context")) return "context";
18116
+ return "execution";
18117
+ }
18118
+ function getExecutionMode(providerName, providerConfig) {
18119
+ if (providerName === "glm" || providerName === "grok") {
18120
+ return "sdk";
18121
+ }
18122
+ if (providerName === "claude-code" || providerName === "gemini-cli") {
18123
+ return "cli";
18124
+ }
18125
+ if (providerName === "openai") {
18126
+ return "hybrid";
18127
+ }
18128
+ return "cli";
18129
+ }
18130
+ function getProviderType(providerName) {
18131
+ if (providerName === "glm" || providerName === "grok") return "sdk";
18132
+ if (providerName === "openai") return "hybrid";
18133
+ return "cli";
18134
+ }
18135
+ function createGetCapabilitiesHandler(deps) {
18136
+ return async () => {
18137
+ logger.info("[MCP] get_capabilities called");
18138
+ try {
18139
+ const projectDir = process.cwd();
18140
+ const config = await loadConfig(projectDir);
18141
+ const version = getVersion();
18142
+ const providers = [];
18143
+ const providerConfigs = config.providers || {};
18144
+ for (const [name, providerConfig] of Object.entries(providerConfigs)) {
18145
+ const cfg = providerConfig;
18146
+ const enabled = cfg.enabled === true;
18147
+ let available = false;
18148
+ try {
18149
+ const availableProviders = await deps.router.getAvailableProviders();
18150
+ available = availableProviders.some((p) => p.name === name);
18151
+ } catch {
18152
+ available = enabled;
18153
+ }
18154
+ providers.push({
18155
+ name,
18156
+ enabled,
18157
+ available,
18158
+ type: getProviderType(name),
18159
+ executionMode: getExecutionMode(name, cfg),
18160
+ priority: cfg.priority || 0,
18161
+ model: cfg.model
18162
+ });
18163
+ }
18164
+ providers.sort((a, b) => b.priority - a.priority);
18165
+ const agentNames = await deps.profileLoader.listProfiles();
18166
+ const agents = [];
18167
+ for (const agentName of agentNames) {
18168
+ try {
18169
+ const profile = await deps.profileLoader.loadProfile(agentName);
18170
+ agents.push({
18171
+ name: profile.name,
18172
+ displayName: profile.displayName,
18173
+ role: profile.role,
18174
+ description: profile.systemPrompt?.substring(0, 200),
18175
+ team: profile.team,
18176
+ abilities: profile.abilities || []
18177
+ });
18178
+ } catch (error) {
18179
+ logger.warn(`Failed to load profile for ${agentName}`, { error });
18180
+ }
18181
+ }
18182
+ const tools = deps.toolSchemas.map((schema) => ({
18183
+ name: schema.name,
18184
+ description: schema.description,
18185
+ category: categorizeTools(schema.name)
18186
+ }));
18187
+ const memoryStats = await deps.memoryManager.getStats();
18188
+ const activeSessions = await deps.sessionManager.getActiveSessions();
18189
+ const result = {
18190
+ version,
18191
+ providers,
18192
+ agents,
18193
+ tools,
18194
+ memory: {
18195
+ enabled: true,
18196
+ entryCount: memoryStats.totalEntries,
18197
+ maxEntries: config.memory?.maxEntries || 1e4
18198
+ },
18199
+ sessions: {
18200
+ enabled: true,
18201
+ activeCount: activeSessions.length,
18202
+ maxSessions: config.orchestration?.session?.maxSessions || 100
18203
+ },
18204
+ features: {
18205
+ smartRouting: true,
18206
+ // Always enabled in v13.0.0
18207
+ memorySearch: true,
18208
+ multiAgentSessions: true,
18209
+ streamingNotifications: false
18210
+ // Configured via MCP server options
18211
+ }
18212
+ };
18213
+ logger.info("[MCP] get_capabilities completed", {
18214
+ version,
18215
+ providersCount: providers.length,
18216
+ agentsCount: agents.length,
18217
+ toolsCount: tools.length
18218
+ });
18219
+ return result;
18220
+ } catch (error) {
18221
+ logger.error("[MCP] get_capabilities failed", { error });
18222
+ throw new Error(`Capabilities check failed: ${error.message}`);
18223
+ }
18224
+ };
18225
+ }
18226
+
18167
18227
  // src/mcp/tools/task/index.ts
18168
18228
  init_esm_shims();
18169
18229
 
@@ -20823,27 +20883,33 @@ var McpClientPool = class extends EventEmitter {
20823
20883
  }
20824
20884
  startHealthChecks() {
20825
20885
  this.healthCheckTimer = setInterval(async () => {
20826
- for (const [provider, pool] of this.pools) {
20827
- const toRemove = [];
20828
- for (const pooledClient of pool.clients) {
20829
- if (!pooledClient.inUse && pooledClient.client.isConnected()) {
20830
- const healthy = await pooledClient.client.healthCheck();
20831
- if (!healthy) {
20832
- toRemove.push(pooledClient);
20886
+ try {
20887
+ for (const [provider, pool] of this.pools) {
20888
+ const toRemove = [];
20889
+ for (const pooledClient of pool.clients) {
20890
+ if (!pooledClient.inUse && pooledClient.client.isConnected()) {
20891
+ const healthy = await pooledClient.client.healthCheck();
20892
+ if (!healthy) {
20893
+ toRemove.push(pooledClient);
20894
+ }
20833
20895
  }
20834
20896
  }
20835
- }
20836
- for (const pooledClient of toRemove) {
20837
- if (pooledClient.inUse) {
20838
- logger.debug("[MCP Pool] Skipping unhealthy client removal - now in use", { provider });
20839
- continue;
20897
+ for (const pooledClient of toRemove) {
20898
+ if (pooledClient.inUse) {
20899
+ logger.debug("[MCP Pool] Skipping unhealthy client removal - now in use", { provider });
20900
+ continue;
20901
+ }
20902
+ this.emitEvent("health_check_failed", provider);
20903
+ logger.warn("[MCP Pool] Health check failed, removing connection", { provider });
20904
+ await pooledClient.client.disconnect();
20905
+ this.removeFromPool(pool, pooledClient);
20906
+ this.emitEvent("connection_closed", provider, { reason: "health_check_failed" });
20840
20907
  }
20841
- this.emitEvent("health_check_failed", provider);
20842
- logger.warn("[MCP Pool] Health check failed, removing connection", { provider });
20843
- await pooledClient.client.disconnect();
20844
- this.removeFromPool(pool, pooledClient);
20845
- this.emitEvent("connection_closed", provider, { reason: "health_check_failed" });
20846
20908
  }
20909
+ } catch (error) {
20910
+ logger.error("[MCP Pool] Unexpected error in health check interval", {
20911
+ error: error.message
20912
+ });
20847
20913
  }
20848
20914
  }, this.config.healthCheckIntervalMs);
20849
20915
  }
@@ -22179,6 +22245,22 @@ var McpServer = class _McpServer {
22179
22245
  description: "Get AutomatosX system status and configuration",
22180
22246
  inputSchema: { type: "object", properties: {} }
22181
22247
  },
22248
+ // v13.0.0: Enhanced Service Discovery
22249
+ {
22250
+ name: "get_capabilities",
22251
+ description: `Get comprehensive AutomatosX capabilities for service discovery.
22252
+
22253
+ Returns:
22254
+ - providers: All AI providers with execution modes (cli/sdk/hybrid)
22255
+ - agents: All available agent profiles with roles and abilities
22256
+ - tools: All MCP tools organized by category
22257
+ - memory: Memory system status (entries, limits)
22258
+ - sessions: Session management status
22259
+ - features: Enabled features (smart routing, streaming, etc.)
22260
+
22261
+ Use this tool first to understand what AutomatosX offers.`,
22262
+ inputSchema: { type: "object", properties: {} }
22263
+ },
22182
22264
  {
22183
22265
  name: "session_create",
22184
22266
  description: "Create a new multi-agent session",
@@ -22448,6 +22530,13 @@ var McpServer = class _McpServer {
22448
22530
  profileLoader: this.profileLoader,
22449
22531
  memoryManager: this.memoryManager
22450
22532
  }));
22533
+ register("get_capabilities", createGetCapabilitiesHandler({
22534
+ memoryManager: this.memoryManager,
22535
+ sessionManager: this.sessionManager,
22536
+ router: this.router,
22537
+ profileLoader: this.profileLoader,
22538
+ toolSchemas: staticSchemas
22539
+ }));
22451
22540
  register("create_task", createCreateTaskHandler({
22452
22541
  getSession: () => this.session
22453
22542
  }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defai.digital/automatosx",
3
- "version": "12.0.1",
3
+ "version": "12.1.1",
4
4
  "description": "Provider-agnostic AI orchestration platform with 20+ specialized agents, persistent memory, and multi-provider routing for Claude Code, Gemini CLI, Codex CLI, GLM, and Grok",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -157,6 +157,11 @@
157
157
  "@ax-cli/schemas": "zod@^3.23.8",
158
158
  "@modelcontextprotocol/sdk": "^1.24.0"
159
159
  },
160
+ "pnpm": {
161
+ "overrides": {
162
+ "tmp": "^0.2.4"
163
+ }
164
+ },
160
165
  "config": {
161
166
  "commitizen": {
162
167
  "path": "cz-conventional-changelog"