fix: allow null parentAgentId in agent schemas and projections
This commit is contained in:
@@ -106,7 +106,7 @@ export interface Agent {
|
||||
requiresAttention?: boolean;
|
||||
attentionReason?: "finished" | "error" | "permission" | null;
|
||||
attentionTimestamp?: Date | null;
|
||||
parentAgentId?: string;
|
||||
parentAgentId?: string | null;
|
||||
}
|
||||
|
||||
export interface Command {
|
||||
|
||||
@@ -12,5 +12,5 @@ export interface AgentDirectoryEntry {
|
||||
requiresAttention?: boolean;
|
||||
attentionReason?: "finished" | "error" | "permission" | null;
|
||||
attentionTimestamp?: Date | null;
|
||||
parentAgentId?: string;
|
||||
parentAgentId?: string | null;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
|
||||
import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";
|
||||
import { z } from "zod";
|
||||
|
||||
async function main() {
|
||||
// The basic auth header
|
||||
const basicAuth = `Basic ${Buffer.from("mo:bo").toString("base64")}`;
|
||||
|
||||
const transport = new StdioClientTransport({
|
||||
command: "codex",
|
||||
args: ["mcp-server"],
|
||||
env: {
|
||||
...process.env,
|
||||
},
|
||||
});
|
||||
|
||||
const client = new Client(
|
||||
{ name: "test-client", version: "1.0.0" },
|
||||
{ capabilities: { elicitation: {} } }
|
||||
);
|
||||
|
||||
// Listen for events
|
||||
client.setNotificationHandler(
|
||||
z.object({
|
||||
method: z.literal("codex/event"),
|
||||
params: z.object({ msg: z.any() }),
|
||||
}).passthrough(),
|
||||
(data) => {
|
||||
const event = (data.params as { msg: unknown }).msg as { type?: string };
|
||||
if (event.type === "mcp_startup_update" || event.type === "mcp_startup_complete") {
|
||||
console.log("MCP Event:", JSON.stringify(event, null, 2));
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
await client.connect(transport);
|
||||
|
||||
// Test using http_headers with Authorization
|
||||
console.log("\n=== Testing HTTP MCP server with http_headers and Authorization ===\n");
|
||||
|
||||
try {
|
||||
const result = await client.callTool({
|
||||
name: "codex",
|
||||
arguments: {
|
||||
prompt: "List all the MCP tools you have available. Just list them, don't use any.",
|
||||
sandbox: "danger-full-access",
|
||||
"approval-policy": "never",
|
||||
config: {
|
||||
mcp_servers: {
|
||||
"agent-control": {
|
||||
url: "http://localhost:6767/mcp/agents",
|
||||
http_headers: {
|
||||
Authorization: basicAuth
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}, undefined, { timeout: 60000 });
|
||||
|
||||
console.log("\n=== RESULT ===");
|
||||
const content = (result as { content: { text?: string }[] }).content;
|
||||
for (const item of content) {
|
||||
if (item.text) {
|
||||
console.log(item.text);
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Error:", error);
|
||||
}
|
||||
|
||||
await client.close();
|
||||
}
|
||||
|
||||
main().catch(console.error);
|
||||
@@ -0,0 +1,27 @@
|
||||
// Quick script to verify buildCodexMcpConfig includes MCP servers
|
||||
|
||||
import { buildPaseoDaemonConfigFromEnv } from "../src/server/config.js";
|
||||
|
||||
const config = buildPaseoDaemonConfigFromEnv();
|
||||
|
||||
console.log("=== agentControlMcp config ===");
|
||||
console.log(JSON.stringify(config.agentControlMcp, null, 2));
|
||||
|
||||
// Simulate what buildCodexMcpConfig does
|
||||
const mcpServers: Record<string, unknown> = {};
|
||||
|
||||
if (config.agentControlMcp) {
|
||||
const agentControlUrl = config.agentControlMcp.url;
|
||||
mcpServers["agent-control"] = {
|
||||
url: agentControlUrl,
|
||||
...(config.agentControlMcp.headers ? { http_headers: config.agentControlMcp.headers } : {}),
|
||||
};
|
||||
}
|
||||
|
||||
mcpServers["playwright"] = {
|
||||
command: "npx",
|
||||
args: ["@playwright/mcp", "--headless", "--isolated"],
|
||||
};
|
||||
|
||||
console.log("\n=== Built MCP servers config ===");
|
||||
console.log(JSON.stringify(mcpServers, null, 2));
|
||||
@@ -84,7 +84,7 @@ export function toAgentPayload(
|
||||
pendingPermissions: sanitizePendingPermissions(agent.pendingPermissions),
|
||||
persistence: sanitizePersistenceHandle(agent.persistence),
|
||||
title: options?.title ?? null,
|
||||
parentAgentId: agent.parentAgentId,
|
||||
parentAgentId: agent.parentAgentId ?? null,
|
||||
};
|
||||
|
||||
const usage = sanitizeUsage(agent.lastUsage);
|
||||
|
||||
@@ -251,7 +251,7 @@ export const AgentSnapshotPayloadSchema = z.object({
|
||||
requiresAttention: z.boolean().optional(),
|
||||
attentionReason: z.enum(["finished", "error", "permission"]).nullable().optional(),
|
||||
attentionTimestamp: z.string().nullable().optional(),
|
||||
parentAgentId: z.string().optional(),
|
||||
parentAgentId: z.string().nullable().optional(),
|
||||
});
|
||||
|
||||
export type AgentSnapshotPayload = z.infer<typeof AgentSnapshotPayloadSchema>;
|
||||
|
||||
Reference in New Issue
Block a user