@polka-codes/core 0.9.65 → 0.9.66

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 (2) hide show
  1. package/dist/index.js +18 -5
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1769,11 +1769,7 @@ var agentWorkflow = async (input, { step, tools, logger }) => {
1769
1769
  if (msg.content) {
1770
1770
  for (const part of msg.content) {
1771
1771
  if (part.type === "tool-call") {
1772
- if (toolSet[part.toolName]) {
1773
- toolCalls.push(part);
1774
- } else {
1775
- logger.warn("Tool not found. Skipping.", part);
1776
- }
1772
+ toolCalls.push(part);
1777
1773
  }
1778
1774
  }
1779
1775
  }
@@ -1817,6 +1813,23 @@ var agentWorkflow = async (input, { step, tools, logger }) => {
1817
1813
  }
1818
1814
  const toolResults = [];
1819
1815
  for (const toolCall of toolCalls) {
1816
+ if (!toolSet[toolCall.toolName]) {
1817
+ logger.warn("Tool not found.", toolCall);
1818
+ await event(`event-tool-error-${toolCall.toolName}-${toolCall.toolCallId}`, {
1819
+ kind: "ToolError" /* ToolError */,
1820
+ tool: toolCall.toolName,
1821
+ error: {
1822
+ type: "error-text",
1823
+ value: `Tool '${toolCall.toolName}' not found.`
1824
+ }
1825
+ });
1826
+ toolResults.push({
1827
+ toolCallId: toolCall.toolCallId,
1828
+ toolName: toolCall.toolName,
1829
+ output: `Error: Tool '${toolCall.toolName}' not found.`
1830
+ });
1831
+ continue;
1832
+ }
1820
1833
  await event(`event-tool-use-${toolCall.toolName}-${toolCall.toolCallId}`, {
1821
1834
  kind: "ToolUse" /* ToolUse */,
1822
1835
  tool: toolCall.toolName,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@polka-codes/core",
3
- "version": "0.9.65",
3
+ "version": "0.9.66",
4
4
  "license": "AGPL-3.0",
5
5
  "author": "github@polka.codes",
6
6
  "type": "module",