declare module '@deepseek-ai/dsh-llm' { interface MessageSourceMap { 'assistant-delivery': { kind: 'assistant-delivery'; form?: 'notice'; summary?: string; }; } } import type { Context } from '@deepseek-ai/cordis'; import { type Agent } from '@deepseek-ai/dsh-agent'; import type { AgentPresetRegistry as AgentPresets } from '@deepseek-ai/dsh-agent-preset-registry'; import { type SessionEvent } from '@deepseek-ai/dsh-session'; import { type AssistantPolicyService } from '@dsh-enhanced/assistant-policy'; import type { InboundPrepareContext, InboundPrepareResult, InboundProcessResult, MarkInboundDispatching, PreparedInboundMessage } from './coordinator.js'; import type { AcceptanceHandle } from './acceptance.js'; import type { FeedbackSignalSelection, ObjectiveCommand, ObjectiveCommandResult } from './feedback-command.js'; import type { InboundImageMaterializer } from './inbound-images.js'; import type { DeliveryInboundRuntime } from './service.js'; import { type RestartConfig } from './restart-runtime.js'; import type { RestartRecord, RestartStore } from './restart-store.js'; import { type OwnerApprovalStatusRead } from './approval-status-context.js'; import type { DeliverySessionLeases } from './session-lease-runtime.js'; import { type DeliveryGoalWakeInput, type DeliveryGoalWakeResult } from './goal-wake-types.js'; import { type WorkflowCommand } from './workflow-command.js'; import type { ConversationBinding, ConversationModelSelection, ConversationRef, DeliveryProgressUpdate, DeliveryLearningControlAction, DeliveryLearningControlReceipt, DeliveryPreferenceEvent, InboundEnvelope, ModelPickerIntent, ModelRouteRef, PermissionPickerIntent } from './types.js'; declare module '@deepseek-ai/dsh-llm' { interface MessageSourceMap { delivery: { kind: 'delivery'; channel: string; account: string; eventId: string; trust: 'untrusted'; }; } } interface DshDeliveryRuntimeOptions { restart?: { store: RestartStore; config: RestartConfig; invocationId: string; authorize(record: RestartRecord): boolean; authorizeTask(inboxId: string): boolean; onContinuationAdmitted(record: RestartRecord, sessionId: string): void; isRestartSafeTool(agent: Agent, name: string): boolean; }; sessionLeases: DeliverySessionLeases; sessionNamespace: string; workspace: string; agentPreset: string; getAgentPresets(): Pick | undefined; readOwnerApprovalStatus(agent: Agent): OwnerApprovalStatusRead | undefined; policyRef: string; provider: string; model: string; maxOutputTokens: number; maxAutoContinuationTurns: number; /** Finite wall-clock budget for one inbound execution, including native tools. */ taskTimeoutMs: number; /** Zero retains the historic foreground-disposal behavior. */ goalContinuationTimeoutMs: number; maxTextBytes: number; prepareForegroundTaskAcceptance(binding: Readonly, envelope: Readonly): AcceptanceHandle | undefined; completeForegroundTaskAcceptance(handle: AcceptanceHandle, input: { status: 'succeeded' | 'failed' | 'timed-out' | 'cancelled' | 'unknown'; quiescent: boolean; }): Promise; recordForegroundTaskModelSelection(handle: AcceptanceHandle, input: { provider: string; model: string; reasoningEffort?: string; }): void; beginForegroundTaskExecution(binding: Readonly, envelope: Readonly): string | undefined; recordForegroundExecutionModelSelection(inboxId: string, input: { provider: string; model: string; reasoningEffort?: string; }): void; completeForegroundTaskExecution(inboxId: string, input: { status: 'succeeded' | 'unknown'; quiescent: boolean; }): void; permissionPickerTtlMs: number; getModelSelection(conversation: ConversationRef): ConversationModelSelection | undefined; /** Atomically remove a stale explicit effort without overwriting a newer model choice. */ clearStaleModelReasoningEffort(conversation: ConversationRef, expected: ConversationModelSelection): { applied: false; } | { applied: true; selection: ConversationModelSelection; }; imageMaterializer: Pick; isInboundAuthorized(binding: Readonly, envelope: Readonly): boolean; isPermissionController(binding: Readonly, envelope: Readonly): boolean; isOwnerFeedbackController(binding: Readonly, envelope: Readonly): boolean; authorizeOwnerPreferenceFeedback(binding: Readonly, envelope: Readonly, selections: readonly Readonly[]): { occurredAt: number; principalLineage: Readonly; admissionCursor: Readonly; exposureTarget?: Readonly<{ sourceInboxId: string; sourceOutboxId: string; }>; } | undefined; dispatchPreferenceFeedback(events: readonly Readonly[]): Promise<'recorded' | 'unavailable' | 'unknown'>; replyCompletedPreferenceTurn(agent: Agent, binding: Readonly, envelope: Readonly, input: ModelCommandReply): 'recorded' | 'unavailable' | 'unknown' | Promise<'recorded' | 'unavailable' | 'unknown'>; dispatchObjectiveFeedback(binding: Readonly, envelope: Readonly, objectiveStatus: ObjectiveCommand | import('./feedback-command.js').ObjectiveFeedbackStatus): Promise; dispatchNaturalObjectiveFeedback(binding: Readonly, envelope: Readonly): Promise; dispatchWorkflowCommand(binding: Readonly, envelope: Readonly, command: Extract): Promise<'conflict' | 'invalid-target' | 'recorded' | 'unavailable' | 'unknown'>; dispatchLearningCommand(binding: Readonly, envelope: Readonly, action: DeliveryLearningControlAction, preferenceKey?: string): Promise<'forbidden' | 'unavailable' | 'unknown' | Readonly>; /** Durably reserve the exact terminal reply authorization before permission state can change. */ authorizePermissionReply(binding: Readonly, envelope: Readonly): boolean; beginModelCommand(conversation: ConversationRef): number; commitModelCommand(input: { conversation: ConversationRef; expectedEpoch: number; route?: ModelRouteRef; }): { applied: false; } | { applied: true; selection?: ConversationModelSelection; }; modelPickerTtlMs: number; progress(binding: Readonly, eventId: string, update: DeliveryProgressUpdate): Promise; replyCommand(binding: Readonly, eventId: string, input: ModelCommandReply, idempotencyKey?: string): void; } interface ModelCommandReply { text: string; format?: 'markdown' | 'model-picker' | 'permission-picker' | 'plain'; modelPicker?: ModelPickerIntent; permissionPicker?: PermissionPickerIntent; fallbackText?: string; } /** Bounded, common-credential-shape filtering for an owner learning reply. */ export declare function redactOwnerLearningReply(value: string, maxBytes: number): Readonly<{ text: string; truncated: boolean; redacted: boolean; }>; /** * Convert one durable session fact into a bounded, user-visible progress update. * Reasoning/thinking content and provider error messages never cross this boundary. Tool calls/results * contribute bounded previews with common credential shapes redacted; the channel still decides * whether its current audience is private enough to render those previews. * * A DSH `reasoning` block is explicitly thinking content and is not guaranteed to be a public * summary, even after assembly into `assistant/message`. `step/start` therefore provides the only * reasoning-independent phase label, so a turn reports progress without exposing hidden thought. */ export declare function deliveryProgressFromSessionEvent(event: SessionEvent): DeliveryProgressUpdate | undefined; export declare function permissionStateHash(events: readonly SessionEvent[], tableFingerprint?: string): string; export declare function permissionPickerOperationId(conversation: Readonly, eventId: string): string; export declare function modelPickerOperationId(conversation: Readonly, eventId: string): string; export declare class DshDeliveryRuntime implements DeliveryInboundRuntime { private readonly ctx; private readonly policy; private readonly options; private readonly restartRuns; canRequestRestart(agent: Agent): boolean; requestRestart(agent: Agent, reason: string): { id: string; status: string; }; resumeRestart(record: RestartRecord, binding: Readonly, envelope: Readonly, signal: AbortSignal): Promise; readonly dispatchControl: "explicit"; private readonly activeSessionControls; private readonly sessionLeases; constructor(ctx: Context, policy: AssistantPolicyService, options: DshDeliveryRuntimeOptions); private resumeAgent; cancelActive(binding: Readonly, command: 'new' | 'stop'): Promise; private beginSessionControl; private endSessionControl; /** * Keep one Delivery-owned handle alive just long enough for the host's native * goal driver to retire the exact armed goal it observed. Delivery never * queues a round itself: the driver remains the only continuation producer. */ private waitForNativeGoalContinuation; private disposeAfterReplyBoundary; /** Wait for only the turn that claims Delivery's exact message identity. */ private followupTurn; /** Wait only for scheduling quiescence; exact turn ownership still comes from followupTurn(). */ private waitForAgentIdle; /** * Queue a synthetic completion turn only after the previous exact turn retired. The runtime may still * serialize scoped tool schemas, but every call is denied before approval/execution while this * turn owns the Agent, so recovering prose cannot repeat an external side effect. */ private automaticCompletionTurn; private setupAgent; /** * DSH validates an explicit reasoning effort before calling an adapter. That is normally the * right contract, but a persisted external-channel selection can outlive a provider's live * model directory. Clear only that stale persisted effort before a prompt crosses the durable * dispatch boundary; TraeX still rechecks the newly created ACP session afterwards. */ private resolveExecutionRoute; private reconcileNativeFullPermissionReviewer; private runPermissionCommand; createSession(input: { envelope: Readonly; generation: number; previous?: Readonly; signal: AbortSignal; }): Promise<{ sessionId: string; workspace: string; agentPreset: string; policyRef: string; }>; /** * Resume one previously owner-scheduled native Goal. This is deliberately * not an inbound-message path: it creates no delivery source and never * calls followup(). The native round driver remains the only producer of * `source.kind === 'goal'` work. */ resumeScheduledGoal(binding: Readonly, input: Readonly): Promise; private validGoalWakeInput; private assertScheduledGoal; private installScheduledGoalFences; private waitForScheduledGoalTerminal; prepare(binding: Readonly, envelope: Readonly, signal: AbortSignal, context: Readonly): Promise; private replySessionCommand; private runFeedbackCommand; private runWorkflowCommand; private runLearningCommand; private sessionHelp; private runSessionCommand; process(binding: Readonly, envelope: Readonly, outerSignal: AbortSignal, prepared?: Readonly, markDispatching?: MarkInboundDispatching, restartContinuation?: RestartRecord): Promise; private processControlled; } export {}; //# sourceMappingURL=agent-runtime.d.ts.map