File size: 2,851 Bytes
4c76b0d | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | import type { FastMode } from "../../../shared/fast-mode.js";
import type { SpawnedToolContext } from "../../spawned-context.js";
import type {
SpawnSubagentContextMode,
SpawnSubagentMode,
SpawnSubagentSandboxMode,
} from "./subagent-spawn.types.js";
export type SpawnSubagentParams = {
task: string;
label?: string;
agentId?: string;
model?: string;
taskName?: string;
thinking?: string;
fastMode?: FastMode;
collect?: boolean;
outputSchema?: Record<string, unknown>;
groupId?: string;
/** Host bridge identity used to recover a replay-safe collector launch. */
swarmLaunchReplayKey?: string;
/** Canonical request hash checked before reusing a host-reserved collector. */
swarmLaunchRequestFingerprint?: string;
cwd?: string;
runTimeoutSeconds?: number;
thread?: boolean;
mode?: SpawnSubagentMode;
cleanup?: "delete" | "keep";
sandbox?: SpawnSubagentSandboxMode;
context?: SpawnSubagentContextMode;
lightContext?: boolean;
expectsCompletionMessage?: boolean;
completionTarget?: "parent";
attachments?: Array<{
name: string;
content: string;
encoding?: "utf8" | "base64";
mimeType?: string;
}>;
attachMountPath?: string;
};
export type SpawnSubagentContext = SpawnedToolContext & {
onSpawnEffectsStart?: () => void;
agentSessionKey?: string;
requesterTurnRunId?: string;
/** Separate key used only for completion routing, not sandbox policy. */
completionOwnerKey?: string;
/** Active requester sandbox classification, preserved separately from the durable lineage key.
* Hidden native spawn derives sandbox admission from this when set, mirroring visible/ACP paths. */
sandboxed?: boolean;
agentChannel?: string;
agentAccountId?: string;
agentTo?: string;
agentThreadId?: string | number;
currentMessagingTarget?: string;
currentChannelId?: string;
currentMessageId?: string | number;
requesterAgentIdOverride?: string;
requesterRunId?: string;
/** Private invocation fence, consumed only before registration transfers ownership. */
assertActive?: () => void;
};
export type SpawnSubagentResult = {
childSessionKey?: string;
sessionKey?: string;
runId?: string;
mode?: SpawnSubagentMode;
taskName?: string;
expectsCompletionMessage?: boolean;
completionTarget?: "parent";
note?: string;
/** Fully resolved model ref applied to the spawned child session. */
resolvedModel?: string;
/** Provider prefix parsed from resolvedModel when the ref includes one. */
resolvedProvider?: string;
modelApplied?: boolean;
error?: string;
attachments?: {
count: number;
totalBytes: number;
files: Array<{ name: string; bytes: number; sha256: string }>;
relDir: string;
};
} & (
| { status: "accepted"; context: SpawnSubagentContextMode }
| { status: "forbidden" | "error"; context?: never }
);
|