Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,13 @@ caipe skills list
caipe skills install <name>
```

Agent listings, the interactive picker, and the chat footer show the selected
execution harness (LangChain Deep Agents, AgentCore, Claude Agent SDK, or a
custom harness). Harness Engine streams are detached from the CLI connection:
if SSE disconnects, the CLI resumes the existing run from its last event ID
without submitting the prompt or repeating provider/tool execution. Older
CAIPE servers remain supported and default to LangChain Deep Agents metadata.

### Headless / CI

```bash
Expand Down
10 changes: 9 additions & 1 deletion src/agents/AgentPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import type React from "react";
import { PICKER_HINT_NAV } from "../chat/shortcuts.js";
import { isRichTerminalEnabled } from "../platform/terminal/capabilities.js";
import { pickerWindow, truncateText } from "./picker.js";
import type { Agent } from "./types.js";
import { type Agent, harnessDisplayName } from "./types.js";

const DESC_SELECTED_MAX = 240;
const ROW_SEPARATOR = " ────────────────────────────────────────────────────────";
Expand Down Expand Up @@ -114,6 +114,13 @@ export function AgentPicker({
{" · in session"}
</Text>
) : null}
<Text
backgroundColor={rowBg}
color={selected ? (rich ? "white" : "cyan") : undefined}
dimColor={!selected}
>
{` · ${harnessDisplayName(agent)}`}
</Text>
</Box>
{selected && descLine ? (
<>
Expand Down Expand Up @@ -152,6 +159,7 @@ export function AgentPicker({
<Text bold color="white">
{selectedAgent ? agentTitle(selectedAgent) : ""}
</Text>
<Text dimColor>{selectedAgent ? ` · ${harnessDisplayName(selectedAgent)}` : ""}</Text>
<Text dimColor>{` · Enter switch · ${agents.length} total · or /agents <id>`}</Text>
</Box>
</Box>
Expand Down
12 changes: 8 additions & 4 deletions src/agents/List.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import { Box, Text } from "ink";
import type React from "react";
import { statusDot } from "../platform/display.js";
import type { Agent } from "./types.js";
import { type Agent, harnessDisplayName } from "./types.js";

interface AgentListProps {
agents: Agent[];
Expand All @@ -31,21 +31,25 @@ export function AgentList({ agents }: AgentListProps): React.ReactElement {
{"Domain".padEnd(14)}
</Text>
<Text bold color="cyan">
{"Protocols".padEnd(16)}
{"Harness".padEnd(28)}
</Text>
<Text bold color="cyan">
{"Protocols".padEnd(12)}
</Text>
<Text bold color="cyan">
Status
</Text>
</Box>
<Box>
<Text dimColor>{"─".repeat(60)}</Text>
<Text dimColor>{"─".repeat(90)}</Text>
</Box>

{agents.map((agent) => (
<Box key={agent.name}>
<Text>{agent.name.padEnd(20)}</Text>
<Text dimColor>{agent.domain.padEnd(14)}</Text>
<Text dimColor>{(agent.protocols ?? ["agui"]).join(", ").padEnd(16)}</Text>
<Text dimColor>{harnessDisplayName(agent).padEnd(28)}</Text>
<Text dimColor>{(agent.protocols ?? ["agui"]).join(", ").padEnd(12)}</Text>
<Text>{statusDot(agent.available)}</Text>
<Text dimColor> {agent.displayName}</Text>
</Box>
Expand Down
8 changes: 7 additions & 1 deletion src/agents/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { getValidToken } from "../auth/tokens.js";
import { getAuthUrl, getServerUrl } from "../platform/config.js";
import { AgentList } from "./List.js";
import { fetchAgents, getAgent } from "./registry.js";
import { harnessDisplayName, normalizeHarnessId } from "./types.js";

interface GlobalOpts {
url?: string;
Expand All @@ -31,6 +32,8 @@ export async function runAgentsList(
name: a.name,
displayName: a.displayName,
domain: a.domain,
harnessId: normalizeHarnessId(a.harnessId),
harnessName: harnessDisplayName(a),
protocols: a.protocols,
available: a.available,
})),
Expand All @@ -45,7 +48,7 @@ export async function runAgentsList(
for (const a of agents) {
const dot = a.available ? "✓" : "✗";
process.stdout.write(
`${dot} ${a.name.padEnd(20)} ${a.domain.padEnd(12)} ${(a.protocols ?? ["agui"]).join(",")}\n`,
`${dot} ${a.name.padEnd(20)} ${a.domain.padEnd(12)} ${harnessDisplayName(a).padEnd(28)} ${(a.protocols ?? ["agui"]).join(",")}\n`,
);
}
return;
Expand All @@ -68,6 +71,9 @@ export async function runAgentsInfo(name: string, globalOpts: GlobalOpts): Promi
process.stdout.write(`\nAgent: ${agent.displayName}\n`);
process.stdout.write(` Name: ${agent.name}\n`);
process.stdout.write(` Domain: ${agent.domain}\n`);
process.stdout.write(
` Harness: ${harnessDisplayName(agent)} (${normalizeHarnessId(agent.harnessId)})\n`,
);
process.stdout.write(` Protocols: ${(agent.protocols ?? ["agui"]).join(", ")}\n`);
process.stdout.write(` Available: ${agent.available ? "yes" : "no"}\n`);
process.stdout.write(` Endpoint: ${agent.endpoint}\n`);
Expand Down
5 changes: 4 additions & 1 deletion src/agents/picker.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { pickerWindow } from "../chat/picker-nav.js";
import type { Agent } from "./types.js";
import { harnessDisplayName, normalizeHarnessId } from "./types.js";

export { pickerWindow };

Expand All @@ -10,7 +11,9 @@ export function filterAgents(agents: Agent[], query: string): Agent[] {
(a) =>
a.name.toLowerCase().includes(q) ||
a.displayName.toLowerCase().includes(q) ||
a.description.toLowerCase().includes(q),
a.description.toLowerCase().includes(q) ||
normalizeHarnessId(a.harnessId).includes(q) ||
harnessDisplayName(a).toLowerCase().includes(q),
);
}

Expand Down
4 changes: 4 additions & 0 deletions src/agents/registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ interface AgentPickerEntry {
id: string;
name: string;
description: string;
harness_id?: string;
harness_name?: string;
}

interface AgentPickerResponse {
Expand Down Expand Up @@ -74,6 +76,8 @@ export async function fetchAgents(
protocols: ["agui"],
available: true,
domain: "general",
harnessId: e.harness_id,
harnessName: e.harness_name,
}));
writeCache(serverUrl, agents);
return agents;
Expand Down
34 changes: 34 additions & 0 deletions src/agents/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,38 @@ export interface Agent {
protocols: "agui"[];
available: boolean;
domain: string;
/** Execution runtime selected by the agent blueprint. Absent on older CAIPE servers. */
harnessId?: string;
/** Human-readable runtime name supplied by the server. */
harnessName?: string;
}

export function normalizeHarnessId(value?: string): string {
const normalized = value?.trim().toLowerCase();
if (
!normalized ||
normalized === "dynamic_agents" ||
normalized === "langchain-deepagents" ||
normalized === "langchain_deepagents"
) {
return "dynamic_agents";
}
return normalized;
}

export function harnessDisplayName(agent: Pick<Agent, "harnessId" | "harnessName">): string {
const explicit = agent.harnessName?.trim();
if (explicit) return explicit;
switch (normalizeHarnessId(agent.harnessId)) {
case "dynamic_agents":
return "LangChain Deep Agents";
case "agentcore":
return "Amazon Bedrock AgentCore";
case "claude_agent_sdk":
return "Claude Agent SDK";
default:
return normalizeHarnessId(agent.harnessId);
}
}

export const DEFAULT_AGENT: Agent = {
Expand All @@ -20,4 +52,6 @@ export const DEFAULT_AGENT: Agent = {
protocols: ["agui"],
available: true,
domain: "general",
harnessId: "dynamic_agents",
harnessName: "LangChain Deep Agents",
};
6 changes: 5 additions & 1 deletion src/chat/Repl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { AgentPicker } from "../agents/AgentPicker.js";
import { filterAgents, sortAgentsForPicker } from "../agents/picker.js";
import { fetchAgents, getAgent } from "../agents/registry.js";
import type { Agent } from "../agents/types.js";
import { harnessDisplayName } from "../agents/types.js";
import { loginBrowser } from "../auth/oauth.js";
import { getValidToken } from "../auth/tokens.js";
import {
Expand Down Expand Up @@ -1035,7 +1036,9 @@ export function Repl({
adapterRef.current = createAdapter(target, ep.streamStart, () => getValidToken(authUrl2));
conversationIdRef.current = undefined;
setCurrentAgent(target);
pushAssistantPlain(`Switched to agent ${target.displayName ?? target.name}.`);
pushAssistantPlain(
`Switched to agent ${target.displayName ?? target.name} · ${harnessDisplayName(target)}.`,
);
},
[serverUrl, pushAssistantPlain],
);
Expand Down Expand Up @@ -1919,6 +1922,7 @@ export function Repl({
{currentAgent.name !== "hello-world" && currentAgent.name !== "default"
? `${currentAgent.name} · `
: ""}
{`${harnessDisplayName(currentAgent)} · `}
{totalTokenDisplay > 0 ? `~${totalTokenDisplay} tokens · ` : ""}
{serverHost ?? ""}
</Text>
Expand Down
Loading