@dexto/tools-builtins 1.6.1 → 1.6.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.
@@ -58,11 +58,13 @@ function createInvokeSkillTool() {
58
58
  }
59
59
  const autoInvocable = await promptManager.listAutoInvocablePrompts();
60
60
  let skillKey;
61
+ let matchedInfo;
61
62
  for (const key of Object.keys(autoInvocable)) {
62
63
  const info = autoInvocable[key];
63
64
  if (!info) continue;
64
65
  if (key === skill || info.displayName === skill || info.commandName === skill || info.name === skill) {
65
66
  skillKey = key;
67
+ matchedInfo = info;
66
68
  break;
67
69
  }
68
70
  }
@@ -72,7 +74,39 @@ function createInvokeSkillTool() {
72
74
  availableSkills: Object.keys(autoInvocable)
73
75
  };
74
76
  }
77
+ const toolkits = Array.isArray(matchedInfo?.metadata?.toolkits) ? (matchedInfo?.metadata?.toolkits).filter((toolkit) => typeof toolkit === "string").map((toolkit) => toolkit.trim()).filter((toolkit) => toolkit.length > 0) : [];
78
+ if (toolkits.length > 0) {
79
+ if (!context.agent?.loadToolkits) {
80
+ return {
81
+ error: `Skill '${skill}' requires toolkits (${toolkits.join(
82
+ ", "
83
+ )}), but this agent does not support dynamic tool loading.`,
84
+ toolkits
85
+ };
86
+ }
87
+ try {
88
+ await context.agent.loadToolkits(toolkits);
89
+ } catch (error) {
90
+ return {
91
+ error: error instanceof Error ? error.message : "Failed to load required toolkits",
92
+ toolkits
93
+ };
94
+ }
95
+ }
75
96
  const promptDef = await promptManager.getPromptDefinition(skillKey);
97
+ if (promptDef?.context !== "fork" && promptDef?.allowedTools && promptDef.allowedTools.length > 0 && context.sessionId && context.agent?.toolManager) {
98
+ try {
99
+ context.agent.toolManager.addSessionAutoApproveTools(
100
+ context.sessionId,
101
+ promptDef.allowedTools
102
+ );
103
+ } catch (error) {
104
+ context.logger?.warn("Failed to add auto-approve tools for skill", {
105
+ tools: promptDef.allowedTools,
106
+ error: error instanceof Error ? error.message : String(error)
107
+ });
108
+ }
109
+ }
76
110
  const promptResult = await promptManager.getPrompt(skillKey, args);
77
111
  const flattened = (0, import_core.flattenPromptResult)(promptResult);
78
112
  const content = flattened.text;
@@ -1 +1 @@
1
- {"version":3,"file":"invoke-skill-tool.d.ts","sourceRoot":"","sources":["../../src/implementations/invoke-skill-tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAmB,IAAI,EAAwB,MAAM,aAAa,CAAC;AAE/E,QAAA,MAAM,sBAAsB;;;;;;;;;;;;EAgBf,CAAC;AAEd;;;;;;GAMG;AACH,wBAAgB,qBAAqB,IAAI,IAAI,CAAC,OAAO,sBAAsB,CAAC,CAsG3E"}
1
+ {"version":3,"file":"invoke-skill-tool.d.ts","sourceRoot":"","sources":["../../src/implementations/invoke-skill-tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAA+B,IAAI,EAAwB,MAAM,aAAa,CAAC;AAE3F,QAAA,MAAM,sBAAsB;;;;;;;;;;;;EAgBf,CAAC;AAEd;;;;;;GAMG;AACH,wBAAgB,qBAAqB,IAAI,IAAI,CAAC,OAAO,sBAAsB,CAAC,CA0J3E"}
@@ -35,11 +35,13 @@ function createInvokeSkillTool() {
35
35
  }
36
36
  const autoInvocable = await promptManager.listAutoInvocablePrompts();
37
37
  let skillKey;
38
+ let matchedInfo;
38
39
  for (const key of Object.keys(autoInvocable)) {
39
40
  const info = autoInvocable[key];
40
41
  if (!info) continue;
41
42
  if (key === skill || info.displayName === skill || info.commandName === skill || info.name === skill) {
42
43
  skillKey = key;
44
+ matchedInfo = info;
43
45
  break;
44
46
  }
45
47
  }
@@ -49,7 +51,39 @@ function createInvokeSkillTool() {
49
51
  availableSkills: Object.keys(autoInvocable)
50
52
  };
51
53
  }
54
+ const toolkits = Array.isArray(matchedInfo?.metadata?.toolkits) ? (matchedInfo?.metadata?.toolkits).filter((toolkit) => typeof toolkit === "string").map((toolkit) => toolkit.trim()).filter((toolkit) => toolkit.length > 0) : [];
55
+ if (toolkits.length > 0) {
56
+ if (!context.agent?.loadToolkits) {
57
+ return {
58
+ error: `Skill '${skill}' requires toolkits (${toolkits.join(
59
+ ", "
60
+ )}), but this agent does not support dynamic tool loading.`,
61
+ toolkits
62
+ };
63
+ }
64
+ try {
65
+ await context.agent.loadToolkits(toolkits);
66
+ } catch (error) {
67
+ return {
68
+ error: error instanceof Error ? error.message : "Failed to load required toolkits",
69
+ toolkits
70
+ };
71
+ }
72
+ }
52
73
  const promptDef = await promptManager.getPromptDefinition(skillKey);
74
+ if (promptDef?.context !== "fork" && promptDef?.allowedTools && promptDef.allowedTools.length > 0 && context.sessionId && context.agent?.toolManager) {
75
+ try {
76
+ context.agent.toolManager.addSessionAutoApproveTools(
77
+ context.sessionId,
78
+ promptDef.allowedTools
79
+ );
80
+ } catch (error) {
81
+ context.logger?.warn("Failed to add auto-approve tools for skill", {
82
+ tools: promptDef.allowedTools,
83
+ error: error instanceof Error ? error.message : String(error)
84
+ });
85
+ }
86
+ }
53
87
  const promptResult = await promptManager.getPrompt(skillKey, args);
54
88
  const flattened = flattenPromptResult(promptResult);
55
89
  const content = flattened.text;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dexto/tools-builtins",
3
- "version": "1.6.1",
3
+ "version": "1.6.3",
4
4
  "description": "Built-in tools factory for Dexto agents",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -19,8 +19,8 @@
19
19
  "dependencies": {
20
20
  "undici": "^7.22.0",
21
21
  "zod": "^3.25.0",
22
- "@dexto/agent-config": "1.6.1",
23
- "@dexto/core": "1.6.1"
22
+ "@dexto/agent-config": "1.6.3",
23
+ "@dexto/core": "1.6.3"
24
24
  },
25
25
  "devDependencies": {
26
26
  "tsup": "^8.0.0",