Add 5 pi extensions: pi-subagents, pi-crew, rpiv-pi, pi-interactive-shell, pi-intercom

This commit is contained in:
2026-05-08 15:59:25 +10:00
parent d0d1d9b045
commit 31b4110c87
457 changed files with 85157 additions and 0 deletions

View File

@@ -0,0 +1,40 @@
import type { AgentConfig, IsolationMode, JoinMode, ThinkingLevel } from "./types.js";
interface AgentInvocationParams {
model?: string;
thinking?: string;
max_turns?: number;
run_in_background?: boolean;
inherit_context?: boolean;
isolated?: boolean;
isolation?: IsolationMode;
}
export function resolveAgentInvocationConfig(
agentConfig: AgentConfig | undefined,
params: AgentInvocationParams,
): {
modelInput?: string;
modelFromParams: boolean;
thinking?: ThinkingLevel;
maxTurns?: number;
inheritContext: boolean;
runInBackground: boolean;
isolated: boolean;
isolation?: IsolationMode;
} {
return {
modelInput: agentConfig?.model ?? params.model,
modelFromParams: agentConfig?.model == null && params.model != null,
thinking: (agentConfig?.thinking ?? params.thinking) as ThinkingLevel | undefined,
maxTurns: agentConfig?.maxTurns ?? params.max_turns,
inheritContext: agentConfig?.inheritContext ?? params.inherit_context ?? false,
runInBackground: agentConfig?.runInBackground ?? params.run_in_background ?? false,
isolated: agentConfig?.isolated ?? params.isolated ?? false,
isolation: agentConfig?.isolation ?? params.isolation,
};
}
export function resolveJoinMode(defaultJoinMode: JoinMode, runInBackground: boolean): JoinMode | undefined {
return runInBackground ? defaultJoinMode : undefined;
}