Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 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
1 change: 1 addition & 0 deletions packages/coding-agent/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## [Unreleased]

- Added built-in Herdr integration that reports agent lifecycle state to Herdr panes automatically, without requiring `herdr integration install pi`.
- Changed Escape to interrupt active work with a visible abort notice, double Escape to open the session tree from an empty prompt or clear an idle draft, and `?` to show shortcuts ([ENG-4489](https://linear.app/primeintellect/issue/ENG-4489/rewire-prime-agent-shortcuts-to-match-claude-code-flow)).
- Changed new-chat guidance to show concise shell, command, file, and shortcut hints, with Agents View first and `? for shortcuts` after the model and effort ([ENG-4489](https://linear.app/primeintellect/issue/ENG-4489/rewire-prime-agent-shortcuts-to-match-claude-code-flow)).
- Changed `?` shortcut help to appear as a temporary compact panel below the transcript, while `/hotkeys` shows the full reference without Ctrl+Z ([ENG-4489](https://linear.app/primeintellect/issue/ENG-4489/rewire-prime-agent-shortcuts-to-match-claude-code-flow)).
Expand Down
25 changes: 24 additions & 1 deletion packages/coding-agent/src/core/agent-session-services.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { join } from "node:path";
import type { ThinkingLevel } from "@earendil-works/pi-agent-core";
import type { Model } from "@earendil-works/pi-ai";
import { getAgentDir } from "../config.js";
import { CONFIG_DIR_NAME, getAgentDir } from "../config.js";
import type { AgentSessionMessageController } from "./agent-messages.js";
import type { AgentObserveController } from "./agent-observe.js";
import { installAgentTraceUpload } from "./agent-traces.js";
import { AuthStorage } from "./auth-storage.js";
import type { AgentRlmHeartbeatController } from "./cron-jobs.js";
import { createHerdrAgentStateExtension } from "./extensions/builtin/herdr-agent-state.js";
import type { SessionStartEvent, ToolDefinition } from "./extensions/index.js";
import { McpManager } from "./mcp/mcp-manager.js";
import { ModelRegistry } from "./model-registry.js";
Expand Down Expand Up @@ -43,6 +44,13 @@ export interface CreateAgentSessionServicesOptions {
modelRegistry?: ModelRegistry;
extensionFlagValues?: Map<string, boolean | string>;
resourceLoaderOptions?: Omit<DefaultResourceLoaderOptions, "cwd" | "agentDir" | "settingsManager">;
/**
* Skip the built-in Herdr reporter for these services. Set for RLM subagent
* runtimes: they inherit the parent's HERDR_* pane identity, so their own
* reporter would race the parent's on the same pane and a subagent quit
* would release the pane while the parent is still running.
*/
noBuiltinHerdrReporter?: boolean;
}

export interface AgentSessionCreationOptions {
Expand Down Expand Up @@ -167,8 +175,23 @@ export async function createAgentSessionServices(
// refresh() resets the OAuth registry to built-ins; re-add user MCP providers too.
modelRegistry.setOnOAuthProvidersReset(() => mcpManager.registerUserProviders());

const userExtensionFactories = options.resourceLoaderOptions?.extensionFactories ?? [];
// The built-in Herdr reporter defers to Herdr's own file-based integration
// when it is present in a directory the loader discovers from; two
// reporters would race on the same pane. The factory re-checks on every
// session load and /reload, using the same dirs the loader scans so
// agentDir overrides are honored.
// With noExtensions the loader skips these dirs entirely, so a file-based
// reporter there never loads; the built-in must not defer to it.
const discoveredExtensionDirs = options.resourceLoaderOptions?.noExtensions
? []
: [join(cwd, CONFIG_DIR_NAME, "extensions"), join(agentDir, "extensions")];
const builtinExtensionFactories = options.noBuiltinHerdrReporter
? []
: [createHerdrAgentStateExtension(discoveredExtensionDirs)];
const resourceLoader = new DefaultResourceLoader({
...(options.resourceLoaderOptions ?? {}),
extensionFactories: [...builtinExtensionFactories, ...userExtensionFactories],
Comment thread
cursor[bot] marked this conversation as resolved.
Resolved
cwd,
Comment thread
macroscopeapp[bot] marked this conversation as resolved.
Resolved
agentDir,
settingsManager,
Expand Down
Loading