Skip to content
Merged
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
2 changes: 1 addition & 1 deletion src/renderer/components/thread/ThreadGoalDock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ function GoalObjectiveText({
return (
<div className="min-w-0 flex-1">
<Tooltip delay={0}>
<Tooltip.Trigger>{text}</Tooltip.Trigger>
<Tooltip.Trigger className="block w-full min-w-0 overflow-hidden">{text}</Tooltip.Trigger>
<Tooltip.Content className="max-w-[32rem] whitespace-normal break-words">
<span className="block">{objective}</span>
{lastReason ? (
Expand Down
2 changes: 2 additions & 0 deletions src/supervisor/agents/acp/canonicalMapping.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ describe("mapAcpSessionUpdate", () => {
action: "set",
objective: "Ship ACP goal support",
status: "active",
availableActions: ["pause", "clear"],
timeUsedSeconds: 0,
updatedAt: 1_784_627_753.997,
},
Expand All @@ -51,6 +52,7 @@ describe("mapAcpSessionUpdate", () => {
action: "set",
objective: "Ship ACP goal support",
status: "active",
availableActions: ["pause", "clear"],
}),
}),
expect.objectContaining({ type: "item.completed" }),
Expand Down
7 changes: 7 additions & 0 deletions src/supervisor/agents/acp/canonicalMapping/dispatch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,13 @@ export function mapAcpSessionUpdate(
}

case "agent_thought_chunk": {
const thoughtMeta =
update._meta && typeof update._meta === "object" && !Array.isArray(update._meta)
? (update._meta as Record<string, unknown>)
: undefined;
if (thoughtMeta?.[PORACODE_ACP_NEW_ASSISTANT_ITEM_META_KEY] === true) {
events.push(...closeOpenContentItems(state));
}
if (!state.openReasoningItemId) {
// Close any prior assistant — reasoning bracket starts.
if (state.openAssistantItemId) {
Expand Down
9 changes: 8 additions & 1 deletion src/supervisor/agents/acp/canonicalMapping/goals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@
* shape before the shared canonical mapper sees it.
*/

import type { GoalItemPayload, RuntimeEvent } from "@/shared/contracts";
import {
goalControlActionSchema,
type GoalItemPayload,
type RuntimeEvent,
} from "@/shared/contracts";
import { startGoalItemEvents, updateGoalItemEvents } from "../../goalRuntime";
import type { AcpMapperState } from "./state";
import { newItemId } from "./state";
Expand Down Expand Up @@ -48,6 +52,8 @@ function readAcpCanonicalGoalUpdate(update: unknown): AcpCanonicalGoalUpdate | u
"cancelled",
] as const);
const objective = readString(raw.objective);
const availableActionsResult = goalControlActionSchema.array().safeParse(raw.availableActions);
const availableActions = availableActionsResult.success ? availableActionsResult.data : undefined;
if (!action && !status && !objective) return undefined;

return {
Expand All @@ -70,6 +76,7 @@ function readAcpCanonicalGoalUpdate(update: unknown): AcpCanonicalGoalUpdate | u
...(readString(raw.providerThreadId)
? { providerThreadId: readString(raw.providerThreadId)! }
: {}),
...(availableActions ? { availableActions } : {}),
...(readFiniteNumber(raw.updatedAt) !== undefined
? { updatedAt: readFiniteNumber(raw.updatedAt)! }
: {}),
Expand Down
2 changes: 2 additions & 0 deletions src/supervisor/agents/base/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,8 @@ export interface AgentAcpAuth {
export interface AgentPromptFormatter {
shouldDeferPromptToTerminal?(config: ThreadConfig): boolean;
buildTerminalPreInputs?(config: ThreadConfig): string[][] | undefined;
/** Translate a canonical goal control into the provider's native prompt command. */
buildGoalControlPrompt?(control: ThreadGoalControl): string | undefined;
buildDirectInput?(
prompt: string,
segments?: PromptSegment[],
Expand Down
Loading