/** * @downcity/agent — Agent 运行时公开 API。 * * 关键点(中文) * - 这是 agent 包核心运行时的稳定公开入口;可选 Tool 通过 `@downcity/agent/tools` 导出。 * - 只导出 Agent、plugin 作者 API 与跨包协议类型。 * - HTTP router、sandbox runner、内部 plugin runtime runner 等实现细节不从根入口暴露。 */ // Agent 入口 export { Agent } from "./agent/Agent.js"; export { Group } from "./group/Group.js"; export type { DispatchDecision, DispatchNode, DispatchResponseMode, DispatchTrigger, DispatchStrategy, AiDispatchStrategyOptions, GroupContract, GroupMessage, GroupOptions, } from "./group/index.js"; export type { GroupSessionDataStore, GroupSessionHistoryMeta, GroupSessionStore, } from "./types/group/GroupSessionStore.js"; export type { GroupDispatchSessionDataStore, GroupDispatchTurnRecord, GroupDispatchTurnStatus, } from "./types/group/GroupDispatchSession.js"; export { GroupSession, GroupSessions } from "./group/index.js"; export type { GroupMemberRuntime, GroupEvent, GroupStatusPhase, GroupEventSubscriber, GroupEventUnsubscribe, GroupPromptInput, GroupPromptResult, GroupSessionContract, GroupSessionCreateInput, GroupSessionGetInput, GroupSessionListInput, GroupSessionSummary, GroupSessionsContract, } from "./group/index.js"; export { AiDispatchStrategy } from "./group/index.js"; export { City } from "./city/index.js"; export type { CityAgents, CityGroups, CityListenOptions, CityOptions, CityRuntimeOptions, CityWorkspaces, } from "./city/index.js"; export type { PluginHostContext, PluginHostExtensions, AgentPluginModule, } from "./city/index.js"; export { create_city_host_instance_id, get_city_host_state_path, is_process_alive, read_city_host_state, register_city_host, request_city_host_shutdown, unregister_city_host, wait_for_city_host_exit, } from "./city/index.js"; export type { AgentHttpBinding, AgentHttpListenOptions, AgentHttpRuntimeOptions, CityHttpRuntimeOptions, CityAgentHttpExtension, AgentRpcBinding, AgentRpcListenOptions, AgentRpcRuntimeOptions, CityRpcRuntimeOptions, AgentSessionModelResolver, CityHostOwner, CityHostState, } from "./city/index.js"; export type { SessionStore } from "./types/store/SessionStore.js"; export type { CompactActiveMessagesInput, CompactActiveMessagesResult, SessionMessageCommitState, SessionMessageStore, SessionDataStore, } from "./types/store/SessionDataStore.js"; export type { SessionAttachmentStore } from "./types/store/SessionAttachmentStore.js"; export { create_session_message_store } from "./workspace/store/SessionMessageStoreFactory.js"; export type { AgentStorage } from "./types/agent/AgentStorage.js"; export { RemoteAgent } from "./remote/RemoteAgent.js"; export { Session } from "./session/Session.js"; export type { SessionOptions } from "./types/session/SessionOptions.js"; export type { SessionOrigin } from "./types/session/SessionOrigin.js"; export { infer_agent_model_label, normalize_agent_model, read_agent_model_context_window, } from "./agent/AgentModel.js"; export type { AgentModel } from "./agent/AgentModel.js"; export type { AgentArchiveSessionInput, AgentArchiveSessionsInput, AgentArchiveSessionResult, AgentArchiveSessionsResult, AgentCleanArchiveResult, AgentCreateSessionInput, AgentListSessionsInput, AgentSessionConfigSnapshot, AgentSessionForkInput, AgentSessionInfo, AgentSessionSecurityConfig, AgentSessionSecurityStatus, AgentSessionSetInput, AgentSessionSetOptions, AgentSessionStatus, AgentSessionSummary, AgentSessionSummaryPage, AgentSessionSystemBlock, AgentSessionSystemBlockSource, AgentSessionSystemSessionInfo, AgentSessionSystemSnapshot, AgentSessionTimelineEvent, RemoteSessionSetInput, } from "./types/agent/SessionTypes.js"; export type { ListSessionMessagesInput, SessionActionMessage, SessionAssistantDataPart, SessionAssistantFilePart, SessionAssistantInteractionPart, SessionAssistantMessage, SessionAssistantMessagePart, SessionAssistantReasoningPart, SessionAssistantTextPart, SessionAssistantToolPart, SessionErrorMessage, SessionMessage, SessionMessagePage, SessionUserDataPart, SessionUserFilePart, SessionUserMessage, SessionUserMessagePart, SessionUserTextPart, } from "./types/session/SessionMessage.js"; export { to_session_message_timeline_events } from "./session/browse/SessionMessageTimeline.js"; export { SessionAssistantOutputAdapter } from "./session/execution/SessionAssistantOutputAdapter.js"; export type { SessionContextSnapshot, SessionMessageStorageStats, SessionSegmentRange, SessionSegmentSnapshot, SessionSegmentSummary, } from "./types/session/SessionSegment.js"; export { is_session_mutation, } from "./types/session/SessionMutation.js"; export type { SessionCompactMutation, SessionConfigMutation, SessionDeltaMutation, SessionMessageMutation, SessionMutation, SessionMutationSubscriber, SessionMutationUnsubscribe, SessionPartMutation, SessionStateMutation, SessionTitleMutation, SessionTurnMutation, } from "./types/session/SessionMutation.js"; export type { RespondSessionInteractionInput, SessionApprovalMode, SessionCancelledInteractionResult, SessionExpiredInteractionResult, SessionInteractionAnswer, SessionInteractionHandle, SessionInteractionLifecycle, SessionInteractionOption, SessionInteractionPort, SessionInteractionQuestion, SessionInteractionQuestionResponseType, SessionInteractionRequest, SessionInteractionResponse, SessionInteractionResult, SessionInteractionSource, SessionInteractionStatus, SessionPendingInteraction, SessionResolvedInteractionResult, } from "./types/session/SessionInteraction.js"; export type { AgentOptions, AgentSessionConstructor, } from "./types/agent/AgentOptions.js"; export type { AgentCreateSessionOptions, AgentSessionCollection, } from "./types/agent/AgentSessionCollection.js"; export type { AgentSession, AgentSessionActor, AgentSessions, RemoteAgentSession, } from "./types/agent/SessionActor.js"; export type { AgentManagedSession } from "./types/session/SessionOptions.js"; export type { RemoteAgentOptions } from "./types/agent/RemoteAgentOptions.js"; export type { RemoteAgentPluginActionInput, RemoteAgentPluginActionResult, } from "./types/agent/RemoteAgentPluginAction.js"; export type { AgentSessionActionCallback, AgentSessionActionEvent, AgentSessionActionRecord, AgentSessionActionState, } from "./types/sdk/AgentSessionAction.js"; export type { AgentSessionPromptInput } from "./types/sdk/AgentSessionPrompt.js"; export type { SessionPromptPart, SessionAssistantResultPart, SessionTextInputPart, SessionFileInputPart, SessionDataInputPart, } from "./types/session/SessionContent.js"; export type { AgentSessionStopResult } from "./types/sdk/AgentSessionStop.js"; export type { AgentSessionTurnHandle, AgentSessionTurnResult, } from "./types/sdk/AgentSessionTurn.js"; export type { AgentSessionCompactHandle, AgentSessionCompactReason, AgentSessionCompactResult, } from "./types/sdk/AgentSessionCompact.js"; export type { PluginContext } from "./types/plugin/PluginContext.js"; export type { AgentPluginContext } from "./types/plugin/AgentPluginContext.js"; export type { PluginNotificationInput, PluginNotificationPublisher, PluginNotificationTopicInput, } from "./types/plugin/PluginNotification.js"; export type { PluginWebServices, } from "./types/plugin/PluginServices.js"; export type { SessionPort } from "./types/session/SessionPort.js"; // Plugin 作者 API export { BasePlugin } from "./plugin/core/BasePlugin.js"; export { create_action, create_plugin, } from "./plugin/core/PluginActionFactory.js"; export type { CreatePluginActionOptions, CreatePluginOptions, } from "./plugin/core/PluginActionFactory.js"; export type { ActionResult, ActionResultMessage, } from "./types/action/ActionResult.js"; // Session 与即时执行集成 export { Executor } from "./executor/Executor.js"; export { DefaultSessionComposer } from "./session/DefaultSessionComposer.js"; export { SessionMessages } from "./session/SessionMessages.js"; export type { AppendCompletedAssistantMessageInput, AppendExternalSessionAssistantMessageInput, AppendExternalSessionUserMessageInput, AppendSessionErrorMessageInput, AppendSessionPromptMessageInput, AppendSessionUserMessageInput, OpenSessionActionMessageInput, OpenSessionAssistantMessageInput, SessionMessagesOptions, } from "./types/session/SessionMessages.js"; export type { SessionComposer, SessionCompactionInput, SessionCompactionPlan, SessionComposeIdentity, SessionComposeInput, SessionComposeState, SessionComposeTurn, SessionStepInput, } from "./types/session/SessionComposer.js"; export { DefaultSessionSystemComposer } from "./executor/composer/system/default/DefaultSessionSystemComposer.js"; export { resolve_session_system_messages } from "./executor/composer/system/default/SystemDomain.js"; export type { SessionExecutor, SessionTurnExecutionResult, } from "./types/session/SessionExecution.js"; export { create_session_turn_context } from "./session/runtime/SessionTurnContext.js"; export type { SessionTurnContext, SessionTurnContextInit, } from "./types/executor/SessionTurnContext.js"; export type { SessionToolExecutionContext } from "./types/executor/SessionToolExecutionContext.js"; export type { PluginExecutionContext } from "./types/plugin/PluginExecutionContext.js"; export type { PluginActionExecutionContext } from "./types/plugin/PluginActionExecution.js"; export type { ToolActionExecutionContext, ToolSessionExecutionScope, } from "./types/tools/ToolActionExecutionContext.js"; export type { SessionActionEvent, SessionActionEventInput, SessionActionStatus, } from "./types/session/SessionAction.js"; export type { SessionSystemMessage } from "./executor/types/SessionPrompts.js"; export { transform_prompts_into_system_messages } from "./executor/composer/system/default/PromptRenderer.js"; // 通用 plugin 宿主工具 export { build_static_plugin_availability, find_plugin_by_name, has_plugin_lifecycle, list_plugin_views, list_plugins_with_lifecycle, list_plugins_without_lifecycle, resolve_plugin_availability, to_plugin_view, } from "./plugin/core/PluginCatalog.js"; export { list_plugin_auth_policies, register_plugin_http_routes, } from "./plugin/core/PluginHttpRoutes.js"; // Runtime plugin 调度集成 export { ActionScheduleStore } from "./plugin/core/ActionScheduleStore.js"; export { parse_action_schedule_run_at_ms_or_throw } from "./plugin/core/ActionScheduleTime.js"; export { extract_session_message_text, extract_session_tool_calls, resolve_session_assistant_visible_text, } from "./session/messages/SessionMessageText.js"; export type { SessionToolCallSummary } from "./session/messages/SessionMessageText.js"; export { build_chat_message_text, parse_chat_message_markup, render_chat_message_file_tag, } from "./executor/messages/ChatMessageMarkup.js"; export type { ChatMessageFileTag, ChatMessageFileType, ChatMessageSegment, ChatMessageSendOptions, } from "./executor/messages/ChatMessageMarkupTypes.js"; // 日志 export { get_logger, type Logger } from "./utils/logger/Logger.js"; export { generate_id } from "./utils/Id.js"; export { format_date_time_in_timezone, resolve_runtime_timezone, } from "./utils/Time.js"; // JSON 基础类型 export type { JsonObject, JsonPrimitive, JsonValue } from "./types/common/Json.js"; // Plugin 作者与控制面类型 export type { PluginAction, PluginActionApi, PluginActionCommand, PluginActionCommandInput, PluginActionExample, PluginActionInputSchema, PluginActionMetadata, PluginActionResult, PluginActions, PluginActionInvokeParams, PluginActionInvokePort, PluginActionInvokeResult, } from "./types/plugin/PluginAction.js"; export type { Plugin } from "./types/plugin/PluginDefinition.js"; export type { PluginLifecycle } from "./types/plugin/PluginCommand.js"; export type { AgentPlugins, PluginAvailability, PluginEffectHook, PluginGuardHook, PluginHooks, PluginPipelineHook, PluginResolves, PluginResolveHook, PluginView, } from "./types/plugin/PluginRuntime.js"; export type { PluginHttpDefinition, PluginHttpRegistration, } from "./types/plugin/PluginHttp.js"; export type { PluginActionResponse, PluginCatalogResponse, PluginAvailabilityResponse, PluginAvailabilityView, } from "./plugin/types/PluginApi.js"; // 主动型 plugin 与 CLI/control 协议类型 export type { PluginState, PluginSnapshot } from "./types/plugin/PluginState.js"; export type { ActionScheduleJobRecord, ActionScheduleJobStatus, CreateActionScheduleJobInput, PluginActionScheduleInput, } from "./plugin/types/ActionSchedule.js"; export { list_plugin_states } from "./plugin/core/PluginStateController.js"; // 跨包 RPC 与 session 标识协议 export type { RpcEventFrame, RpcRequest, RpcServerFrame, } from "./types/rpc/RpcProtocol.js"; export { resolve_session_id } from "./executor/ids/resolveSessionId.js";