import type { NativeTaskAccess } from "./native-task-policy.js"; import type { CopilotSession, CustomAgentConfig, SessionHooks, Tool } from "@github/copilot-sdk"; export type NativeSubagentMode = "off" | "sync"; export declare function resolveNativeSubagents(value?: unknown): NativeSubagentMode; export declare const NATIVE_SUBAGENT_TOOLS: string[]; export declare const NATIVE_BUILTIN_AGENTS: string[]; export declare const NATIVE_EXCLUDED_TOOLS: string[]; export declare const NATIVE_SUBAGENT_GUIDANCE = "\n## Native local delegation\nChoose delegation by role fit, expected lifetime, scale, execution location, and the user's intent.\nBefore delegating, inspect the current caller-visible agent catalog already in context, or call\nps_list_agents if that catalog is not available. It includes static deployment agents and enabled\npublished agents available to this user. Compare primary purpose, capabilities, and source access.\nA helpful tool alone does not establish role fit; do not repurpose an unrelated specialist.\nIf a specialist fits, prefer spawn_agent(agent_name=, task=)\nover a generic durable agent or native task. Do not invent names or recreate the specialist's persona.\nA specialist can perform its own intake: spawn the matching role rather than asking the user for\ndetails that role is designed to collect. Named task supplies the assignment; its definition supplies\ninstructions, tools, and startup requirements. Do not override system_message or tool_names.\nIf no specialist fits, choose native or durable execution using the rules below. Do not delegate\nagainst an explicit user prohibition, or choose a specialist that cannot meet the required execution location.\nUser words such as \"subagent\", \"sub-agent\", \"spawn\", or \"spin off\" are strong hints for durable spawn_agent:\ndefault to durable when the intended mechanism is otherwise ambiguous; short duration alone does not\noverride that hint. \"Spin off an agent to summarize the README\" therefore favors durable execution.\nThese are contextual hints, not literal keyword rules: \"spawn a native task\" still asks for native\nexecution when its lifetime and capabilities fit.\nPrefer durable spawn_agent for expected long-running sessions, broad scale-out across independently\nmanaged work, ongoing monitoring, work outliving this turn, recovery across restarts, or cross-worker work.\nNative tasks share this worker and the parent's turn time budget; they are not independent durable sessions.\nFilesystem sharing is only between a native task and its IMMEDIATE parent session.\nIf you are a durable child, a path reported by your durable parent or sibling is not\nyour local file. Before asking your native task to process it, use read_artifact(toFile)\nto materialize that session's published artifact in YOUR working directory, then pass\nyour local path to task. Native tasks have no artifact tools and cannot fetch it for you.\nThe presence of a producer path alongside an artifact reference does not establish\nshared storage, even when the request explicitly asks you to use a native task.\nUse native task for bounded, synchronously awaited local work that fits this turn and benefits from separate context:\ntask(agent_type=\"swarm-explore\", mode=\"sync\") for investigation, or task(agent_type=\"swarm-task\", mode=\"sync\")\nfor tests, builds, and verbose commands.\nSame-worker files and uncommitted changes favor native execution\nwhen the user has left the delegation mechanism open. Local files alone do not cancel a durable hint:\n\"use subagents in parallel to compare README.md and package.json\" favors durable children with source\naccess or artifact handoff, even though the files are small. An explicit requirement to execute in this\nexact checkout with uncommitted edits, however, favors native tasks when the work fits this turn.\nPreserve explicit topology: separate agents/sessions that themselves run native tasks means spawn_agent\nchildren, each using native tasks within its own turn. Do not collapse that into native tasks in the parent.\nResolve \"spawn separate subagents for this\" from the existing objective and results; do not ask the user\nto repeat an established task. Ask only when missing information materially blocks useful action.\nUse judgment rather than a fixed duration or agent-count threshold. Simple work without a delegation\nrequest is best done directly. A matching named role takes priority over native convenience.\nDurable children may run on another worker: provide task context and repository access or artifacts;\ndo not assume they can read this worker's local paths. Explain briefly if explicit native execution\ncannot satisfy a required lifetime or capability, and use a durable agent to meet that requirement.\nProvide full context and ask for findings/results. Simple lookups are best done directly.\nNative workers have local CLI tools only. They return results through task.\nPilotSwarm child contracts, facts, wake-ups, and complete_agent apply ONLY to spawn_agent children.\nNative background mode and write_agent are unavailable.\nswarm-explore and swarm-task inherit the parent model, reasoning effort, and context tier.\nOmit the model, reasoning_effort, and context_tier arguments; overrides are unavailable.\n"; export declare const NATIVE_SUBAGENT_GUIDANCE_V2 = "\n## Native local delegation\nNative task(agent_type=\"swarm-explore\", mode=\"sync\") performs bounded investigation;\ntask(agent_type=\"swarm-task\", mode=\"sync\") performs bounded commands or builds.\nNative tasks run on the immediate parent's worker, share its files and turn budget, and return results directly.\nThey are not independent durable sessions. Follow the base and selected workflow instructions when choosing direct, native or durable execution.\nProvide the objective, relevant instructions, exact scope, input/artifact locations and expected evidence.\nA durable parent's or sibling's local paths are not this session's files: materialize published artifacts with read_artifact(toFile) first.\nNative workers have local CLI tools only unless an explicit external-tool allowlist is shown.\nDurable child contracts, timers and complete_agent apply only to spawn_agent children.\nNative background mode, nested delegation and scheduling are unavailable.\nNative tasks inherit the parent model, reasoning effort and context tier.\nOmit the model, reasoning_effort, and context_tier arguments; overrides are unavailable.\n"; export declare function nativeSubagentGuidance(access?: NativeTaskAccess, version?: "v1" | "v2"): string; export declare function nativeSubagentDefinitions(model: string, access?: NativeTaskAccess): CustomAgentConfig[]; /** Native execution remains in the CLI. Compose policy around the native tool. */ export declare function nativeSubagentHooks(model: string, hooks?: SessionHooks, canAdmit?: () => boolean, access?: NativeTaskAccess): SessionHooks; export declare function isNativeChildEvent(event: any): boolean; /** Retire reusable native agents before the worker can snapshot or release its lock. * Do not waitForPending(): its ten-minute wait may schedule follow-up turns. * A timeout/failure rejects the activity rather than claiming a safe boundary. */ export declare function settleNativeSubagents(session: CopilotSession, { timeoutMs, rejectRunning }?: { timeoutMs?: number; rejectRunning?: boolean; }): Promise; /** Defense in depth if a CLI tool name collides with an external tool name. * Apply both at declaration time and when per-turn handlers are refreshed. */ export declare function guardNativeExternalTools(tools: Tool[], parentSessionId: string, access?: NativeTaskAccess): Tool[]; //# sourceMappingURL=native-subagents.d.ts.map