chore: minor nits

This commit is contained in:
ajspig 2026-08-05 15:43:21 -04:00
parent 8a116c2439
commit a2db216ce2
3 changed files with 35 additions and 21 deletions

View File

@ -5,7 +5,7 @@
"": {
"name": "honcho-mcp-proxy",
"dependencies": {
"@honcho-ai/sdk": "^2.1.0",
"@honcho-ai/sdk": "^2.2.0",
"@modelcontextprotocol/sdk": "^1.26.0",
"agents": "^0.4.0",
"nanoid": "^5.1.7",

View File

@ -15,7 +15,7 @@
"deploy:staging": "wrangler deploy --env staging"
},
"dependencies": {
"@honcho-ai/sdk": "^2.1.0",
"@honcho-ai/sdk": "^2.2.0",
"@modelcontextprotocol/sdk": "^1.26.0",
"agents": "^0.4.0",
"nanoid": "^5.1.7",

View File

@ -129,26 +129,40 @@ export function register(server: McpServer, ctx: ToolContext) {
filters: message_filters,
limit: message_limit,
};
const searchMessages = async () => {
if (session_id) {
const session = await ctx.honcho.session(session_id);
return session.search(query, messageOptions);
}
if (peer) {
return peer.search(query, messageOptions);
}
return ctx.honcho.search(query, messageOptions);
};
// Conclusion search needs an (observer, observed) pair, so it only
// runs when peer_id is given.
const searchConclusions = async () => {
if (!peer) {
return [];
}
try {
return await peer.conclusions.query(
query,
conclusion_top_k,
undefined,
conclusion_filters,
);
} catch (e) {
if (conclusion_filters) throw e;
return [];
}
};
const [messages, conclusions] = await Promise.all([
session_id
? ctx.honcho
.session(session_id)
.then((session) => session.search(query, messageOptions))
: peer
? peer.search(query, messageOptions)
: ctx.honcho.search(query, messageOptions),
// Conclusion search needs an (observer, observed) pair, so it only
// runs when peer_id is given. Errors degrade to [] so message search
// still works, except when the caller passed filters: a bad filter
// must fail loudly, not look like zero matches.
peer
? peer.conclusions
.query(query, conclusion_top_k, undefined, conclusion_filters)
.catch((e) => {
if (conclusion_filters) throw e;
return [];
})
: [],
searchMessages(),
searchConclusions(),
]);
return textResult({
messages: formatMessages(messages),