@dexto/core 1.5.6 → 1.5.8

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 (217) hide show
  1. package/dist/agent/DextoAgent.cjs +189 -30
  2. package/dist/agent/DextoAgent.d.ts +44 -9
  3. package/dist/agent/DextoAgent.d.ts.map +1 -1
  4. package/dist/agent/DextoAgent.js +190 -31
  5. package/dist/agent/schemas.cjs +5 -0
  6. package/dist/agent/schemas.d.ts +456 -66
  7. package/dist/agent/schemas.d.ts.map +1 -1
  8. package/dist/agent/schemas.js +5 -0
  9. package/dist/context/manager.cjs +1 -1
  10. package/dist/context/manager.js +1 -1
  11. package/dist/context/utils.cjs +90 -17
  12. package/dist/context/utils.d.ts.map +1 -1
  13. package/dist/context/utils.js +90 -17
  14. package/dist/errors/types.cjs +2 -1
  15. package/dist/errors/types.d.ts +2 -1
  16. package/dist/errors/types.d.ts.map +1 -1
  17. package/dist/errors/types.js +2 -1
  18. package/dist/events/index.cjs +4 -1
  19. package/dist/events/index.d.ts +37 -2
  20. package/dist/events/index.d.ts.map +1 -1
  21. package/dist/events/index.js +4 -1
  22. package/dist/image/types.d.ts +15 -0
  23. package/dist/image/types.d.ts.map +1 -1
  24. package/dist/index.browser.d.ts +1 -1
  25. package/dist/index.browser.d.ts.map +1 -1
  26. package/dist/llm/curation-config.cjs +82 -0
  27. package/dist/llm/curation-config.d.ts +13 -0
  28. package/dist/llm/curation-config.d.ts.map +1 -0
  29. package/dist/llm/curation-config.js +59 -0
  30. package/dist/llm/curation.cjs +57 -0
  31. package/dist/llm/curation.d.ts +16 -0
  32. package/dist/llm/curation.d.ts.map +1 -0
  33. package/dist/llm/curation.js +34 -0
  34. package/dist/llm/error-codes.cjs +1 -0
  35. package/dist/llm/error-codes.d.ts +1 -0
  36. package/dist/llm/error-codes.d.ts.map +1 -1
  37. package/dist/llm/error-codes.js +1 -0
  38. package/dist/llm/errors.cjs +16 -1
  39. package/dist/llm/errors.d.ts +15 -8
  40. package/dist/llm/errors.d.ts.map +1 -1
  41. package/dist/llm/errors.js +16 -1
  42. package/dist/llm/executor/provider-options.cjs +1 -1
  43. package/dist/llm/executor/provider-options.js +1 -1
  44. package/dist/llm/executor/turn-executor.cjs +35 -2
  45. package/dist/llm/executor/turn-executor.d.ts.map +1 -1
  46. package/dist/llm/executor/turn-executor.js +35 -2
  47. package/dist/llm/index.cjs +14 -3
  48. package/dist/llm/index.d.ts +3 -1
  49. package/dist/llm/index.d.ts.map +1 -1
  50. package/dist/llm/index.js +13 -2
  51. package/dist/llm/registry/auto-update.cjs +263 -0
  52. package/dist/llm/registry/auto-update.d.ts +27 -0
  53. package/dist/llm/registry/auto-update.d.ts.map +1 -0
  54. package/dist/llm/registry/auto-update.js +227 -0
  55. package/dist/llm/registry/index.cjs +806 -0
  56. package/dist/llm/{registry.d.ts → registry/index.d.ts} +67 -13
  57. package/dist/llm/registry/index.d.ts.map +1 -0
  58. package/dist/llm/registry/index.js +756 -0
  59. package/dist/llm/registry/models.generated.cjs +4861 -0
  60. package/dist/llm/registry/models.generated.d.ts +431 -0
  61. package/dist/llm/registry/models.generated.d.ts.map +1 -0
  62. package/dist/llm/registry/models.generated.js +4838 -0
  63. package/dist/llm/registry/models.manual.cjs +44 -0
  64. package/dist/llm/registry/models.manual.d.ts +22 -0
  65. package/dist/llm/registry/models.manual.d.ts.map +1 -0
  66. package/dist/llm/registry/models.manual.js +21 -0
  67. package/dist/llm/registry/sync.cjs +354 -0
  68. package/dist/llm/registry/sync.d.ts +41 -0
  69. package/dist/llm/registry/sync.d.ts.map +1 -0
  70. package/dist/llm/registry/sync.js +328 -0
  71. package/dist/llm/resolver.cjs +29 -7
  72. package/dist/llm/resolver.d.ts +1 -1
  73. package/dist/llm/resolver.d.ts.map +1 -1
  74. package/dist/llm/resolver.js +31 -8
  75. package/dist/llm/schemas.cjs +13 -1
  76. package/dist/llm/schemas.d.ts +59 -59
  77. package/dist/llm/schemas.d.ts.map +1 -1
  78. package/dist/llm/schemas.js +14 -1
  79. package/dist/llm/services/factory.cjs +43 -27
  80. package/dist/llm/services/factory.d.ts +20 -1
  81. package/dist/llm/services/factory.d.ts.map +1 -1
  82. package/dist/llm/services/factory.js +44 -28
  83. package/dist/llm/services/test-utils.integration.cjs +5 -1
  84. package/dist/llm/services/test-utils.integration.d.ts.map +1 -1
  85. package/dist/llm/services/test-utils.integration.js +5 -1
  86. package/dist/llm/services/vercel.cjs +4 -1
  87. package/dist/llm/services/vercel.d.ts +1 -0
  88. package/dist/llm/services/vercel.d.ts.map +1 -1
  89. package/dist/llm/services/vercel.js +4 -1
  90. package/dist/llm/types.cjs +5 -2
  91. package/dist/llm/types.d.ts +1 -1
  92. package/dist/llm/types.d.ts.map +1 -1
  93. package/dist/llm/types.js +5 -2
  94. package/dist/llm/validation.cjs +1 -1
  95. package/dist/llm/validation.js +1 -1
  96. package/dist/logger/v2/dexto-logger.cjs +4 -0
  97. package/dist/logger/v2/dexto-logger.d.ts +3 -0
  98. package/dist/logger/v2/dexto-logger.d.ts.map +1 -1
  99. package/dist/logger/v2/dexto-logger.js +4 -0
  100. package/dist/logger/v2/types.d.ts +2 -0
  101. package/dist/logger/v2/types.d.ts.map +1 -1
  102. package/dist/mcp/error-codes.cjs +1 -0
  103. package/dist/mcp/error-codes.d.ts +1 -0
  104. package/dist/mcp/error-codes.d.ts.map +1 -1
  105. package/dist/mcp/error-codes.js +1 -0
  106. package/dist/mcp/errors.cjs +13 -0
  107. package/dist/mcp/errors.d.ts +7 -0
  108. package/dist/mcp/errors.d.ts.map +1 -1
  109. package/dist/mcp/errors.js +13 -0
  110. package/dist/mcp/manager.cjs +46 -4
  111. package/dist/mcp/manager.d.ts +10 -2
  112. package/dist/mcp/manager.d.ts.map +1 -1
  113. package/dist/mcp/manager.js +46 -4
  114. package/dist/mcp/mcp-client.cjs +89 -5
  115. package/dist/mcp/mcp-client.d.ts +5 -1
  116. package/dist/mcp/mcp-client.d.ts.map +1 -1
  117. package/dist/mcp/mcp-client.js +89 -5
  118. package/dist/mcp/schemas.cjs +6 -1
  119. package/dist/mcp/schemas.d.ts +1 -1
  120. package/dist/mcp/schemas.d.ts.map +1 -1
  121. package/dist/mcp/schemas.js +6 -1
  122. package/dist/mcp/types.d.ts +5 -0
  123. package/dist/mcp/types.d.ts.map +1 -1
  124. package/dist/prompts/index.d.ts +1 -1
  125. package/dist/prompts/index.d.ts.map +1 -1
  126. package/dist/prompts/prompt-manager.cjs +90 -4
  127. package/dist/prompts/prompt-manager.d.ts +16 -6
  128. package/dist/prompts/prompt-manager.d.ts.map +1 -1
  129. package/dist/prompts/prompt-manager.js +90 -4
  130. package/dist/prompts/providers/config-prompt-provider.cjs +104 -10
  131. package/dist/prompts/providers/config-prompt-provider.d.ts.map +1 -1
  132. package/dist/prompts/providers/config-prompt-provider.js +105 -11
  133. package/dist/prompts/providers/custom-prompt-provider.cjs +1 -0
  134. package/dist/prompts/providers/custom-prompt-provider.d.ts.map +1 -1
  135. package/dist/prompts/providers/custom-prompt-provider.js +1 -0
  136. package/dist/prompts/providers/mcp-prompt-provider.cjs +1 -0
  137. package/dist/prompts/providers/mcp-prompt-provider.d.ts.map +1 -1
  138. package/dist/prompts/providers/mcp-prompt-provider.js +1 -0
  139. package/dist/prompts/schemas.cjs +28 -2
  140. package/dist/prompts/schemas.d.ts +130 -0
  141. package/dist/prompts/schemas.d.ts.map +1 -1
  142. package/dist/prompts/schemas.js +28 -2
  143. package/dist/prompts/types.d.ts +55 -3
  144. package/dist/prompts/types.d.ts.map +1 -1
  145. package/dist/resources/handlers/filesystem-handler.cjs +25 -0
  146. package/dist/resources/handlers/filesystem-handler.d.ts +1 -0
  147. package/dist/resources/handlers/filesystem-handler.d.ts.map +1 -1
  148. package/dist/resources/handlers/filesystem-handler.js +25 -0
  149. package/dist/session/chat-session.cjs +1 -1
  150. package/dist/session/chat-session.d.ts +1 -1
  151. package/dist/session/chat-session.d.ts.map +1 -1
  152. package/dist/session/chat-session.js +1 -1
  153. package/dist/session/index.d.ts +1 -1
  154. package/dist/session/index.d.ts.map +1 -1
  155. package/dist/session/message-queue.cjs +29 -5
  156. package/dist/session/message-queue.d.ts +3 -1
  157. package/dist/session/message-queue.d.ts.map +1 -1
  158. package/dist/session/message-queue.js +29 -5
  159. package/dist/session/session-manager.cjs +84 -3
  160. package/dist/session/session-manager.d.ts +12 -0
  161. package/dist/session/session-manager.d.ts.map +1 -1
  162. package/dist/session/session-manager.js +74 -3
  163. package/dist/session/types.d.ts +1 -0
  164. package/dist/session/types.d.ts.map +1 -1
  165. package/dist/systemPrompt/contributors.cjs +42 -0
  166. package/dist/systemPrompt/contributors.d.ts +13 -0
  167. package/dist/systemPrompt/contributors.d.ts.map +1 -1
  168. package/dist/systemPrompt/contributors.js +41 -0
  169. package/dist/tools/errors.cjs +7 -3
  170. package/dist/tools/errors.d.ts +5 -1
  171. package/dist/tools/errors.d.ts.map +1 -1
  172. package/dist/tools/errors.js +7 -3
  173. package/dist/tools/internal-tools/constants.cjs +2 -1
  174. package/dist/tools/internal-tools/constants.d.ts +1 -1
  175. package/dist/tools/internal-tools/constants.d.ts.map +1 -1
  176. package/dist/tools/internal-tools/constants.js +2 -1
  177. package/dist/tools/internal-tools/implementations/invoke-skill-tool.cjs +140 -0
  178. package/dist/tools/internal-tools/implementations/invoke-skill-tool.d.ts +24 -0
  179. package/dist/tools/internal-tools/implementations/invoke-skill-tool.d.ts.map +1 -0
  180. package/dist/tools/internal-tools/implementations/invoke-skill-tool.js +117 -0
  181. package/dist/tools/internal-tools/provider.cjs +15 -0
  182. package/dist/tools/internal-tools/provider.d.ts +15 -1
  183. package/dist/tools/internal-tools/provider.d.ts.map +1 -1
  184. package/dist/tools/internal-tools/provider.js +15 -0
  185. package/dist/tools/internal-tools/registry.cjs +6 -0
  186. package/dist/tools/internal-tools/registry.d.ts +35 -1
  187. package/dist/tools/internal-tools/registry.d.ts.map +1 -1
  188. package/dist/tools/internal-tools/registry.js +6 -0
  189. package/dist/tools/schemas.d.ts +1 -1
  190. package/dist/tools/schemas.d.ts.map +1 -1
  191. package/dist/tools/tool-call-metadata.cjs +75 -0
  192. package/dist/tools/tool-call-metadata.d.ts +16 -0
  193. package/dist/tools/tool-call-metadata.d.ts.map +1 -0
  194. package/dist/tools/tool-call-metadata.js +51 -0
  195. package/dist/tools/tool-manager.cjs +481 -103
  196. package/dist/tools/tool-manager.d.ts +131 -9
  197. package/dist/tools/tool-manager.d.ts.map +1 -1
  198. package/dist/tools/tool-manager.js +482 -104
  199. package/dist/utils/api-key-resolver.cjs +5 -2
  200. package/dist/utils/api-key-resolver.d.ts.map +1 -1
  201. package/dist/utils/api-key-resolver.js +5 -2
  202. package/dist/utils/env.cjs +49 -0
  203. package/dist/utils/env.d.ts +4 -0
  204. package/dist/utils/env.d.ts.map +1 -0
  205. package/dist/utils/env.js +24 -0
  206. package/dist/utils/index.cjs +3 -1
  207. package/dist/utils/index.d.ts +1 -0
  208. package/dist/utils/index.d.ts.map +1 -1
  209. package/dist/utils/index.js +1 -0
  210. package/dist/utils/service-initializer.cjs +25 -7
  211. package/dist/utils/service-initializer.d.ts +24 -1
  212. package/dist/utils/service-initializer.d.ts.map +1 -1
  213. package/dist/utils/service-initializer.js +25 -7
  214. package/package.json +6 -2
  215. package/dist/llm/registry.cjs +0 -1631
  216. package/dist/llm/registry.d.ts.map +0 -1
  217. package/dist/llm/registry.js +0 -1586
@@ -0,0 +1,117 @@
1
+ import "../../../chunk-PTJYTZNU.js";
2
+ import { z } from "zod";
3
+ import { flattenPromptResult } from "../../../prompts/utils.js";
4
+ const InvokeSkillInputSchema = z.object({
5
+ skill: z.string().min(1, "Skill name is required").describe(
6
+ 'The name of the skill to invoke (e.g., "plugin-name:skill-name" or "skill-name")'
7
+ ),
8
+ args: z.record(z.string()).optional().describe("Optional arguments to pass to the skill"),
9
+ taskContext: z.string().optional().describe(
10
+ "Context about what task this skill should accomplish. Recommended for forked skills to provide context since they run in isolation without conversation history."
11
+ )
12
+ }).strict();
13
+ function createInvokeSkillTool(services) {
14
+ return {
15
+ id: "invoke_skill",
16
+ description: buildToolDescription(),
17
+ inputSchema: InvokeSkillInputSchema,
18
+ execute: async (input, context) => {
19
+ const { skill, args, taskContext } = input;
20
+ const promptManager = services.promptManager;
21
+ if (!promptManager) {
22
+ return {
23
+ error: "PromptManager not available. This is a configuration error."
24
+ };
25
+ }
26
+ const autoInvocable = await promptManager.listAutoInvocablePrompts();
27
+ let skillKey;
28
+ for (const key of Object.keys(autoInvocable)) {
29
+ const info = autoInvocable[key];
30
+ if (!info) continue;
31
+ if (key === skill || info.displayName === skill || info.commandName === skill || info.name === skill) {
32
+ skillKey = key;
33
+ break;
34
+ }
35
+ }
36
+ if (!skillKey) {
37
+ return {
38
+ error: `Skill '${skill}' not found or not available for model invocation. Use a skill from the available list.`,
39
+ availableSkills: Object.keys(autoInvocable)
40
+ };
41
+ }
42
+ const promptDef = await promptManager.getPromptDefinition(skillKey);
43
+ const promptResult = await promptManager.getPrompt(skillKey, args);
44
+ const flattened = flattenPromptResult(promptResult);
45
+ const content = flattened.text;
46
+ if (promptDef?.context === "fork") {
47
+ const taskForker = services.taskForker;
48
+ if (!taskForker) {
49
+ return {
50
+ error: `Skill '${skill}' requires fork execution (context: fork), but agent spawning is not available. Configure agent-spawner custom tool to enable forked skills.`,
51
+ skill: skillKey
52
+ };
53
+ }
54
+ let instructions;
55
+ if (taskContext) {
56
+ instructions = `## Task Context
57
+ ${taskContext}
58
+
59
+ ## Skill Instructions
60
+ ${content}`;
61
+ } else {
62
+ instructions = content;
63
+ }
64
+ const forkOptions = {
65
+ task: `Skill: ${skill}`,
66
+ instructions,
67
+ // Fork skills auto-approve by default since they run in isolation
68
+ autoApprove: true
69
+ };
70
+ if (promptDef.agent) {
71
+ forkOptions.agentId = promptDef.agent;
72
+ }
73
+ if (context?.toolCallId) {
74
+ forkOptions.toolCallId = context.toolCallId;
75
+ }
76
+ if (context?.sessionId) {
77
+ forkOptions.sessionId = context.sessionId;
78
+ }
79
+ const result = await taskForker.fork(forkOptions);
80
+ if (result.success) {
81
+ return result.response ?? "Task completed successfully.";
82
+ } else {
83
+ return `Error: ${result.error ?? "Unknown error during forked execution"}`;
84
+ }
85
+ }
86
+ return {
87
+ skill: skillKey,
88
+ content,
89
+ instructions: "Follow the instructions in the skill content above to complete the task."
90
+ };
91
+ }
92
+ };
93
+ }
94
+ function buildToolDescription() {
95
+ return `Invoke a skill to load and execute specialized instructions for a task. Skills are predefined prompts that guide how to handle specific scenarios.
96
+
97
+ When to use:
98
+ - When you recognize a task that matches an available skill
99
+ - When you need specialized guidance for a complex operation
100
+ - When the user references a skill by name
101
+
102
+ Parameters:
103
+ - skill: The name of the skill to invoke
104
+ - args: Optional arguments to pass to the skill (e.g., for $ARGUMENTS substitution)
105
+ - taskContext: Context about what you're trying to accomplish (important for forked skills that run in isolation)
106
+
107
+ Execution modes:
108
+ - **Inline skills**: Return instructions for you to follow in the current conversation
109
+ - **Fork skills**: Automatically execute in an isolated subagent and return the result (no additional tool calls needed)
110
+
111
+ Fork skills run in complete isolation without access to conversation history. They're useful for tasks that should run independently.
112
+
113
+ Available skills are listed in your system prompt. Use the skill name exactly as shown.`;
114
+ }
115
+ export {
116
+ createInvokeSkillTool
117
+ };
@@ -55,6 +55,21 @@ class InternalToolsProvider {
55
55
  setAgent(agent) {
56
56
  this.agent = agent;
57
57
  }
58
+ /**
59
+ * Set prompt manager after construction (avoids circular dependency)
60
+ * Must be called before initialize() if invoke_skill tool is enabled
61
+ */
62
+ setPromptManager(promptManager) {
63
+ this.services.promptManager = promptManager;
64
+ }
65
+ /**
66
+ * Set task forker for context:fork skill execution (late-binding)
67
+ * Called by agent-spawner custom tool provider after RuntimeService is created.
68
+ * This enables invoke_skill to fork execution to an isolated subagent.
69
+ */
70
+ setTaskForker(taskForker) {
71
+ this.services.taskForker = taskForker;
72
+ }
58
73
  /**
59
74
  * Initialize the internal tools provider by registering all available internal tools
60
75
  * and custom tools from the registry
@@ -2,6 +2,7 @@ import { ToolSet, InternalTool } from '../types.js';
2
2
  import type { IDextoLogger } from '../../logger/v2/types.js';
3
3
  import type { DextoAgent } from '../../agent/DextoAgent.js';
4
4
  import { InternalToolsServices } from './registry.js';
5
+ import type { PromptManager } from '../../prompts/prompt-manager.js';
5
6
  import type { InternalToolsConfig, CustomToolsConfig } from '../schemas.js';
6
7
  /**
7
8
  * Provider for built-in internal tools and custom tool providers
@@ -17,6 +18,7 @@ import type { InternalToolsConfig, CustomToolsConfig } from '../schemas.js';
17
18
  * - No unnecessary ProcessedInternalTool wrapper - uses InternalTool directly
18
19
  * - Custom tools follow the same provider pattern as blob storage
19
20
  */
21
+ type ToolServices = InternalToolsServices & Record<string, unknown>;
20
22
  export declare class InternalToolsProvider {
21
23
  private services;
22
24
  private internalTools;
@@ -25,12 +27,23 @@ export declare class InternalToolsProvider {
25
27
  private customToolConfigs;
26
28
  private logger;
27
29
  private agent?;
28
- constructor(services: InternalToolsServices, config: InternalToolsConfig | undefined, customToolConfigs: CustomToolsConfig | undefined, logger: IDextoLogger);
30
+ constructor(services: ToolServices, config: InternalToolsConfig | undefined, customToolConfigs: CustomToolsConfig | undefined, logger: IDextoLogger);
29
31
  /**
30
32
  * Set agent reference after construction (avoids circular dependency)
31
33
  * Must be called before initialize() if custom tools need agent access
32
34
  */
33
35
  setAgent(agent: DextoAgent): void;
36
+ /**
37
+ * Set prompt manager after construction (avoids circular dependency)
38
+ * Must be called before initialize() if invoke_skill tool is enabled
39
+ */
40
+ setPromptManager(promptManager: PromptManager): void;
41
+ /**
42
+ * Set task forker for context:fork skill execution (late-binding)
43
+ * Called by agent-spawner custom tool provider after RuntimeService is created.
44
+ * This enables invoke_skill to fork execution to an isolated subagent.
45
+ */
46
+ setTaskForker(taskForker: import('./registry.js').TaskForker): void;
34
47
  /**
35
48
  * Initialize the internal tools provider by registering all available internal tools
36
49
  * and custom tools from the registry
@@ -99,4 +112,5 @@ export declare class InternalToolsProvider {
99
112
  */
100
113
  getCustomToolCount(): number;
101
114
  }
115
+ export {};
102
116
  //# sourceMappingURL=provider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../../src/tools/internal-tools/provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC1E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAG5D,OAAO,EAAE,qBAAqB,EAA0C,MAAM,eAAe,CAAC;AAC9F,OAAO,KAAK,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAK5E;;;;;;;;;;;;;GAaG;AACH,qBAAa,qBAAqB;IAC9B,OAAO,CAAC,QAAQ,CAAwB;IACxC,OAAO,CAAC,aAAa,CAAwC;IAC7D,OAAO,CAAC,WAAW,CAAwC;IAC3D,OAAO,CAAC,MAAM,CAAsB;IACpC,OAAO,CAAC,iBAAiB,CAAoB;IAC7C,OAAO,CAAC,MAAM,CAAe;IAC7B,OAAO,CAAC,KAAK,CAAC,CAAa;gBAGvB,QAAQ,EAAE,qBAAqB,EAC/B,MAAM,EAAE,mBAAmB,YAAK,EAChC,iBAAiB,EAAE,iBAAiB,YAAK,EACzC,MAAM,EAAE,YAAY;IAYxB;;;OAGG;IACH,QAAQ,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI;IAIjC;;;OAGG;IACG,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IA+BjC;;OAEG;IACH,OAAO,CAAC,qBAAqB;IAgD7B;;;OAGG;IACH,OAAO,CAAC,mBAAmB;IAgE3B;;OAEG;IACH,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAIlC;;OAEG;IACH,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAI1C;;OAEG;IACH,aAAa,CAAC,QAAQ,EAAE,MAAM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ACH,cAAc,IAAI,OAAO;IAczB;;OAEG;IACH,oBAAoB,IAAI,MAAM,EAAE;IAIhC;;OAEG;IACH,kBAAkB,IAAI,MAAM,EAAE;IAI9B;;OAEG;IACH,YAAY,IAAI,MAAM,EAAE;IAIxB;;OAEG;IACH,YAAY,IAAI,MAAM;IAItB;;OAEG;IACH,oBAAoB,IAAI,MAAM;IAI9B;;OAEG;IACH,kBAAkB,IAAI,MAAM;CAG/B"}
@@ -33,6 +33,21 @@ class InternalToolsProvider {
33
33
  setAgent(agent) {
34
34
  this.agent = agent;
35
35
  }
36
+ /**
37
+ * Set prompt manager after construction (avoids circular dependency)
38
+ * Must be called before initialize() if invoke_skill tool is enabled
39
+ */
40
+ setPromptManager(promptManager) {
41
+ this.services.promptManager = promptManager;
42
+ }
43
+ /**
44
+ * Set task forker for context:fork skill execution (late-binding)
45
+ * Called by agent-spawner custom tool provider after RuntimeService is created.
46
+ * This enables invoke_skill to fork execution to an isolated subagent.
47
+ */
48
+ setTaskForker(taskForker) {
49
+ this.services.taskForker = taskForker;
50
+ }
36
51
  /**
37
52
  * Initialize the internal tools provider by registering all available internal tools
38
53
  * and custom tools from the registry
@@ -27,6 +27,7 @@ var import_ask_user_tool = require("./implementations/ask-user-tool.js");
27
27
  var import_delegate_to_url_tool = require("./implementations/delegate-to-url-tool.js");
28
28
  var import_list_resources_tool = require("./implementations/list-resources-tool.js");
29
29
  var import_get_resource_tool = require("./implementations/get-resource-tool.js");
30
+ var import_invoke_skill_tool = require("./implementations/invoke-skill-tool.js");
30
31
  const INTERNAL_TOOL_REGISTRY = {
31
32
  search_history: {
32
33
  factory: (services) => (0, import_search_history_tool.createSearchHistoryTool)(services.searchService),
@@ -53,6 +54,11 @@ const INTERNAL_TOOL_REGISTRY = {
53
54
  factory: (services) => (0, import_get_resource_tool.createGetResourceTool)(services.resourceManager),
54
55
  requiredServices: ["resourceManager"],
55
56
  description: "Access a stored resource to get URLs or metadata"
57
+ },
58
+ invoke_skill: {
59
+ factory: (services) => (0, import_invoke_skill_tool.createInvokeSkillTool)(services),
60
+ requiredServices: ["promptManager"],
61
+ description: "Invoke a skill to load specialized instructions for a task"
56
62
  }
57
63
  };
58
64
  function getInternalToolInfo(toolName) {
@@ -2,6 +2,7 @@ import { InternalTool } from '../types.js';
2
2
  import { SearchService } from '../../search/index.js';
3
3
  import { ApprovalManager } from '../../approval/manager.js';
4
4
  import { ResourceManager } from '../../resources/manager.js';
5
+ import type { PromptManager } from '../../prompts/prompt-manager.js';
5
6
  import type { KnownInternalTool } from './constants.js';
6
7
  /**
7
8
  * Agent features that tools can depend on.
@@ -22,14 +23,47 @@ import type { KnownInternalTool } from './constants.js';
22
23
  * Tools can require multiple features - all must be enabled or startup fails with a clear error.
23
24
  */
24
25
  export type AgentFeature = 'elicitation';
26
+ /**
27
+ * Interface for forking skill execution to an isolated subagent.
28
+ * Implemented by RuntimeService in @dexto/agent-management.
29
+ */
30
+ export interface TaskForker {
31
+ /**
32
+ * Execute a task in an isolated subagent context.
33
+ * The subagent has no access to the parent's conversation history.
34
+ *
35
+ * @param options.task - Short description for UI/logs
36
+ * @param options.instructions - Full instructions for the subagent
37
+ * @param options.agentId - Optional agent ID from registry to use for execution
38
+ * @param options.autoApprove - Auto-approve tool calls (default: true for fork skills)
39
+ * @param options.toolCallId - Optional tool call ID for progress events
40
+ * @param options.sessionId - Optional session ID for progress events
41
+ * @returns Result with success status and response/error
42
+ */
43
+ fork(options: {
44
+ task: string;
45
+ instructions: string;
46
+ agentId?: string;
47
+ autoApprove?: boolean;
48
+ toolCallId?: string;
49
+ sessionId?: string;
50
+ }): Promise<{
51
+ success: boolean;
52
+ response?: string;
53
+ error?: string;
54
+ }>;
55
+ }
25
56
  /**
26
57
  * Services available to internal tools
27
58
  * Add new services here as needed for internal tools
28
59
  */
29
- export interface InternalToolsServices {
60
+ export interface InternalToolsServices extends Record<string, unknown> {
30
61
  searchService?: SearchService;
31
62
  approvalManager?: ApprovalManager;
32
63
  resourceManager?: ResourceManager;
64
+ promptManager?: PromptManager;
65
+ /** Optional forker for executing skills in isolated context (context: fork) */
66
+ taskForker?: TaskForker;
33
67
  }
34
68
  /**
35
69
  * Internal tool factory function type
@@ -1 +1 @@
1
- {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../src/tools/internal-tools/registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAM7D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAExD;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,MAAM,YAAY,GAAG,aAAa,CAAC;AAEzC;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IAClC,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,eAAe,CAAC,EAAE,eAAe,CAAC;CACrC;AAED;;GAEG;AACH,KAAK,mBAAmB,GAAG,CAAC,QAAQ,EAAE,qBAAqB,KAAK,YAAY,CAAC;AAE7E;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACtC,OAAO,EAAE,mBAAmB,CAAC;IAC7B,gBAAgB,EAAE,SAAS,CAAC,MAAM,qBAAqB,CAAC,EAAE,CAAC;IAC3D,gBAAgB,CAAC,EAAE,SAAS,YAAY,EAAE,CAAC;IAC3C,kDAAkD;IAClD,WAAW,EAAE,MAAM,CAAC;CACvB;AAED;;GAEG;AACH,eAAO,MAAM,sBAAsB,EAAE,MAAM,CAAC,iBAAiB,EAAE,yBAAyB,CA8BvF,CAAC;AAEF;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,iBAAiB,GAAG,yBAAyB,CAE1F"}
1
+ {"version":3,"file":"registry.d.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AAE,qBAAqB,KAAK,YAAY,CAAC;AAE7E;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACtC,OAAO,EAAE,mBAAmB,CAAC;IAC7B,gBAAgB,EAAE,SAAS,CAAC,MAAM,qBAAqB,CAAC,EAAE,CAAC;IAC3D,gBAAgB,CAAC,EAAE,SAAS,YAAY,EAAE,CAAC;IAC3C,kDAAkD;IAClD,WAAW,EAAE,MAAM,CAAC;CACvB;AAED;;GAEG;AACH,eAAO,MAAM,sBAAsB,EAAE,MAAM,CAAC,iBAAiB,EAAE,yBAAyB,CAmCvF,CAAC;AAEF;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,iBAAiB,GAAG,yBAAyB,CAE1F"}
@@ -4,6 +4,7 @@ import { createAskUserTool } from "./implementations/ask-user-tool.js";
4
4
  import { createDelegateToUrlTool } from "./implementations/delegate-to-url-tool.js";
5
5
  import { createListResourcesTool } from "./implementations/list-resources-tool.js";
6
6
  import { createGetResourceTool } from "./implementations/get-resource-tool.js";
7
+ import { createInvokeSkillTool } from "./implementations/invoke-skill-tool.js";
7
8
  const INTERNAL_TOOL_REGISTRY = {
8
9
  search_history: {
9
10
  factory: (services) => createSearchHistoryTool(services.searchService),
@@ -30,6 +31,11 @@ const INTERNAL_TOOL_REGISTRY = {
30
31
  factory: (services) => createGetResourceTool(services.resourceManager),
31
32
  requiredServices: ["resourceManager"],
32
33
  description: "Access a stored resource to get URLs or metadata"
34
+ },
35
+ invoke_skill: {
36
+ factory: (services) => createInvokeSkillTool(services),
37
+ requiredServices: ["promptManager"],
38
+ description: "Invoke a skill to load specialized instructions for a task"
33
39
  }
34
40
  };
35
41
  function getInternalToolInfo(toolName) {
@@ -5,7 +5,7 @@ export declare const ALLOWED_TOOLS_STORAGE_TYPES: readonly ["memory", "storage"]
5
5
  export type AllowedToolsStorageType = (typeof ALLOWED_TOOLS_STORAGE_TYPES)[number];
6
6
  export declare const DEFAULT_TOOL_CONFIRMATION_MODE: ToolConfirmationMode;
7
7
  export declare const DEFAULT_ALLOWED_TOOLS_STORAGE: AllowedToolsStorageType;
8
- export declare const InternalToolsSchema: z.ZodDefault<z.ZodArray<z.ZodEnum<["search_history", "ask_user", "delegate_to_url", "list_resources", "get_resource"]>, "many">>;
8
+ export declare const InternalToolsSchema: z.ZodDefault<z.ZodArray<z.ZodEnum<["search_history", "ask_user", "delegate_to_url", "list_resources", "get_resource", "invoke_skill"]>, "many">>;
9
9
  export type InternalToolsConfig = z.output<typeof InternalToolsSchema>;
10
10
  /**
11
11
  * Custom tool configuration schema.
@@ -1 +1 @@
1
- {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../src/tools/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,uBAAuB,kDAAmD,CAAC;AACxF,MAAM,MAAM,oBAAoB,GAAG,CAAC,OAAO,uBAAuB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE5E,eAAO,MAAM,2BAA2B,gCAAiC,CAAC;AAC1E,MAAM,MAAM,uBAAuB,GAAG,CAAC,OAAO,2BAA2B,CAAC,CAAC,MAAM,CAAC,CAAC;AAEnF,eAAO,MAAM,8BAA8B,EAAE,oBAAqC,CAAC;AACnF,eAAO,MAAM,6BAA6B,EAAE,uBAAmC,CAAC;AAIhF,eAAO,MAAM,mBAAmB,kIAK3B,CAAC;AAEN,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAkBvE;;;;;;;;GAQG;AACH,eAAO,MAAM,sBAAsB,8CAA4C,CAAC;AAEhF,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEvE;;;GAGG;AACH,eAAO,MAAM,gCAAgC;;;;;;gCAKgD,CAAC;AAE9F;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,gFAKzB,CAAC;AAEN,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A0B,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAGlF,eAAO,MAAM,gBAAgB;;;;;;;;;;;;EAShB,CAAC;AAEd,eAAO,MAAM,iBAAiB;;;;;;;;;;;;GAEgB,CAAC;AAE/C,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,iBAAiB,CAAC,CAAC"}
@@ -0,0 +1,75 @@
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 tool_call_metadata_exports = {};
20
+ __export(tool_call_metadata_exports, {
21
+ extractToolCallMeta: () => extractToolCallMeta,
22
+ wrapToolParametersSchema: () => wrapToolParametersSchema
23
+ });
24
+ module.exports = __toCommonJS(tool_call_metadata_exports);
25
+ const META_SCHEMA = {
26
+ type: "object",
27
+ properties: {
28
+ runInBackground: {
29
+ type: "boolean",
30
+ description: "Run the tool in background and return a task ID immediately."
31
+ },
32
+ timeoutMs: {
33
+ type: "number",
34
+ description: "Optional timeout in milliseconds for background tasks."
35
+ },
36
+ notifyOnComplete: {
37
+ type: "boolean",
38
+ description: "Notify when the background task completes."
39
+ },
40
+ callDescription: {
41
+ type: "string",
42
+ description: "Optional description shown to the user when requesting approval."
43
+ }
44
+ },
45
+ additionalProperties: false
46
+ };
47
+ const META_KEY = "__dexto";
48
+ function wrapToolParametersSchema(parameters) {
49
+ if (parameters.type !== "object" || !parameters.properties) {
50
+ return parameters;
51
+ }
52
+ if (META_KEY in parameters.properties) {
53
+ return parameters;
54
+ }
55
+ return {
56
+ ...parameters,
57
+ properties: {
58
+ ...parameters.properties,
59
+ [META_KEY]: META_SCHEMA
60
+ }
61
+ };
62
+ }
63
+ function extractToolCallMeta(args) {
64
+ const { __dexto, ...toolArgs } = args;
65
+ const meta = __dexto ?? {};
66
+ return {
67
+ toolArgs,
68
+ meta
69
+ };
70
+ }
71
+ // Annotate the CommonJS export names for ESM import in node:
72
+ 0 && (module.exports = {
73
+ extractToolCallMeta,
74
+ wrapToolParametersSchema
75
+ });
@@ -0,0 +1,16 @@
1
+ import type { JSONSchema7 } from 'json-schema';
2
+ export type ToolCallMetadata = {
3
+ runInBackground?: boolean;
4
+ timeoutMs?: number;
5
+ notifyOnComplete?: boolean;
6
+ callDescription?: string;
7
+ };
8
+ export type ToolCallMetaWrapper = {
9
+ __dexto: ToolCallMetadata;
10
+ };
11
+ export declare function wrapToolParametersSchema(parameters: JSONSchema7): JSONSchema7;
12
+ export declare function extractToolCallMeta(args: Record<string, unknown>): {
13
+ toolArgs: Record<string, unknown>;
14
+ meta: ToolCallMetadata;
15
+ };
16
+ //# sourceMappingURL=tool-call-metadata.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-call-metadata.d.ts","sourceRoot":"","sources":["../../src/tools/tool-call-metadata.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,MAAM,MAAM,gBAAgB,GAAG;IAC3B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,eAAe,CAAC,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAC9B,OAAO,EAAE,gBAAgB,CAAC;CAC7B,CAAC;AA2BF,wBAAgB,wBAAwB,CAAC,UAAU,EAAE,WAAW,GAAG,WAAW,CAgB7E;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG;IAChE,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,IAAI,EAAE,gBAAgB,CAAC;CAC1B,CAQA"}
@@ -0,0 +1,51 @@
1
+ import "../chunk-PTJYTZNU.js";
2
+ const META_SCHEMA = {
3
+ type: "object",
4
+ properties: {
5
+ runInBackground: {
6
+ type: "boolean",
7
+ description: "Run the tool in background and return a task ID immediately."
8
+ },
9
+ timeoutMs: {
10
+ type: "number",
11
+ description: "Optional timeout in milliseconds for background tasks."
12
+ },
13
+ notifyOnComplete: {
14
+ type: "boolean",
15
+ description: "Notify when the background task completes."
16
+ },
17
+ callDescription: {
18
+ type: "string",
19
+ description: "Optional description shown to the user when requesting approval."
20
+ }
21
+ },
22
+ additionalProperties: false
23
+ };
24
+ const META_KEY = "__dexto";
25
+ function wrapToolParametersSchema(parameters) {
26
+ if (parameters.type !== "object" || !parameters.properties) {
27
+ return parameters;
28
+ }
29
+ if (META_KEY in parameters.properties) {
30
+ return parameters;
31
+ }
32
+ return {
33
+ ...parameters,
34
+ properties: {
35
+ ...parameters.properties,
36
+ [META_KEY]: META_SCHEMA
37
+ }
38
+ };
39
+ }
40
+ function extractToolCallMeta(args) {
41
+ const { __dexto, ...toolArgs } = args;
42
+ const meta = __dexto ?? {};
43
+ return {
44
+ toolArgs,
45
+ meta
46
+ };
47
+ }
48
+ export {
49
+ extractToolCallMeta,
50
+ wrapToolParametersSchema
51
+ };