chore: cr updates

This commit is contained in:
ajspig 2026-03-12 16:42:26 -04:00
parent 1bc9da865b
commit 2c48147775
4 changed files with 13 additions and 6 deletions

View File

@ -49,7 +49,7 @@ A Cloudflare Worker that implements the [Model Context Protocol (MCP)](https://m
### General Tools
**Workspace:** `search_workspace`, `get_workspace_metadata`, `set_workspace_metadata`
**Workspace:** `inspect_workspace` (aggregates metadata, configuration, and peer/session IDs), `list_workspaces` (enumerates accessible workspaces), `search_workspace`, `get_workspace_metadata`, `set_workspace_metadata`
**Peers:** `create_peer`, `list_peers`, `chat`, `get_peer_card`, `set_peer_card`, `get_peer_context`, `get_representation`, `get_peer_metadata`, `set_peer_metadata`, `search_peer_messages`

View File

@ -53,6 +53,8 @@ Beyond the bespoke flow, Honcho exposes the full API for advanced use cases.
| Tool | When to use |
| --- | --- |
| `inspect_workspace` | Inspect a single workspace's details |
| `list_workspaces` | Enumerate available workspaces |
| `search_workspace` | Find messages across all sessions and peers |
| `get_workspace_metadata` | Read workspace-level settings |
| `set_workspace_metadata` | Store workspace-level settings |
@ -81,10 +83,12 @@ Beyond the bespoke flow, Honcho exposes the full API for advanced use cases.
| `clone_session` | Fork a conversation (optionally up to a specific message) |
| `add_peers_to_session` / `remove_peers_from_session` | Manage session participants |
| `get_session_peers` | See who is in a session |
| `inspect_session` | Inspect detailed session structure/metadata |
| `add_messages_to_session` | Add messages from specific peers |
| `get_session_messages` | Read conversation history |
| `search_session_messages` | Semantic search within a session |
| `get_session_context` | Get LLM-ready context (messages + summary) |
| `get_session_summaries` | Retrieve session summaries (for overview/search) |
| `get_session_representation` | Get a peer's session-scoped representation |
| `get_session_metadata` / `set_session_metadata` | Custom attributes on a session |

View File

@ -14,17 +14,19 @@ export interface HonchoConfig {
*/
export function parseConfig(request: Request): HonchoConfig {
const authHeader = request.headers.get("Authorization");
if (!authHeader?.startsWith("Bearer ")) {
const trimmedAuthHeader = authHeader?.trim();
if (!trimmedAuthHeader?.startsWith("Bearer ")) {
throw new Error(
"Missing Authorization header. Provide 'Authorization: Bearer <your-honcho-key>'.",
);
}
const apiKey = authHeader.substring(7);
const apiKey = trimmedAuthHeader.substring(7).trim();
if (!apiKey) {
throw new Error("Authorization header is empty after 'Bearer '.");
}
const userName = request.headers.get("X-Honcho-User-Name");
const rawUserName = request.headers.get("X-Honcho-User-Name");
const userName = rawUserName?.trim();
if (!userName) {
throw new Error(
"Missing X-Honcho-User-Name header. Provide 'X-Honcho-User-Name: <your-name>'.",
@ -35,7 +37,8 @@ export function parseConfig(request: Request): HonchoConfig {
apiKey,
userName,
baseUrl:
request.headers.get("X-Honcho-Base-URL") || "https://api.honcho.dev",
request.headers.get("X-Honcho-Base-URL")?.trim() ||
"https://api.honcho.dev",
workspaceId: request.headers.get("X-Honcho-Workspace-ID") || "default",
assistantName:
request.headers.get("X-Honcho-Assistant-Name") || "Assistant",

View File

@ -46,7 +46,7 @@ export default {
headers: CORS_ALLOWED_HEADERS,
},
});
return handler(request, env, executionCtx);
return await handler(request, env, executionCtx);
} catch (e) {
const message =
e instanceof Error ? e.message : "Internal server error";