refactor(agents): unify spawned metadata and extract attachments service

This commit is contained in:
Peter Steinberger
2026-03-08 00:23:28 +00:00
parent 61000b8e4d
commit eed403dc74
9 changed files with 675 additions and 350 deletions

View File

@@ -2,6 +2,7 @@ import { Type } from "@sinclair/typebox";
import type { GatewayMessageChannel } from "../../utils/message-channel.js";
import { ACP_SPAWN_MODES, ACP_SPAWN_STREAM_TARGETS, spawnAcpDirect } from "../acp-spawn.js";
import { optionalStringEnum } from "../schema/typebox.js";
import type { SpawnedToolContext } from "../spawned-context.js";
import { SUBAGENT_SPAWN_MODES, spawnSubagentDirect } from "../subagent-spawn.js";
import type { AnyAgentTool } from "./common.js";
import { jsonResult, readStringParam, ToolInputError } from "./common.js";
@@ -58,21 +59,18 @@ const SessionsSpawnToolSchema = Type.Object({
),
});
export function createSessionsSpawnTool(opts?: {
agentSessionKey?: string;
agentChannel?: GatewayMessageChannel;
agentAccountId?: string;
agentTo?: string;
agentThreadId?: string | number;
agentGroupId?: string | null;
agentGroupChannel?: string | null;
agentGroupSpace?: string | null;
sandboxed?: boolean;
/** Explicit agent ID override for cron/hook sessions where session key parsing may not work. */
requesterAgentIdOverride?: string;
/** Internal-only workspace inheritance path for spawned subagents. */
workspaceDir?: string;
}): AnyAgentTool {
export function createSessionsSpawnTool(
opts?: {
agentSessionKey?: string;
agentChannel?: GatewayMessageChannel;
agentAccountId?: string;
agentTo?: string;
agentThreadId?: string | number;
sandboxed?: boolean;
/** Explicit agent ID override for cron/hook sessions where session key parsing may not work. */
requesterAgentIdOverride?: string;
} & SpawnedToolContext,
): AnyAgentTool {
return {
label: "Sessions",
name: "sessions_spawn",