@dxos/assistant 0.8.4-main.e8ec1fe → 0.8.4-main.ef1bc66f44

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 (100) hide show
  1. package/dist/lib/neutral/chunk-ZPC54VRM.mjs +596 -0
  2. package/dist/lib/neutral/chunk-ZPC54VRM.mjs.map +7 -0
  3. package/dist/lib/{browser → neutral}/extraction/index.mjs +5 -5
  4. package/dist/lib/neutral/extraction/index.mjs.map +7 -0
  5. package/dist/lib/{browser → neutral}/index.mjs +320 -681
  6. package/dist/lib/neutral/index.mjs.map +7 -0
  7. package/dist/lib/neutral/meta.json +1 -0
  8. package/dist/lib/neutral/testing/index.mjs +38 -0
  9. package/dist/lib/neutral/testing/index.mjs.map +7 -0
  10. package/dist/types/src/conversation/context.d.ts +97 -62
  11. package/dist/types/src/conversation/context.d.ts.map +1 -1
  12. package/dist/types/src/conversation/context.test.d.ts +2 -0
  13. package/dist/types/src/conversation/context.test.d.ts.map +1 -0
  14. package/dist/types/src/conversation/conversation.d.ts +40 -15
  15. package/dist/types/src/conversation/conversation.d.ts.map +1 -1
  16. package/dist/types/src/conversation/conversation.test.d.ts +2 -0
  17. package/dist/types/src/conversation/conversation.test.d.ts.map +1 -0
  18. package/dist/types/src/diff.d.ts +3 -1
  19. package/dist/types/src/diff.d.ts.map +1 -1
  20. package/dist/types/src/errors.d.ts +12 -16
  21. package/dist/types/src/errors.d.ts.map +1 -1
  22. package/dist/types/src/execution-graph.d.ts +2 -2
  23. package/dist/types/src/execution-graph.d.ts.map +1 -1
  24. package/dist/types/src/extraction/extraction-ner-function/extraction-ner-function.d.ts +247 -245
  25. package/dist/types/src/extraction/extraction-ner-function/extraction-ner-function.d.ts.map +1 -1
  26. package/dist/types/src/extraction/extraction.d.ts +342 -308
  27. package/dist/types/src/extraction/extraction.d.ts.map +1 -1
  28. package/dist/types/src/extraction/quotes.d.ts +2 -2
  29. package/dist/types/src/extraction/quotes.d.ts.map +1 -1
  30. package/dist/types/src/functions/services.d.ts +6 -7
  31. package/dist/types/src/functions/services.d.ts.map +1 -1
  32. package/dist/types/src/functions.test.d.ts +2 -0
  33. package/dist/types/src/functions.test.d.ts.map +1 -0
  34. package/dist/types/src/session/GenericToolkit.d.ts +23 -0
  35. package/dist/types/src/session/GenericToolkit.d.ts.map +1 -1
  36. package/dist/types/src/session/artifact-diff.d.ts +1 -1
  37. package/dist/types/src/session/artifact-diff.d.ts.map +1 -1
  38. package/dist/types/src/session/format.d.ts +3 -3
  39. package/dist/types/src/session/format.d.ts.map +1 -1
  40. package/dist/types/src/session/index.d.ts +1 -0
  41. package/dist/types/src/session/index.d.ts.map +1 -1
  42. package/dist/types/src/session/observer.d.ts +4 -3
  43. package/dist/types/src/session/observer.d.ts.map +1 -1
  44. package/dist/types/src/session/session.d.ts +14 -9
  45. package/dist/types/src/session/session.d.ts.map +1 -1
  46. package/dist/types/src/session/toolkit.d.ts +5 -6
  47. package/dist/types/src/session/toolkit.d.ts.map +1 -1
  48. package/dist/types/src/session/version-pin.d.ts +2 -2
  49. package/dist/types/src/session/version-pin.d.ts.map +1 -1
  50. package/dist/types/src/testing/index.d.ts +2 -0
  51. package/dist/types/src/testing/index.d.ts.map +1 -0
  52. package/dist/types/src/testing/layer.d.ts +22 -0
  53. package/dist/types/src/testing/layer.d.ts.map +1 -0
  54. package/dist/types/src/types/artifact.d.ts +13 -5
  55. package/dist/types/src/types/artifact.d.ts.map +1 -1
  56. package/dist/types/tsconfig.tsbuildinfo +1 -1
  57. package/package.json +40 -33
  58. package/src/conversation/context.test.ts +46 -0
  59. package/src/conversation/context.ts +211 -67
  60. package/src/conversation/conversation.test.ts +65 -0
  61. package/src/conversation/conversation.ts +123 -48
  62. package/src/diff.test.ts +35 -4
  63. package/src/diff.ts +13 -4
  64. package/src/errors.ts +2 -2
  65. package/src/execution-graph.test.ts +1 -1
  66. package/src/execution-graph.ts +4 -4
  67. package/src/extraction/extraction-ner-function/extraction-ner-function.test.ts +7 -7
  68. package/src/extraction/extraction-ner-function/extraction-ner-function.ts +1 -1
  69. package/src/extraction/extraction.ts +4 -4
  70. package/src/extraction/quotes.ts +4 -5
  71. package/src/functions/services.ts +55 -30
  72. package/src/functions.conversations.json +1 -0
  73. package/src/functions.test.ts +74 -0
  74. package/src/session/GenericToolkit.ts +30 -0
  75. package/src/session/artifact-diff.ts +1 -1
  76. package/src/session/format.test.ts +101 -38
  77. package/src/session/format.ts +12 -13
  78. package/src/session/index.ts +1 -0
  79. package/src/session/observer.ts +3 -1
  80. package/src/session/session.conversations.json +1 -1
  81. package/src/session/session.test.ts +26 -13
  82. package/src/session/session.ts +36 -14
  83. package/src/session/toolkit.ts +13 -22
  84. package/src/session/version-pin.ts +4 -3
  85. package/src/templates/instructions/format.tpl +0 -4
  86. package/src/testing/index.ts +5 -0
  87. package/src/testing/layer.ts +84 -0
  88. package/src/types/artifact.ts +31 -13
  89. package/dist/lib/browser/extraction/index.mjs.map +0 -7
  90. package/dist/lib/browser/index.mjs.map +0 -7
  91. package/dist/lib/browser/meta.json +0 -1
  92. package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +0 -11
  93. package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +0 -7
  94. package/dist/lib/node-esm/extraction/index.mjs +0 -226
  95. package/dist/lib/node-esm/extraction/index.mjs.map +0 -7
  96. package/dist/lib/node-esm/index.mjs +0 -1291
  97. package/dist/lib/node-esm/index.mjs.map +0 -7
  98. package/dist/lib/node-esm/meta.json +0 -1
  99. /package/dist/lib/{browser → neutral}/chunk-J5LGTIGS.mjs +0 -0
  100. /package/dist/lib/{browser → neutral}/chunk-J5LGTIGS.mjs.map +0 -0
@@ -1 +1 @@
1
- {"conversations":[{"parameters":{"model":"@anthropic/claude-3-5-sonnet-20241022","stream":true,"tools":[]},"prompt":{"content":[{"role":"user","content":"Hello world!","options":{}}]},"response":[{"type":"response-metadata","id":"msg_01Bm496JGgDMgC9YwdYTFFHo","modelId":"claude-3-5-sonnet-20241022","timestamp":"1970-01-01T00:00:00.000Z","metadata":{}},{"type":"text-start","id":"0","metadata":{}},{"type":"text-delta","id":"0","delta":"Hi","metadata":{}},{"type":"text-delta","id":"0","delta":"!","metadata":{}},{"type":"text-delta","id":"0","delta":" How can","metadata":{}},{"type":"text-delta","id":"0","delta":" I help you today?","metadata":{}},{"type":"text-end","id":"0","metadata":{}},{"type":"finish","reason":"stop","usage":{"inputTokens":10,"outputTokens":12,"totalTokens":22},"metadata":{"anthropic":{"usage":{"cache_creation":{"ephemeral_1h_input_tokens":0,"ephemeral_5m_input_tokens":0},"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"input_tokens":10,"output_tokens":1,"server_tool_use":null,"service_tier":"standard"}}}}]},{"parameters":{"model":"@anthropic/claude-3-5-sonnet-20241022","stream":true,"tools":[{"name":"Calculator","description":"Basic calculator tool","inputSchema":{"type":"object","required":["input"],"properties":{"input":{"type":"string","description":"The calculation to perform."}},"additionalProperties":false}}]},"prompt":{"content":[{"role":"user","content":"What is 10 + 30?","options":{}}]},"response":[{"type":"response-metadata","id":"msg_01UNTbjtTHEpdFgGunu2k8Br","modelId":"claude-3-5-sonnet-20241022","timestamp":"1970-01-01T00:00:00.000Z","metadata":{}},{"type":"text-start","id":"0","metadata":{}},{"type":"text-delta","id":"0","delta":"I","metadata":{}},{"type":"text-delta","id":"0","delta":"'ll help","metadata":{}},{"type":"text-delta","id":"0","delta":" you calculate","metadata":{}},{"type":"text-delta","id":"0","delta":" ","metadata":{}},{"type":"text-delta","id":"0","delta":"10 + 30","metadata":{}},{"type":"text-delta","id":"0","delta":" using the","metadata":{}},{"type":"text-delta","id":"0","delta":" Calculator tool.","metadata":{}},{"type":"text-end","id":"0","metadata":{}},{"type":"tool-params-start","id":"toolu_01LTGUgfihCQtVchm1b37xHQ","name":"Calculator","providerExecuted":false,"metadata":{}},{"type":"tool-params-delta","id":"toolu_01LTGUgfihCQtVchm1b37xHQ","delta":"","metadata":{}},{"type":"tool-params-delta","id":"toolu_01LTGUgfihCQtVchm1b37xHQ","delta":"{\"input\": \"","metadata":{}},{"type":"tool-params-delta","id":"toolu_01LTGUgfihCQtVchm1b37xHQ","delta":"10 + 30","metadata":{}},{"type":"tool-params-delta","id":"toolu_01LTGUgfihCQtVchm1b37xHQ","delta":"\"}","metadata":{}},{"type":"tool-params-end","id":"toolu_01LTGUgfihCQtVchm1b37xHQ","metadata":{}},{"type":"tool-call","id":"toolu_01LTGUgfihCQtVchm1b37xHQ","name":"Calculator","params":{"input":"10 + 30"},"providerExecuted":false,"metadata":{}},{"type":"finish","reason":"tool-calls","usage":{"inputTokens":394,"outputTokens":73,"totalTokens":467},"metadata":{"anthropic":{"usage":{"cache_creation":{"ephemeral_1h_input_tokens":0,"ephemeral_5m_input_tokens":0},"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"input_tokens":394,"output_tokens":1,"server_tool_use":null,"service_tier":"standard"}}}}]},{"parameters":{"model":"@anthropic/claude-3-5-sonnet-20241022","stream":true,"tools":[{"name":"Calculator","description":"Basic calculator tool","inputSchema":{"type":"object","required":["input"],"properties":{"input":{"type":"string","description":"The calculation to perform."}},"additionalProperties":false}}]},"prompt":{"content":[{"role":"user","content":"What is 10 + 30?","options":{}},{"role":"assistant","content":[{"type":"text","text":"I'll help you calculate 10 + 30 using the Calculator tool.","options":{}},{"type":"tool-call","id":"toolu_01LTGUgfihCQtVchm1b37xHQ","name":"Calculator","params":{"input":"10 + 30"},"providerExecuted":false,"options":{}}],"options":{}},{"role":"tool","content":[{"type":"tool-result","id":"toolu_01LTGUgfihCQtVchm1b37xHQ","name":"Calculator","result":{"result":40},"options":{}}],"options":{}}]},"response":[{"type":"response-metadata","id":"msg_01AKio3GheJGn38BhvAp33rs","modelId":"claude-3-5-sonnet-20241022","timestamp":"1970-01-01T00:00:00.000Z","metadata":{}},{"type":"text-start","id":"0","metadata":{}},{"type":"text-delta","id":"0","delta":"The result","metadata":{}},{"type":"text-delta","id":"0","delta":" of 10 +","metadata":{}},{"type":"text-delta","id":"0","delta":" 30 is ","metadata":{}},{"type":"text-delta","id":"0","delta":"40.","metadata":{}},{"type":"text-end","id":"0","metadata":{}},{"type":"finish","reason":"stop","usage":{"inputTokens":482,"outputTokens":18,"totalTokens":500},"metadata":{"anthropic":{"usage":{"cache_creation":{"ephemeral_1h_input_tokens":0,"ephemeral_5m_input_tokens":0},"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"input_tokens":482,"output_tokens":3,"server_tool_use":null,"service_tier":"standard"}}}}]}]}
1
+ {"conversations":[{"parameters":{"model":"@anthropic/claude-opus-4-0","stream":true,"tools":[]},"prompt":{"content":[{"role":"user","content":"Hello world!","options":{"anthropic":{"cacheControl":{"ttl":"5m","type":"ephemeral"}}}}]},"response":[{"type":"response-metadata","id":"msg_017uwtKswqvfkbAWcbhvqC4C","modelId":"claude-opus-4-20250514","timestamp":"1970-01-01T00:00:00.000Z","metadata":{}},{"type":"reasoning-start","id":"0","metadata":{}},{"type":"reasoning-delta","id":"0","delta":"This is a simple greeting. The user","metadata":{}},{"type":"reasoning-delta","id":"0","delta":" is","metadata":{}},{"type":"reasoning-delta","id":"0","delta":" saying \"Hello world!\" which is a","metadata":{}},{"type":"reasoning-delta","id":"0","delta":" common programming reference","metadata":{}},{"type":"reasoning-delta","id":"0","delta":" an","metadata":{}},{"type":"reasoning-delta","id":"0","delta":"d also just","metadata":{}},{"type":"reasoning-delta","id":"0","delta":" a friendly","metadata":{}},{"type":"reasoning-delta","id":"0","delta":" greeting","metadata":{}},{"type":"reasoning-delta","id":"0","delta":". I should respond in a warm","metadata":{}},{"type":"reasoning-delta","id":"0","delta":", friendly","metadata":{}},{"type":"reasoning-delta","id":"0","delta":" manner","metadata":{}},{"type":"reasoning-delta","id":"0","delta":".","metadata":{}},{"type":"reasoning-delta","id":"0","delta":"","metadata":{}},{"type":"reasoning-delta","id":"0","delta":"","metadata":{"anthropic":{"type":"thinking","signature":"Et0CCkYICxgCKkCdNXMJ2XlhcT2JaidKOD95WAUCmsGVKt4lBZS6WzzEO+nRk3t2VSMYzI2y8j1W8Vo9e23S7msWD/GyCvFCmUSTEgxCkIK4hDt94dX/NscaDJjA28lvZl0Ne717ryIw1SWQvyJjlU12gCD/g8ZMJG4DvWe8ZbzyUWJA0vF96hlxfAHy4REOzYUcdMwqU4eXKsQBJsFiFgDcxjwTpq+NsK2xansfoTZHS243MvBnDiFuQ2DcDsxNaAA6dLMlmfpO3xT7BLgEJjGvfooVAYs2gs8Ew+tHNGpFJzebZNzdwZ+BGrWYQm7lHDecS6AelQAQSvgiQYgCXr8u+ZgPuPOojoj3FkwzGBrXiJBk2zaX5AmbbCnyV/snVE2ZDWJovGwy/31Mh7UrGke9baTws0FmGaWoDrqXocBJjDk5RqPb/EhSPlc4vV06EYuYQWc/2p/TjA6VhmDoghgB"}}},{"type":"reasoning-end","id":"0","metadata":{}},{"type":"text-start","id":"1","metadata":{}},{"type":"text-delta","id":"1","delta":"Hello! ","metadata":{}},{"type":"text-delta","id":"1","delta":"👋 It's nice","metadata":{}},{"type":"text-delta","id":"1","delta":" to meet you. How are you doing","metadata":{}},{"type":"text-delta","id":"1","delta":" today?","metadata":{}},{"type":"text-end","id":"1","metadata":{}},{"type":"finish","reason":"stop","usage":{"inputTokens":39,"outputTokens":67,"totalTokens":106},"metadata":{"anthropic":{"usage":{"cache_creation":{"ephemeral_1h_input_tokens":0,"ephemeral_5m_input_tokens":0},"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"input_tokens":39,"output_tokens":8,"server_tool_use":null,"service_tier":"standard"}}}}]},{"parameters":{"model":"@anthropic/claude-opus-4-0","stream":true,"tools":[{"name":"Calculator","description":"Basic calculator tool","inputSchema":{"type":"object","required":["input"],"properties":{"input":{"type":"string","description":"The calculation to perform."}},"additionalProperties":false}}]},"prompt":{"content":[{"role":"user","content":"What is 10 + 30?","options":{"anthropic":{"cacheControl":{"ttl":"5m","type":"ephemeral"}}}}]},"response":[{"type":"response-metadata","id":"msg_012rNz1xGkUFW2DgQCG1kv3i","modelId":"claude-opus-4-20250514","timestamp":"1970-01-01T00:00:00.000Z","metadata":{}},{"type":"reasoning-start","id":"0","metadata":{}},{"type":"reasoning-delta","id":"0","delta":"The user is asking for","metadata":{}},{"type":"reasoning-delta","id":"0","delta":" a","metadata":{}},{"type":"reasoning-delta","id":"0","delta":" simple calculation: 10 + ","metadata":{}},{"type":"reasoning-delta","id":"0","delta":"30. I have access","metadata":{}},{"type":"reasoning-delta","id":"0","delta":" to a Calculator","metadata":{}},{"type":"reasoning-delta","id":"0","delta":" tool","metadata":{}},{"type":"reasoning-delta","id":"0","delta":" that can perform","metadata":{}},{"type":"reasoning-delta","id":"0","delta":" this","metadata":{}},{"type":"reasoning-delta","id":"0","delta":" calculation","metadata":{}},{"type":"reasoning-delta","id":"0","delta":".","metadata":{}},{"type":"reasoning-delta","id":"0","delta":" I","metadata":{}},{"type":"reasoning-delta","id":"0","delta":" nee","metadata":{}},{"type":"reasoning-delta","id":"0","delta":"d to use the Calculator function with the input","metadata":{}},{"type":"reasoning-delta","id":"0","delta":" \"10 + 30\".","metadata":{}},{"type":"reasoning-delta","id":"0","delta":"","metadata":{}},{"type":"reasoning-delta","id":"0","delta":"","metadata":{"anthropic":{"type":"thinking","signature":"EuQCCkYICxgCKkDCaQH/XgXQY671pbNNWj6taybrqZ3Y7GESqvy5W7628w3Cnu6h/lTA4OLFIYH+e0zk41gjqms8n3/i3OsqVnWHEgxRchr+8QIACHJJMY0aDCHMkDM2ij2mqYpU1iIwTI/oHXwFtEwLFSW2JTNpA/167J0LSA+syc2lRuurdVzaTnDp1b7AdqfJJhz3CxwGKssB2JNFsVzNONC7d48c2BkCk6jkzLTLFYy4ncFYXTQ7CmWLUPIER2qew+Uf46f8xyFnip5Azhjo8Z/gqRbls2QcL3pRGILnoMyZyI2P9HEsN698Vm4fDZsZ86nuq1IGcGNw8ATATH0plAkQPP+4f1r3W974KxOpM12c5KSf+6wF06B6tpvD2G61cCKB0vaVeNbBTL9XIkXB+zeIyUirsX3QiMhRzvlkk4bBQDZqiGMSa8gzGFLgUwdPdmMEobyH/fzHRXaoZkBSq20vetgYAQ=="}}},{"type":"reasoning-end","id":"0","metadata":{}},{"type":"text-start","id":"1","metadata":{}},{"type":"text-delta","id":"1","delta":"I","metadata":{}},{"type":"text-delta","id":"1","delta":"'ll help","metadata":{}},{"type":"text-delta","id":"1","delta":" you calculate that.","metadata":{}},{"type":"text-end","id":"1","metadata":{}},{"type":"tool-params-start","id":"toolu_01RkWnXmu3kpGRuJvSSwXTAw","name":"Calculator","providerExecuted":false,"metadata":{}},{"type":"tool-params-delta","id":"toolu_01RkWnXmu3kpGRuJvSSwXTAw","delta":"","metadata":{}},{"type":"tool-params-delta","id":"toolu_01RkWnXmu3kpGRuJvSSwXTAw","delta":"{\"","metadata":{}},{"type":"tool-params-delta","id":"toolu_01RkWnXmu3kpGRuJvSSwXTAw","delta":"input\": \"","metadata":{}},{"type":"tool-params-delta","id":"toolu_01RkWnXmu3kpGRuJvSSwXTAw","delta":"10 + 30\"}","metadata":{}},{"type":"tool-params-end","id":"toolu_01RkWnXmu3kpGRuJvSSwXTAw","metadata":{}},{"type":"tool-call","id":"toolu_01RkWnXmu3kpGRuJvSSwXTAw","name":"Calculator","params":{"input":"10 + 30"},"providerExecuted":false,"metadata":{}},{"type":"finish","reason":"tool-calls","usage":{"inputTokens":424,"outputTokens":117,"totalTokens":541},"metadata":{"anthropic":{"usage":{"cache_creation":{"ephemeral_1h_input_tokens":0,"ephemeral_5m_input_tokens":0},"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"input_tokens":424,"output_tokens":5,"server_tool_use":null,"service_tier":"standard"}}}}]},{"parameters":{"model":"@anthropic/claude-opus-4-0","stream":true,"tools":[{"name":"Calculator","description":"Basic calculator tool","inputSchema":{"type":"object","required":["input"],"properties":{"input":{"type":"string","description":"The calculation to perform."}},"additionalProperties":false}}]},"prompt":{"content":[{"role":"user","content":"What is 10 + 30?","options":{}},{"role":"assistant","content":[{"type":"reasoning","text":"The user is asking for a simple calculation: 10 + 30. I have access to a Calculator tool that can perform this calculation. I need to use the Calculator function with the input \"10 + 30\".","options":{}},{"type":"text","text":"I'll help you calculate that.","options":{}},{"type":"tool-call","id":"toolu_01RkWnXmu3kpGRuJvSSwXTAw","name":"Calculator","params":{"input":"10 + 30"},"providerExecuted":false,"options":{}}],"options":{}},{"role":"tool","content":[{"type":"tool-result","id":"toolu_01RkWnXmu3kpGRuJvSSwXTAw","name":"Calculator","isFailure":false,"result":{"result":40},"providerExecuted":false,"options":{}}],"options":{"anthropic":{"cacheControl":{"ttl":"5m","type":"ephemeral"}}}}]},"response":[{"type":"response-metadata","id":"msg_019G9T2pTH1sGre6wyK7x77d","modelId":"claude-opus-4-20250514","timestamp":"1970-01-01T00:00:00.000Z","metadata":{}},{"type":"text-start","id":"0","metadata":{}},{"type":"text-delta","id":"0","delta":"10 + 30 =","metadata":{}},{"type":"text-delta","id":"0","delta":" 40","metadata":{}},{"type":"text-end","id":"0","metadata":{}},{"type":"finish","reason":"stop","usage":{"inputTokens":473,"outputTokens":12,"totalTokens":485},"metadata":{"anthropic":{"usage":{"cache_creation":{"ephemeral_1h_input_tokens":0,"ephemeral_5m_input_tokens":0},"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"input_tokens":473,"output_tokens":7,"server_tool_use":null,"service_tier":"standard"}}}}]},{"parameters":{"model":"@anthropic/claude-opus-4-0","stream":true,"tools":[{"name":"Calculator","description":"Basic calculator tool","inputSchema":{"type":"object","required":["input"],"properties":{"input":{"type":"string","description":"The calculation to perform."}},"additionalProperties":false}}]},"prompt":{"content":[{"role":"user","content":"I am testing error handling in tool paramter parsing. I want you to call the calculator tool but omit the input parameter to intentionally differ from the tool schema.","options":{}},{"role":"assistant","content":[{"type":"reasoning","text":"The user is asking me to intentionally make an incorrect tool call by omitting the required \"input\" parameter when calling the Calculator tool. This is for testing error handling. \n\nAccording to the schema, the Calculator tool requires an \"input\" parameter of type string. The user wants me to call it without providing this required parameter to see how the system handles this error.\n\nI should make the tool call without the input parameter as requested.","options":{}},{"type":"text","text":"I'll make a Calculator tool call without the required \"input\" parameter as you requested for testing error handling:","options":{}},{"type":"tool-call","id":"toolu_017r1n7RCMfHtzEP5bgKCJKu","name":"Calculator","params":{},"providerExecuted":false,"options":{}}],"options":{}},{"role":"tool","content":[{"type":"tool-result","id":"toolu_017r1n7RCMfHtzEP5bgKCJKu","name":"Calculator","isFailure":false,"result":"MalformedOutput: { \"module\": \"Toolkit\", \"method\": \"Calculator.handle\", \"description\": \"Failed to decode tool call parameters for tool 'Calculator' from:\\n'{}'\", \"cause\": { readonly input: string }\n└─ [\"input\"]\n └─ is missing }\ncaused by:\nParseError: { readonly input: string }\n└─ [\"input\"]\n └─ is missing","providerExecuted":false,"options":{}}],"options":{"anthropic":{"cacheControl":{"ttl":"5m","type":"ephemeral"}}}}]},"response":[{"type":"response-metadata","id":"msg_01LwcnKy2BAxT5EsE8q8Pfa8","modelId":"claude-opus-4-20250514","timestamp":"1970-01-01T00:00:00.000Z","metadata":{}},{"type":"text-start","id":"0","metadata":{}},{"type":"text-delta","id":"0","delta":"As expecte","metadata":{}},{"type":"text-delta","id":"0","delta":"d, the system","metadata":{}},{"type":"text-delta","id":"0","delta":" returne","metadata":{}},{"type":"text-delta","id":"0","delta":"d an error indicating","metadata":{}},{"type":"text-delta","id":"0","delta":" that the require","metadata":{}},{"type":"text-delta","id":"0","delta":"d \"input\" parameter is missing from","metadata":{}},{"type":"text-delta","id":"0","delta":" the Calculator tool call. The","metadata":{}},{"type":"text-delta","id":"0","delta":" error message shows that the tool","metadata":{}},{"type":"text-delta","id":"0","delta":" expects an object","metadata":{}},{"type":"text-delta","id":"0","delta":" with a","metadata":{}},{"type":"text-delta","id":"0","delta":" require","metadata":{}},{"type":"text-delta","id":"0","delta":"d \"input\" property of","metadata":{}},{"type":"text-delta","id":"0","delta":" type string, an","metadata":{}},{"type":"text-delta","id":"0","delta":"d the","metadata":{}},{"type":"text-delta","id":"0","delta":" parsing","metadata":{}},{"type":"text-delta","id":"0","delta":" failed because this","metadata":{}},{"type":"text-delta","id":"0","delta":" parameter","metadata":{}},{"type":"text-delta","id":"0","delta":" was not","metadata":{}},{"type":"text-delta","id":"0","delta":" provided.","metadata":{}},{"type":"text-end","id":"0","metadata":{}},{"type":"finish","reason":"stop","usage":{"inputTokens":601,"outputTokens":59,"totalTokens":660},"metadata":{"anthropic":{"usage":{"cache_creation":{"ephemeral_1h_input_tokens":0,"ephemeral_5m_input_tokens":0},"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"input_tokens":601,"output_tokens":2,"server_tool_use":null,"service_tier":"standard"}}}}]},{"parameters":{"model":"@anthropic/claude-opus-4-0","stream":true,"tools":[{"name":"Calculator","description":"Basic calculator tool","inputSchema":{"type":"object","required":["input"],"properties":{"input":{"type":"string","description":"The calculation to perform."}},"additionalProperties":false}}]},"prompt":{"content":[{"role":"user","content":"I am testing error handling in tool paramter parsing. I want you to call the calculator tool but omit the input parameter to intentionally differ from the tool schema.","options":{}},{"role":"assistant","content":[{"type":"reasoning","text":"The user is explicitly asking me to call the Calculator tool incorrectly by omitting the required \"input\" parameter. This is for testing error handling. I should do exactly what they're asking - call the Calculator tool without providing the required input parameter.","options":{}},{"type":"text","text":"I'll call the Calculator tool without the required input parameter as you requested for testing error handling:","options":{}},{"type":"tool-call","id":"toolu_01Xhu7F8btMmV9W1rHuxtRZt","name":"Calculator","params":{},"providerExecuted":false,"options":{}}],"options":{}},{"role":"tool","content":[{"type":"tool-result","id":"toolu_01Xhu7F8btMmV9W1rHuxtRZt","name":"Calculator","isFailure":false,"result":"MalformedOutput: { \"module\": \"Toolkit\", \"method\": \"Calculator.handle\", \"description\": \"Failed to decode tool call parameters for tool 'Calculator' from:\\n'{}'\", \"cause\": { readonly input: string }\n└─ [\"input\"]\n └─ is missing }\ncaused by:\nParseError: { readonly input: string }\n└─ [\"input\"]\n └─ is missing","providerExecuted":false,"options":{}}],"options":{"anthropic":{"cacheControl":{"ttl":"5m","type":"ephemeral"}}}}]},"response":[{"type":"response-metadata","id":"msg_014Q8swcEVZXry1hVJuTAnpH","modelId":"claude-opus-4-20250514","timestamp":"1970-01-01T00:00:00.000Z","metadata":{}},{"type":"text-start","id":"0","metadata":{}},{"type":"text-delta","id":"0","delta":"Perfect","metadata":{}},{"type":"text-delta","id":"0","delta":"! As","metadata":{}},{"type":"text-delta","id":"0","delta":" expected, the system","metadata":{}},{"type":"text-delta","id":"0","delta":" caught","metadata":{}},{"type":"text-delta","id":"0","delta":" the error","metadata":{}},{"type":"text-delta","id":"0","delta":" an","metadata":{}},{"type":"text-delta","id":"0","delta":"d returned a detaile","metadata":{}},{"type":"text-delta","id":"0","delta":"d error message indicating that the require","metadata":{}},{"type":"text-delta","id":"0","delta":"d \"","metadata":{}},{"type":"text-delta","id":"0","delta":"input\" parameter is missing from","metadata":{}},{"type":"text-delta","id":"0","delta":" the Calculator","metadata":{}},{"type":"text-delta","id":"0","delta":" tool call. The","metadata":{}},{"type":"text-delta","id":"0","delta":" error shows:\n\n1","metadata":{}},{"type":"text-delta","id":"0","delta":". It","metadata":{}},{"type":"text-delta","id":"0","delta":" failed to decode the tool call parameters","metadata":{}},{"type":"text-delta","id":"0","delta":"\n2. The specific","metadata":{}},{"type":"text-delta","id":"0","delta":" issue is","metadata":{}},{"type":"text-delta","id":"0","delta":" that the \"input\" fiel","metadata":{}},{"type":"text-delta","id":"0","delta":"d is missing\n3. The error type","metadata":{}},{"type":"text-delta","id":"0","delta":" is \"","metadata":{}},{"type":"text-delta","id":"0","delta":"M","metadata":{}},{"type":"text-delta","id":"0","delta":"alformedOutput\"","metadata":{}},{"type":"text-delta","id":"0","delta":" with","metadata":{}},{"type":"text-delta","id":"0","delta":" a neste","metadata":{}},{"type":"text-delta","id":"0","delta":"d \"","metadata":{}},{"type":"text-delta","id":"0","delta":"ParseError\"\n\nThis demonstrates","metadata":{}},{"type":"text-delta","id":"0","delta":" that the tool","metadata":{}},{"type":"text-delta","id":"0","delta":" parameter","metadata":{}},{"type":"text-delta","id":"0","delta":" validation is working correctly an","metadata":{}},{"type":"text-delta","id":"0","delta":"d will","metadata":{}},{"type":"text-delta","id":"0","delta":" reject","metadata":{}},{"type":"text-delta","id":"0","delta":" calls","metadata":{}},{"type":"text-delta","id":"0","delta":" that don't match","metadata":{}},{"type":"text-delta","id":"0","delta":" the require","metadata":{}},{"type":"text-delta","id":"0","delta":"d schema.","metadata":{}},{"type":"text-end","id":"0","metadata":{}},{"type":"finish","reason":"stop","usage":{"inputTokens":598,"outputTokens":109,"totalTokens":707},"metadata":{"anthropic":{"usage":{"cache_creation":{"ephemeral_1h_input_tokens":0,"ephemeral_5m_input_tokens":0},"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"input_tokens":598,"output_tokens":1,"server_tool_use":null,"service_tier":"standard"}}}}]},{"parameters":{"model":"@anthropic/claude-opus-4-0","stream":true,"tools":[{"name":"Calculator","description":"Basic calculator tool","inputSchema":{"type":"object","required":["input"],"properties":{"input":{"type":"string","description":"The calculation to perform."}},"additionalProperties":false}}]},"prompt":{"content":[{"role":"user","content":"I am testing error handling in tool paramter parsing. I want you to call the calculator tool but omit the input parameter to intentionally differ from the tool schema.","options":{}},{"role":"assistant","content":[{"type":"reasoning","text":"The user is asking me to intentionally call the Calculator tool incorrectly by omitting the required \"input\" parameter. This is for testing error handling. I should do exactly what they asked - make a tool call without the required parameter.","options":{}},{"type":"text","text":"I'll make the calculator tool call without the required input parameter as you requested:","options":{}},{"type":"tool-call","id":"toolu_01Cj6NpsjAN3jog6e2EQaF1h","name":"Calculator","params":{},"providerExecuted":false,"options":{}}],"options":{}},{"role":"tool","content":[{"type":"tool-result","id":"toolu_01Cj6NpsjAN3jog6e2EQaF1h","name":"Calculator","isFailure":false,"result":"MalformedOutput: { \"module\": \"Toolkit\", \"method\": \"Calculator.handle\", \"description\": \"Failed to decode tool call parameters for tool 'Calculator' from:\\n'{}'\", \"cause\": { readonly input: string }\n└─ [\"input\"]\n └─ is missing }\ncaused by:\nParseError: { readonly input: string }\n└─ [\"input\"]\n └─ is missing","providerExecuted":false,"options":{}}],"options":{"anthropic":{"cacheControl":{"ttl":"5m","type":"ephemeral"}}}}]},"response":[{"type":"response-metadata","id":"msg_01VZkgASUpXGFq2qw9nkTzdV","modelId":"claude-opus-4-20250514","timestamp":"1970-01-01T00:00:00.000Z","metadata":{}},{"type":"text-start","id":"0","metadata":{}},{"type":"text-delta","id":"0","delta":"Perfect","metadata":{}},{"type":"text-delta","id":"0","delta":"! As","metadata":{}},{"type":"text-delta","id":"0","delta":" expecte","metadata":{}},{"type":"text-delta","id":"0","delta":"d, the system","metadata":{}},{"type":"text-delta","id":"0","delta":" returne","metadata":{}},{"type":"text-delta","id":"0","delta":"d a M","metadata":{}},{"type":"text-delta","id":"0","delta":"alformedOutput error indicating","metadata":{}},{"type":"text-delta","id":"0","delta":" that the require","metadata":{}},{"type":"text-delta","id":"0","delta":"d \"","metadata":{}},{"type":"text-delta","id":"0","delta":"input\" parameter is missing from","metadata":{}},{"type":"text-delta","id":"0","delta":" the tool call. The","metadata":{}},{"type":"text-delta","id":"0","delta":" error message clearly","metadata":{}},{"type":"text-delta","id":"0","delta":" shows that the Calculator tool expects","metadata":{}},{"type":"text-delta","id":"0","delta":" an object","metadata":{}},{"type":"text-delta","id":"0","delta":" with a","metadata":{}},{"type":"text-delta","id":"0","delta":" require","metadata":{}},{"type":"text-delta","id":"0","delta":"d \"input\" property of","metadata":{}},{"type":"text-delta","id":"0","delta":" type string, an","metadata":{}},{"type":"text-delta","id":"0","delta":"d the","metadata":{}},{"type":"text-delta","id":"0","delta":" parsing","metadata":{}},{"type":"text-delta","id":"0","delta":" failed because this","metadata":{}},{"type":"text-delta","id":"0","delta":" parameter was not provided in","metadata":{}},{"type":"text-delta","id":"0","delta":" the function call.","metadata":{}},{"type":"text-end","id":"0","metadata":{}},{"type":"finish","reason":"stop","usage":{"inputTokens":595,"outputTokens":71,"totalTokens":666},"metadata":{"anthropic":{"usage":{"cache_creation":{"ephemeral_1h_input_tokens":0,"ephemeral_5m_input_tokens":0},"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"input_tokens":595,"output_tokens":1,"server_tool_use":null,"service_tier":"standard"}}}}]},{"parameters":{"model":"@anthropic/claude-opus-4-0","stream":true,"tools":[{"name":"Calculator","description":"Basic calculator tool","inputSchema":{"type":"object","required":["input"],"properties":{"input":{"type":"string","description":"The calculation to perform."}},"additionalProperties":false}}]},"prompt":{"content":[{"role":"user","content":"I am testing error handling in tool paramter parsing. I want you to call the calculator tool but omit the input parameter to intentionally differ from the tool schema.","options":{}},{"role":"assistant","content":[{"type":"reasoning","text":"The user is explicitly asking me to intentionally call the Calculator tool incorrectly by omitting the required \"input\" parameter. This is for testing error handling. I should do exactly what they're asking - make a tool call without the required parameter.","options":{}},{"type":"text","text":"I'll intentionally call the Calculator tool without the required \"input\" parameter as you requested for testing error handling:","options":{}},{"type":"tool-call","id":"toolu_01U8MHzVVAsEtED1skwMMLGx","name":"Calculator","params":{},"providerExecuted":false,"options":{}}],"options":{}},{"role":"tool","content":[{"type":"tool-result","id":"toolu_01U8MHzVVAsEtED1skwMMLGx","name":"Calculator","isFailure":false,"result":"MalformedOutput: { \"module\": \"Toolkit\", \"method\": \"Calculator.handle\", \"description\": \"Failed to decode tool call parameters for tool 'Calculator' from:\\n'{}'\", \"cause\": { readonly input: string }\n└─ [\"input\"]\n └─ is missing }\ncaused by:\nParseError: { readonly input: string }\n└─ [\"input\"]\n └─ is missing","providerExecuted":false,"options":{}}],"options":{"anthropic":{"cacheControl":{"ttl":"5m","type":"ephemeral"}}}}]},"response":[{"type":"response-metadata","id":"msg_01E1ZCajrbTCFUw1DKMNnPmW","modelId":"claude-opus-4-20250514","timestamp":"1970-01-01T00:00:00.000Z","metadata":{}},{"type":"text-start","id":"0","metadata":{}},{"type":"text-delta","id":"0","delta":"As expected, this","metadata":{}},{"type":"text-delta","id":"0","delta":" cause","metadata":{}},{"type":"text-delta","id":"0","delta":"d an error because the \"","metadata":{}},{"type":"text-delta","id":"0","delta":"input\" parameter is required according to the","metadata":{}},{"type":"text-delta","id":"0","delta":" tool","metadata":{}},{"type":"text-delta","id":"0","delta":"'s","metadata":{}},{"type":"text-delta","id":"0","delta":" schema but","metadata":{}},{"type":"text-delta","id":"0","delta":" was not","metadata":{}},{"type":"text-delta","id":"0","delta":" provided.","metadata":{}},{"type":"text-delta","id":"0","delta":" The error message clearly","metadata":{}},{"type":"text-delta","id":"0","delta":" indicates that the \"","metadata":{}},{"type":"text-delta","id":"0","delta":"input\" parameter is missing from the function","metadata":{}},{"type":"text-delta","id":"0","delta":" call.","metadata":{}},{"type":"text-end","id":"0","metadata":{}},{"type":"finish","reason":"stop","usage":{"inputTokens":602,"outputTokens":47,"totalTokens":649},"metadata":{"anthropic":{"usage":{"cache_creation":{"ephemeral_1h_input_tokens":0,"ephemeral_5m_input_tokens":0},"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"input_tokens":602,"output_tokens":4,"server_tool_use":null,"service_tier":"standard"}}}}]},{"parameters":{"model":"@anthropic/claude-opus-4-0","stream":true,"tools":[{"name":"Calculator","description":"Basic calculator tool","inputSchema":{"type":"object","required":["input"],"properties":{"input":{"type":"string","description":"The calculation to perform."}},"additionalProperties":false}}]},"prompt":{"content":[{"role":"user","content":"I am testing error handling in tool paramter parsing. I want you to call the calculator tool but omit the input parameter to intentionally differ from the tool schema.","options":{}},{"role":"assistant","content":[{"type":"reasoning","text":"The user is specifically asking me to intentionally make an error by calling the calculator tool without providing the required \"input\" parameter. This is for testing error handling. I should do exactly as they ask - call the Calculator function but omit the input parameter.","options":{}},{"type":"text","text":"I'll call the calculator tool without the required input parameter as you requested for testing error handling:","options":{}},{"type":"tool-call","id":"toolu_01CVBkZhcEYZikyNaaH2z9mS","name":"Calculator","params":{},"providerExecuted":false,"options":{}}],"options":{}},{"role":"tool","content":[{"type":"tool-result","id":"toolu_01CVBkZhcEYZikyNaaH2z9mS","name":"Calculator","isFailure":false,"result":"MalformedOutput: { \"module\": \"Toolkit\", \"method\": \"Calculator.handle\", \"description\": \"Failed to decode tool call parameters for tool 'Calculator' from:\\n'{}'\", \"cause\": { readonly input: string }\n└─ [\"input\"]\n └─ is missing }\ncaused by:\nParseError: { readonly input: string }\n└─ [\"input\"]\n └─ is missing","providerExecuted":false,"options":{}}],"options":{"anthropic":{"cacheControl":{"ttl":"5m","type":"ephemeral"}}}}]},"response":[{"type":"response-metadata","id":"msg_01N8WsmrXjnPKG22vDuHm57j","modelId":"claude-opus-4-20250514","timestamp":"1970-01-01T00:00:00.000Z","metadata":{}},{"type":"text-start","id":"0","metadata":{}},{"type":"text-delta","id":"0","delta":"Perfect","metadata":{}},{"type":"text-delta","id":"0","delta":"! As","metadata":{}},{"type":"text-delta","id":"0","delta":" expected, the system","metadata":{}},{"type":"text-delta","id":"0","delta":" caught","metadata":{}},{"type":"text-delta","id":"0","delta":" the error","metadata":{}},{"type":"text-delta","id":"0","delta":" an","metadata":{}},{"type":"text-delta","id":"0","delta":"d returned a detaile","metadata":{}},{"type":"text-delta","id":"0","delta":"d error message indicating","metadata":{}},{"type":"text-delta","id":"0","delta":" that the require","metadata":{}},{"type":"text-delta","id":"0","delta":"d \"","metadata":{}},{"type":"text-delta","id":"0","delta":"input\" parameter is missing from","metadata":{}},{"type":"text-delta","id":"0","delta":" the Calculator","metadata":{}},{"type":"text-delta","id":"0","delta":" tool call","metadata":{}},{"type":"text-delta","id":"0","delta":". The","metadata":{}},{"type":"text-delta","id":"0","delta":" error shows","metadata":{}},{"type":"text-delta","id":"0","delta":":","metadata":{}},{"type":"text-delta","id":"0","delta":"\n\n1. It","metadata":{}},{"type":"text-delta","id":"0","delta":"'s","metadata":{}},{"type":"text-delta","id":"0","delta":" a \"MalformedOutput\"","metadata":{}},{"type":"text-delta","id":"0","delta":" error\n2. The tool","metadata":{}},{"type":"text-delta","id":"0","delta":" call","metadata":{}},{"type":"text-delta","id":"0","delta":" parameters faile","metadata":{}},{"type":"text-delta","id":"0","delta":"d to decode\n3.","metadata":{}},{"type":"text-delta","id":"0","delta":" Specifically, the \"input\" parameter is","metadata":{}},{"type":"text-delta","id":"0","delta":" missing (","metadata":{}},{"type":"text-delta","id":"0","delta":"as","metadata":{}},{"type":"text-delta","id":"0","delta":" shown","metadata":{}},{"type":"text-delta","id":"0","delta":" in","metadata":{}},{"type":"text-delta","id":"0","delta":" the schema","metadata":{}},{"type":"text-delta","id":"0","delta":" validation","metadata":{}},{"type":"text-delta","id":"0","delta":" error)","metadata":{}},{"type":"text-delta","id":"0","delta":"\n\nThis demonstrates that the tool","metadata":{}},{"type":"text-delta","id":"0","delta":" parameter","metadata":{}},{"type":"text-delta","id":"0","delta":" parsing correctly","metadata":{}},{"type":"text-delta","id":"0","delta":" validates","metadata":{}},{"type":"text-delta","id":"0","delta":" against","metadata":{}},{"type":"text-delta","id":"0","delta":" the schema and provides","metadata":{}},{"type":"text-delta","id":"0","delta":" helpful","metadata":{}},{"type":"text-delta","id":"0","delta":" error messages when required parameters are om","metadata":{}},{"type":"text-delta","id":"0","delta":"itted.","metadata":{}},{"type":"text-end","id":"0","metadata":{}},{"type":"finish","reason":"stop","usage":{"inputTokens":598,"outputTokens":110,"totalTokens":708},"metadata":{"anthropic":{"usage":{"cache_creation":{"ephemeral_1h_input_tokens":0,"ephemeral_5m_input_tokens":0},"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"input_tokens":598,"output_tokens":1,"server_tool_use":null,"service_tier":"standard"}}}}]},{"parameters":{"model":"@anthropic/claude-opus-4-0","stream":true,"tools":[{"name":"Calculator","description":"Basic calculator tool","inputSchema":{"type":"object","required":["input"],"properties":{"input":{"type":"string","description":"The calculation to perform."}},"additionalProperties":false}}]},"prompt":{"content":[{"role":"user","content":"I am testing error handling in tool paramter parsing. I want you to call the calculator tool but omit the input parameter to intentionally differ from the tool schema.","options":{}},{"role":"assistant","content":[{"type":"reasoning","text":"The user is explicitly asking me to make an incorrect tool call for testing purposes. They want me to call the Calculator tool but intentionally omit the required \"input\" parameter to see how the system handles this error.\n\nI should do exactly as they ask - call the Calculator tool without providing the input parameter.","options":{}},{"type":"text","text":"I'll call the Calculator tool without the required input parameter as you requested for testing error handling:","options":{}},{"type":"tool-call","id":"toolu_01726iiTkhXnF7sK3novVpQD","name":"Calculator","params":{},"providerExecuted":false,"options":{}}],"options":{}},{"role":"tool","content":[{"type":"tool-result","id":"toolu_01726iiTkhXnF7sK3novVpQD","name":"Calculator","isFailure":false,"result":"MalformedOutput: { \"module\": \"Toolkit\", \"method\": \"Calculator.handle\", \"description\": \"Failed to decode tool call parameters for tool 'Calculator' from:\\n'{}'\", \"cause\": { readonly input: string }\n└─ [\"input\"]\n └─ is missing }\ncaused by:\nParseError: { readonly input: string }\n└─ [\"input\"]\n └─ is missing","providerExecuted":false,"options":{}}],"options":{"anthropic":{"cacheControl":{"ttl":"5m","type":"ephemeral"}}}}]},"response":[{"type":"response-metadata","id":"msg_01B3E3XdtmyBssmLNfBDLcMD","modelId":"claude-opus-4-20250514","timestamp":"1970-01-01T00:00:00.000Z","metadata":{}},{"type":"text-start","id":"0","metadata":{}},{"type":"text-delta","id":"0","delta":"As expected, the system","metadata":{}},{"type":"text-delta","id":"0","delta":" returne","metadata":{}},{"type":"text-delta","id":"0","delta":"d an","metadata":{}},{"type":"text-delta","id":"0","delta":" error indicating","metadata":{}},{"type":"text-delta","id":"0","delta":" that the require","metadata":{}},{"type":"text-delta","id":"0","delta":"d \"input\" parameter is missing from","metadata":{}},{"type":"text-delta","id":"0","delta":" the Calculator","metadata":{}},{"type":"text-delta","id":"0","delta":" tool call","metadata":{}},{"type":"text-delta","id":"0","delta":". The error message shows that the tool","metadata":{}},{"type":"text-delta","id":"0","delta":" expects an object","metadata":{}},{"type":"text-delta","id":"0","delta":" with a","metadata":{}},{"type":"text-delta","id":"0","delta":" require","metadata":{}},{"type":"text-delta","id":"0","delta":"d \"input\" property of","metadata":{}},{"type":"text-delta","id":"0","delta":" type string, an","metadata":{}},{"type":"text-delta","id":"0","delta":"d the","metadata":{}},{"type":"text-delta","id":"0","delta":" parser","metadata":{}},{"type":"text-delta","id":"0","delta":" detecte","metadata":{}},{"type":"text-delta","id":"0","delta":"d that this","metadata":{}},{"type":"text-delta","id":"0","delta":" property was","metadata":{}},{"type":"text-delta","id":"0","delta":" not","metadata":{}},{"type":"text-delta","id":"0","delta":" provided in","metadata":{}},{"type":"text-delta","id":"0","delta":" the empty","metadata":{}},{"type":"text-delta","id":"0","delta":" parameter","metadata":{}},{"type":"text-delta","id":"0","delta":" set","metadata":{}},{"type":"text-delta","id":"0","delta":" I","metadata":{}},{"type":"text-delta","id":"0","delta":" sent","metadata":{}},{"type":"text-delta","id":"0","delta":".","metadata":{}},{"type":"text-end","id":"0","metadata":{}},{"type":"finish","reason":"stop","usage":{"inputTokens":598,"outputTokens":66,"totalTokens":664},"metadata":{"anthropic":{"usage":{"cache_creation":{"ephemeral_1h_input_tokens":0,"ephemeral_5m_input_tokens":0},"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"input_tokens":598,"output_tokens":5,"server_tool_use":null,"service_tier":"standard"}}}}]},{"parameters":{"model":"@anthropic/claude-opus-4-0","stream":true,"tools":[{"name":"Calculator","description":"Basic calculator tool","inputSchema":{"type":"object","required":["input"],"properties":{"input":{"type":"string","description":"The calculation to perform."}},"additionalProperties":false}}]},"prompt":{"content":[{"role":"user","content":"I am testing error handling in tool paramter parsing. I want you to call the calculator tool but omit the input parameter to intentionally differ from the tool schema.","options":{}},{"role":"assistant","content":[{"type":"reasoning","text":"The user is explicitly asking me to call the calculator tool incorrectly by omitting the required \"input\" parameter. This is for testing error handling. I should do exactly what they asked - call the tool without the input parameter.","options":{}},{"type":"text","text":"I'll call the calculator tool without the input parameter as requested for your error handling test:","options":{}},{"type":"tool-call","id":"toolu_011JJQC9oxAckyRM91rstDhx","name":"Calculator","params":{},"providerExecuted":false,"options":{}}],"options":{}},{"role":"tool","content":[{"type":"tool-result","id":"toolu_011JJQC9oxAckyRM91rstDhx","name":"Calculator","isFailure":false,"result":"MalformedOutput: { \"module\": \"Toolkit\", \"method\": \"Calculator.handle\", \"description\": \"Failed to decode tool call parameters for tool 'Calculator' from:\\n'{}'\", \"cause\": { readonly input: string }\n└─ [\"input\"]\n └─ is missing }\ncaused by:\nParseError: { readonly input: string }\n└─ [\"input\"]\n └─ is missing","providerExecuted":false,"options":{}}],"options":{"anthropic":{"cacheControl":{"ttl":"5m","type":"ephemeral"}}}}]},"response":[{"type":"response-metadata","id":"msg_016gJRaPtRkr9tPDL8tHzHfy","modelId":"claude-opus-4-20250514","timestamp":"1970-01-01T00:00:00.000Z","metadata":{}},{"type":"text-start","id":"0","metadata":{}},{"type":"text-delta","id":"0","delta":"Perfect","metadata":{}},{"type":"text-delta","id":"0","delta":"! As","metadata":{}},{"type":"text-delta","id":"0","delta":" expected, the system","metadata":{}},{"type":"text-delta","id":"0","delta":" caught","metadata":{}},{"type":"text-delta","id":"0","delta":" the missing required parameter an","metadata":{}},{"type":"text-delta","id":"0","delta":"d returned an","metadata":{}},{"type":"text-delta","id":"0","delta":" error.","metadata":{}},{"type":"text-delta","id":"0","delta":" The","metadata":{}},{"type":"text-delta","id":"0","delta":" error message clearly","metadata":{}},{"type":"text-delta","id":"0","delta":" indicates that:","metadata":{}},{"type":"text-delta","id":"0","delta":"\n\n1. The tool","metadata":{}},{"type":"text-delta","id":"0","delta":" call","metadata":{}},{"type":"text-delta","id":"0","delta":" faile","metadata":{}},{"type":"text-delta","id":"0","delta":"d to decode parameters","metadata":{}},{"type":"text-delta","id":"0","delta":" for","metadata":{}},{"type":"text-delta","id":"0","delta":" the Calculator tool\n2. The specific","metadata":{}},{"type":"text-delta","id":"0","delta":" issue is","metadata":{}},{"type":"text-delta","id":"0","delta":" that the \"","metadata":{}},{"type":"text-delta","id":"0","delta":"input\" parameter is missing","metadata":{}},{"type":"text-delta","id":"0","delta":"\n3. The \"","metadata":{}},{"type":"text-delta","id":"0","delta":"input\" parameter is require","metadata":{}},{"type":"text-delta","id":"0","delta":"d (","metadata":{}},{"type":"text-delta","id":"0","delta":"as define","metadata":{}},{"type":"text-delta","id":"0","delta":"d in the schema where","metadata":{}},{"type":"text-delta","id":"0","delta":" it's liste","metadata":{}},{"type":"text-delta","id":"0","delta":"d in","metadata":{}},{"type":"text-delta","id":"0","delta":" the \"required\" array)\n\nThis","metadata":{}},{"type":"text-delta","id":"0","delta":" demonstrates that the error handling is working correctly","metadata":{}},{"type":"text-delta","id":"0","delta":" - it validates","metadata":{}},{"type":"text-delta","id":"0","delta":" the","metadata":{}},{"type":"text-delta","id":"0","delta":" tool","metadata":{}},{"type":"text-delta","id":"0","delta":" parameters","metadata":{}},{"type":"text-delta","id":"0","delta":" against","metadata":{}},{"type":"text-delta","id":"0","delta":" the define","metadata":{}},{"type":"text-delta","id":"0","delta":"d schema and provides","metadata":{}},{"type":"text-delta","id":"0","delta":" inform","metadata":{}},{"type":"text-delta","id":"0","delta":"ative error messages when require","metadata":{}},{"type":"text-delta","id":"0","delta":"d parameters are om","metadata":{}},{"type":"text-delta","id":"0","delta":"itted.","metadata":{}},{"type":"text-end","id":"0","metadata":{}},{"type":"finish","reason":"stop","usage":{"inputTokens":597,"outputTokens":116,"totalTokens":713},"metadata":{"anthropic":{"usage":{"cache_creation":{"ephemeral_1h_input_tokens":0,"ephemeral_5m_input_tokens":0},"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"input_tokens":597,"output_tokens":1,"server_tool_use":null,"service_tier":"standard"}}}}]},{"parameters":{"model":"@anthropic/claude-opus-4-0","stream":true,"tools":[{"name":"Calculator","description":"Basic calculator tool","inputSchema":{"type":"object","required":["input"],"properties":{"input":{"type":"string","description":"The calculation to perform."}},"additionalProperties":false}}]},"prompt":{"content":[{"role":"user","content":"I am testing error handling in tool paramter parsing. I want you to call the calculator tool but omit the input parameter to intentionally differ from the tool schema.","options":{}},{"role":"assistant","content":[{"type":"reasoning","text":"The user is explicitly asking me to make an incorrect tool call for testing purposes. They want me to call the Calculator function but deliberately omit the required \"input\" parameter to test error handling.\n\nI should do exactly what they asked - call the Calculator tool without providing the input parameter.","options":{}},{"type":"text","text":"I'll call the Calculator tool without the required input parameter as you requested for testing error handling:","options":{}},{"type":"tool-call","id":"toolu_01KgYHncH8KeSeEXKaS8v1nk","name":"Calculator","params":{},"providerExecuted":false,"options":{}}],"options":{}},{"role":"tool","content":[{"type":"tool-result","id":"toolu_01KgYHncH8KeSeEXKaS8v1nk","name":"Calculator","isFailure":false,"result":"MalformedOutput: { \"module\": \"Toolkit\", \"method\": \"Calculator.handle\", \"description\": \"Failed to decode tool call parameters for tool 'Calculator' from:\\n'{}'\", \"cause\": { readonly input: string }\n└─ [\"input\"]\n └─ is missing }\ncaused by:\nParseError: { readonly input: string }\n└─ [\"input\"]\n └─ is missing","providerExecuted":false,"options":{}}],"options":{"anthropic":{"cacheControl":{"ttl":"5m","type":"ephemeral"}}}}]},"response":[{"type":"response-metadata","id":"msg_01HyNQFkeRifAfdbn2PKA9Wp","modelId":"claude-opus-4-20250514","timestamp":"1970-01-01T00:00:00.000Z","metadata":{}},{"type":"text-start","id":"0","metadata":{}},{"type":"text-delta","id":"0","delta":"Perfect","metadata":{}},{"type":"text-delta","id":"0","delta":"! The error handling is working as expecte","metadata":{}},{"type":"text-delta","id":"0","delta":"d. The","metadata":{}},{"type":"text-delta","id":"0","delta":" system","metadata":{}},{"type":"text-delta","id":"0","delta":" caught","metadata":{}},{"type":"text-delta","id":"0","delta":" that the required \"","metadata":{}},{"type":"text-delta","id":"0","delta":"input\" parameter was","metadata":{}},{"type":"text-delta","id":"0","delta":" missing and returned a detaile","metadata":{}},{"type":"text-delta","id":"0","delta":"d error message indicating:","metadata":{}},{"type":"text-delta","id":"0","delta":"\n- The tool call","metadata":{}},{"type":"text-delta","id":"0","delta":" faile","metadata":{}},{"type":"text-delta","id":"0","delta":"d to decode parameters","metadata":{}},{"type":"text-delta","id":"0","delta":"\n- The specific fiel","metadata":{}},{"type":"text-delta","id":"0","delta":"d \"","metadata":{}},{"type":"text-delta","id":"0","delta":"input\" is missing\n- The expecte","metadata":{}},{"type":"text-delta","id":"0","delta":"d schema","metadata":{}},{"type":"text-delta","id":"0","delta":" requires a","metadata":{}},{"type":"text-delta","id":"0","delta":" readonly","metadata":{}},{"type":"text-delta","id":"0","delta":" input","metadata":{}},{"type":"text-delta","id":"0","delta":" string","metadata":{}},{"type":"text-delta","id":"0","delta":"\n\nThis demonstrates that the parameter","metadata":{}},{"type":"text-delta","id":"0","delta":" validation is properly enforcing","metadata":{}},{"type":"text-delta","id":"0","delta":" the tool","metadata":{}},{"type":"text-delta","id":"0","delta":" schema requirements.","metadata":{}},{"type":"text-end","id":"0","metadata":{}},{"type":"finish","reason":"stop","usage":{"inputTokens":598,"outputTokens":78,"totalTokens":676},"metadata":{"anthropic":{"usage":{"cache_creation":{"ephemeral_1h_input_tokens":0,"ephemeral_5m_input_tokens":0},"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"input_tokens":598,"output_tokens":1,"server_tool_use":null,"service_tier":"standard"}}}}]},{"parameters":{"model":"@anthropic/claude-opus-4-0","stream":true,"tools":[{"name":"Calculator","description":"Basic calculator tool","inputSchema":{"type":"object","required":["input"],"properties":{"input":{"type":"string","description":"The calculation to perform."}},"additionalProperties":false}}]},"prompt":{"content":[{"role":"user","content":"I am testing error handling in tool paramter parsing. I want you to call the calculator tool but omit the input parameter to intentionally differ from the tool schema.","options":{}},{"role":"assistant","content":[{"type":"reasoning","text":"The user is explicitly asking me to make an incorrect tool call by omitting the required \"input\" parameter from the Calculator function. This is for testing error handling. I'll make the function call without the input parameter as requested.","options":{}},{"type":"text","text":"I understand you want me to intentionally make an incorrect tool call for testing purposes. I'll call the Calculator tool without the required \"input\" parameter:","options":{}},{"type":"tool-call","id":"toolu_01W2EJ2Pqp2tAj1hDrVCeobt","name":"Calculator","params":{},"providerExecuted":false,"options":{}}],"options":{}},{"role":"tool","content":[{"type":"tool-result","id":"toolu_01W2EJ2Pqp2tAj1hDrVCeobt","name":"Calculator","isFailure":false,"result":"MalformedOutput: { \"module\": \"Toolkit\", \"method\": \"Calculator.handle\", \"description\": \"Failed to decode tool call parameters for tool 'Calculator' from:\\n'{}'\", \"cause\": { readonly input: string }\n└─ [\"input\"]\n └─ is missing }\ncaused by:\nParseError: { readonly input: string }\n└─ [\"input\"]\n └─ is missing","providerExecuted":false,"options":{}}],"options":{"anthropic":{"cacheControl":{"ttl":"5m","type":"ephemeral"}}}}]},"response":[{"type":"response-metadata","id":"msg_015NnS1UfNwCsAyN6dWCfCsj","modelId":"claude-opus-4-20250514","timestamp":"1970-01-01T00:00:00.000Z","metadata":{}},{"type":"text-start","id":"0","metadata":{}},{"type":"text-delta","id":"0","delta":"Perfect","metadata":{}},{"type":"text-delta","id":"0","delta":"! The","metadata":{}},{"type":"text-delta","id":"0","delta":" error handling is working correctly.","metadata":{}},{"type":"text-delta","id":"0","delta":" The","metadata":{}},{"type":"text-delta","id":"0","delta":" system","metadata":{}},{"type":"text-delta","id":"0","delta":" detecte","metadata":{}},{"type":"text-delta","id":"0","delta":"d that the require","metadata":{}},{"type":"text-delta","id":"0","delta":"d \"input\" parameter was","metadata":{}},{"type":"text-delta","id":"0","delta":" missing from","metadata":{}},{"type":"text-delta","id":"0","delta":" the Calculator","metadata":{}},{"type":"text-delta","id":"0","delta":" tool call an","metadata":{}},{"type":"text-delta","id":"0","delta":"d returned a detaile","metadata":{}},{"type":"text-delta","id":"0","delta":"d error message indicating:","metadata":{}},{"type":"text-delta","id":"0","delta":"\n\n1","metadata":{}},{"type":"text-delta","id":"0","delta":". The tool call","metadata":{}},{"type":"text-delta","id":"0","delta":" parameters","metadata":{}},{"type":"text-delta","id":"0","delta":" faile","metadata":{}},{"type":"text-delta","id":"0","delta":"d to decode\n2. The specific missing","metadata":{}},{"type":"text-delta","id":"0","delta":" parameter:","metadata":{}},{"type":"text-delta","id":"0","delta":" \"input\"\n3. The expecte","metadata":{}},{"type":"text-delta","id":"0","delta":"d schema","metadata":{}},{"type":"text-delta","id":"0","delta":" structure","metadata":{}},{"type":"text-delta","id":"0","delta":":","metadata":{}},{"type":"text-delta","id":"0","delta":" `{ readonly input: string }`","metadata":{}},{"type":"text-delta","id":"0","delta":"\n\nThis error","metadata":{}},{"type":"text-delta","id":"0","delta":" response","metadata":{}},{"type":"text-delta","id":"0","delta":" confirms","metadata":{}},{"type":"text-delta","id":"0","delta":" that the parameter validation","metadata":{}},{"type":"text-delta","id":"0","delta":" is functioning","metadata":{}},{"type":"text-delta","id":"0","delta":" as expecte","metadata":{}},{"type":"text-delta","id":"0","delta":"d when","metadata":{}},{"type":"text-delta","id":"0","delta":" require","metadata":{}},{"type":"text-delta","id":"0","delta":"d parameters are om","metadata":{}},{"type":"text-delta","id":"0","delta":"itted.","metadata":{}},{"type":"text-end","id":"0","metadata":{}},{"type":"finish","reason":"stop","usage":{"inputTokens":610,"outputTokens":94,"totalTokens":704},"metadata":{"anthropic":{"usage":{"cache_creation":{"ephemeral_1h_input_tokens":0,"ephemeral_5m_input_tokens":0},"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"input_tokens":610,"output_tokens":1,"server_tool_use":null,"service_tier":"standard"}}}}]},{"parameters":{"model":"@anthropic/claude-opus-4-0","stream":true,"tools":[{"name":"Calculator","description":"Basic calculator tool","inputSchema":{"type":"object","required":["input"],"properties":{"input":{"type":"string","description":"The calculation to perform."}},"additionalProperties":false}}]},"prompt":{"content":[{"role":"user","content":"I am testing error handling in tool paramter parsing. I want you to call the calculator tool but omit the input parameter to intentionally differ from the tool schema.","options":{}},{"role":"assistant","content":[{"type":"reasoning","text":"The user is specifically asking me to intentionally call the calculator tool incorrectly by omitting the required \"input\" parameter. This is for testing error handling. They want me to make an invalid tool call on purpose.\n\nI should do exactly what they asked - call the Calculator function without providing the required \"input\" parameter.","options":{}},{"type":"text","text":"I understand you want me to intentionally make an incorrect tool call for testing purposes. I'll call the Calculator function without the required \"input\" parameter:","options":{}},{"type":"tool-call","id":"toolu_016cxVEiPd9t8mhq7bXVFwgT","name":"Calculator","params":{},"providerExecuted":false,"options":{}}],"options":{}},{"role":"tool","content":[{"type":"tool-result","id":"toolu_016cxVEiPd9t8mhq7bXVFwgT","name":"Calculator","isFailure":false,"result":"MalformedOutput: { \"module\": \"Toolkit\", \"method\": \"Calculator.handle\", \"description\": \"Failed to decode tool call parameters for tool 'Calculator' from:\\n'{}'\", \"cause\": { readonly input: string }\n└─ [\"input\"]\n └─ is missing }\ncaused by:\nParseError: { readonly input: string }\n└─ [\"input\"]\n └─ is missing","providerExecuted":false,"options":{}}],"options":{"anthropic":{"cacheControl":{"ttl":"5m","type":"ephemeral"}}}}]},"response":[{"type":"response-metadata","id":"msg_01M4DAqgcjAUmjuShAhMAbqK","modelId":"claude-opus-4-20250514","timestamp":"1970-01-01T00:00:00.000Z","metadata":{}},{"type":"text-start","id":"0","metadata":{}},{"type":"text-delta","id":"0","delta":"Perfect","metadata":{}},{"type":"text-delta","id":"0","delta":"! The","metadata":{}},{"type":"text-delta","id":"0","delta":" error","metadata":{}},{"type":"text-delta","id":"0","delta":" handling is working correctly.","metadata":{}},{"type":"text-delta","id":"0","delta":" The","metadata":{}},{"type":"text-delta","id":"0","delta":" system","metadata":{}},{"type":"text-delta","id":"0","delta":" caught","metadata":{}},{"type":"text-delta","id":"0","delta":" that the require","metadata":{}},{"type":"text-delta","id":"0","delta":"d \"input\" parameter was missing and returne","metadata":{}},{"type":"text-delta","id":"0","delta":"d a detaile","metadata":{}},{"type":"text-delta","id":"0","delta":"d error message explaining","metadata":{}},{"type":"text-delta","id":"0","delta":":","metadata":{}},{"type":"text-delta","id":"0","delta":"\n\n1. The tool call","metadata":{}},{"type":"text-delta","id":"0","delta":" faile","metadata":{}},{"type":"text-delta","id":"0","delta":"d to decode parameters","metadata":{}},{"type":"text-delta","id":"0","delta":"\n2. The specific","metadata":{}},{"type":"text-delta","id":"0","delta":" missing","metadata":{}},{"type":"text-delta","id":"0","delta":" fiel","metadata":{}},{"type":"text-delta","id":"0","delta":"d:","metadata":{}},{"type":"text-delta","id":"0","delta":" \"input\"","metadata":{}},{"type":"text-delta","id":"0","delta":" \n3. The expecte","metadata":{}},{"type":"text-delta","id":"0","delta":"d schema","metadata":{}},{"type":"text-delta","id":"0","delta":" structure","metadata":{}},{"type":"text-delta","id":"0","delta":":","metadata":{}},{"type":"text-delta","id":"0","delta":" `{","metadata":{}},{"type":"text-delta","id":"0","delta":" readonly","metadata":{}},{"type":"text-delta","id":"0","delta":" input: string }`\n\nThis demonstrates","metadata":{}},{"type":"text-delta","id":"0","delta":" that the parameter","metadata":{}},{"type":"text-delta","id":"0","delta":" validation","metadata":{}},{"type":"text-delta","id":"0","delta":" is properly","metadata":{}},{"type":"text-delta","id":"0","delta":" checking against","metadata":{}},{"type":"text-delta","id":"0","delta":" the tool","metadata":{}},{"type":"text-delta","id":"0","delta":"'s JSON","metadata":{}},{"type":"text-delta","id":"0","delta":" schema and rej","metadata":{}},{"type":"text-delta","id":"0","delta":"ecting calls","metadata":{}},{"type":"text-delta","id":"0","delta":" that","metadata":{}},{"type":"text-delta","id":"0","delta":" don't include","metadata":{}},{"type":"text-delta","id":"0","delta":" all required parameters.","metadata":{}},{"type":"text-end","id":"0","metadata":{}},{"type":"finish","reason":"stop","usage":{"inputTokens":610,"outputTokens":98,"totalTokens":708},"metadata":{"anthropic":{"usage":{"cache_creation":{"ephemeral_1h_input_tokens":0,"ephemeral_5m_input_tokens":0},"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"input_tokens":610,"output_tokens":1,"server_tool_use":null,"service_tier":"standard"}}}}]},{"parameters":{"model":"@anthropic/claude-opus-4-0","stream":true,"tools":[{"name":"Calculator","description":"Basic calculator tool","inputSchema":{"type":"object","required":["input"],"properties":{"input":{"type":"string","description":"The calculation to perform."}},"additionalProperties":false}}]},"prompt":{"content":[{"role":"user","content":"I am testing error handling in tool paramter parsing. I want you to call the calculator tool but omit the input parameter to intentionally differ from the tool schema.","options":{}},{"role":"assistant","content":[{"type":"reasoning","text":"The user is explicitly asking me to intentionally call the calculator tool incorrectly by omitting the required \"input\" parameter. This is for testing error handling. I should do exactly as they ask - call the Calculator function without providing the input parameter.","options":{}},{"type":"text","text":"I'll call the calculator tool without the required input parameter as requested for your error handling test:","options":{}},{"type":"tool-call","id":"toolu_012AjotXs8rRcN3ifCgfDzfo","name":"Calculator","params":{},"providerExecuted":false,"options":{}}],"options":{}},{"role":"tool","content":[{"type":"tool-result","id":"toolu_012AjotXs8rRcN3ifCgfDzfo","name":"Calculator","isFailure":false,"result":"MalformedOutput: { \"module\": \"Toolkit\", \"method\": \"Calculator.handle\", \"description\": \"Failed to decode tool call parameters for tool 'Calculator' from:\\n'{}'\", \"cause\": { readonly input: string }\n└─ [\"input\"]\n └─ is missing }\ncaused by:\nParseError: { readonly input: string }\n└─ [\"input\"]\n └─ is missing","providerExecuted":false,"options":{}}],"options":{"anthropic":{"cacheControl":{"ttl":"5m","type":"ephemeral"}}}}]},"response":[{"type":"response-metadata","id":"msg_01MkUfXu1fN2higVMbKKMVah","modelId":"claude-opus-4-20250514","timestamp":"1970-01-01T00:00:00.000Z","metadata":{}},{"type":"text-start","id":"0","metadata":{}},{"type":"text-delta","id":"0","delta":"Perfect","metadata":{}},{"type":"text-delta","id":"0","delta":"! As","metadata":{}},{"type":"text-delta","id":"0","delta":" expected, the system","metadata":{}},{"type":"text-delta","id":"0","delta":" returne","metadata":{}},{"type":"text-delta","id":"0","delta":"d a `MalformedOutput`","metadata":{}},{"type":"text-delta","id":"0","delta":" error indicating","metadata":{}},{"type":"text-delta","id":"0","delta":" that the","metadata":{}},{"type":"text-delta","id":"0","delta":" require","metadata":{}},{"type":"text-delta","id":"0","delta":"d parameter","metadata":{}},{"type":"text-delta","id":"0","delta":" \"","metadata":{}},{"type":"text-delta","id":"0","delta":"input\" is missing from","metadata":{}},{"type":"text-delta","id":"0","delta":" the tool call. The","metadata":{}},{"type":"text-delta","id":"0","delta":" error message clearly","metadata":{}},{"type":"text-delta","id":"0","delta":" shows:","metadata":{}},{"type":"text-delta","id":"0","delta":"\n\n1. The tool call","metadata":{}},{"type":"text-delta","id":"0","delta":" parameters","metadata":{}},{"type":"text-delta","id":"0","delta":" faile","metadata":{}},{"type":"text-delta","id":"0","delta":"d to decode\n2. The specific issue","metadata":{}},{"type":"text-delta","id":"0","delta":":","metadata":{}},{"type":"text-delta","id":"0","delta":" `[\"","metadata":{}},{"type":"text-delta","id":"0","delta":"input\"]","metadata":{}},{"type":"text-delta","id":"0","delta":" └─ is missing`\n3","metadata":{}},{"type":"text-delta","id":"0","delta":". The parameter","metadata":{}},{"type":"text-delta","id":"0","delta":" schema","metadata":{}},{"type":"text-delta","id":"0","delta":" shows","metadata":{}},{"type":"text-delta","id":"0","delta":" `","metadata":{}},{"type":"text-delta","id":"0","delta":"input","metadata":{}},{"type":"text-delta","id":"0","delta":"`","metadata":{}},{"type":"text-delta","id":"0","delta":" is a","metadata":{}},{"type":"text-delta","id":"0","delta":" required string parameter\n\nThis demonstrates","metadata":{}},{"type":"text-delta","id":"0","delta":" that the error handling is","metadata":{}},{"type":"text-delta","id":"0","delta":" working correctly - when a","metadata":{}},{"type":"text-delta","id":"0","delta":" required parameter is om","metadata":{}},{"type":"text-delta","id":"0","delta":"itted from","metadata":{}},{"type":"text-delta","id":"0","delta":" a","metadata":{}},{"type":"text-delta","id":"0","delta":" tool call, the system properly catches","metadata":{}},{"type":"text-delta","id":"0","delta":" this an","metadata":{}},{"type":"text-delta","id":"0","delta":"d returns a","metadata":{}},{"type":"text-delta","id":"0","delta":" descript","metadata":{}},{"type":"text-delta","id":"0","delta":"ive error rather","metadata":{}},{"type":"text-delta","id":"0","delta":" than proce","metadata":{}},{"type":"text-delta","id":"0","delta":"eding with an","metadata":{}},{"type":"text-delta","id":"0","delta":" invalid call","metadata":{}},{"type":"text-delta","id":"0","delta":".","metadata":{}},{"type":"text-end","id":"0","metadata":{}},{"type":"finish","reason":"stop","usage":{"inputTokens":598,"outputTokens":126,"totalTokens":724},"metadata":{"anthropic":{"usage":{"cache_creation":{"ephemeral_1h_input_tokens":0,"ephemeral_5m_input_tokens":0},"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"input_tokens":598,"output_tokens":1,"server_tool_use":null,"service_tier":"standard"}}}}]},{"parameters":{"model":"@anthropic/claude-opus-4-0","stream":true,"tools":[{"name":"Calculator","description":"Basic calculator tool","inputSchema":{"type":"object","required":["input"],"properties":{"input":{"type":"string","description":"The calculation to perform."}},"additionalProperties":false}}]},"prompt":{"content":[{"role":"user","content":"I am testing error handling in tool paramter parsing. I want you to call the calculator tool but omit the input parameter to intentionally differ from the tool schema.","options":{}},{"role":"assistant","content":[{"type":"reasoning","text":"The user is explicitly asking me to make an incorrect tool call for testing purposes. They want me to call the Calculator tool but omit the required \"input\" parameter, which would violate the tool's schema. This is a testing scenario where they want to see how the system handles errors.\n\nI should do exactly what they're asking - make the tool call without the required parameter.","options":{}},{"type":"text","text":"I'll intentionally call the Calculator tool without the required \"input\" parameter as you requested for testing error handling:","options":{}},{"type":"tool-call","id":"toolu_013D15z5B8mUNG9ocMsNyLA9","name":"Calculator","params":{},"providerExecuted":false,"options":{}}],"options":{}},{"role":"tool","content":[{"type":"tool-result","id":"toolu_013D15z5B8mUNG9ocMsNyLA9","name":"Calculator","isFailure":false,"result":"MalformedOutput: { \"module\": \"Toolkit\", \"method\": \"Calculator.handle\", \"description\": \"Failed to decode tool call parameters for tool 'Calculator' from:\\n'{}'\", \"cause\": { readonly input: string }\n└─ [\"input\"]\n └─ is missing }\ncaused by:\nParseError: { readonly input: string }\n└─ [\"input\"]\n └─ is missing","providerExecuted":false,"options":{}}],"options":{"anthropic":{"cacheControl":{"ttl":"5m","type":"ephemeral"}}}}]},"response":[{"type":"response-metadata","id":"msg_01PSXo5qG6jEaehv6c7sCK22","modelId":"claude-opus-4-20250514","timestamp":"1970-01-01T00:00:00.000Z","metadata":{}},{"type":"text-start","id":"0","metadata":{}},{"type":"text-delta","id":"0","delta":"Perfect","metadata":{}},{"type":"text-delta","id":"0","delta":"! As","metadata":{}},{"type":"text-delta","id":"0","delta":" expecte","metadata":{}},{"type":"text-delta","id":"0","delta":"d, the system","metadata":{}},{"type":"text-delta","id":"0","delta":" caught","metadata":{}},{"type":"text-delta","id":"0","delta":" the missing required parameter","metadata":{}},{"type":"text-delta","id":"0","delta":" and returned an","metadata":{}},{"type":"text-delta","id":"0","delta":" error.","metadata":{}},{"type":"text-delta","id":"0","delta":" The error message clearly indicates that the \"","metadata":{}},{"type":"text-delta","id":"0","delta":"input\" parameter is missing","metadata":{}},{"type":"text-delta","id":"0","delta":" from","metadata":{}},{"type":"text-delta","id":"0","delta":" the Calculator","metadata":{}},{"type":"text-delta","id":"0","delta":" tool call, which viol","metadata":{}},{"type":"text-delta","id":"0","delta":"ates the tool's schema that","metadata":{}},{"type":"text-delta","id":"0","delta":" requires this parameter.","metadata":{}},{"type":"text-delta","id":"0","delta":" This is the","metadata":{}},{"type":"text-delta","id":"0","delta":" correct behavior for error handling when","metadata":{}},{"type":"text-delta","id":"0","delta":" tool","metadata":{}},{"type":"text-delta","id":"0","delta":" parameters","metadata":{}},{"type":"text-delta","id":"0","delta":" don","metadata":{}},{"type":"text-delta","id":"0","delta":"'t match","metadata":{}},{"type":"text-delta","id":"0","delta":" the expected schema.","metadata":{}},{"type":"text-end","id":"0","metadata":{}},{"type":"finish","reason":"stop","usage":{"inputTokens":602,"outputTokens":69,"totalTokens":671},"metadata":{"anthropic":{"usage":{"cache_creation":{"ephemeral_1h_input_tokens":0,"ephemeral_5m_input_tokens":0},"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"input_tokens":602,"output_tokens":1,"server_tool_use":null,"service_tier":"standard"}}}}]},{"parameters":{"model":"@anthropic/claude-opus-4-0","stream":true,"tools":[{"name":"Calculator","description":"Basic calculator tool","inputSchema":{"type":"object","required":["input"],"properties":{"input":{"type":"string","description":"The calculation to perform."}},"additionalProperties":false}}]},"prompt":{"content":[{"role":"user","content":"I am testing error handling in tool paramter parsing. I want you to call the calculator tool but omit the input parameter to intentionally differ from the tool schema.","options":{"anthropic":{"cacheControl":{"ttl":"5m","type":"ephemeral"}}}}]},"response":[{"type":"response-metadata","id":"msg_0195DbxUY7oVbrs7QAUP6YLS","modelId":"claude-opus-4-20250514","timestamp":"1970-01-01T00:00:00.000Z","metadata":{}},{"type":"reasoning-start","id":"0","metadata":{}},{"type":"reasoning-delta","id":"0","delta":"The user is","metadata":{}},{"type":"reasoning-delta","id":"0","delta":" asking me to intent","metadata":{}},{"type":"reasoning-delta","id":"0","delta":"ionally create","metadata":{}},{"type":"reasoning-delta","id":"0","delta":" an error by calling","metadata":{}},{"type":"reasoning-delta","id":"0","delta":" the Calculator tool without","metadata":{}},{"type":"reasoning-delta","id":"0","delta":" providing the required \"","metadata":{}},{"type":"reasoning-delta","id":"0","delta":"input\" parameter.","metadata":{}},{"type":"reasoning-delta","id":"0","delta":" They want to test","metadata":{}},{"type":"reasoning-delta","id":"0","delta":" error handling in tool parameter parsing.","metadata":{}},{"type":"reasoning-delta","id":"0","delta":"\n\nSince","metadata":{}},{"type":"reasoning-delta","id":"0","delta":" they","metadata":{}},{"type":"reasoning-delta","id":"0","delta":"'re","metadata":{}},{"type":"reasoning-delta","id":"0","delta":" explicitly","metadata":{}},{"type":"reasoning-delta","id":"0","delta":" asking me","metadata":{}},{"type":"reasoning-delta","id":"0","delta":" to omit a","metadata":{}},{"type":"reasoning-delta","id":"0","delta":" required parameter to","metadata":{}},{"type":"reasoning-delta","id":"0","delta":" test error handling, I should ","metadata":{}},{"type":"reasoning-delta","id":"0","delta":"do exactly","metadata":{}},{"type":"reasoning-delta","id":"0","delta":" that -","metadata":{}},{"type":"reasoning-delta","id":"0","delta":" call the Calculator function","metadata":{}},{"type":"reasoning-delta","id":"0","delta":" without including","metadata":{}},{"type":"reasoning-delta","id":"0","delta":" the \"input\" parameter.","metadata":{}},{"type":"reasoning-delta","id":"0","delta":"","metadata":{}},{"type":"reasoning-delta","id":"0","delta":"","metadata":{"anthropic":{"type":"thinking","signature":"EqQECkYICxgCKkCmOPj7JooxBf0AyUOHaXqqCPWM8owD1CuCDoT3UAYaJZg/bNtiSV2h9cN9xtQ6rxgo6e47q91ce1l6UALCh5jFEgzNvzFUUvy1Tyc29XEaDDqZkD3ULvixDmGomSIw8TYIr+sXVdFxil1YFtzhEJpJEscdlQFCTvDIv/KJiyJJGaJZtEEJ61+W8nv9T53lKosDKqCWCn6yyh3VNAOoZ00WwMDoJyfC8nOz66b+wvSJQXV+7FBDGvHzdk15QBNk/lsxH/ehgZXdmev29vD2/oasg8QwnwBy0wSmoSSD84hmRMtoK3JU6piYoFfX0FdruVcI/I6RtBllze6y25gVDbt30rbm4kqQoy5uzVnqMF+4ueEk9sk+bw5KQymrYHE0sfrSAYK4HX23LUtOyYujk0GWkdHwVpQEPL7VRcU9PWdP22fe2Q+fm3oQGUDNZpi5gTxBMQYK6RxscZ5gfJDbCAxh8MEquCnMxyk0qmj8CN1KyO344L56gTY7t8FvuzZFuitkt9byovMwFIe5ulr+r3U5DRSywEkv6O+gCRH6llYufPXnnkO5ahz4zMDUmCeHEhI+UX7+ceCZgC2e7gOxq9RWgoWrSHwJ9pzHxlexdFohNlT+uwcgPmNFiWQptMZPWFH7J3NOnr0O/v3/886qDjkwpllzNmSfv/1l4Ivmoe/Kn5nprh7YVgGDoyLAVPxs2X91K3f5lqWq/39Xm9cYAQ=="}}},{"type":"reasoning-end","id":"0","metadata":{}},{"type":"text-start","id":"1","metadata":{}},{"type":"text-delta","id":"1","delta":"I understan","metadata":{}},{"type":"text-delta","id":"1","delta":"d you want to test error handling by","metadata":{}},{"type":"text-delta","id":"1","delta":" having","metadata":{}},{"type":"text-delta","id":"1","delta":" me make","metadata":{}},{"type":"text-delta","id":"1","delta":" an","metadata":{}},{"type":"text-delta","id":"1","delta":" invali","metadata":{}},{"type":"text-delta","id":"1","delta":"d tool","metadata":{}},{"type":"text-delta","id":"1","delta":" call. I'll call the Calculator tool","metadata":{}},{"type":"text-delta","id":"1","delta":" without the required \"input\" parameter:","metadata":{}},{"type":"text-end","id":"1","metadata":{}},{"type":"tool-params-start","id":"toolu_01M5a1PVAQFXNv46cwDyWi7z","name":"Calculator","providerExecuted":false,"metadata":{}},{"type":"tool-params-delta","id":"toolu_01M5a1PVAQFXNv46cwDyWi7z","delta":"","metadata":{}},{"type":"tool-params-end","id":"toolu_01M5a1PVAQFXNv46cwDyWi7z","metadata":{}}]},{"parameters":{"model":"@anthropic/claude-opus-4-0","stream":true,"tools":[{"name":"Calculator","description":"Basic calculator tool","inputSchema":{"type":"object","required":["input"],"properties":{"input":{"type":"string","description":"The calculation to perform."}},"additionalProperties":false}}]},"prompt":{"content":[{"role":"user","content":"I am testing error handling in tool paramter parsing. I want you to call the calculator tool but omit the input parameter to intentionally differ from the tool schema.","options":{}},{"role":"assistant","content":[{"type":"reasoning","text":"The user is asking me to intentionally create an error by calling the Calculator tool without providing the required \"input\" parameter. They want to test error handling in tool parameter parsing.\n\nSince they're explicitly asking me to omit a required parameter to test error handling, I should do exactly that - call the Calculator function without including the \"input\" parameter.","options":{}},{"type":"text","text":"I understand you want to test error handling by having me make an invalid tool call. I'll call the Calculator tool without the required \"input\" parameter:","options":{}},{"type":"tool-call","id":"toolu_01M5a1PVAQFXNv46cwDyWi7z","name":"Calculator","params":{},"providerExecuted":false,"options":{}}],"options":{}},{"role":"tool","content":[{"type":"tool-result","id":"toolu_01M5a1PVAQFXNv46cwDyWi7z","name":"Calculator","isFailure":false,"result":"MalformedOutput: { \"module\": \"Toolkit\", \"method\": \"Calculator.handle\", \"description\": \"Failed to decode tool call parameters for tool 'Calculator' from:\\n'{}'\", \"cause\": { readonly input: string }\n└─ [\"input\"]\n └─ is missing }\ncaused by:\nParseError: { readonly input: string }\n└─ [\"input\"]\n └─ is missing","providerExecuted":false,"options":{}}],"options":{"anthropic":{"cacheControl":{"ttl":"5m","type":"ephemeral"}}}}]},"response":[{"type":"response-metadata","id":"msg_01BeXiK9yEhEQrs9zPYNem6C","modelId":"claude-opus-4-20250514","timestamp":"1970-01-01T00:00:00.000Z","metadata":{}},{"type":"text-start","id":"0","metadata":{}},{"type":"text-delta","id":"0","delta":"As expected, this","metadata":{}},{"type":"text-delta","id":"0","delta":" generate","metadata":{}},{"type":"text-delta","id":"0","delta":"d an","metadata":{}},{"type":"text-delta","id":"0","delta":" error because the \"","metadata":{}},{"type":"text-delta","id":"0","delta":"input\" parameter is required according","metadata":{}},{"type":"text-delta","id":"0","delta":" to the tool","metadata":{}},{"type":"text-delta","id":"0","delta":"'s","metadata":{}},{"type":"text-delta","id":"0","delta":" schema,","metadata":{}},{"type":"text-delta","id":"0","delta":" but","metadata":{}},{"type":"text-delta","id":"0","delta":" I om","metadata":{}},{"type":"text-delta","id":"0","delta":"itted it. The error message clearly","metadata":{}},{"type":"text-delta","id":"0","delta":" indicates that the \"","metadata":{}},{"type":"text-delta","id":"0","delta":"input\" fiel","metadata":{}},{"type":"text-delta","id":"0","delta":"d is missing from the tool call parameters","metadata":{}},{"type":"text-delta","id":"0","delta":".","metadata":{}},{"type":"text-end","id":"0","metadata":{}},{"type":"finish","reason":"stop","usage":{"inputTokens":610,"outputTokens":50,"totalTokens":660},"metadata":{"anthropic":{"usage":{"cache_creation":{"ephemeral_1h_input_tokens":0,"ephemeral_5m_input_tokens":0},"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"input_tokens":610,"output_tokens":4,"server_tool_use":null,"service_tier":"standard"}}}}]}]}
@@ -9,13 +9,12 @@ import * as Effect from 'effect/Effect';
9
9
  import * as Layer from 'effect/Layer';
10
10
  import * as Schema from 'effect/Schema';
11
11
 
12
- import { AiService, MemoizedAiService, ToolExecutionService, ToolResolverService } from '@dxos/ai';
13
- import { AiServiceTestingPreset } from '@dxos/ai/testing';
14
12
  import { Obj, Type } from '@dxos/echo';
15
- import { TestHelpers } from '@dxos/effect';
16
- import { TracingService } from '@dxos/functions';
13
+ import { TestHelpers } from '@dxos/effect/testing';
17
14
  import { log } from '@dxos/log';
18
15
 
16
+ import { AssistantTestLayer } from '../testing';
17
+
19
18
  import { AiSession } from './session';
20
19
 
21
20
  // Define a calendar event artifact schema.
@@ -25,7 +24,7 @@ const CalendarEventSchema = Schema.Struct({
25
24
  endTime: Schema.String,
26
25
  description: Schema.String,
27
26
  }).pipe(
28
- Type.Obj({
27
+ Type.object({
29
28
  typename: 'example.com/type/CalendarEvent',
30
29
  version: '0.1.0',
31
30
  }),
@@ -66,15 +65,10 @@ const toolkitLayer = TestToolkit.toLayer({
66
65
  });
67
66
 
68
67
  const TestLayer = Layer.mergeAll(
68
+ AssistantTestLayer({
69
+ types: [CalendarEventSchema],
70
+ }),
69
71
  toolkitLayer,
70
- AiService.model('@anthropic/claude-3-5-sonnet-20241022'),
71
- TracingService.layerNoop,
72
- ToolResolverService.layerEmpty,
73
- ToolExecutionService.layerEmpty,
74
- ).pipe(
75
- //
76
- Layer.provideMerge(MemoizedAiService.layerTest()),
77
- Layer.provide(AiServiceTestingPreset('direct')),
78
72
  );
79
73
 
80
74
  describe('AiSession', () => {
@@ -111,6 +105,25 @@ describe('AiSession', () => {
111
105
  TestHelpers.provideTestContext,
112
106
  ),
113
107
  );
108
+
109
+ it.effect(
110
+ 'tool schema error',
111
+ Effect.fnUntraced(
112
+ function* (_) {
113
+ const session = new AiSession({ operationModel: 'configured' });
114
+ const toolkit = yield* TestToolkit;
115
+ const response = yield* session.run({
116
+ toolkit,
117
+ prompt:
118
+ 'I am testing error handling in tool paramter parsing. I want you to call the calculator tool but omit the input parameter to intentionally differ from the tool schema.',
119
+ history: [],
120
+ });
121
+ log.info('response', { response });
122
+ },
123
+ Effect.provide(TestLayer),
124
+ TestHelpers.provideTestContext,
125
+ ),
126
+ );
114
127
  });
115
128
 
116
129
  // Travel to rome, florence, livorno, siena, madrid for conferences
@@ -20,11 +20,12 @@ import {
20
20
  type ToolResolverService,
21
21
  callTool,
22
22
  getToolCalls,
23
+ withoutToolCallParising,
23
24
  } from '@dxos/ai';
24
25
  import { type Blueprint } from '@dxos/blueprints';
25
26
  import { todo } from '@dxos/debug';
26
27
  import { Obj } from '@dxos/echo';
27
- import { TracingService } from '@dxos/functions';
28
+ import { type FunctionInvocationService, TracingService } from '@dxos/functions';
28
29
  import { log } from '@dxos/log';
29
30
  import { Message } from '@dxos/types';
30
31
 
@@ -39,21 +40,22 @@ export type AiSessionRunRequirements =
39
40
  | LanguageModel.LanguageModel
40
41
  | ToolExecutionService
41
42
  | ToolResolverService
42
- | TracingService;
43
+ | TracingService
44
+ | FunctionInvocationService;
43
45
 
44
- export type AiSessionRunParams<Tools extends Record<string, Tool.Any>> = {
46
+ export type AiSessionOptions = {};
47
+
48
+ export type AiSessionRunProps<Tools extends Record<string, Tool.Any>> = {
45
49
  prompt: string;
46
50
  // TODO(wittjosiah): Rename to systemPrompt.
47
51
  system?: string;
48
52
  history?: Message.Message[];
49
- objects?: Obj.Any[];
50
- blueprints?: Blueprint.Blueprint[];
53
+ objects?: Obj.Unknown[];
54
+ blueprints?: readonly Blueprint.Blueprint[];
51
55
  toolkit?: Toolkit.WithHandler<Tools>;
52
- observer?: GenerationObserver;
56
+ observer?: GenerationObserver<Tools>;
53
57
  };
54
58
 
55
- export type AiSessionOptions = {};
56
-
57
59
  /**
58
60
  * Contains message history, tools, current context.
59
61
  * Current context means the state of the app, time of day, and other contextual information.
@@ -75,8 +77,20 @@ export class AiSession {
75
77
  /** Pending messages for this session (incl. the current prompt). */
76
78
  private _pending: Message.Message[] = [];
77
79
 
80
+ private _started = 0;
81
+ private _ended = 0;
82
+ private _toolCalls = 0;
83
+
78
84
  constructor(private readonly _options: AiSessionOptions = {}) {}
79
85
 
86
+ get duration(): number {
87
+ return this._ended - this._started;
88
+ }
89
+
90
+ get toolCalls(): number {
91
+ return this._toolCalls;
92
+ }
93
+
80
94
  run = <Tools extends Record<string, Tool.Any>>({
81
95
  prompt,
82
96
  system: systemTemplate,
@@ -85,8 +99,9 @@ export class AiSession {
85
99
  blueprints = [],
86
100
  toolkit,
87
101
  observer = GenerationObserver.noop(),
88
- }: AiSessionRunParams<Tools>): Effect.Effect<Message.Message[], AiSessionRunError, AiSessionRunRequirements> =>
102
+ }: AiSessionRunProps<Tools>): Effect.Effect<Message.Message[], AiSessionRunError, AiSessionRunRequirements> =>
89
103
  Effect.gen(this, function* () {
104
+ this._started = Date.now();
90
105
  this._history = [...history];
91
106
  this._pending = [];
92
107
  const pending = this._pending;
@@ -103,7 +118,7 @@ export class AiSession {
103
118
  const promptMessage = yield* submitMessage(yield* formatUserPrompt({ prompt, history }));
104
119
 
105
120
  // Generate system and prompt messages.
106
- const system = yield* formatSystemPrompt({ system: systemTemplate, blueprints, objects });
121
+ const system = yield* formatSystemPrompt({ system: systemTemplate, blueprints, objects }).pipe(Effect.orDie);
107
122
 
108
123
  // Tool call loop.
109
124
  do {
@@ -115,15 +130,19 @@ export class AiSession {
115
130
  objects: objects?.length ?? 0,
116
131
  });
117
132
 
118
- const prompt = yield* AiPreprocessor.preprocessPrompt([...this._history, ...this._pending], { system });
133
+ const prompt = yield* AiPreprocessor.preprocessPrompt([...this._history, ...this._pending], {
134
+ system,
135
+ cacheControl: 'ephemeral',
136
+ });
119
137
 
120
138
  // Execute the stream request.
121
- // logDump('prompt', Prompt.Prompt.pipe(Schema.encodeSync)(prompt));
122
139
  const blocks = yield* LanguageModel.streamText({
123
140
  prompt,
124
141
  toolkit,
125
142
  disableToolCallResolution: true,
126
143
  }).pipe(
144
+ // Disable tool call parsing so that we can handle parameter schema errors on a per-tool call basis.
145
+ withoutToolCallParising,
127
146
  // TOOD(dmaretskyi): Error mapping.
128
147
  AiParser.parseResponse({
129
148
  onBegin: () => observer.onBegin(),
@@ -176,9 +195,12 @@ export class AiSession {
176
195
  blocks: toolResults,
177
196
  }),
178
197
  );
198
+
199
+ this._toolCalls++;
179
200
  } while (true);
180
201
 
181
- log('done', { pending: this._pending.length });
202
+ this._ended = Date.now();
203
+ log('done', { pending: this._pending.length, duration: this.duration, tools: this._toolCalls });
182
204
  return this._pending;
183
205
  }).pipe(this._semaphore.withPermits(1), Effect.withSpan('AiSession.run'));
184
206
 
@@ -188,7 +210,7 @@ export class AiSession {
188
210
  // TODO(burdon): Implement or remove.
189
211
  async runStructured<S extends Schema.Schema.AnyNoContext>(
190
212
  _schema: S,
191
- _options: AiSessionRunParams<any>,
213
+ _options: AiSessionRunProps<any>,
192
214
  ): Promise<Schema.Schema.Type<S>> {
193
215
  return todo();
194
216
  // const parser = structuredOutputParser(schema);
@@ -4,45 +4,36 @@
4
4
 
5
5
  import type * as Tool from '@effect/ai/Tool';
6
6
  import * as Toolkit from '@effect/ai/Toolkit';
7
- import type * as Context from 'effect/Context';
8
7
  import * as Effect from 'effect/Effect';
9
8
 
10
- import { type AiToolNotFoundError, ToolExecutionService, type ToolId, ToolResolverService } from '@dxos/ai';
9
+ import { type AiToolNotFoundError, ToolExecutionService, ToolResolverService } from '@dxos/ai';
11
10
  import { type Blueprint } from '@dxos/blueprints';
12
11
  import { isTruthy } from '@dxos/util';
13
12
 
14
- export type ToolkitParams<Tools extends Record<string, Tool.Any>> = {
15
- toolkit?: Toolkit.Toolkit<Tools>;
16
- toolIds?: ToolId[];
17
- blueprints?: Blueprint.Blueprint[];
13
+ export type CreateToolkitProps = {
14
+ toolkit?: Toolkit.Any;
15
+ blueprints?: readonly Blueprint.Blueprint[];
18
16
  };
19
17
 
20
18
  /**
21
19
  * Build a combined toolkit from the blueprint tools and the provided toolkit.
22
20
  */
23
- export const createToolkit = <Tools extends Record<string, Tool.Any> = {}>({
24
- toolkit: toolkitParam,
25
- toolIds = [],
21
+ export const createToolkit = ({
22
+ toolkit: toolkitProp,
26
23
  blueprints = [],
27
- }: ToolkitParams<Tools>): Effect.Effect<
24
+ }: CreateToolkitProps): Effect.Effect<
28
25
  Toolkit.WithHandler<any>,
29
26
  AiToolNotFoundError,
30
- ToolResolverService | ToolExecutionService | Tool.HandlersFor<Tools>
27
+ ToolResolverService | ToolExecutionService | Tool.HandlersFor<any>
31
28
  > =>
32
29
  Effect.gen(function* () {
33
- const blueprintToolkit = yield* ToolResolverService.resolveToolkit([
34
- ...blueprints.flatMap(({ tools }) => tools),
35
- ...toolIds,
36
- ]);
30
+ const blueprintToolkit = yield* ToolResolverService.resolveToolkit(blueprints.flatMap(({ tools }) => tools));
31
+ const blueprintToolHandler = yield* blueprintToolkit.toContext(ToolExecutionService.handlersFor(blueprintToolkit));
37
32
 
38
- const blueprintToolkitHandler: Context.Context<Tool.HandlersFor<any>> = yield* blueprintToolkit.toContext(
39
- ToolExecutionService.handlersFor(blueprintToolkit),
40
- );
41
-
42
- const toolkit = Toolkit.merge(...[toolkitParam, blueprintToolkit].filter(isTruthy));
43
- return yield* toolkit.pipe(Effect.provide(blueprintToolkitHandler)) as any as Effect.Effect<
33
+ const toolkit = Toolkit.merge(...[toolkitProp, blueprintToolkit].filter(isTruthy));
34
+ return yield* toolkit.pipe(Effect.provide(blueprintToolHandler)) as any as Effect.Effect<
44
35
  Toolkit.WithHandler<any>,
45
36
  never,
46
- Tool.HandlersFor<Tools>
37
+ Tool.HandlersFor<any>
47
38
  >;
48
39
  });
@@ -4,8 +4,9 @@
4
4
 
5
5
  import * as Schema from 'effect/Schema';
6
6
 
7
- import { type AnyEchoObject, ObjectId } from '@dxos/echo/internal';
7
+ import { type Obj } from '@dxos/echo';
8
8
  import { type ObjectVersion, getVersion } from '@dxos/echo-db';
9
+ import { ObjectId } from '@dxos/keys';
9
10
  import { type ContentBlock } from '@dxos/types';
10
11
 
11
12
  // TODO(dmaretskyi): Extract.
@@ -26,11 +27,11 @@ export interface VersionPin extends Schema.Schema.Type<typeof VersionPinSchema>
26
27
 
27
28
  export const VersionPin: typeof VersionPinSchema & {
28
29
  DISPOSITION: 'version-pin';
29
- fromObject: (object: AnyEchoObject) => VersionPin;
30
+ fromObject: (object: Obj.Unknown) => VersionPin;
30
31
  createBlock: (pin: VersionPin) => ContentBlock.Any;
31
32
  } = class extends VersionPinSchema {
32
33
  static readonly DISPOSITION = 'version-pin';
33
- static fromObject(object: AnyEchoObject): VersionPin {
34
+ static fromObject(object: Obj.Unknown): VersionPin {
34
35
  return VersionPin.make({
35
36
  objectId: object.id,
36
37
  version: getVersion(object),
@@ -52,10 +52,6 @@ Do not use bullets when listing suggestions.
52
52
  You may ask multiple choice questions by wrapping consise options inside <option> tags inside a well formed <select> tag.
53
53
  Example: <select><option>Yes</option><option>No</option></select>
54
54
 
55
- ## Toolkit
56
-
57
- If the user asks for a list of tools, then just emit a single self-closing <toolkit/> tag instead of listing the tools.
58
-
59
55
  ## Context
60
56
 
61
57
  The current date and time is {{DATETIME}}.
@@ -0,0 +1,5 @@
1
+ //
2
+ // Copyright 2026 DXOS.org
3
+ //
4
+
5
+ export * from './layer';