@dexto/agent-management 1.5.6 → 1.5.7

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 (128) hide show
  1. package/dist/config/config-enrichment.cjs +70 -20
  2. package/dist/config/config-enrichment.d.ts +10 -2
  3. package/dist/config/config-enrichment.d.ts.map +1 -1
  4. package/dist/config/config-enrichment.js +74 -20
  5. package/dist/config/discover-prompts.cjs +1 -1
  6. package/dist/config/discover-prompts.d.ts +11 -11
  7. package/dist/config/discover-prompts.d.ts.map +1 -1
  8. package/dist/config/discover-prompts.js +1 -1
  9. package/dist/config/loader.cjs +31 -13
  10. package/dist/config/loader.d.ts.map +1 -1
  11. package/dist/config/loader.js +31 -13
  12. package/dist/index.cjs +65 -0
  13. package/dist/index.d.ts +3 -0
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/index.js +66 -0
  16. package/dist/models/custom-models.cjs +2 -1
  17. package/dist/models/custom-models.d.ts +7 -6
  18. package/dist/models/custom-models.d.ts.map +1 -1
  19. package/dist/models/custom-models.js +2 -1
  20. package/dist/plugins/discover-plugins.cjs +176 -0
  21. package/dist/plugins/discover-plugins.d.ts +39 -0
  22. package/dist/plugins/discover-plugins.d.ts.map +1 -0
  23. package/dist/plugins/discover-plugins.js +140 -0
  24. package/dist/plugins/discover-skills.cjs +89 -0
  25. package/dist/plugins/discover-skills.d.ts +46 -0
  26. package/dist/plugins/discover-skills.d.ts.map +1 -0
  27. package/dist/plugins/discover-skills.js +54 -0
  28. package/dist/plugins/error-codes.cjs +47 -0
  29. package/dist/plugins/error-codes.d.ts +24 -0
  30. package/dist/plugins/error-codes.d.ts.map +1 -0
  31. package/dist/plugins/error-codes.js +23 -0
  32. package/dist/plugins/errors.cjs +197 -0
  33. package/dist/plugins/errors.d.ts +68 -0
  34. package/dist/plugins/errors.d.ts.map +1 -0
  35. package/dist/plugins/errors.js +173 -0
  36. package/dist/plugins/index.cjs +144 -0
  37. package/dist/plugins/index.d.ts +23 -0
  38. package/dist/plugins/index.d.ts.map +1 -0
  39. package/dist/plugins/index.js +115 -0
  40. package/dist/plugins/install-plugin.cjs +211 -0
  41. package/dist/plugins/install-plugin.d.ts +47 -0
  42. package/dist/plugins/install-plugin.d.ts.map +1 -0
  43. package/dist/plugins/install-plugin.js +173 -0
  44. package/dist/plugins/list-plugins.cjs +134 -0
  45. package/dist/plugins/list-plugins.d.ts +26 -0
  46. package/dist/plugins/list-plugins.d.ts.map +1 -0
  47. package/dist/plugins/list-plugins.js +99 -0
  48. package/dist/plugins/load-plugin.cjs +197 -0
  49. package/dist/plugins/load-plugin.d.ts +20 -0
  50. package/dist/plugins/load-plugin.d.ts.map +1 -0
  51. package/dist/plugins/load-plugin.js +163 -0
  52. package/dist/plugins/marketplace/error-codes.cjs +45 -0
  53. package/dist/plugins/marketplace/error-codes.d.ts +21 -0
  54. package/dist/plugins/marketplace/error-codes.d.ts.map +1 -0
  55. package/dist/plugins/marketplace/error-codes.js +21 -0
  56. package/dist/plugins/marketplace/errors.cjs +188 -0
  57. package/dist/plugins/marketplace/errors.d.ts +64 -0
  58. package/dist/plugins/marketplace/errors.d.ts.map +1 -0
  59. package/dist/plugins/marketplace/errors.js +164 -0
  60. package/dist/plugins/marketplace/index.cjs +95 -0
  61. package/dist/plugins/marketplace/index.d.ts +14 -0
  62. package/dist/plugins/marketplace/index.d.ts.map +1 -0
  63. package/dist/plugins/marketplace/index.js +74 -0
  64. package/dist/plugins/marketplace/install-from-marketplace.cjs +152 -0
  65. package/dist/plugins/marketplace/install-from-marketplace.d.ts +25 -0
  66. package/dist/plugins/marketplace/install-from-marketplace.d.ts.map +1 -0
  67. package/dist/plugins/marketplace/install-from-marketplace.js +120 -0
  68. package/dist/plugins/marketplace/operations.cjs +374 -0
  69. package/dist/plugins/marketplace/operations.d.ts +43 -0
  70. package/dist/plugins/marketplace/operations.d.ts.map +1 -0
  71. package/dist/plugins/marketplace/operations.js +339 -0
  72. package/dist/plugins/marketplace/registry.cjs +166 -0
  73. package/dist/plugins/marketplace/registry.d.ts +72 -0
  74. package/dist/plugins/marketplace/registry.d.ts.map +1 -0
  75. package/dist/plugins/marketplace/registry.js +119 -0
  76. package/dist/plugins/marketplace/schemas.cjs +79 -0
  77. package/dist/plugins/marketplace/schemas.d.ts +260 -0
  78. package/dist/plugins/marketplace/schemas.d.ts.map +1 -0
  79. package/dist/plugins/marketplace/schemas.js +49 -0
  80. package/dist/plugins/marketplace/types.cjs +16 -0
  81. package/dist/plugins/marketplace/types.d.ts +156 -0
  82. package/dist/plugins/marketplace/types.d.ts.map +1 -0
  83. package/dist/plugins/marketplace/types.js +0 -0
  84. package/dist/plugins/schemas.cjs +74 -0
  85. package/dist/plugins/schemas.d.ts +262 -0
  86. package/dist/plugins/schemas.d.ts.map +1 -0
  87. package/dist/plugins/schemas.js +46 -0
  88. package/dist/plugins/types.cjs +16 -0
  89. package/dist/plugins/types.d.ts +186 -0
  90. package/dist/plugins/types.d.ts.map +1 -0
  91. package/dist/plugins/types.js +0 -0
  92. package/dist/plugins/uninstall-plugin.cjs +133 -0
  93. package/dist/plugins/uninstall-plugin.d.ts +24 -0
  94. package/dist/plugins/uninstall-plugin.d.ts.map +1 -0
  95. package/dist/plugins/uninstall-plugin.js +99 -0
  96. package/dist/plugins/validate-plugin.cjs +180 -0
  97. package/dist/plugins/validate-plugin.d.ts +53 -0
  98. package/dist/plugins/validate-plugin.d.ts.map +1 -0
  99. package/dist/plugins/validate-plugin.js +145 -0
  100. package/dist/preferences/schemas.d.ts +12 -12
  101. package/dist/runtime/AgentRuntime.cjs +1 -2
  102. package/dist/runtime/AgentRuntime.d.ts.map +1 -1
  103. package/dist/runtime/AgentRuntime.js +1 -2
  104. package/dist/tool-provider/llm-resolution.cjs +74 -0
  105. package/dist/tool-provider/llm-resolution.d.ts +51 -0
  106. package/dist/tool-provider/llm-resolution.d.ts.map +1 -0
  107. package/dist/tool-provider/llm-resolution.js +50 -0
  108. package/dist/tool-provider/runtime-service.cjs +158 -23
  109. package/dist/tool-provider/runtime-service.d.ts +32 -2
  110. package/dist/tool-provider/runtime-service.d.ts.map +1 -1
  111. package/dist/tool-provider/runtime-service.js +158 -23
  112. package/dist/tool-provider/tool-provider.cjs +2 -0
  113. package/dist/tool-provider/tool-provider.d.ts.map +1 -1
  114. package/dist/tool-provider/tool-provider.js +2 -0
  115. package/dist/tool-provider/types.d.ts +2 -0
  116. package/dist/tool-provider/types.d.ts.map +1 -1
  117. package/dist/utils/api-key-resolver.cjs +5 -2
  118. package/dist/utils/api-key-resolver.d.ts.map +1 -1
  119. package/dist/utils/api-key-resolver.js +5 -2
  120. package/dist/utils/dexto-auth.cjs +83 -0
  121. package/dist/utils/dexto-auth.d.ts +23 -0
  122. package/dist/utils/dexto-auth.d.ts.map +1 -0
  123. package/dist/utils/dexto-auth.js +57 -0
  124. package/dist/utils/feature-flags.cjs +30 -0
  125. package/dist/utils/feature-flags.d.ts +21 -0
  126. package/dist/utils/feature-flags.d.ts.map +1 -0
  127. package/dist/utils/feature-flags.js +6 -0
  128. package/package.json +2 -2
@@ -1,30 +1,30 @@
1
1
  import { z } from 'zod';
2
2
  export declare const PreferenceLLMSchema: z.ZodEffects<z.ZodObject<{
3
- provider: z.ZodEnum<["openai", "openai-compatible", "anthropic", "google", "groq", "xai", "cohere", "openrouter", "litellm", "glama", "vertex", "bedrock", "local", "ollama"]>;
3
+ provider: z.ZodEnum<["openai", "openai-compatible", "anthropic", "google", "groq", "xai", "cohere", "minimax", "glm", "openrouter", "litellm", "glama", "vertex", "bedrock", "local", "ollama", "dexto"]>;
4
4
  model: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
5
5
  apiKey: z.ZodOptional<z.ZodString>;
6
6
  baseURL: z.ZodOptional<z.ZodString>;
7
7
  reasoningEffort: z.ZodOptional<z.ZodEnum<["none", "minimal", "low", "medium", "high", "xhigh"]>>;
8
8
  }, "strict", z.ZodTypeAny, {
9
- provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama";
9
+ provider: "dexto" | "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "minimax" | "glm" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama";
10
10
  model: string;
11
11
  apiKey?: string | undefined;
12
12
  baseURL?: string | undefined;
13
13
  reasoningEffort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | undefined;
14
14
  }, {
15
- provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama";
15
+ provider: "dexto" | "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "minimax" | "glm" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama";
16
16
  model: string;
17
17
  apiKey?: string | undefined;
18
18
  baseURL?: string | undefined;
19
19
  reasoningEffort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | undefined;
20
20
  }>, {
21
- provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama";
21
+ provider: "dexto" | "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "minimax" | "glm" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama";
22
22
  model: string;
23
23
  apiKey?: string | undefined;
24
24
  baseURL?: string | undefined;
25
25
  reasoningEffort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | undefined;
26
26
  }, {
27
- provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama";
27
+ provider: "dexto" | "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "minimax" | "glm" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama";
28
28
  model: string;
29
29
  apiKey?: string | undefined;
30
30
  baseURL?: string | undefined;
@@ -68,31 +68,31 @@ export declare const PreferenceSoundsSchema: z.ZodObject<{
68
68
  }>;
69
69
  export declare const GlobalPreferencesSchema: z.ZodObject<{
70
70
  llm: z.ZodEffects<z.ZodObject<{
71
- provider: z.ZodEnum<["openai", "openai-compatible", "anthropic", "google", "groq", "xai", "cohere", "openrouter", "litellm", "glama", "vertex", "bedrock", "local", "ollama"]>;
71
+ provider: z.ZodEnum<["openai", "openai-compatible", "anthropic", "google", "groq", "xai", "cohere", "minimax", "glm", "openrouter", "litellm", "glama", "vertex", "bedrock", "local", "ollama", "dexto"]>;
72
72
  model: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
73
73
  apiKey: z.ZodOptional<z.ZodString>;
74
74
  baseURL: z.ZodOptional<z.ZodString>;
75
75
  reasoningEffort: z.ZodOptional<z.ZodEnum<["none", "minimal", "low", "medium", "high", "xhigh"]>>;
76
76
  }, "strict", z.ZodTypeAny, {
77
- provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama";
77
+ provider: "dexto" | "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "minimax" | "glm" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama";
78
78
  model: string;
79
79
  apiKey?: string | undefined;
80
80
  baseURL?: string | undefined;
81
81
  reasoningEffort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | undefined;
82
82
  }, {
83
- provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama";
83
+ provider: "dexto" | "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "minimax" | "glm" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama";
84
84
  model: string;
85
85
  apiKey?: string | undefined;
86
86
  baseURL?: string | undefined;
87
87
  reasoningEffort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | undefined;
88
88
  }>, {
89
- provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama";
89
+ provider: "dexto" | "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "minimax" | "glm" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama";
90
90
  model: string;
91
91
  apiKey?: string | undefined;
92
92
  baseURL?: string | undefined;
93
93
  reasoningEffort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | undefined;
94
94
  }, {
95
- provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama";
95
+ provider: "dexto" | "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "minimax" | "glm" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama";
96
96
  model: string;
97
97
  apiKey?: string | undefined;
98
98
  baseURL?: string | undefined;
@@ -136,7 +136,7 @@ export declare const GlobalPreferencesSchema: z.ZodObject<{
136
136
  }>>;
137
137
  }, "strict", z.ZodTypeAny, {
138
138
  llm: {
139
- provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama";
139
+ provider: "dexto" | "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "minimax" | "glm" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama";
140
140
  model: string;
141
141
  apiKey?: string | undefined;
142
142
  baseURL?: string | undefined;
@@ -158,7 +158,7 @@ export declare const GlobalPreferencesSchema: z.ZodObject<{
158
158
  };
159
159
  }, {
160
160
  llm: {
161
- provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama";
161
+ provider: "dexto" | "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "minimax" | "glm" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama";
162
162
  model: string;
163
163
  apiKey?: string | undefined;
164
164
  baseURL?: string | undefined;
@@ -59,8 +59,7 @@ class AgentRuntime {
59
59
  config.agentConfig,
60
60
  void 0,
61
61
  // No config path
62
- false
63
- // Not interactive CLI
62
+ { isInteractiveCli: false, skipPluginDiscovery: true }
64
63
  );
65
64
  enrichedConfig.agentId = agentId;
66
65
  const agent = new import_core.DextoAgent(enrichedConfig);
@@ -1 +1 @@
1
- {"version":3,"file":"AgentRuntime.d.ts","sourceRoot":"","sources":["../../src/runtime/AgentRuntime.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAc,KAAK,YAAY,EAAyB,MAAM,aAAa,CAAC;AAInF,OAAO,KAAK,EACR,kBAAkB,EAClB,WAAW,EACX,WAAW,EACX,UAAU,EACV,WAAW,EACd,MAAM,YAAY,CAAC;AACpB,OAAO,EAA4B,KAAK,2BAA2B,EAAE,MAAM,cAAc,CAAC;AAE1F;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAChC,4BAA4B;IAC5B,MAAM,CAAC,EAAE,kBAAkB,CAAC;IAC5B,sBAAsB;IACtB,MAAM,EAAE,YAAY,CAAC;CACxB;AAED,qBAAa,YAAY;IACrB,OAAO,CAAC,IAAI,CAAY;IACxB,OAAO,CAAC,MAAM,CAA8B;IAC5C,OAAO,CAAC,MAAM,CAAe;gBAEjB,OAAO,EAAE,mBAAmB;IAYxC;;;;;OAKG;IACG,UAAU,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;IA0E3D;;;;;;;OAOG;IACG,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAoEvF;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS;IAIlD;;OAEG;IACH,UAAU,CAAC,MAAM,CAAC,EAAE,WAAW,GAAG,WAAW,EAAE;IAI/C;;OAEG;IACG,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAsC/C;;OAEG;IACG,OAAO,CAAC,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IASlD;;OAEG;IACH,SAAS,IAAI,2BAA2B;IAIxC;;OAEG;IACH,QAAQ,IAAI;QAAE,WAAW,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;KAAE;CAaxE"}
1
+ {"version":3,"file":"AgentRuntime.d.ts","sourceRoot":"","sources":["../../src/runtime/AgentRuntime.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAc,KAAK,YAAY,EAAyB,MAAM,aAAa,CAAC;AAInF,OAAO,KAAK,EACR,kBAAkB,EAClB,WAAW,EACX,WAAW,EACX,UAAU,EACV,WAAW,EACd,MAAM,YAAY,CAAC;AACpB,OAAO,EAA4B,KAAK,2BAA2B,EAAE,MAAM,cAAc,CAAC;AAE1F;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAChC,4BAA4B;IAC5B,MAAM,CAAC,EAAE,kBAAkB,CAAC;IAC5B,sBAAsB;IACtB,MAAM,EAAE,YAAY,CAAC;CACxB;AAED,qBAAa,YAAY;IACrB,OAAO,CAAC,IAAI,CAAY;IACxB,OAAO,CAAC,MAAM,CAA8B;IAC5C,OAAO,CAAC,MAAM,CAAe;gBAEjB,OAAO,EAAE,mBAAmB;IAYxC;;;;;OAKG;IACG,UAAU,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;IA2E3D;;;;;;;OAOG;IACG,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAoEvF;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS;IAIlD;;OAEG;IACH,UAAU,CAAC,MAAM,CAAC,EAAE,WAAW,GAAG,WAAW,EAAE;IAI/C;;OAEG;IACG,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAsC/C;;OAEG;IACG,OAAO,CAAC,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IASlD;;OAEG;IACH,SAAS,IAAI,2BAA2B;IAIxC;;OAEG;IACH,QAAQ,IAAI;QAAE,WAAW,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;KAAE;CAaxE"}
@@ -36,8 +36,7 @@ class AgentRuntime {
36
36
  config.agentConfig,
37
37
  void 0,
38
38
  // No config path
39
- false
40
- // Not interactive CLI
39
+ { isInteractiveCli: false, skipPluginDiscovery: true }
41
40
  );
42
41
  enrichedConfig.agentId = agentId;
43
42
  const agent = new DextoAgent(enrichedConfig);
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var llm_resolution_exports = {};
20
+ __export(llm_resolution_exports, {
21
+ resolveSubAgentLLM: () => resolveSubAgentLLM
22
+ });
23
+ module.exports = __toCommonJS(llm_resolution_exports);
24
+ var import_core = require("@dexto/core");
25
+ function resolveSubAgentLLM(options) {
26
+ const { subAgentLLM, parentLLM, subAgentId } = options;
27
+ const agentLabel = subAgentId ? `'${subAgentId}'` : "sub-agent";
28
+ const subAgentProvider = subAgentLLM.provider;
29
+ const subAgentModel = subAgentLLM.model;
30
+ const parentProvider = parentLLM.provider;
31
+ if ((0, import_core.hasAllRegistryModelsSupport)(parentProvider)) {
32
+ try {
33
+ const transformedModel = (0, import_core.transformModelNameForProvider)(
34
+ subAgentModel,
35
+ subAgentProvider,
36
+ parentProvider
37
+ );
38
+ return {
39
+ llm: {
40
+ ...subAgentLLM,
41
+ provider: parentProvider,
42
+ model: transformedModel,
43
+ apiKey: parentLLM.apiKey,
44
+ baseURL: parentLLM.baseURL
45
+ },
46
+ resolution: "gateway-transform",
47
+ reason: `${agentLabel} using ${parentProvider} gateway with model ${transformedModel} (transformed from ${subAgentProvider}/${subAgentModel})`
48
+ };
49
+ } catch {
50
+ }
51
+ }
52
+ if (parentProvider === subAgentProvider) {
53
+ return {
54
+ llm: {
55
+ ...subAgentLLM,
56
+ apiKey: parentLLM.apiKey,
57
+ // Use parent's credentials
58
+ baseURL: parentLLM.baseURL
59
+ // Inherit custom endpoint (e.g., Azure OpenAI)
60
+ },
61
+ resolution: "same-provider",
62
+ reason: `${agentLabel} using ${subAgentProvider}/${subAgentModel} with parent's credentials`
63
+ };
64
+ }
65
+ return {
66
+ llm: parentLLM,
67
+ resolution: "parent-fallback",
68
+ reason: `${agentLabel} cannot use ${subAgentProvider}/${subAgentModel} with parent's ${parentProvider} provider. Falling back to parent's LLM config. Tip: Use 'dexto login' for Dexto Credits which supports all models.`
69
+ };
70
+ }
71
+ // Annotate the CommonJS export names for ESM import in node:
72
+ 0 && (module.exports = {
73
+ resolveSubAgentLLM
74
+ });
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Sub-agent LLM resolution logic
3
+ *
4
+ * When a parent agent spawns a sub-agent (e.g., coding-agent spawns explore-agent),
5
+ * this module determines which LLM configuration the sub-agent should use.
6
+ *
7
+ * Resolution priority:
8
+ * 1. If parent's provider can serve sub-agent's model (dexto/openrouter/same provider)
9
+ * → Use parent's provider + sub-agent's model (transformed if needed)
10
+ * 2. If incompatible providers
11
+ * → Fall back to parent's full LLM config (with warning)
12
+ *
13
+ * Future enhancement (when .local.yml is implemented):
14
+ * 0. Check sub-agent's .local.yml for LLM override (highest priority)
15
+ */
16
+ import type { LLMConfig } from '@dexto/core';
17
+ /**
18
+ * Result of resolving a sub-agent's LLM configuration
19
+ */
20
+ export interface SubAgentLLMResolution {
21
+ /** The resolved LLM configuration to use */
22
+ llm: LLMConfig;
23
+ /** How the resolution was determined */
24
+ resolution: 'gateway-transform' | 'same-provider' | 'parent-fallback';
25
+ /** Human-readable explanation for debugging */
26
+ reason: string;
27
+ }
28
+ export interface ResolveSubAgentLLMOptions {
29
+ /** The sub-agent's bundled LLM configuration */
30
+ subAgentLLM: LLMConfig;
31
+ /** The parent agent's LLM configuration (already has preferences applied) */
32
+ parentLLM: LLMConfig;
33
+ /** Sub-agent ID for logging purposes */
34
+ subAgentId?: string;
35
+ }
36
+ /**
37
+ * Resolves which LLM configuration a sub-agent should use.
38
+ *
39
+ * The goal is to use the sub-agent's intended model (e.g., Haiku for explore-agent)
40
+ * when possible, while leveraging the parent's provider/credentials.
41
+ *
42
+ * @example
43
+ * // Parent uses dexto, sub-agent wants anthropic/haiku
44
+ * resolveSubAgentLLM({
45
+ * subAgentLLM: { provider: 'anthropic', model: 'claude-haiku-4-5-20251001', apiKey: '$ANTHROPIC_API_KEY' },
46
+ * parentLLM: { provider: 'dexto', model: 'anthropic/claude-sonnet-4', apiKey: '$DEXTO_API_KEY' }
47
+ * })
48
+ * // Returns: { provider: 'dexto', model: 'anthropic/claude-haiku-4.5', apiKey: '$DEXTO_API_KEY' }
49
+ */
50
+ export declare function resolveSubAgentLLM(options: ResolveSubAgentLLMOptions): SubAgentLLMResolution;
51
+ //# sourceMappingURL=llm-resolution.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"llm-resolution.d.ts","sourceRoot":"","sources":["../../src/tool-provider/llm-resolution.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAG7C;;GAEG;AACH,MAAM,WAAW,qBAAqB;IAClC,4CAA4C;IAC5C,GAAG,EAAE,SAAS,CAAC;IACf,wCAAwC;IACxC,UAAU,EACJ,mBAAmB,GACnB,eAAe,GACf,iBAAiB,CAAC;IACxB,+CAA+C;IAC/C,MAAM,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,yBAAyB;IACtC,gDAAgD;IAChD,WAAW,EAAE,SAAS,CAAC;IACvB,6EAA6E;IAC7E,SAAS,EAAE,SAAS,CAAC;IACrB,wCAAwC;IACxC,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,yBAAyB,GAAG,qBAAqB,CAmE5F"}
@@ -0,0 +1,50 @@
1
+ import { hasAllRegistryModelsSupport, transformModelNameForProvider } from "@dexto/core";
2
+ function resolveSubAgentLLM(options) {
3
+ const { subAgentLLM, parentLLM, subAgentId } = options;
4
+ const agentLabel = subAgentId ? `'${subAgentId}'` : "sub-agent";
5
+ const subAgentProvider = subAgentLLM.provider;
6
+ const subAgentModel = subAgentLLM.model;
7
+ const parentProvider = parentLLM.provider;
8
+ if (hasAllRegistryModelsSupport(parentProvider)) {
9
+ try {
10
+ const transformedModel = transformModelNameForProvider(
11
+ subAgentModel,
12
+ subAgentProvider,
13
+ parentProvider
14
+ );
15
+ return {
16
+ llm: {
17
+ ...subAgentLLM,
18
+ provider: parentProvider,
19
+ model: transformedModel,
20
+ apiKey: parentLLM.apiKey,
21
+ baseURL: parentLLM.baseURL
22
+ },
23
+ resolution: "gateway-transform",
24
+ reason: `${agentLabel} using ${parentProvider} gateway with model ${transformedModel} (transformed from ${subAgentProvider}/${subAgentModel})`
25
+ };
26
+ } catch {
27
+ }
28
+ }
29
+ if (parentProvider === subAgentProvider) {
30
+ return {
31
+ llm: {
32
+ ...subAgentLLM,
33
+ apiKey: parentLLM.apiKey,
34
+ // Use parent's credentials
35
+ baseURL: parentLLM.baseURL
36
+ // Inherit custom endpoint (e.g., Azure OpenAI)
37
+ },
38
+ resolution: "same-provider",
39
+ reason: `${agentLabel} using ${subAgentProvider}/${subAgentModel} with parent's credentials`
40
+ };
41
+ }
42
+ return {
43
+ llm: parentLLM,
44
+ resolution: "parent-fallback",
45
+ reason: `${agentLabel} cannot use ${subAgentProvider}/${subAgentModel} with parent's ${parentProvider} provider. Falling back to parent's LLM config. Tip: Use 'dexto login' for Dexto Credits which supports all models.`
46
+ };
47
+ }
48
+ export {
49
+ resolveSubAgentLLM
50
+ };
@@ -21,10 +21,12 @@ __export(runtime_service_exports, {
21
21
  RuntimeService: () => RuntimeService
22
22
  });
23
23
  module.exports = __toCommonJS(runtime_service_exports);
24
+ var import_core = require("@dexto/core");
24
25
  var import_AgentRuntime = require("../runtime/AgentRuntime.js");
25
26
  var import_approval_delegation = require("../runtime/approval-delegation.js");
26
27
  var import_loader = require("../config/loader.js");
27
28
  var import_registry = require("../registry/registry.js");
29
+ var import_llm_resolution = require("./llm-resolution.js");
28
30
  class RuntimeService {
29
31
  runtime;
30
32
  parentId;
@@ -69,6 +71,7 @@ class RuntimeService {
69
71
  * @param input.task - Short task description (for logging/UI)
70
72
  * @param input.instructions - Full prompt sent to sub-agent
71
73
  * @param input.agentId - Optional agent ID from registry
74
+ * @param input.autoApprove - Optional override for auto-approve (used by fork skills)
72
75
  * @param input.timeout - Optional task timeout in milliseconds
73
76
  * @param input.toolCallId - Optional tool call ID for progress events
74
77
  * @param input.sessionId - Optional session ID for progress events
@@ -95,10 +98,7 @@ class RuntimeService {
95
98
  }
96
99
  }
97
100
  const timeout = input.timeout ?? this.config.defaultTimeout;
98
- let autoApprove = false;
99
- if (input.agentId && this.config.autoApproveAgents) {
100
- autoApprove = this.config.autoApproveAgents.includes(input.agentId);
101
- }
101
+ const autoApprove = input.autoApprove !== void 0 ? input.autoApprove : !!(input.agentId && this.config.autoApproveAgents?.includes(input.agentId));
102
102
  const result = await this.trySpawnWithFallback(
103
103
  input,
104
104
  timeout,
@@ -108,6 +108,36 @@ class RuntimeService {
108
108
  );
109
109
  return result;
110
110
  }
111
+ /**
112
+ * Fork execution to an isolated subagent.
113
+ * Implements TaskForker interface for use by invoke_skill when context: fork is set.
114
+ *
115
+ * @param options.task - Short description for UI/logs
116
+ * @param options.instructions - Full instructions for the subagent
117
+ * @param options.agentId - Optional agent ID from registry to use for execution
118
+ * @param options.autoApprove - Auto-approve tool calls (default: true for fork skills)
119
+ * @param options.toolCallId - Optional tool call ID for progress events
120
+ * @param options.sessionId - Optional session ID for progress events
121
+ */
122
+ async fork(options) {
123
+ const spawnOptions = {
124
+ task: options.task,
125
+ instructions: options.instructions
126
+ };
127
+ if (options.agentId) {
128
+ spawnOptions.agentId = options.agentId;
129
+ }
130
+ if (options.autoApprove !== void 0) {
131
+ spawnOptions.autoApprove = options.autoApprove;
132
+ }
133
+ if (options.toolCallId) {
134
+ spawnOptions.toolCallId = options.toolCallId;
135
+ }
136
+ if (options.sessionId) {
137
+ spawnOptions.sessionId = options.sessionId;
138
+ }
139
+ return this.spawnAndExecute(spawnOptions);
140
+ }
111
141
  /**
112
142
  * Set up progress event emission for a sub-agent.
113
143
  * Subscribes to llm:tool-call and llm:response events and emits service:event with progress data.
@@ -183,12 +213,25 @@ class RuntimeService {
183
213
  subAgentBus.off("llm:response", responseHandler);
184
214
  };
185
215
  }
216
+ /**
217
+ * Check if an error is LLM-related (API errors, credit issues, model not found, etc.)
218
+ */
219
+ isLLMError(error) {
220
+ if (error instanceof import_core.DextoRuntimeError) {
221
+ if (error.scope === "llm") return true;
222
+ if (error.type === import_core.ErrorType.PAYMENT_REQUIRED || error.type === import_core.ErrorType.FORBIDDEN) {
223
+ return true;
224
+ }
225
+ }
226
+ const msg = error instanceof Error ? error.message : String(error);
227
+ return msg.includes("model") || msg.includes("provider") || msg.includes("rate limit") || msg.includes("quota");
228
+ }
186
229
  /**
187
230
  * Try to spawn agent, falling back to parent's LLM config if the sub-agent's config fails
188
231
  */
189
232
  async trySpawnWithFallback(input, timeout, autoApprove, toolCallId, sessionId) {
190
233
  let spawnedAgentId;
191
- let usedFallback = false;
234
+ let llmMode = "subagent";
192
235
  let cleanupProgressTracking;
193
236
  try {
194
237
  const buildOptions = {};
@@ -198,7 +241,7 @@ class RuntimeService {
198
241
  if (autoApprove) {
199
242
  buildOptions.autoApprove = autoApprove;
200
243
  }
201
- let subAgentConfig = await this.buildSubAgentConfig(buildOptions);
244
+ let subAgentConfig = await this.buildSubAgentConfig(buildOptions, sessionId);
202
245
  let handle;
203
246
  try {
204
247
  handle = await this.runtime.spawnAgent({
@@ -224,15 +267,15 @@ class RuntimeService {
224
267
  });
225
268
  spawnedAgentId = handle.agentId;
226
269
  } catch (spawnError) {
227
- const errorMsg = spawnError instanceof Error ? spawnError.message : String(spawnError);
228
- const isLlmError = errorMsg.includes("Model") || errorMsg.includes("model") || errorMsg.includes("API") || errorMsg.includes("apiKey") || errorMsg.includes("provider");
229
- if (isLlmError && input.agentId) {
270
+ const isLlmError = this.isLLMError(spawnError);
271
+ if (isLlmError && input.agentId && llmMode === "subagent") {
272
+ const errorMsg = spawnError instanceof Error ? spawnError.message : String(spawnError);
230
273
  this.logger.warn(
231
- `Sub-agent LLM config failed: ${errorMsg}. Falling back to parent's LLM config.`
274
+ `Sub-agent '${input.agentId}' LLM config failed: ${errorMsg}. Falling back to parent's full LLM config.`
232
275
  );
233
- usedFallback = true;
276
+ llmMode = "parent";
234
277
  buildOptions.inheritLlm = true;
235
- subAgentConfig = await this.buildSubAgentConfig(buildOptions);
278
+ subAgentConfig = await this.buildSubAgentConfig(buildOptions, sessionId);
236
279
  handle = await this.runtime.spawnAgent({
237
280
  agentConfig: subAgentConfig,
238
281
  ephemeral: true,
@@ -241,7 +284,8 @@ class RuntimeService {
241
284
  parentId: this.parentId,
242
285
  task: input.task,
243
286
  autoApprove,
244
- usedLlmFallback: true,
287
+ llmMode: "parent",
288
+ fallbackStage: "spawn",
245
289
  spawnedAt: (/* @__PURE__ */ new Date()).toISOString()
246
290
  },
247
291
  onBeforeStart: (agent) => {
@@ -261,7 +305,7 @@ class RuntimeService {
261
305
  }
262
306
  }
263
307
  this.logger.info(
264
- `Spawned sub-agent '${spawnedAgentId}' for task: ${input.task}${autoApprove ? " (auto-approve)" : ""}${usedFallback ? " (using parent LLM)" : ""}`
308
+ `Spawned sub-agent '${spawnedAgentId}' for task: ${input.task}${autoApprove ? " (auto-approve)" : ""}${llmMode === "parent" ? " (using parent LLM)" : ""}`
265
309
  );
266
310
  cleanupProgressTracking = this.setupProgressTracking(
267
311
  handle,
@@ -269,11 +313,74 @@ class RuntimeService {
269
313
  toolCallId,
270
314
  sessionId
271
315
  );
272
- const result = await this.runtime.executeTask(
273
- spawnedAgentId,
274
- input.instructions,
275
- timeout
276
- );
316
+ let result;
317
+ try {
318
+ result = await this.runtime.executeTask(
319
+ spawnedAgentId,
320
+ input.instructions,
321
+ timeout
322
+ );
323
+ } catch (execError) {
324
+ const isLlmExecError = this.isLLMError(execError);
325
+ if (llmMode === "parent") {
326
+ throw execError;
327
+ }
328
+ if (isLlmExecError && input.agentId && llmMode === "subagent") {
329
+ this.logger.warn(
330
+ `Sub-agent '${input.agentId}' LLM error during execution: ${execError instanceof Error ? execError.message : String(execError)}. Retrying with parent's full LLM config.`
331
+ );
332
+ try {
333
+ await this.runtime.stopAgent(spawnedAgentId);
334
+ } catch {
335
+ }
336
+ if (cleanupProgressTracking) {
337
+ cleanupProgressTracking();
338
+ }
339
+ llmMode = "parent";
340
+ buildOptions.inheritLlm = true;
341
+ subAgentConfig = await this.buildSubAgentConfig(buildOptions, sessionId);
342
+ handle = await this.runtime.spawnAgent({
343
+ agentConfig: subAgentConfig,
344
+ ephemeral: true,
345
+ group: this.parentId,
346
+ metadata: {
347
+ parentId: this.parentId,
348
+ task: input.task,
349
+ autoApprove,
350
+ llmMode: "parent",
351
+ fallbackStage: "execution",
352
+ spawnedAt: (/* @__PURE__ */ new Date()).toISOString()
353
+ },
354
+ onBeforeStart: (agent) => {
355
+ if (!autoApprove) {
356
+ const delegatingHandler = (0, import_approval_delegation.createDelegatingApprovalHandler)(
357
+ this.parentAgent.services.approvalManager,
358
+ agent.config.agentId ?? "unknown",
359
+ this.logger
360
+ );
361
+ agent.setApprovalHandler(delegatingHandler);
362
+ }
363
+ }
364
+ });
365
+ spawnedAgentId = handle.agentId;
366
+ this.logger.info(
367
+ `Re-spawned sub-agent '${spawnedAgentId}' for task: ${input.task} (using parent LLM)`
368
+ );
369
+ cleanupProgressTracking = this.setupProgressTracking(
370
+ handle,
371
+ input,
372
+ toolCallId,
373
+ sessionId
374
+ );
375
+ result = await this.runtime.executeTask(
376
+ spawnedAgentId,
377
+ input.instructions,
378
+ timeout
379
+ );
380
+ } else {
381
+ throw execError;
382
+ }
383
+ }
277
384
  const output = {
278
385
  success: result.success
279
386
  };
@@ -283,6 +390,9 @@ class RuntimeService {
283
390
  if (result.error !== void 0) {
284
391
  output.error = result.error;
285
392
  }
393
+ if (llmMode === "parent") {
394
+ output.warning = `Sub-agent '${input.agentId}' used fallback LLM (parent's full config) due to an error with its configured model.`;
395
+ }
286
396
  return output;
287
397
  } catch (error) {
288
398
  const errorMessage = error instanceof Error ? error.message : String(error);
@@ -309,10 +419,15 @@ class RuntimeService {
309
419
  * @param options.agentId - Agent ID from registry
310
420
  * @param options.inheritLlm - Use parent's LLM config instead of sub-agent's
311
421
  * @param options.autoApprove - Auto-approve all tool calls
422
+ * @param sessionId - Optional session ID to get session-specific LLM config
312
423
  */
313
- async buildSubAgentConfig(options) {
424
+ async buildSubAgentConfig(options, sessionId) {
314
425
  const { agentId, inheritLlm, autoApprove } = options;
315
426
  const parentConfig = this.parentAgent.config;
427
+ const currentParentLLM = this.parentAgent.getCurrentLLMConfig(sessionId);
428
+ this.logger.debug(
429
+ `[RuntimeService] Building sub-agent config with LLM: ${currentParentLLM.provider}/${currentParentLLM.model}` + (sessionId ? ` (sessionId: ${sessionId})` : " (no sessionId)")
430
+ );
316
431
  const toolConfirmationMode = autoApprove ? "auto-approve" : "manual";
317
432
  if (agentId) {
318
433
  const registry = (0, import_registry.getAgentRegistry)();
@@ -324,8 +439,18 @@ class RuntimeService {
324
439
  const loadedConfig = await (0, import_loader.loadAgentConfig)(configPath, this.logger);
325
440
  let llmConfig = loadedConfig.llm;
326
441
  if (inheritLlm) {
327
- this.logger.debug("Using parent LLM config (inheritLlm=true)");
328
- llmConfig = { ...parentConfig.llm };
442
+ this.logger.debug(
443
+ `Sub-agent '${agentId}' using parent LLM config (inheritLlm=true)`
444
+ );
445
+ llmConfig = { ...currentParentLLM };
446
+ } else {
447
+ const resolution = (0, import_llm_resolution.resolveSubAgentLLM)({
448
+ subAgentLLM: loadedConfig.llm,
449
+ parentLLM: currentParentLLM,
450
+ subAgentId: agentId
451
+ });
452
+ this.logger.debug(`Sub-agent LLM resolution: ${resolution.reason}`);
453
+ llmConfig = resolution.llm;
329
454
  }
330
455
  return {
331
456
  ...loadedConfig,
@@ -343,12 +468,22 @@ class RuntimeService {
343
468
  }
344
469
  }
345
470
  const config = {
346
- llm: { ...parentConfig.llm },
471
+ llm: { ...currentParentLLM },
347
472
  // Default system prompt for sub-agents
348
473
  systemPrompt: "You are a helpful sub-agent. Complete the task given to you efficiently and concisely.",
349
474
  toolConfirmation: {
350
475
  mode: toolConfirmationMode
351
476
  },
477
+ // Inherit MCP servers from parent so subagent has tool access
478
+ mcpServers: parentConfig.mcpServers ? { ...parentConfig.mcpServers } : {},
479
+ // Inherit internal tools from parent, excluding tools that don't work in subagent context
480
+ // - ask_user: Subagents can't interact with the user directly
481
+ // - invoke_skill: Avoid nested skill invocations for simplicity
482
+ internalTools: parentConfig.internalTools ? parentConfig.internalTools.filter(
483
+ (tool) => tool !== "ask_user" && tool !== "invoke_skill"
484
+ ) : [],
485
+ // Inherit custom tools from parent
486
+ customTools: parentConfig.customTools ? [...parentConfig.customTools] : [],
352
487
  // Suppress sub-agent console logs entirely using silent transport
353
488
  logger: {
354
489
  level: "error",