webdaemon 30.1.0 → 31.0.0
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.
- package/dist/index.js +1 -1
- package/dist/index.js.map +2 -2
- package/dist/types/ts/McpAgentTools.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -31,7 +31,7 @@ ${n.getSrc()}`:null}catch{return null}}function Ae(n){return Et(n.outputSchema)|
|
|
|
31
31
|
${o.src}`;t.has(r)||(t.add(r),e.push(o))}return e}async function Ne(n,t,e,o){let r=[],s=[];for(let i of t){let a=n.clientToolNames.has(i.name);if(e&&o.push({role:"tool",content:X(i,a)}),a){s.push(i);continue}try{let l=await n.toolRuntime.executeToolCall(i);k(o,i.name,l,e),r.push({toolCallId:i.id,name:i.name,content:l})}catch(l){let c=String(l);k(o,i.name,c,e,!0),r.push({toolCallId:i.id,name:i.name,content:c,isError:!0})}}return{toolResults:r,clientToolCalls:s}}var Q=class{#t;constructor(t){this.#t=t}listTools(t){return Nt(t).map(Ie)}async callTool(t,e,o){let r=Nt(o).find(i=>i.name===t);if(!r)throw new w(-32602,`Unknown tool: ${t}`);if($e(o,r),typeof e.question!="string"||!e.question.trim())throw"question is required";let s=Ae(r)?ve(o.token):null;if(s){let i=typeof e.conversationId=="string"&&e.conversationId?e.conversationId:null;return await this.#t.askExpertConversation(o.request,e.question,s,i)}return await this.#t.askExpert(o.request,e.question)}};function Nt(n){return n?.yaml?.mcp?.tools??[]}function Ie(n){return{name:n.name,...n.title===void 0?{}:{title:n.title},description:n.description,inputSchema:n.inputSchema,...n.outputSchema===void 0?{}:{outputSchema:n.outputSchema},...n.annotations===void 0?{}:{annotations:n.annotations}}}function $e(n,t){let e=t.capability;if(!e)throw`Tool '${t.name}' declares no capability`;if(!Rt({token:n.token,providerSource:n.source,toolName:t.name,capability:e,providerYaml:n.yaml}))throw`Missing capability: ${e}`}function Me(n){let{system:{party:t,source:e,protocol:o,sourcePrefix:r},content:{yaml:s}}=m.getConfig();return{party:t,source:e,protocol:o,sourcePrefix:r,yaml:s,token:Je(n),request:n}}function Je(n){return d.from(n)}function Ue(n){for(let t=n.length-1;t>=0;t--){let e=n[t];if(e.role==="assistant"&&!e.error)return e.content}return null}function Le(n){if(!n.length)return`
|
|
32
32
|
|
|
33
33
|
Available semantic memories:
|
|
34
|
-
None discovered.`;let t=["","","Available semantic memories:","Use
|
|
34
|
+
None discovered.`;let t=["","","Available semantic memories:","Use index_search with the exact root and collection when these memories are relevant.","Search results are chunks: pass a result's key to index_resolve to read the complete source document before quoting from it."];for(let e of n){let o=b(e.root),r=b(e.collection);if(!o||!r)continue;t.push(`- root: ${o}`),t.push(` collection: ${r}`);let s=b(e.description);s&&t.push(` description: ${s}`);let i=_(e.schema),a=$t(i?.textProperties);a.length&&t.push(` textProperties: ${a.join(", ")}`);let l=_(i?.propertyTypes);l&&t.push(` propertyTypes: ${JSON.stringify(l)}`),t.push(` query with: index_search({ root: ${JSON.stringify(o)}, collection: ${JSON.stringify(r)}, text: "<search text>", limit: 5 }) \u2014 then index_resolve({ root, collection, key }) for a full document`)}return t.join(`
|
|
35
35
|
`)}function je(n){if(!n.length)return`
|
|
36
36
|
|
|
37
37
|
Available structured memories:
|