The Open Framework for Building Agents
feat(eve): refresh the Slack status on each step and show readable tool names (#4097)
Andrew Barba001cc00c367d
diff --git a/.changeset/humanize-tool-labels.md b/.changeset/humanize-tool-labels.mdnew file mode 100644index 000000000..dbd0becfd--- /dev/null+++ b/.changeset/humanize-tool-labels.md@@ -0,0 +1,5 @@+---+"eve": patch+---++Tool, agent, and connection names now read as plain words in activity labels, approval prompts, and the Slack status and task card. An extension or memory namespace before `__` is dropped, and `sync_accounts` or `syncAccounts` shows as `Sync accounts`. A connection call shows as `Linear: List issues`, and its approval asks `Approve Linear: List issues?` instead of naming `connection_execute`. Agent calls read as `Researcher: Find the March incidents`. Labels set with `label.start` are unchanged.diff --git a/.changeset/slack-reviewing-results-status.md b/.changeset/slack-reviewing-results-status.mdnew file mode 100644index 000000000..53547a2c8--- /dev/null+++ b/.changeset/slack-reviewing-results-status.md@@ -0,0 +1,5 @@+---+"eve": patch+---++Channels can now handle `step.started`, which fires before each model call in a turn. The default Slack channel uses it to replace a stale thread status when the model starts another step. The status shows `Reviewing results...` after a task finishes and `Thinking...` after a tool call. Before, `Waiting on 3 tasks...` or a finished tool's label lingered until the model streamed its next output.diff --git a/docs/channels/slack.mdx b/docs/channels/slack.mdxindex b6d6a6b1c..c21f6ade2 100644--- a/docs/channels/slack.mdx+++ b/docs/channels/slack.mdx@@ -462,6 +462,7 @@ eve shows an agent's progress in two places. Short work, such as thinking or a t| The model reasons | The first line of its reasoning || The model calls tools | Its narration before the calls, or an action label such as `Search useEveAgent` || The turn waits on its tasks | `Waiting on researcher...`, or `Waiting on 3 tasks...` |+| The model starts its next step | `Reviewing results...` after a task finishes, otherwise `Thinking...` || A reply posts | Cleared by Slack |Slack clears a thread status after two minutes without a message, so during a long wait the task card is what shows the work is still going.@@ -480,7 +481,7 @@ When a turn starts its first task, eve posts a task card in the thread and keepsEach row shows:-- **Title:** the tool's [`label.start`](/docs/tools#label-tool-activity), or the tool name. An agent task shows the agent name and the first sentence of its brief (`researcher: Find the incidents behind the checkout spike`). A task the agent hands to its own copy shows the brief alone.+- **Title:** the tool's [`label.start`](/docs/tools#label-tool-activity), or a readable form of the tool name. eve drops the extension or memory namespace before `__` and splits the rest into words, so `crm__sync_accounts` and `syncAccounts` both show as `Sync accounts`. A connection call shows the connection and its tool, as in `Linear: List issues`. An agent task shows the agent name and the first sentence of its brief (`Researcher: Find the incidents behind the checkout spike`). A task the agent hands to its own copy shows the brief alone. eve can't infer brand casing from a name, so `github` shows as `Github`; set `label.start` when the exact wording matters.- **Waiting:** while the task waits on an approval, an answer, or a sign-in, the row says so, as in `Waiting for approval`. In a DM or private channel it also shows the request's prompt; elsewhere it shows only what kind of request is waiting, since `approvalChannel` can send the request to one person. The request itself posts wherever `approvalChannel` sends it, and the row goes back to working once the request resolves.- **How it ended:** the first sentence of the result or the agent's reply, cut to about 100 characters, `Failed` for a failure, or a line for a cancelled task that says why it stopped. A task the model cancelled with `task_cancel` shows `Stopped early since it was no longer needed` with a success check, since the model no longer needed that work. A task stopped by [cancelling the turn](#message-hooks) shows `Stopped by request`, one stopped because its turn ended shows `Stopped when the turn ended`, and one whose run stopped on its own shows `Stopped`. Those rows and failed rows never show a success check. In a DM or private channel, a failure also shows the first sentence of its error, as in `Failed: Rate limited`. Error text can carry internal details, so everywhere else, including proactive sessions without a known `audience`, shows `Failed` alone. A completed or failed task that ran for a second or more also shows how long it took: `Done in 1m 14s: Found three incidents.` or `Failed after 3m`.diff --git a/docs/tools/overview.mdx b/docs/tools/overview.mdxindex 68ed54d54..08a4882fe 100644--- a/docs/tools/overview.mdx+++ b/docs/tools/overview.mdx@@ -126,7 +126,7 @@ export default defineTool({});```-The label is presentation only. It does not replace the path-derived tool name, enter model input, or change execution. eve records the bounded label on the corresponding public action event so activity renderers and other authorized stream consumers can use it without interpreting raw tool data. Built-in channel activity can show `Deploy storefront to production` instead of `deploy`; if the callback throws or returns an empty label, activity falls back to the tool name.+The label is presentation only. It does not replace the path-derived tool name, enter model input, or change execution. eve records the bounded label on the corresponding public action event so activity renderers and other authorized stream consumers can use it without interpreting raw tool data. Built-in channel activity can show `Deploy storefront to production` instead of `Deploy`; if the callback throws or returns an empty label, activity falls back to a readable form of the tool name, such as `Sync accounts` for `sync_accounts`.Provided tools define labels for `bash`, `glob`, `grep`, `load_skill`, `read_file`, `web_fetch`, `web_search`, and `write_file`.diff --git a/packages/eve/extension-contracts/compatibility/channel/v42.ts b/packages/eve/extension-contracts/compatibility/channel/v42.tsnew file mode 100644index 000000000..41d205711--- /dev/null+++ b/packages/eve/extension-contracts/compatibility/channel/v42.ts@@ -0,0 +1,12 @@+import { defineChannel } from "#public/channels/index.js";++// Epoch 42 channels could observe a model step only once it finished; epoch 43+// adds an optional `step.started` handler. Channels without one see no change.+export default defineChannel({+ routes: [],+ events: {+ "step.completed"(event) {+ console.info("step completed", { finishReason: event.finishReason, turnId: event.turnId });+ },+ },+});diff --git a/packages/eve/extension-contracts/reports/channel/v43.json b/packages/eve/extension-contracts/reports/channel/v43.jsonnew file mode 100644index 000000000..14d7e50ad--- /dev/null+++ b/packages/eve/extension-contracts/reports/channel/v43.json@@ -0,0 +1,21 @@+{+ "kind": "eve-extension-capability-contract",+ "capability": "channel",+ "epoch": 43,+ "sha256": "46cae95024b5ddd5468042ec947243a3442530c5c2af578f66f7d3c580427c92",+ "exports": [+ "DELETE",+ "GET",+ "HEAD",+ "OPTIONS",+ "PATCH",+ "POST",+ "PUT",+ "WS",+ "createWebSocketUpgradeServer",+ "defineChannel",+ "disableRoute",+ "isChannel",+ "isDisabledRouteSentinel"+ ]+}diff --git a/packages/eve/src/channel/task-card.ts b/packages/eve/src/channel/task-card.tsindex 4a88b9f4f..b8eabdfc4 100644--- a/packages/eve/src/channel/task-card.ts+++ b/packages/eve/src/channel/task-card.ts@@ -3,6 +3,7 @@ import type { TaskCancelReason, UnstampedMessageStreamEvent } from "#protocol/meimport { actionRequestName } from "#shared/action-request-name.js";import type { RuntimeActionRequest } from "#shared/action-types.js";import type { ChannelAudience } from "#shared/channel-audience.js";+import { displayTitle } from "#shared/display-name.js";import type { JsonObject, JsonValue } from "#shared/json.js";import { firstSentence, normalizePresentationText } from "#shared/presentation-text.js";@@ -34,8 +35,8 @@ export interface TaskCardTask {/** The tool or agent name. */readonly name: string;/**- * The tool's start label, or the name. An agent's is `researcher: brief`,- * or the brief alone for a call to the agent's own copy.+ * The tool's start label, or the name's display title. An agent's is+ * `Researcher: brief`, or the brief alone for a call to the agent's own copy.*/readonly title: string;/** `blocked` while the task waits on a person; see {@link TaskCardTask.blockedOn}. */@@ -64,7 +65,7 @@ export interface TaskCardAction {readonly id: string;/** The tool name. */readonly name: string;- /** The tool's start label, or the name. */+ /** The tool's start label, or the name's display title. */readonly title: string;readonly status: TaskCardStatus;/** The call's input, when its JSON is at most 4,096 characters. */@@ -247,7 +248,7 @@ function trackTurnEvent(name,startedAt: at,status: "working",- title: name,+ title: displayTitle(name),};const started: TrackedCall = {callId: call.callId,@@ -347,7 +348,7 @@ function requestedCall(name,startedAt: at,status: "working",- title: presentationText(label) ?? name,+ title: presentationText(label) ?? displayTitle(name),};const input = boundedInput(action.input);if (input !== undefined) call.input = input;diff --git a/packages/eve/src/compiler/extension-compatibility.ts b/packages/eve/src/compiler/extension-compatibility.tsindex a00bf5a0a..efb5022d1 100644--- a/packages/eve/src/compiler/extension-compatibility.ts+++ b/packages/eve/src/compiler/extension-compatibility.ts@@ -114,9 +114,10 @@ const EXTENSION_CAPABILITY_CONTRACTS = {},},channel: {- current: 42,+ current: 43,supported: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 18, 29, 31, 36, 37, 38, 39, 40, 41, 42,+ 43,],dropped: {12: "Message and reasoning append events now expose deltas instead of cumulative snapshots.",diff --git a/packages/eve/src/execution/session/turn-connection-approval.integration.test.ts b/packages/eve/src/execution/session/turn-connection-approval.integration.test.tsindex e6aeef389..a6240b97b 100644--- a/packages/eve/src/execution/session/turn-connection-approval.integration.test.ts+++ b/packages/eve/src/execution/session/turn-connection-approval.integration.test.ts@@ -751,6 +751,14 @@ describe("turn connection approval restoration", () => {const request = getPendingInputBatches(readDurableSession(parked.sessionState).state)[0]!.requests[0]!;expect(request.action.toolName).toBe("connection_execute");+ expect(request.prompt).toBe("Approve Notes: Save note?");+ expect(+ fixture.events.flatMap((event) =>+ event.type === "actions.requested"+ ? Object.values(event.data.presentation ?? {}).map((entry) => entry.label)+ : [],+ ),+ ).toContain("Notes: Save note");expect(fixture.fetch).not.toHaveBeenCalled();if (cold) clearDurableDynamicCallbacks(sessionId);const candidate = await fixture.step({diff --git a/packages/eve/src/execution/tasks/task-id-input.test.ts b/packages/eve/src/execution/tasks/task-id-input.test.tsindex 37a24f8e0..b605df530 100644--- a/packages/eve/src/execution/tasks/task-id-input.test.ts+++ b/packages/eve/src/execution/tasks/task-id-input.test.ts@@ -27,9 +27,9 @@ describe("agent call label", () => {it.each([["names a subagent before the first sentence of its brief",- "researcher",+ "code__incident_researcher","Find the March incidents. Include timelines.\nThen rank them.",- "researcher: Find the March incidents.",+ "Incident researcher: Find the March incidents.",],["shows the brief alone for the agent's own copy",@@ -55,7 +55,7 @@ describe("agent call label", () => {"See PR No. 4035 for details. Then review it.","See PR No. 4035 for details.",],- ["falls back to the agent's name for an empty brief", "agent", " \n", "agent"],+ ["falls back to the agent's name for an empty brief", "agent", " \n", "Agent"],])("%s", (_name, tool, message, expected) => {expect(withTaskIdInput(agentTool(tool)).label?.start?.({ message })).toBe(expected);});diff --git a/packages/eve/src/execution/tasks/task-id-input.ts b/packages/eve/src/execution/tasks/task-id-input.tsindex 2639183fb..0ffa2d700 100644--- a/packages/eve/src/execution/tasks/task-id-input.ts+++ b/packages/eve/src/execution/tasks/task-id-input.ts@@ -5,6 +5,7 @@ import {} from "#execution/tasks/render.js";import { isAgentTool } from "#execution/tasks/tool-entry-point.js";import type { HarnessToolDefinition } from "#harness/execute-tool.js";+import { displayTitle } from "#shared/display-name.js";import type { JsonObject } from "#shared/json.js";import { firstSentence } from "#shared/presentation-text.js";import { AGENT_TOOL_NAME } from "#tools/framework/agent-contract.js";@@ -27,7 +28,7 @@ export function withTaskIdSchema(schema: ToolSchema): ToolSchema {/*** The tool as the model sees it: its input gains `taskId`, and its description* explains it. An agent tool also gets its activity label, the agent and the- * first sentence of its message: `researcher: Find the March incidents`.+ * first sentence of its message: `Researcher: Find the March incidents`.*/export function withTaskIdInput(definition: HarnessToolDefinition): HarnessToolDefinition {const schema = definition.inputSchema;@@ -51,7 +52,7 @@ export function withTaskIdInput(definition: HarnessToolDefinition): HarnessToolD}/**- * `researcher: Find the March incidents`, from the first sentence of the+ * `Researcher: Find the March incidents`, from the first sentence of the* message. A call to the agent's own copy shows the brief alone, since its* name, `agent`, says nothing. The agent's name when the message is empty.*/@@ -61,8 +62,8 @@ function agentCallLabel(name: string, input: unknown): string {? (input as { message?: unknown }).message: undefined;const brief = typeof message === "string" ? firstSentence(message) : undefined;- if (brief === undefined) return name;- return name === AGENT_TOOL_NAME ? brief : `${name}: ${brief}`;+ if (brief === undefined) return displayTitle(name);+ return name === AGENT_TOOL_NAME ? brief : `${displayTitle(name)}: ${brief}`;}/** A `serve` tool call's model input, split into the task it names and the tool's own input. */diff --git a/packages/eve/src/execution/tools/connection-target.ts b/packages/eve/src/execution/tools/connection-target.tsindex 12bffb5cc..aaadcdc45 100644--- a/packages/eve/src/execution/tools/connection-target.ts+++ b/packages/eve/src/execution/tools/connection-target.ts@@ -2,6 +2,7 @@import type { ConnectionRegistry } from "#runtime/connections/registry-types.js";import type { ResolvedConnectionDefinition } from "#runtime/types.js";+import { displayProperName, displayTitle } from "#shared/display-name.js";import { isObject } from "#shared/guards.js";import type { JsonObject } from "#shared/json.js";@@ -24,6 +25,16 @@ export function qualifiedToolName(target: Pick<ExecuteTarget, "connection" | "toreturn `${target.connection}__${target.tool}`;}+/**+ * How a tool call reads to a person: `Linear: List issues` for a+ * `connection_execute` call, otherwise the tool's display title.+ */+export function toolCallDisplayName(toolName: string, input: unknown): string {+ const target = toolName === CONNECTION_EXECUTE_TOOL_NAME ? readExecuteTarget(input) : undefined;+ if (target === undefined) return displayTitle(toolName);+ return `${displayProperName(target.connection)}: ${displayTitle(target.tool)}`;+}+export function findConnection(registry: ConnectionRegistry,name: string,diff --git a/packages/eve/src/execution/tools/connection-tools.ts b/packages/eve/src/execution/tools/connection-tools.tsindex cc2fa217b..81e886c2d 100644--- a/packages/eve/src/execution/tools/connection-tools.ts+++ b/packages/eve/src/execution/tools/connection-tools.ts@@ -36,6 +36,7 @@ import {supportsInteractiveAuthorization,type ConnectionToolMetadata,} from "#shared/connection-types.js";+import { displayProperName } from "#shared/display-name.js";import { toErrorMessage } from "#shared/errors.js";import { isObject } from "#shared/guards.js";import type { JsonObject } from "#shared/json.js";@@ -55,6 +56,7 @@ import {findConnection,qualifiedToolName,readExecuteTarget,+ toolCallDisplayName,} from "./connection-target.js";const log = createLogger("framework.connection-tools");@@ -159,6 +161,9 @@ export function resolveConnectionTools(): DynamicToolSet | null {description: CONNECTION_SEARCH_DESCRIPTION,inputSchema: CONNECTION_SEARCH_INPUT_SCHEMA,execute: defineDurableCallback({ callback: searchConnectionTools, closure: {} }),+ label: {+ start: defineDurableCallback({ callback: connectionSearchLabel, closure: {} }),+ },}),[CONNECTION_EXECUTE_TOOL_NAME]: defineTool({description: CONNECTION_EXECUTE_DESCRIPTION,@@ -177,8 +182,14 @@ export function resolveConnectionTools(): DynamicToolSet | null {}function connectionToolLabel(_closure: object, input: unknown): string {- const target = readExecuteTarget(input);- return target === undefined ? CONNECTION_EXECUTE_TOOL_NAME : qualifiedToolName(target);+ return toolCallDisplayName(CONNECTION_EXECUTE_TOOL_NAME, input);+}++function connectionSearchLabel(_closure: object, input: unknown): string {+ const connection = isObject(input) ? input.connection : undefined;+ return typeof connection === "string" && connection !== ""+ ? `Search ${displayProperName(connection)} tools`+ : "Search connected tools";}// ---------------------------------------------------------------------------diff --git a/packages/eve/src/harness/input-extraction.test.ts b/packages/eve/src/harness/input-extraction.test.tsindex fea08b96a..5d0b6ca79 100644--- a/packages/eve/src/harness/input-extraction.test.ts+++ b/packages/eve/src/harness/input-extraction.test.ts@@ -34,7 +34,7 @@ describe("extractToolApprovalInputRequests", () => {{ id: "approve", label: "Approve" },{ id: "cancel", label: "Cancel" },],- prompt: "Approve tool call: bash",+ prompt: "Approve Bash?",requestId: "approval-1",},]);@@ -72,7 +72,7 @@ describe("extractToolApprovalInputRequests", () => {{ id: "approve", label: "Approve" },{ id: "cancel", label: "Cancel" },],- prompt: "Approve tool call: bash",+ prompt: "Approve Bash?",requestId: "approval-1",},]);diff --git a/packages/eve/src/harness/input-extraction.ts b/packages/eve/src/harness/input-extraction.tsindex af959b52c..da7914b01 100644--- a/packages/eve/src/harness/input-extraction.ts+++ b/packages/eve/src/harness/input-extraction.ts@@ -1,6 +1,7 @@import type { ContentPart, ModelMessage, ToolSet } from "ai";import { z } from "#compiled/zod/index.js";+import { toolCallDisplayName } from "#execution/tools/connection-target.js";import type { InputRequest } from "#shared/input.js";import { createRuntimeToolCallActionFromToolCall } from "#harness/tool-call-action.js";@@ -99,7 +100,7 @@ function extractApprovalRequests(input: {{ id: "approve", label: "Approve" },{ id: "cancel", label: "Cancel" },],- prompt: `Approve tool call: ${toolCall.toolName}`,+ prompt: `Approve ${toolCallDisplayName(toolCall.toolName, toolCall.input)}?`,requestId: approval.approvalId,});}diff --git a/packages/eve/src/harness/stale-input-responses.test.ts b/packages/eve/src/harness/stale-input-responses.test.tsindex 101a1437b..946d16bb9 100644--- a/packages/eve/src/harness/stale-input-responses.test.ts+++ b/packages/eve/src/harness/stale-input-responses.test.ts@@ -63,7 +63,8 @@ it("converts a stale approval into a non-authorizing user message", () => {expect(result.displayMessage).toBe("Approve");expect(result.stepInput.inputResponses).toBeUndefined();- expect(result.stepInput.message).toEqual(expect.stringContaining("Approve tool call: bash"));+ expect(result.stepInput.message).toEqual(expect.stringContaining('"prompt": "Approve Bash?"'));+ expect(result.stepInput.message).toEqual(expect.stringContaining('"toolName": "bash"'));expect(result.stepInput.message).toEqual(expect.stringContaining('"label": "Approve"'));expect(result.stepInput.message).toEqual(expect.stringContaining("This does not authorize an earlier action"),diff --git a/packages/eve/src/harness/stale-input-responses.ts b/packages/eve/src/harness/stale-input-responses.tsindex 8169fdb57..c312bb51f 100644--- a/packages/eve/src/harness/stale-input-responses.ts+++ b/packages/eve/src/harness/stale-input-responses.ts@@ -161,10 +161,13 @@ function formatModelMessage(requestId: string;requestType?: "approval";response: typeof responseDetails;+ toolName?: string;} = { requestId: response.requestId, response: responseDetails };if (request !== undefined) {resolved.prompt = request.prompt;resolved.requestType = "approval";+ // The prompt is display text; the model needs the tool's real name.+ resolved.toolName = request.action.toolName;}return resolved;diff --git a/packages/eve/src/harness/tool-loop.test.ts b/packages/eve/src/harness/tool-loop.test.tsindex d24656a72..88da0f7e0 100644--- a/packages/eve/src/harness/tool-loop.test.ts+++ b/packages/eve/src/harness/tool-loop.test.ts@@ -3213,7 +3213,7 @@ describe("createToolLoopHarness", () => {{ id: "approve", label: "Approve" },{ id: "cancel", label: "Cancel" },],- prompt: "Approve tool call: bash",+ prompt: "Approve Bash?",requestId: "approval-1",},],@@ -7879,7 +7879,7 @@ describe("createToolLoopHarness", () => {{ id: "approve", label: "Approve" },{ id: "cancel", label: "Cancel" },],- prompt: "Approve tool call: bash",+ prompt: "Approve Bash?",requestId: "approval-1",},],diff --git a/packages/eve/src/public/channels/slack/action-status.ts b/packages/eve/src/public/channels/slack/action-status.tsindex 0a1c38936..b29c7707c 100644--- a/packages/eve/src/public/channels/slack/action-status.ts+++ b/packages/eve/src/public/channels/slack/action-status.ts@@ -6,11 +6,12 @@import type { ActionPresentationByCallId } from "#protocol/message.js";import { actionRequestName } from "#shared/action-request-name.js";import type { RuntimeActionRequest } from "#shared/action-types.js";+import { displayName, displayTitle } from "#shared/display-name.js";import { AGENT_TOOL_NAME } from "#tools/framework/agent-contract.js";/**- * The first call's label, or its tool or agent name, plus `+N more` when the- * model requested several calls at once.+ * The first call's label, or its tool or agent display title, plus `+N more`+ * when the model requested several calls at once.*/export function describeActionRequests(actions: readonly RuntimeActionRequest[],@@ -18,7 +19,7 @@ export function describeActionRequests(): string {const [first] = actions;if (first === undefined) return "Working...";- const label = presentation?.[first.callId]?.label ?? actionRequestName(first);+ const label = presentation?.[first.callId]?.label ?? displayTitle(actionRequestName(first));return actions.length === 1 ? label : `${label} +${String(actions.length - 1)} more`;}@@ -29,7 +30,7 @@ export function describeActionRequests(*/export function waitingOnTasks(names: readonly string[]): string {const [only] = names;- if (names.length === 1 && only !== AGENT_TOOL_NAME) return `Waiting on ${only!}...`;+ if (names.length === 1 && only !== AGENT_TOOL_NAME) return `Waiting on ${displayName(only!)}...`;return names.length === 1? "Waiting on a task...": `Waiting on ${String(names.length)} tasks...`;diff --git a/packages/eve/src/public/channels/slack/connections.ts b/packages/eve/src/public/channels/slack/connections.tsindex 2de9d912d..bbf51e629 100644--- a/packages/eve/src/public/channels/slack/connections.ts+++ b/packages/eve/src/public/channels/slack/connections.ts@@ -18,17 +18,13 @@*/import type { ConnectionAuthorizationOutcome } from "#protocol/message.js";+import { displayProperName } from "#shared/display-name.js";export type { ConnectionAuthorizationOutcome };-/**- * Title-cases a connection name (`linear` → `Linear`) for display. Empty- * strings pass through unchanged so the renderer never emits an empty- * label inside a sentence.- */+/** A connection name for display (`linear` → `Linear`, `my_crm` → `My crm`). */export function formatConnectionDisplayName(connectionName: string): string {- if (connectionName.length === 0) return connectionName;- return connectionName.charAt(0).toUpperCase() + connectionName.slice(1);+ return displayProperName(connectionName);}/**diff --git a/packages/eve/src/public/channels/slack/defaults.ts b/packages/eve/src/public/channels/slack/defaults.tsindex 06bb3ca73..d5df94713 100644--- a/packages/eve/src/public/channels/slack/defaults.ts+++ b/packages/eve/src/public/channels/slack/defaults.ts@@ -414,7 +414,23 @@ export const defaultEvents: SlackChannelInternalEvents = {if (working.length > 0) await channel.thread.startTyping(waitingOnTasks(working));},+ // The turn's next model step reads the results, so `step.started` can say so.+ async "task.settled"(event, channel, _ctx) {+ if (event.cancel === undefined) channel.state.pendingTaskResultsTurnId = event.turnId;+ },++ // Each later step replaces the status left by the previous one, such as a+ // finished tool's label or `Waiting on 3 tasks...`, which would otherwise+ // linger until the model streams something. `turn.started` covers step 0.+ async "step.started"(event, channel, _ctx) {+ if (event.stepIndex === 0) return;+ const reviewing = channel.state.pendingTaskResultsTurnId === event.turnId;+ channel.state.pendingTaskResultsTurnId = null;+ await channel.thread.startTyping(reviewing ? "Reviewing results..." : "Thinking...");+ },+async "turn.started"(_event, channel, _ctx) {+ channel.state.pendingTaskResultsTurnId = null;channel.state.pendingToolCallMessage = null;channel.state.lastReasoningTypingAtMs = null;channel.state.lastReasoningTypingStatus = null;diff --git a/packages/eve/src/public/channels/slack/renderers.ts b/packages/eve/src/public/channels/slack/renderers.tsindex 2f87919c5..89494974e 100644--- a/packages/eve/src/public/channels/slack/renderers.ts+++ b/packages/eve/src/public/channels/slack/renderers.ts@@ -31,6 +31,7 @@ const SLACK_RENDERED_EVENTS = ["session.completed","session.failed","session.waiting",+ "step.started","task.settled","task.started","turn.cancelled",diff --git a/packages/eve/src/public/channels/slack/slackChannel.test.ts b/packages/eve/src/public/channels/slack/slackChannel.test.tsindex 6bb0c8658..8ef2013d4 100644--- a/packages/eve/src/public/channels/slack/slackChannel.test.ts+++ b/packages/eve/src/public/channels/slack/slackChannel.test.ts@@ -762,6 +762,65 @@ describe("slackChannel() default event handlers", () => {]);});+ it("replaces the previous step's status when the model starts another step", async () => {+ const adapter = withState(+ getAdapter(slackChannel({ credentials: { botToken: "xoxb-test" } })),+ THREAD_STATE,+ );+ const ctx = buildAdapterContext(adapter, stubAccessor());+ const stepStarted = (stepIndex: number) =>+ makeEvent("step.started", { modelId: "test", sequence: 1, stepIndex, turnId: "t1" });+ const taskStarted = (callId: string, name: string) =>+ makeEvent("task.started", { callId, kind: "agent", name, taskId: `${name}-1`, turnId: "t1" });++ await callEvent(adapter, stepStarted(0), ctx);+ await callEvent(adapter, taskStarted("c1", "researcher"), ctx);+ await callEvent(adapter, taskStarted("c2", "reviewer"), ctx);+ await callEvent(adapter, makeEvent("turn.waiting", { sequence: 1, turnId: "t1" }), ctx);+ await callEvent(+ adapter,+ makeEvent("task.settled", {+ callId: "c1",+ status: "completed",+ taskId: "researcher-1",+ turnId: "t1",+ }),+ ctx,+ );+ await callEvent(adapter, stepStarted(1), ctx);+ await callEvent(adapter, makeEvent("turn.waiting", { sequence: 1, turnId: "t1" }), ctx);+ await callEvent(+ adapter,+ makeEvent("actions.requested", {+ actions: [{ callId: "call_1", input: {}, kind: "tool-call", toolName: "search" }],+ sequence: 1,+ stepIndex: 2,+ turnId: "t1",+ }),+ ctx,+ );+ await callEvent(+ adapter,+ makeEvent("task.settled", {+ callId: "c2",+ cancel: { reason: "task_cancel" },+ status: "cancelled",+ taskId: "reviewer-1",+ turnId: "t1",+ }),+ ctx,+ );+ await callEvent(adapter, stepStarted(3), ctx);++ expect(slackStatuses(fetchMock)).toEqual([+ "Waiting on 2 tasks...",+ "Reviewing results...",+ "Waiting on reviewer...",+ "Search",+ "Thinking...",+ ]);+ });+it("forgets a failed turn's tasks even when a renderer replaces its failure reply", async () => {const adapter = withState(getAdapter(@@ -871,7 +930,7 @@ describe("slackChannel() default event handlers", () => {expect(ctx.state.pendingToolCallMessage).toBeNull();});- it("shows the first call's start label in the typing status, without the model's own task calls", async () => {+ it("shows the first call's start label in the typing status, or its display title, without the model's own task calls", async () => {const adapter = withState(getAdapter(slackChannel({ credentials: { botToken: "xoxb-test" } })),THREAD_STATE,@@ -894,9 +953,12 @@ describe("slackChannel() default event handlers", () => {await callEvent(adapter, requested(["task_wait"]), ctx);expect(fetchMock).not.toHaveBeenCalled();- await callEvent(adapter, requested(["task_cancel", "search", "deploy"]), ctx);- await callEvent(adapter, requested(["task_cancel", "deploy"]), ctx);- expect(slackStatuses(fetchMock)).toEqual(["Search checkout incidents +1 more", "deploy"]);+ await callEvent(adapter, requested(["task_cancel", "search", "ops__deploy_preview"]), ctx);+ await callEvent(adapter, requested(["task_cancel", "ops__deploy_preview"]), ctx);+ expect(slackStatuses(fetchMock)).toEqual([+ "Search checkout incidents +1 more",+ "Deploy preview",+ ]);});it("message.completed clears typing without posting for empty delivery", async () => {diff --git a/packages/eve/src/public/channels/slack/slackChannel.ts b/packages/eve/src/public/channels/slack/slackChannel.tsindex d6979e3bc..360d7ce62 100644--- a/packages/eve/src/public/channels/slack/slackChannel.ts+++ b/packages/eve/src/public/channels/slack/slackChannel.ts@@ -249,6 +249,12 @@ export interface SlackChannelState {* turn id. The default `turn.waiting` handler names the working tasks.*/taskCards?: Record<string, SlackTaskCardState> | null;+ /**+ * The turn with a task that settled since its last model step. The default+ * `step.started` handler shows `Reviewing results...` for the step that reads+ * the results.+ */+ pendingTaskResultsTurnId?: string | null;/*** Principal id to Slack user id, recorded as each message or input response* is delivered. Default handlers use it to address the principal named ondiff --git a/packages/eve/src/public/channels/slack/task-card.ts b/packages/eve/src/public/channels/slack/task-card.tsindex cd7283a3b..67b8d59a2 100644--- a/packages/eve/src/public/channels/slack/task-card.ts+++ b/packages/eve/src/public/channels/slack/task-card.ts@@ -23,6 +23,7 @@ import type {SlackEventContext,} from "#public/channels/slack/slackChannel.js";import { normalizeChannelAudience } from "#shared/channel-audience.js";+import { displayName } from "#shared/display-name.js";import { formatDuration } from "#shared/format-duration.js";import { AGENT_TOOL_NAME } from "#tools/framework/agent-contract.js";@@ -111,7 +112,7 @@ function agentNames(tasks: readonly TaskCardTask[]): string | undefined {if (tasks.some((task) => task.kind !== "agent" || task.name === AGENT_TOOL_NAME)) {return undefined;}- const names = [...new Set(tasks.map((task) => task.name))];+ const names = [...new Set(tasks.map((task) => displayName(task.name)))];if (names.length === 0 || names.length > MAX_NAMED_AGENTS) return undefined;if (names.length <= 2) return names.join(" and ");return `${names.slice(0, -1).join(", ")}, and ${names.at(-1)!}`;diff --git a/packages/eve/src/public/channels/teams/defaults.ts b/packages/eve/src/public/channels/teams/defaults.tsindex d0e9638d6..2ef9ec713 100644--- a/packages/eve/src/public/channels/teams/defaults.ts+++ b/packages/eve/src/public/channels/teams/defaults.ts@@ -13,6 +13,7 @@ import type {TeamsContext,TeamsInboundResult,} from "#public/channels/teams/teamsChannel.js";+import { displayProperName } from "#shared/display-name.js";import { parseJsonObject } from "#shared/json.js";/** Default auth projection for Teams message actors. */@@ -203,10 +204,9 @@ export const defaultEvents: TeamsChannelEvents = {},};-/** Capitalizes the first character of a connection name for Teams auth card display (e.g. "linear" -> "Linear"). */+/** A connection name for the Teams auth card (`linear` → `Linear`). */export function formatConnectionDisplayName(connectionName: string): string {- if (connectionName.length === 0) return connectionName;- return connectionName.charAt(0).toUpperCase() + connectionName.slice(1);+ return displayProperName(connectionName);}/** Builds final-state text for a completed connection authorization attempt. */diff --git a/packages/eve/src/public/definitions/channel.ts b/packages/eve/src/public/definitions/channel.tsindex 36c7421b6..ec10254a3 100644--- a/packages/eve/src/public/definitions/channel.ts+++ b/packages/eve/src/public/definitions/channel.ts@@ -207,6 +207,7 @@ export interface ChannelEvents<TCtx = void> {readonly "message.appended"?: ChannelEventHandler<"message.appended", TCtx>;readonly "reasoning.appended"?: ChannelEventHandler<"reasoning.appended", TCtx>;readonly "reasoning.completed"?: ChannelEventHandler<"reasoning.completed", TCtx>;+ readonly "step.started"?: ChannelEventHandler<"step.started", TCtx>;readonly "step.completed"?: ChannelEventHandler<"step.completed", TCtx>;readonly "input.requested"?: ChannelEventHandler<"input.requested", TCtx>;readonly "input.resolved"?: ChannelEventHandler<"input.resolved", TCtx>;@@ -322,6 +323,7 @@ const channelEventTypes: Record<keyof ChannelEvents, null> = {"message.appended": null,"reasoning.appended": null,"reasoning.completed": null,+ "step.started": null,"step.completed": null,"input.requested": null,"input.resolved": null,diff --git a/packages/eve/src/shared/display-name.test.ts b/packages/eve/src/shared/display-name.test.tsnew file mode 100644index 000000000..ab8c66cd4--- /dev/null+++ b/packages/eve/src/shared/display-name.test.ts@@ -0,0 +1,32 @@+import { describe, expect, it } from "vitest";++import { displayName, displayProperName, displayTitle } from "#shared/display-name.js";++describe("displayName", () => {+ it.each([+ ["researcher", "researcher", "Researcher"],+ ["create_issue", "create issue", "Create issue"],+ ["code-reviewer", "code reviewer", "Code reviewer"],+ ["code__code_reviewer", "code reviewer", "Code reviewer"],+ ["memory__remove_memory", "remove memory", "Remove memory"],+ ["listPullRequests", "list pull requests", "List pull requests"],+ ["getPRStatus", "get PR status", "Get PR status"],+ ["sync_CRM_accounts", "sync CRM accounts", "Sync CRM accounts"],+ ["s3_upload", "s3 upload", "S3 upload"],+ ["___", "___", "___"],+ ])("renders %s as %s", (identifier, name, title) => {+ expect(displayName(identifier)).toBe(name);+ expect(displayTitle(identifier)).toBe(title);+ });+});++describe("displayProperName", () => {+ it.each([+ ["linear", "Linear"],+ ["GitHub", "GitHub"],+ ["my_crm", "My crm"],+ ["code__github", "Github"],+ ])("renders %s as %s", (identifier, name) => {+ expect(displayProperName(identifier)).toBe(name);+ });+});diff --git a/packages/eve/src/shared/display-name.ts b/packages/eve/src/shared/display-name.tsnew file mode 100644index 000000000..2f4f08bff--- /dev/null+++ b/packages/eve/src/shared/display-name.ts@@ -0,0 +1,43 @@+/**+ * Display text for an eve identifier, such as a tool, agent, or skill name:+ * `code__code_reviewer` → `code reviewer`, `getPRStatus` → `get PR status`.+ * Only the last `__` segment names the thing; the segments before it are the+ * extension or memory namespace it was mounted under, which means nothing to+ * someone reading a status.+ */+export function displayName(identifier: string): string {+ const words = lastSegment(identifier)+ .replace(/([a-z0-9])([A-Z])/gu, "$1 $2")+ .replace(/([A-Z]+)([A-Z][a-z])/gu, "$1 $2")+ .split(SEPARATORS)+ .filter((word) => word !== "")+ .map((word) => (word.length > 1 && word === word.toUpperCase() ? word : word.toLowerCase()));+ return words.length === 0 ? identifier : words.join(" ");+}++/** {@link displayName} in sentence case, for the start of a title: `Code reviewer`. */+export function displayTitle(identifier: string): string {+ return capitalize(displayName(identifier));+}++/**+ * Display text for a proper noun, such as a connection name: `my_crm` →+ * `My crm`. It keeps the author's casing, since `GitHub` is one word.+ */+export function displayProperName(identifier: string): string {+ const name = lastSegment(identifier)+ .split(SEPARATORS)+ .filter((word) => word !== "")+ .join(" ");+ return name === "" ? identifier : capitalize(name);+}++const SEPARATORS = /[\s_-]+/u;++function lastSegment(identifier: string): string {+ return identifier.split("__").findLast((segment) => segment !== "") ?? identifier;+}++function capitalize(text: string): string {+ return text.charAt(0).toUpperCase() + text.slice(1);+}diff --git a/packages/eve/src/tools/provided/load-skill.ts b/packages/eve/src/tools/provided/load-skill.tsindex 80ba6d9b5..24d01429b 100644--- a/packages/eve/src/tools/provided/load-skill.ts+++ b/packages/eve/src/tools/provided/load-skill.ts@@ -3,18 +3,20 @@ import {SKILL_INPUT_SCHEMA,SKILL_OUTPUT_SCHEMA,} from "#execution/tools/load-skill.js";-import { toolLabel } from "#tools/tool-label.js";+import { displayTitle } from "#shared/display-name.js";import { defineTool } from "#tools/definition.js";import { attachToolBehavior } from "#tools/behavior.js";export const loadSkill = attachToolBehavior(defineTool({label: {- start: (input) =>- toolLabel(- "Load",- typeof input === "object" && input !== null ? Reflect.get(input, "skill") : undefined,- ),+ start: (input) => {+ const skill =+ typeof input === "object" && input !== null ? Reflect.get(input, "skill") : undefined;+ return typeof skill === "string" && skill.trim() !== ""+ ? `Load skill: ${displayTitle(skill.trim())}`+ : "Load skill";+ },},description: ["Load the full instructions for one available skill by name or id.",diff --git a/packages/eve/src/tools/tool-label.test.ts b/packages/eve/src/tools/tool-label.test.tsindex 9aa8a2e5f..944a7c303 100644--- a/packages/eve/src/tools/tool-label.test.ts+++ b/packages/eve/src/tools/tool-label.test.ts@@ -16,7 +16,9 @@ describe("provided tool labels", () => {expect(grep.label?.start({ pattern: "slackActivityMessage" })).toBe("Search slackActivityMessage",);- expect(loadSkill.label?.start({ skill: "technical-writing" })).toBe("Load technical-writing");+ expect(loadSkill.label?.start({ skill: "technical-writing" })).toBe(+ "Load skill: Technical writing",+ );expect(readFile.label?.start({ filePath: "channels/slack/activity.ts" })).toBe("Read channels/slack/activity.ts",);