import type { OrgBus } from './bus.js'; import type { RoleCheckpoint } from './checkpoint.js'; import { type CompletionFacts, type TaskEvidence } from './completion-gate.js'; import type { OrgDaemon } from './daemon.js'; import type { AgentRuntime, RunningOrg } from './daemon-types.js'; import * as decisionOps from './decisions.js'; import { resolveLoadout } from './loadouts.js'; import type { Mailbox } from './mailbox.js'; import type { TaskReferences } from './packet.js'; import type { PolicyEngine } from './policy.js'; import { type TaskPick } from './task-match.js'; import { type DecisionKind, type OrgRole } from './types.js'; /** #302: the `org_complete` consent gate's emit-and-return logic, extracted * (matching `resolvedIdleNudgeCount`'s and `runOutcomeResult`'s precedent) * so it is unit-testable without a live daemon, a running org, or the SDK's * own tool-calling loop — none of which a test can drive directly, since * `queryFn` replaces the whole SDK `query()`, tool orchestration included. * `onComplete` gathers the facts (needs `this`/`running`) and calls this; * this does the one decision (`checkCompletion`) and its two possible * side effects. Returns the refusal string, or `null` to allow — exactly * what the org_complete tool handler (session.ts) relays as the result. */ export declare function resolveOrgComplete(bus: OrgBus, role: string, outcome: 'achieved' | 'partial' | 'failed', summary: string, blocker: 'budget' | 'human' | 'external' | 'time' | undefined, blockerDetail: string | undefined, runFacts: Pick): string | null; /** The sessionOpts built inside spawnRoleIncarnation (role-incarnation.ts). */ export declare function buildRoleSessionOpts(daemon: OrgDaemon, name: string, running: RunningOrg, role: OrgRole, roleCwd: string, runtime: AgentRuntime, abort: AbortController, loadout: ReturnType | undefined, policy: PolicyEngine, mailbox: Mailbox, roleCheckpoint: RoleCheckpoint | undefined): { org: string; role: { [x: string]: unknown; id: string; title: string; type: string; reports_to: string | null; responsibilities: string[]; instructions_file?: string | undefined; skills?: string[] | undefined; skill_pool?: string[] | undefined; blueprint?: string | undefined; ui?: { [x: string]: unknown; x?: number | undefined; y?: number | undefined; icon?: string | undefined; color?: string | undefined; } | undefined; adapter_config?: { model?: string | undefined; max_tokens?: number | undefined; provider?: string | undefined; } | undefined; provider?: { kind: "antigravity" | "api-key" | "base-url" | "bedrock" | "codex" | "gemini" | "openai" | "subscription" | "vercel-api-key" | "vertex"; vendor?: "alibaba" | "anthropic" | "cohere" | "deepseek" | "fireworks" | "glm" | "google" | "groq" | "mistral" | "ollama" | "openai" | "openai-compatible" | "openrouter" | "perplexity" | "together" | "xai" | undefined; apiKeyEnv?: string | undefined; apiKey?: string | undefined; baseUrl?: string | undefined; authTokenEnv?: string | undefined; authToken?: string | undefined; usageProxy?: boolean | undefined; usageProxyEnvVar?: string | undefined; } | undefined; policy?: { [x: string]: unknown; allowTools?: string[] | undefined; denyTools?: string[] | undefined; fileWrite?: string[] | undefined; fileRead?: string[] | undefined; webAllow?: string[] | undefined; maxTokens?: number | undefined; maxTokensBasis?: "billable" | "uncached" | undefined; maxUsd?: number | undefined; git?: "commit" | "none" | "push" | "read" | undefined; sandbox?: { mode?: "auto" | "off" | "required" | undefined; allowedDomains?: string[] | undefined; deniedDomains?: string[] | undefined; allowWrite?: string[] | undefined; denyWrite?: string[] | undefined; denyExec?: string[] | undefined; denyRead?: string[] | undefined; homeWriteAllow?: string[] | undefined; allowUnixSockets?: boolean | undefined; } | undefined; fence?: { [x: string]: unknown; enabled?: boolean | undefined; confidenceThreshold?: number | undefined; enablePIIDetection?: boolean | undefined; scanMessages?: boolean | undefined; scanOutput?: boolean | undefined; abortThreshold?: number | undefined; allowlist?: { id: string; pattern: string; types: ("context_manipulation" | "data_exfiltration" | "encoding_attack" | "instruction_override" | "jailbreak" | "pii_exposure" | "prompt_injection" | "role_switching" | "unknown")[]; context?: string | undefined; reason?: string | undefined; source?: string | undefined; }[] | undefined; } | undefined; autoApproveTools?: string[] | undefined; approvalTools?: string[] | undefined; access?: "full" | "scoped" | undefined; settings?: ("local" | "project" | "user")[] | undefined; access_ack?: { by: "human"; at: string; hash: string; sig?: string | undefined; } | undefined; } | undefined; session_scope?: "role" | "task" | undefined; review_input?: "artifact-only" | undefined; deliberative?: boolean | undefined; runtime?: "aider" | "antigravity" | "claude" | "cline" | "codex" | "copilot" | "crush" | "dsh" | "grok" | "hermes" | "kilo" | "kimicode" | "opencode" | "pi" | "pi-rpc" | "qwen" | "qwen-rpc" | "vercel" | undefined; max_turns_per_message?: number | undefined; max_tool_rounds?: number | undefined; budget_tokens?: number | undefined; budget_usd?: number | undefined; tool_providers?: { [x: string]: unknown; kind: "mcp-stdio"; name: string; command: string; args: string[]; env: Record; allow?: string[] | undefined; prefix?: string | undefined; timeout_ms: number; idle_ms: number; }[] | undefined; kind?: "agent" | "endpoint" | undefined; endpoint?: { [x: string]: unknown; url: string; credential_file?: string | undefined; timeout_ms?: number | undefined; input_hint?: string | undefined; } | undefined; }; bus: OrgBus; policy: PolicyEngine; mailbox: Mailbox; taskProcesses: import("./task-cancel.js").TaskProcesses | undefined; cwd: string; def: { [x: string]: unknown; name: string; goal: string; status: string; schedule: string | number | null; run_config: { memory_namespace?: string | undefined; max_tool_rounds?: number | undefined; idle_minutes?: number | undefined; verify_writes?: boolean | undefined; lead_watch?: false | { not_started_s?: number | undefined; silent_s?: number | undefined; unread_s?: number | undefined; } | undefined; block_recheck_minutes?: number | undefined; experimental?: unknown; session_scope?: "role" | "task" | undefined; context?: { require_brief?: boolean | undefined; notes?: boolean | undefined; session_cap?: { tasks?: number | undefined; tokens?: number | undefined; } | undefined; } | undefined; session_idle_exit_ms?: number | undefined; bash_timeout_ms?: number | undefined; deadline_seconds?: number | undefined; notify_task_creator?: boolean | undefined; circuit_breaker?: { failure_threshold?: number | undefined; cooldown_ms?: number | undefined; } | undefined; max_role_resets?: number | undefined; failure_routing?: { retry?: { maxAttempts?: number | undefined; backoffMs?: number[] | undefined; } | undefined; fallbackAssignee?: string | undefined; escalate?: boolean | undefined; } | undefined; prechecks?: { name: string; command: string; }[] | undefined; allow_unattended_full_access?: boolean | undefined; accept_full_access_taint?: string[] | undefined; max_concurrent_agents: number; budget_tokens: number; budget_tokens_basis: "billable" | "uncached"; max_turns_per_message: number; workspace: string; stale_base_threshold: number; max_role_respawns: number; completion: "boss" | "dag" | { mode: "boss" | "dag"; protocol?: string | undefined; }; completion_evidence: boolean; max_evidence_attempts: number; respawn_drain_timeout_ms: number; respawn_force_stop_timeout_ms: number; respawn_start_timeout_ms: number; }; fence?: { [x: string]: unknown; enabled?: boolean | undefined; confidenceThreshold?: number | undefined; enablePIIDetection?: boolean | undefined; scanMessages?: boolean | undefined; scanOutput?: boolean | undefined; abortThreshold?: number | undefined; allowlist?: { id: string; pattern: string; types: ("context_manipulation" | "data_exfiltration" | "encoding_attack" | "instruction_override" | "jailbreak" | "pii_exposure" | "prompt_injection" | "role_switching" | "unknown")[]; context?: string | undefined; reason?: string | undefined; source?: string | undefined; }[] | undefined; } | undefined; federation?: { [x: string]: unknown; allow_from?: string[] | undefined; allow_to?: string[] | undefined; } | undefined; cost_tiers?: { [x: string]: unknown; default?: string | undefined; roles?: Record | undefined; tiers?: Record> | undefined; providers?: Record>> | undefined; }> | undefined; } | undefined; loadouts?: Record | undefined; requires?: { [x: string]: unknown; sections?: number | undefined; } | undefined; sections?: Record | undefined; documents?: Record | undefined; roles: { [x: string]: unknown; id: string; title: string; type: string; reports_to: string | null; responsibilities: string[]; instructions_file?: string | undefined; skills?: string[] | undefined; skill_pool?: string[] | undefined; blueprint?: string | undefined; ui?: { [x: string]: unknown; x?: number | undefined; y?: number | undefined; icon?: string | undefined; color?: string | undefined; } | undefined; adapter_config?: { model?: string | undefined; max_tokens?: number | undefined; provider?: string | undefined; } | undefined; provider?: { kind: "antigravity" | "api-key" | "base-url" | "bedrock" | "codex" | "gemini" | "openai" | "subscription" | "vercel-api-key" | "vertex"; vendor?: "alibaba" | "anthropic" | "cohere" | "deepseek" | "fireworks" | "glm" | "google" | "groq" | "mistral" | "ollama" | "openai" | "openai-compatible" | "openrouter" | "perplexity" | "together" | "xai" | undefined; apiKeyEnv?: string | undefined; apiKey?: string | undefined; baseUrl?: string | undefined; authTokenEnv?: string | undefined; authToken?: string | undefined; usageProxy?: boolean | undefined; usageProxyEnvVar?: string | undefined; } | undefined; policy?: { [x: string]: unknown; allowTools?: string[] | undefined; denyTools?: string[] | undefined; fileWrite?: string[] | undefined; fileRead?: string[] | undefined; webAllow?: string[] | undefined; maxTokens?: number | undefined; maxTokensBasis?: "billable" | "uncached" | undefined; maxUsd?: number | undefined; git?: "commit" | "none" | "push" | "read" | undefined; sandbox?: { mode?: "auto" | "off" | "required" | undefined; allowedDomains?: string[] | undefined; deniedDomains?: string[] | undefined; allowWrite?: string[] | undefined; denyWrite?: string[] | undefined; denyExec?: string[] | undefined; denyRead?: string[] | undefined; homeWriteAllow?: string[] | undefined; allowUnixSockets?: boolean | undefined; } | undefined; fence?: { [x: string]: unknown; enabled?: boolean | undefined; confidenceThreshold?: number | undefined; enablePIIDetection?: boolean | undefined; scanMessages?: boolean | undefined; scanOutput?: boolean | undefined; abortThreshold?: number | undefined; allowlist?: { id: string; pattern: string; types: ("context_manipulation" | "data_exfiltration" | "encoding_attack" | "instruction_override" | "jailbreak" | "pii_exposure" | "prompt_injection" | "role_switching" | "unknown")[]; context?: string | undefined; reason?: string | undefined; source?: string | undefined; }[] | undefined; } | undefined; autoApproveTools?: string[] | undefined; approvalTools?: string[] | undefined; access?: "full" | "scoped" | undefined; settings?: ("local" | "project" | "user")[] | undefined; access_ack?: { by: "human"; at: string; hash: string; sig?: string | undefined; } | undefined; } | undefined; session_scope?: "role" | "task" | undefined; review_input?: "artifact-only" | undefined; deliberative?: boolean | undefined; runtime?: "aider" | "antigravity" | "claude" | "cline" | "codex" | "copilot" | "crush" | "dsh" | "grok" | "hermes" | "kilo" | "kimicode" | "opencode" | "pi" | "pi-rpc" | "qwen" | "qwen-rpc" | "vercel" | undefined; max_turns_per_message?: number | undefined; max_tool_rounds?: number | undefined; budget_tokens?: number | undefined; budget_usd?: number | undefined; tool_providers?: { [x: string]: unknown; kind: "mcp-stdio"; name: string; command: string; args: string[]; env: Record; allow?: string[] | undefined; prefix?: string | undefined; timeout_ms: number; idle_ms: number; }[] | undefined; kind?: "agent" | "endpoint" | undefined; endpoint?: { [x: string]: unknown; url: string; credential_file?: string | undefined; timeout_ms?: number | undefined; input_hint?: string | undefined; } | undefined; }[]; runtime?: "aider" | "antigravity" | "claude" | "cline" | "codex" | "copilot" | "crush" | "dsh" | "grok" | "hermes" | "kilo" | "kimicode" | "opencode" | "pi" | "pi-rpc" | "qwen" | "qwen-rpc" | "vercel" | undefined; }; runTask: string | undefined; orgDir: string; orgRoot: string; run: string; buildProviderTools: () => Promise; maxTurns: number; resumeSessionId: string | undefined; sessionLedger: import("./session-ledger.js").SessionLedger | undefined; isTaskClosed: (taskId: string) => boolean; loadoutFor: (taskId: string) => import("./loadouts.js").ResolvedLoadout | undefined; lastMessageId: () => string | undefined; onOutput: (line: string) => void; onSessionId: (id: string) => void; onTurnEnd: () => void; deliver: (from: string, to: string, subject: string, body: string) => Promise; askHuman: (r: string, question: string, blocking?: boolean) => Promise; onGate: (r: string, gateName: string, gateDesc: string) => Promise; circuitBreaker: { threshold: number; state: { failures: number; tripped: boolean; }; } | undefined; beforeTool: (r: string, toolName: string, input: Record) => Promise; fence: import("./fence.js").RoleFence | undefined; onDecision: (r: string, toolName: string, message: string, kind: DecisionKind) => void; hasPendingGate: () => boolean; onComplete: ((r: string, outcome: 'achieved' | 'partial' | 'failed', summary: string, blocker?: 'budget' | 'human' | 'external' | 'time', blockerDetail?: string) => string | null) | undefined; onContextLimit: (() => void) | undefined; onListRuntimeOptions: (() => Promise) | undefined; onRespawnRole: ((callerId: string, args: any) => Promise) | undefined; onCompactRole: ((callerId: string, args: any) => Promise) | undefined; onClearRole: ((callerId: string, args: any) => Promise) | undefined; recall: (r: string, q: string) => Promise; searchKnowledge: (r: string, q: string) => Promise; glossary: string[]; remember: (r: string, content: string, scope: 'org' | 'agent') => Promise; learn: (r: string, payload: { nodes?: unknown[]; edges?: unknown[]; rules?: unknown[]; }) => Promise; createTask: (r: string, title: string, assignee: string, deps: string[], loadout?: string, brief?: string, pick?: TaskPick, references?: TaskReferences) => string; pickAssignee: (title: string, brief?: string, caller?: string) => Promise; onSkillLoad: (r: string, skill: string) => void; loadoutCatalog: import("./loadouts.js").LoadoutSummary[] | undefined; loadout: import("./loadouts.js").ResolvedLoadout | undefined; completeTask: (r: string, taskId: string, result?: string, evidence?: TaskEvidence) => string; requireTaskEvidence: boolean; requestReview: ((r: string, taskId: string, reviewer: string, base?: string) => string) | undefined; listTasks: (taskId?: string) => string; splitTask: (r: string, parentId: string, children: { title: string; assignee: string; }[]) => string; mergeTask: (r: string, sourceId: string, targetId: string) => string; cancelTask: (r: string, taskId: string, reason?: string) => string; blockTask: (r: string, taskId: string, untilIso: string, reason?: string, every?: number) => string; planGraph: (r: string, specs: decisionOps.PlanTaskSpec[]) => string; documents?: import("./documents/host.js").DocumentToolHost | undefined; queryFn: typeof import("@anthropic-ai/claude-agent-sdk").query | undefined; runner: import("./agent-runner-types.js").AgentRunner | undefined; externalAbort: AbortController; silentSessionMs: number | undefined; }; //# sourceMappingURL=role-session-opts.d.ts.map