chore: updating with latest SDK
This commit is contained in:
parent
ba282517d4
commit
8b1a616332
|
|
@ -15,7 +15,7 @@
|
|||
"deploy:staging": "wrangler deploy --env staging"
|
||||
},
|
||||
"dependencies": {
|
||||
"@honcho-ai/sdk": "^2.0.0",
|
||||
"@honcho-ai/sdk": "^2.1.0",
|
||||
"@modelcontextprotocol/sdk": "^1.26.0",
|
||||
"agents": "^0.4.0",
|
||||
"nanoid": "^5.1.7",
|
||||
|
|
|
|||
|
|
@ -35,9 +35,7 @@ export function parseConfig(request: Request): HonchoConfig {
|
|||
return {
|
||||
apiKey,
|
||||
userName,
|
||||
baseUrl:
|
||||
request.headers.get("X-Honcho-Base-URL")?.trim() ||
|
||||
"https://api.honcho.dev",
|
||||
baseUrl: "https://api.honcho.dev",
|
||||
workspaceId: request.headers.get("X-Honcho-Workspace-ID")?.trim() || "default",
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import { createServer } from "./server.js";
|
|||
const CORS_ORIGIN = "*";
|
||||
const CORS_METHODS = "GET, POST, DELETE, OPTIONS";
|
||||
const CORS_ALLOWED_HEADERS =
|
||||
"Content-Type, Authorization, X-Honcho-User-Name, X-Honcho-Base-URL, X-Honcho-Workspace-ID, X-Honcho-Assistant-Name";
|
||||
"Content-Type, Authorization, X-Honcho-User-Name, X-Honcho-Workspace-ID";
|
||||
|
||||
const CORS_HEADERS = {
|
||||
"Access-Control-Allow-Origin": CORS_ORIGIN,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
import { z } from "zod";
|
||||
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
||||
import { Message } from "@honcho-ai/sdk";
|
||||
import type { ToolContext } from "../types.js";
|
||||
import {
|
||||
textResult,
|
||||
|
|
@ -26,7 +25,7 @@ export function register(server: McpServer, ctx: ToolContext) {
|
|||
},
|
||||
async ({ session_id }) => {
|
||||
try {
|
||||
const session = await ctx.honcho.session(session_id, { metadata: {} });
|
||||
const session = await ctx.honcho.session(session_id);
|
||||
return textResult({ session_id: session.id });
|
||||
} catch (e) {
|
||||
return errorResult(
|
||||
|
|
@ -367,21 +366,8 @@ export function register(server: McpServer, ctx: ToolContext) {
|
|||
},
|
||||
async ({ session_id, message_id }) => {
|
||||
try {
|
||||
// Workaround: the current @honcho-ai/sdk Session API does not expose
|
||||
// a single-message getter, so we fetch the message by ID via raw HTTP.
|
||||
const messageData = await ctx.honcho.http.get<{
|
||||
id: string;
|
||||
content: string;
|
||||
peer_id: string;
|
||||
session_id: string;
|
||||
workspace_id: string;
|
||||
metadata: Record<string, unknown>;
|
||||
created_at: string;
|
||||
token_count: number;
|
||||
}>(
|
||||
`/v3/workspaces/${ctx.honcho.workspaceId}/sessions/${session_id}/messages/${message_id}`,
|
||||
);
|
||||
const message = Message.fromApiResponse(messageData);
|
||||
const session = await ctx.honcho.session(session_id);
|
||||
const message = await session.getMessage(message_id);
|
||||
return textResult(formatMessage(message));
|
||||
} catch (e) {
|
||||
return errorResult(
|
||||
|
|
|
|||
Loading…
Reference in New Issue