@downcity/agent 1.1.32 → 1.1.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +26 -84
- package/bin/config/Defaults.js +1 -1
- package/bin/config/Defaults.js.map +1 -1
- package/bin/config/DowncitySchema.d.ts.map +1 -1
- package/bin/config/DowncitySchema.js +2 -8
- package/bin/config/DowncitySchema.js.map +1 -1
- package/bin/config/Paths.d.ts +2 -2
- package/bin/config/Paths.js +2 -2
- package/bin/config/project/AgentInitializer.d.ts.map +1 -1
- package/bin/config/project/AgentInitializer.js +2 -2
- package/bin/config/project/AgentInitializer.js.map +1 -1
- package/bin/core/AgentContextTypes.d.ts +10 -10
- package/bin/core/AgentContextTypes.d.ts.map +1 -1
- package/bin/core/AgentContextTypes.js +1 -1
- package/bin/core/AgentCore.d.ts +14 -13
- package/bin/core/AgentCore.d.ts.map +1 -1
- package/bin/core/AgentCore.js +63 -90
- package/bin/core/AgentCore.js.map +1 -1
- package/bin/core/AgentCoreTypes.d.ts +4 -4
- package/bin/core/AgentCoreTypes.d.ts.map +1 -1
- package/bin/core/AgentCoreTypes.js +1 -1
- package/bin/{session → executor}/Executor.d.ts +4 -4
- package/bin/executor/Executor.d.ts.map +1 -0
- package/bin/executor/Executor.js.map +1 -0
- package/bin/{session → executor}/SessionRunScope.d.ts +5 -5
- package/bin/executor/SessionRunScope.d.ts.map +1 -0
- package/bin/{session → executor}/SessionRunScope.js +1 -1
- package/bin/executor/SessionRunScope.js.map +1 -0
- package/bin/{session → executor}/composer/compaction/SessionCompactionComposer.d.ts +1 -1
- package/bin/executor/composer/compaction/SessionCompactionComposer.d.ts.map +1 -0
- package/bin/executor/composer/compaction/SessionCompactionComposer.js.map +1 -0
- package/bin/executor/composer/compaction/jsonl/JsonlSessionCompactionComposer.d.ts.map +1 -0
- package/bin/executor/composer/compaction/jsonl/JsonlSessionCompactionComposer.js.map +1 -0
- package/bin/{session → executor}/composer/compaction/jsonl/JsonlSessionCompactionExecutor.d.ts +2 -2
- package/bin/executor/composer/compaction/jsonl/JsonlSessionCompactionExecutor.d.ts.map +1 -0
- package/bin/executor/composer/compaction/jsonl/JsonlSessionCompactionExecutor.js.map +1 -0
- package/bin/{session → executor}/composer/context/LocalSessionContextComposer.d.ts +2 -2
- package/bin/executor/composer/context/LocalSessionContextComposer.d.ts.map +1 -0
- package/bin/executor/composer/context/LocalSessionContextComposer.js.map +1 -0
- package/bin/{session → executor}/composer/context/SessionContextComposer.d.ts +2 -2
- package/bin/executor/composer/context/SessionContextComposer.d.ts.map +1 -0
- package/bin/executor/composer/context/SessionContextComposer.js.map +1 -0
- package/bin/{session → executor}/composer/history/SessionHistoryComposer.d.ts +2 -2
- package/bin/executor/composer/history/SessionHistoryComposer.d.ts.map +1 -0
- package/bin/executor/composer/history/SessionHistoryComposer.js.map +1 -0
- package/bin/{session → executor}/composer/history/SessionHistoryWriter.d.ts +2 -2
- package/bin/executor/composer/history/SessionHistoryWriter.d.ts.map +1 -0
- package/bin/executor/composer/history/SessionHistoryWriter.js.map +1 -0
- package/bin/{session → executor}/composer/history/jsonl/JsonlSessionHistoryComposer.d.ts +2 -2
- package/bin/executor/composer/history/jsonl/JsonlSessionHistoryComposer.d.ts.map +1 -0
- package/bin/executor/composer/history/jsonl/JsonlSessionHistoryComposer.js.map +1 -0
- package/bin/executor/composer/system/SessionSystemComposer.d.ts.map +1 -0
- package/bin/executor/composer/system/SessionSystemComposer.js.map +1 -0
- package/bin/{session → executor}/composer/system/default/DefaultSessionSystemComposer.d.ts +1 -1
- package/bin/executor/composer/system/default/DefaultSessionSystemComposer.d.ts.map +1 -0
- package/bin/executor/composer/system/default/DefaultSessionSystemComposer.js.map +1 -0
- package/bin/executor/composer/system/default/InitPromptAssets.d.ts.map +1 -0
- package/bin/executor/composer/system/default/InitPromptAssets.js.map +1 -0
- package/bin/executor/composer/system/default/InitPrompts.d.ts.map +1 -0
- package/bin/executor/composer/system/default/InitPrompts.js.map +1 -0
- package/bin/executor/composer/system/default/PromptRenderer.d.ts.map +1 -0
- package/bin/executor/composer/system/default/PromptRenderer.js.map +1 -0
- package/bin/executor/composer/system/default/StaticPromptCatalog.d.ts.map +1 -0
- package/bin/executor/composer/system/default/StaticPromptCatalog.js.map +1 -0
- package/bin/{session → executor}/composer/system/default/SystemDomain.d.ts +9 -9
- package/bin/executor/composer/system/default/SystemDomain.d.ts.map +1 -0
- package/bin/{session → executor}/composer/system/default/SystemDomain.js +17 -17
- package/bin/executor/composer/system/default/SystemDomain.js.map +1 -0
- package/bin/executor/composer/system/default/SystemPromptAssets.d.ts.map +1 -0
- package/bin/executor/composer/system/default/SystemPromptAssets.js.map +1 -0
- package/bin/executor/composer/system/default/assets/core.prompt.d.ts.map +1 -0
- package/bin/{session → executor}/composer/system/default/assets/core.prompt.js +1 -1
- package/bin/executor/composer/system/default/assets/core.prompt.js.map +1 -0
- package/bin/executor/composer/system/default/assets/init/PROFILE.md.d.ts.map +1 -0
- package/bin/{session → executor}/composer/system/default/assets/init/PROFILE.md.js +1 -1
- package/bin/executor/composer/system/default/assets/init/PROFILE.md.js.map +1 -0
- package/bin/executor/composer/system/default/assets/init/SOUL.md.d.ts.map +1 -0
- package/bin/{session → executor}/composer/system/default/assets/init/SOUL.md.js +1 -1
- package/bin/executor/composer/system/default/assets/init/SOUL.md.js.map +1 -0
- package/bin/{session → executor}/composer/system/default/assets/plugin.prompt.d.ts +1 -1
- package/bin/executor/composer/system/default/assets/plugin.prompt.d.ts.map +1 -0
- package/bin/executor/composer/system/default/assets/plugin.prompt.js +8 -0
- package/bin/executor/composer/system/default/assets/plugin.prompt.js.map +1 -0
- package/bin/executor/composer/system/default/assets/task.prompt.d.ts.map +1 -0
- package/bin/{session → executor}/composer/system/default/assets/task.prompt.js +1 -1
- package/bin/executor/composer/system/default/assets/task.prompt.js.map +1 -0
- package/bin/executor/composer/system/default/variables/GeoContext.d.ts.map +1 -0
- package/bin/executor/composer/system/default/variables/GeoContext.js.map +1 -0
- package/bin/executor/composer/system/default/variables/PromptTypes.d.ts.map +1 -0
- package/bin/executor/composer/system/default/variables/PromptTypes.js.map +1 -0
- package/bin/executor/composer/system/default/variables/VariableReplacer.d.ts.map +1 -0
- package/bin/executor/composer/system/default/variables/VariableReplacer.js.map +1 -0
- package/bin/executor/core-engine/CoreEngineError.d.ts.map +1 -0
- package/bin/executor/core-engine/CoreEngineError.js.map +1 -0
- package/bin/{session → executor}/core-engine/CoreEngineLoopDecision.d.ts +1 -1
- package/bin/executor/core-engine/CoreEngineLoopDecision.d.ts.map +1 -0
- package/bin/executor/core-engine/CoreEngineLoopDecision.js.map +1 -0
- package/bin/{session → executor}/core-engine/CoreEngineMessageState.d.ts +1 -1
- package/bin/executor/core-engine/CoreEngineMessageState.d.ts.map +1 -0
- package/bin/executor/core-engine/CoreEngineMessageState.js.map +1 -0
- package/bin/{session → executor}/core-engine/CoreEngineSignals.d.ts +1 -1
- package/bin/executor/core-engine/CoreEngineSignals.d.ts.map +1 -0
- package/bin/executor/core-engine/CoreEngineSignals.js.map +1 -0
- package/bin/{session → executor}/core-engine/CoreEngineUiStreamCollector.d.ts +1 -1
- package/bin/executor/core-engine/CoreEngineUiStreamCollector.d.ts.map +1 -0
- package/bin/executor/core-engine/CoreEngineUiStreamCollector.js.map +1 -0
- package/bin/executor/ids/resolveSessionId.d.ts.map +1 -0
- package/bin/executor/ids/resolveSessionId.js.map +1 -0
- package/bin/{session → executor}/messages/AssistantResultPersistence.d.ts +1 -1
- package/bin/executor/messages/AssistantResultPersistence.d.ts.map +1 -0
- package/bin/executor/messages/AssistantResultPersistence.js.map +1 -0
- package/bin/{session → executor}/messages/SessionAttachmentMapper.d.ts +1 -1
- package/bin/executor/messages/SessionAttachmentMapper.d.ts.map +1 -0
- package/bin/executor/messages/SessionAttachmentMapper.js.map +1 -0
- package/bin/{session → executor}/messages/SessionMessageCodec.d.ts +1 -1
- package/bin/executor/messages/SessionMessageCodec.d.ts.map +1 -0
- package/bin/executor/messages/SessionMessageCodec.js.map +1 -0
- package/bin/{session → executor}/messages/SessionMessageLog.d.ts +1 -1
- package/bin/executor/messages/SessionMessageLog.d.ts.map +1 -0
- package/bin/executor/messages/SessionMessageLog.js.map +1 -0
- package/bin/{session → executor}/messages/SessionStepEventMapper.d.ts +1 -1
- package/bin/executor/messages/SessionStepEventMapper.d.ts.map +1 -0
- package/bin/executor/messages/SessionStepEventMapper.js.map +1 -0
- package/bin/{session → executor}/store/history/SessionHistoryStore.d.ts +2 -2
- package/bin/executor/store/history/SessionHistoryStore.d.ts.map +1 -0
- package/bin/executor/store/history/SessionHistoryStore.js.map +1 -0
- package/bin/{session → executor}/store/history/jsonl/JsonlSessionHistoryStore.d.ts +3 -3
- package/bin/executor/store/history/jsonl/JsonlSessionHistoryStore.d.ts.map +1 -0
- package/bin/executor/store/history/jsonl/JsonlSessionHistoryStore.js.map +1 -0
- package/bin/{session → executor}/tools/shell/ShellToolBridge.d.ts +5 -5
- package/bin/executor/tools/shell/ShellToolBridge.d.ts.map +1 -0
- package/bin/{session → executor}/tools/shell/ShellToolBridge.js +3 -3
- package/bin/executor/tools/shell/ShellToolBridge.js.map +1 -0
- package/bin/{session → executor}/tools/shell/ShellToolDefinition.d.ts +2 -2
- package/bin/executor/tools/shell/ShellToolDefinition.d.ts.map +1 -0
- package/bin/{session → executor}/tools/shell/ShellToolDefinition.js +2 -2
- package/bin/executor/tools/shell/ShellToolDefinition.js.map +1 -0
- package/bin/{session → executor}/tools/shell/ShellToolFormatting.d.ts +2 -2
- package/bin/executor/tools/shell/ShellToolFormatting.d.ts.map +1 -0
- package/bin/{session → executor}/tools/shell/ShellToolFormatting.js +2 -2
- package/bin/executor/tools/shell/ShellToolFormatting.js.map +1 -0
- package/bin/executor/tools/shell/ShellToolSchemas.d.ts.map +1 -0
- package/bin/{session → executor}/tools/shell/ShellToolSchemas.js +1 -1
- package/bin/executor/tools/shell/ShellToolSchemas.js.map +1 -0
- package/bin/{session → executor}/types/SessionExecutor.d.ts +1 -1
- package/bin/executor/types/SessionExecutor.d.ts.map +1 -0
- package/bin/executor/types/SessionExecutor.js.map +1 -0
- package/bin/executor/types/SessionHistoryMeta.d.ts.map +1 -0
- package/bin/executor/types/SessionHistoryMeta.js.map +1 -0
- package/bin/executor/types/SessionHistoryPaths.d.ts.map +1 -0
- package/bin/executor/types/SessionHistoryPaths.js.map +1 -0
- package/bin/executor/types/SessionLoop.d.ts.map +1 -0
- package/bin/executor/types/SessionLoop.js.map +1 -0
- package/bin/executor/types/SessionMessages.d.ts.map +1 -0
- package/bin/executor/types/SessionMessages.js.map +1 -0
- package/bin/executor/types/SessionPrompts.d.ts.map +1 -0
- package/bin/executor/types/SessionPrompts.js.map +1 -0
- package/bin/{session → executor}/types/SessionRun.d.ts +2 -2
- package/bin/executor/types/SessionRun.d.ts.map +1 -0
- package/bin/executor/types/SessionRun.js.map +1 -0
- package/bin/index.d.ts +26 -26
- package/bin/index.d.ts.map +1 -1
- package/bin/index.js +19 -19
- package/bin/index.js.map +1 -1
- package/bin/plugin/builtins/asr/Plugin.d.ts +7 -3
- package/bin/plugin/builtins/asr/Plugin.d.ts.map +1 -1
- package/bin/plugin/builtins/asr/Plugin.js +404 -394
- package/bin/plugin/builtins/asr/Plugin.js.map +1 -1
- package/bin/plugin/builtins/auth/Plugin.d.ts +7 -3
- package/bin/plugin/builtins/auth/Plugin.d.ts.map +1 -1
- package/bin/plugin/builtins/auth/Plugin.js +133 -123
- package/bin/plugin/builtins/auth/Plugin.js.map +1 -1
- package/bin/plugin/builtins/chat/Action.d.ts +4 -4
- package/bin/plugin/builtins/chat/Action.js +5 -5
- package/bin/plugin/builtins/chat/Action.js.map +1 -1
- package/bin/plugin/builtins/chat/ChatPlugin.js +3 -3
- package/bin/plugin/builtins/chat/ChatPlugin.js.map +1 -1
- package/bin/plugin/builtins/chat/ChatPluginTypes.d.ts +1 -1
- package/bin/plugin/builtins/chat/PROMPT.direct.d.ts +1 -1
- package/bin/plugin/builtins/chat/PROMPT.direct.d.ts.map +1 -1
- package/bin/plugin/builtins/chat/PROMPT.direct.js +1 -1
- package/bin/plugin/builtins/chat/PROMPT.direct.js.map +1 -1
- package/bin/plugin/builtins/chat/accounts/{ChannelAccountService.d.ts → ChannelAccountManager.d.ts} +4 -4
- package/bin/plugin/builtins/chat/accounts/{ChannelAccountService.d.ts.map → ChannelAccountManager.d.ts.map} +1 -1
- package/bin/plugin/builtins/chat/accounts/{ChannelAccountService.js → ChannelAccountManager.js} +4 -4
- package/bin/plugin/builtins/chat/accounts/{ChannelAccountService.js.map → ChannelAccountManager.js.map} +1 -1
- package/bin/plugin/builtins/chat/channels/feishu/types/FeishuChannel.d.ts +1 -1
- package/bin/plugin/builtins/chat/channels/feishu/types/FeishuChannel.js +1 -1
- package/bin/plugin/builtins/chat/channels/qq/PROMPT.direct.d.ts +1 -1
- package/bin/plugin/builtins/chat/channels/qq/PROMPT.direct.d.ts.map +1 -1
- package/bin/plugin/builtins/chat/channels/qq/PROMPT.direct.js +1 -1
- package/bin/plugin/builtins/chat/channels/qq/PROMPT.direct.js.map +1 -1
- package/bin/plugin/builtins/chat/channels/qq/types/QqChannel.d.ts +1 -1
- package/bin/plugin/builtins/chat/channels/qq/types/QqChannel.js +1 -1
- package/bin/plugin/builtins/chat/runtime/ChatActionExecution.d.ts +1 -1
- package/bin/plugin/builtins/chat/runtime/ChatActionExecution.js +2 -2
- package/bin/plugin/builtins/chat/runtime/ChatActionExecution.js.map +1 -1
- package/bin/plugin/builtins/chat/runtime/ChatActionInput.d.ts +1 -1
- package/bin/plugin/builtins/chat/runtime/ChatActionInput.js +1 -1
- package/bin/plugin/builtins/chat/runtime/ChatChannelConfig.js +8 -8
- package/bin/plugin/builtins/chat/runtime/ChatChannelConfig.js.map +1 -1
- package/bin/plugin/builtins/chat/runtime/ChatChannelCore.js +11 -11
- package/bin/plugin/builtins/chat/runtime/ChatChannelCore.js.map +1 -1
- package/bin/plugin/builtins/chat/runtime/ChatChannelFacade.d.ts +1 -1
- package/bin/plugin/builtins/chat/runtime/ChatChannelFacade.js +1 -1
- package/bin/plugin/builtins/chat/runtime/ChatChannelLifecycle.d.ts +1 -1
- package/bin/plugin/builtins/chat/runtime/ChatChannelLifecycle.js +1 -1
- package/bin/plugin/builtins/chat/runtime/ChatMetaStore.d.ts +2 -2
- package/bin/plugin/builtins/chat/runtime/ChatMetaStore.js +2 -2
- package/bin/plugin/builtins/chat/runtime/ChatPluginActionRegistry.d.ts +3 -3
- package/bin/plugin/builtins/chat/runtime/ChatPluginActionRegistry.js +3 -3
- package/bin/plugin/builtins/chat/runtime/ChatPluginSystem.js +2 -2
- package/bin/plugin/builtins/chat/runtime/ChatPluginSystem.js.map +1 -1
- package/bin/plugin/builtins/chat/runtime/ChatPromptAssets.d.ts +3 -3
- package/bin/plugin/builtins/chat/runtime/ChatPromptAssets.d.ts.map +1 -1
- package/bin/plugin/builtins/chat/runtime/ChatPromptAssets.js +4 -4
- package/bin/plugin/builtins/chat/runtime/ChatPromptAssets.js.map +1 -1
- package/bin/plugin/builtins/chat/runtime/ChatQueueStore.d.ts +4 -4
- package/bin/plugin/builtins/chat/runtime/ChatQueueStore.js +4 -4
- package/bin/plugin/builtins/chat/runtime/ChatQueueStore.js.map +1 -1
- package/bin/plugin/builtins/chat/runtime/ChatQueueWorker.d.ts +3 -3
- package/bin/plugin/builtins/chat/runtime/ChatQueueWorker.js +3 -3
- package/bin/plugin/builtins/chat/runtime/ChatSession.d.ts +6 -6
- package/bin/plugin/builtins/chat/runtime/ChatSession.d.ts.map +1 -1
- package/bin/plugin/builtins/chat/runtime/ChatSession.js +1 -1
- package/bin/plugin/builtins/chat/runtime/ChatSession.js.map +1 -1
- package/bin/plugin/builtins/chat/runtime/ChatSessionContextComposer.d.ts +3 -3
- package/bin/plugin/builtins/chat/runtime/ChatSessionContextComposer.d.ts.map +1 -1
- package/bin/plugin/builtins/chat/runtime/ChatSessionContextComposer.js +2 -2
- package/bin/plugin/builtins/chat/runtime/ChatSessionContextComposer.js.map +1 -1
- package/bin/plugin/builtins/chat/runtime/ChatSessionTypes.d.ts +2 -2
- package/bin/plugin/builtins/chat/runtime/ChatSessionTypes.d.ts.map +1 -1
- package/bin/plugin/builtins/chat/runtime/ChatkeySend.d.ts +1 -1
- package/bin/plugin/builtins/chat/runtime/ChatkeySend.js +1 -1
- package/bin/plugin/builtins/chat/runtime/InboundAugment.d.ts +1 -1
- package/bin/plugin/builtins/chat/runtime/InboundAugment.js +1 -1
- package/bin/plugin/builtins/chat/runtime/PluginDispatch.d.ts +2 -2
- package/bin/plugin/builtins/chat/runtime/PluginDispatch.js +2 -2
- package/bin/plugin/builtins/chat/runtime/PluginPoints.d.ts +10 -10
- package/bin/plugin/builtins/chat/runtime/PluginPoints.js +10 -10
- package/bin/plugin/builtins/chat/runtime/SystemPrompt.js +1 -1
- package/bin/plugin/builtins/chat/runtime/SystemPrompt.js.map +1 -1
- package/bin/plugin/builtins/chat/runtime/UIMessageTransformer.d.ts +1 -1
- package/bin/plugin/builtins/chat/runtime/UIMessageTransformer.d.ts.map +1 -1
- package/bin/plugin/builtins/chat/runtime/UserVisibleText.d.ts +1 -1
- package/bin/plugin/builtins/chat/runtime/UserVisibleText.d.ts.map +1 -1
- package/bin/plugin/builtins/chat/types/ChannelContext.d.ts +1 -1
- package/bin/plugin/builtins/chat/types/ChannelContext.js +1 -1
- package/bin/plugin/builtins/chat/types/ChannelStatus.d.ts +1 -1
- package/bin/plugin/builtins/chat/types/ChatMessageMarkup.d.ts +1 -1
- package/bin/plugin/builtins/chat/types/ChatMessageMarkup.js +1 -1
- package/bin/plugin/builtins/chat/types/ChatMeta.d.ts +2 -2
- package/bin/plugin/builtins/chat/types/ChatMeta.js +2 -2
- package/bin/plugin/builtins/chat/types/ChatPlugin.d.ts +6 -6
- package/bin/plugin/builtins/chat/types/ChatPlugin.js +3 -3
- package/bin/plugin/builtins/chat/types/ChatPluginActionPayload.d.ts +2 -2
- package/bin/plugin/builtins/chat/types/ChatPluginActionPayload.js +2 -2
- package/bin/plugin/builtins/chat/types/ChatPromptContext.d.ts +2 -2
- package/bin/plugin/builtins/chat/types/ChatRuntime.d.ts +3 -3
- package/bin/plugin/builtins/chat/types/ChatRuntime.js +2 -2
- package/bin/plugin/builtins/contact/Action.d.ts +3 -3
- package/bin/plugin/builtins/contact/Action.js +2 -2
- package/bin/plugin/builtins/contact/ContactPlugin.js +2 -2
- package/bin/plugin/builtins/contact/ContactPlugin.js.map +1 -1
- package/bin/plugin/builtins/contact/runtime/ContactPromptAssets.d.ts +2 -2
- package/bin/plugin/builtins/contact/runtime/ContactPromptAssets.js +2 -2
- package/bin/plugin/builtins/contact/runtime/Paths.d.ts +1 -1
- package/bin/plugin/builtins/contact/runtime/Paths.js +1 -1
- package/bin/plugin/builtins/contact/runtime/RemoteClient.d.ts +1 -1
- package/bin/plugin/builtins/contact/runtime/RemoteClient.js +2 -2
- package/bin/plugin/builtins/contact/runtime/RemoteClient.js.map +1 -1
- package/bin/plugin/builtins/contact/types/ContactCheck.d.ts +2 -2
- package/bin/plugin/builtins/contact/types/ContactCheck.d.ts.map +1 -1
- package/bin/plugin/builtins/contact/types/ContactCommand.d.ts +1 -1
- package/bin/plugin/builtins/contact/types/ContactCommand.js +1 -1
- package/bin/plugin/builtins/memory/MemoryPlugin.d.ts +1 -1
- package/bin/plugin/builtins/memory/MemoryPlugin.js +1 -1
- package/bin/plugin/builtins/memory/runtime/Search.js +1 -1
- package/bin/plugin/builtins/memory/runtime/Search.js.map +1 -1
- package/bin/plugin/builtins/memory/runtime/Store.d.ts +3 -3
- package/bin/plugin/builtins/memory/runtime/Store.js +3 -3
- package/bin/plugin/builtins/shell/ShellRuntimeTypes.d.ts +4 -4
- package/bin/plugin/builtins/shell/ShellRuntimeTypes.js +3 -3
- package/bin/plugin/builtins/shell/runtime/ShellActionRuntime.d.ts +2 -2
- package/bin/plugin/builtins/shell/runtime/ShellActionRuntime.js +2 -2
- package/bin/plugin/builtins/shell/runtime/ShellActionRuntimeSupport.d.ts +2 -2
- package/bin/plugin/builtins/shell/runtime/ShellActionRuntimeSupport.js +2 -2
- package/bin/plugin/builtins/shell/runtime/ShellProcessEvents.d.ts +1 -1
- package/bin/plugin/builtins/shell/runtime/ShellRuntimeEnvironment.js +1 -1
- package/bin/plugin/builtins/shell/runtime/ShellRuntimeEnvironment.js.map +1 -1
- package/bin/plugin/builtins/shell/types/ShellPlugin.d.ts +4 -4
- package/bin/plugin/builtins/shell/types/ShellPlugin.js +2 -2
- package/bin/plugin/builtins/skill/Plugin.d.ts +8 -4
- package/bin/plugin/builtins/skill/Plugin.d.ts.map +1 -1
- package/bin/plugin/builtins/skill/Plugin.js +215 -205
- package/bin/plugin/builtins/skill/Plugin.js.map +1 -1
- package/bin/plugin/builtins/skill/runtime/SystemProvider.js +1 -1
- package/bin/plugin/builtins/skill/runtime/SystemProvider.js.map +1 -1
- package/bin/plugin/builtins/task/PROMPT.d.ts +1 -1
- package/bin/plugin/builtins/task/PROMPT.d.ts.map +1 -1
- package/bin/plugin/builtins/task/PROMPT.js +1 -1
- package/bin/plugin/builtins/task/PROMPT.js.map +1 -1
- package/bin/plugin/builtins/task/Scheduler.d.ts +4 -4
- package/bin/plugin/builtins/task/Scheduler.d.ts.map +1 -1
- package/bin/plugin/builtins/task/Scheduler.js +2 -2
- package/bin/plugin/builtins/task/runtime/CronTrigger.d.ts +4 -4
- package/bin/plugin/builtins/task/runtime/CronTrigger.d.ts.map +1 -1
- package/bin/plugin/builtins/task/runtime/CronTrigger.js +2 -2
- package/bin/plugin/builtins/task/runtime/CronTrigger.js.map +1 -1
- package/bin/plugin/builtins/task/runtime/TaskActionExecution.d.ts +1 -1
- package/bin/plugin/builtins/task/runtime/TaskActionExecution.js +1 -1
- package/bin/plugin/builtins/task/runtime/TaskActionInput.d.ts +1 -1
- package/bin/plugin/builtins/task/runtime/TaskActionInput.js +2 -2
- package/bin/plugin/builtins/task/runtime/TaskActionInput.js.map +1 -1
- package/bin/plugin/builtins/task/runtime/TaskPluginActionRegistry.d.ts +3 -3
- package/bin/plugin/builtins/task/runtime/TaskPluginActionRegistry.js +3 -3
- package/bin/plugin/builtins/task/runtime/TaskPromptAssets.d.ts.map +1 -1
- package/bin/plugin/builtins/task/runtime/TaskPromptAssets.js +2 -2
- package/bin/plugin/builtins/task/runtime/TaskPromptAssets.js.map +1 -1
- package/bin/plugin/builtins/task/runtime/TaskRunChatDispatch.d.ts +2 -2
- package/bin/plugin/builtins/task/runtime/TaskRunChatDispatch.js +2 -2
- package/bin/plugin/builtins/task/runtime/TaskRunnerRound.d.ts +1 -1
- package/bin/plugin/builtins/task/runtime/TaskRunnerRound.d.ts.map +1 -1
- package/bin/plugin/builtins/task/runtime/TaskRunnerRound.js +1 -1
- package/bin/plugin/builtins/task/runtime/TaskRunnerRound.js.map +1 -1
- package/bin/plugin/builtins/task/runtime/TaskRunnerSession.d.ts +1 -1
- package/bin/plugin/builtins/task/runtime/TaskRunnerSession.d.ts.map +1 -1
- package/bin/plugin/builtins/task/runtime/TaskRunnerSession.js +8 -8
- package/bin/plugin/builtins/task/runtime/TaskRunnerSession.js.map +1 -1
- package/bin/plugin/builtins/task/runtime/TaskRunnerTypes.d.ts +2 -2
- package/bin/plugin/builtins/task/runtime/TaskRunnerTypes.d.ts.map +1 -1
- package/bin/plugin/builtins/task/types/Cron.d.ts +3 -3
- package/bin/plugin/builtins/task/types/Cron.d.ts.map +1 -1
- package/bin/plugin/builtins/task/types/TaskPluginTypes.d.ts +3 -3
- package/bin/plugin/builtins/task/types/TaskPluginTypes.js +3 -3
- package/bin/plugin/builtins/tts/Plugin.d.ts +7 -3
- package/bin/plugin/builtins/tts/Plugin.d.ts.map +1 -1
- package/bin/plugin/builtins/tts/Plugin.js +419 -409
- package/bin/plugin/builtins/tts/Plugin.js.map +1 -1
- package/bin/plugin/builtins/web/Plugin.d.ts +7 -3
- package/bin/plugin/builtins/web/Plugin.d.ts.map +1 -1
- package/bin/plugin/builtins/web/Plugin.js +380 -370
- package/bin/plugin/builtins/web/Plugin.js.map +1 -1
- package/bin/plugin/builtins/workboard/Plugin.d.ts +7 -3
- package/bin/plugin/builtins/workboard/Plugin.d.ts.map +1 -1
- package/bin/plugin/builtins/workboard/Plugin.js +64 -54
- package/bin/plugin/builtins/workboard/Plugin.js.map +1 -1
- package/bin/plugin/builtins/workboard/runtime/Collector.d.ts +1 -1
- package/bin/plugin/builtins/workboard/runtime/Collector.js +2 -2
- package/bin/plugin/builtins/workboard/runtime/Collector.js.map +1 -1
- package/bin/plugin/builtins/workboard/runtime/Normalizer.d.ts +2 -2
- package/bin/plugin/builtins/workboard/runtime/Normalizer.d.ts.map +1 -1
- package/bin/plugin/builtins/workboard/runtime/Normalizer.js +1 -1
- package/bin/plugin/builtins/workboard/runtime/Normalizer.js.map +1 -1
- package/bin/plugin/core/BasePlugin.d.ts +2 -2
- package/bin/plugin/core/BasePlugin.js +2 -2
- package/bin/plugin/core/BuiltinPluginClasses.d.ts +8 -3
- package/bin/plugin/core/BuiltinPluginClasses.d.ts.map +1 -1
- package/bin/plugin/core/BuiltinPluginClasses.js +19 -2
- package/bin/plugin/core/BuiltinPluginClasses.js.map +1 -1
- package/bin/plugin/core/Catalog.d.ts +4 -3
- package/bin/plugin/core/Catalog.d.ts.map +1 -1
- package/bin/plugin/core/Catalog.js +3 -3
- package/bin/plugin/core/Catalog.js.map +1 -1
- package/bin/plugin/core/HttpRoutes.d.ts +2 -2
- package/bin/plugin/core/HttpRoutes.d.ts.map +1 -1
- package/bin/plugin/core/HttpRoutes.js +6 -6
- package/bin/plugin/core/HttpRoutes.js.map +1 -1
- package/bin/plugin/core/LocalExecution.d.ts.map +1 -1
- package/bin/plugin/core/LocalExecution.js +15 -0
- package/bin/plugin/core/LocalExecution.js.map +1 -1
- package/bin/plugin/core/PluginActionRunner.d.ts.map +1 -1
- package/bin/plugin/core/PluginActionRunner.js +0 -1
- package/bin/plugin/core/PluginActionRunner.js.map +1 -1
- package/bin/plugin/core/PluginClassRegistry.d.ts +24 -4
- package/bin/plugin/core/PluginClassRegistry.d.ts.map +1 -1
- package/bin/plugin/core/PluginClassRegistry.js +30 -4
- package/bin/plugin/core/PluginClassRegistry.js.map +1 -1
- package/bin/plugin/core/PluginCommand.d.ts +2 -2
- package/bin/plugin/core/PluginCommand.js +4 -4
- package/bin/plugin/core/PluginCommand.js.map +1 -1
- package/bin/plugin/core/PluginCommandRequest.d.ts +4 -4
- package/bin/plugin/core/PluginCommandRequest.js +3 -3
- package/bin/plugin/core/PluginStateController.js +2 -2
- package/bin/plugin/core/PluginStateController.js.map +1 -1
- package/bin/plugin/core/schedule/Store.d.ts +2 -2
- package/bin/plugin/core/schedule/Store.js +2 -2
- package/bin/plugin/core/schedule/Time.d.ts +1 -1
- package/bin/plugin/core/schedule/Time.js +1 -1
- package/bin/plugin/types/Plugin.d.ts +17 -21
- package/bin/plugin/types/Plugin.d.ts.map +1 -1
- package/bin/plugin/types/PluginApi.d.ts +3 -3
- package/bin/plugin/types/PluginApi.d.ts.map +1 -1
- package/bin/plugin/types/PluginApi.js +1 -1
- package/bin/plugin/types/PluginState.d.ts +1 -1
- package/bin/plugin/types/PluginState.d.ts.map +1 -1
- package/bin/plugin/types/Plugins.d.ts +2 -2
- package/bin/plugin/types/Plugins.d.ts.map +1 -1
- package/bin/runtime/host/AgentHostRuntime.js +1 -1
- package/bin/runtime/host/daemon/Api.d.ts +2 -2
- package/bin/runtime/host/daemon/Api.js +1 -1
- package/bin/runtime/sandbox/types/SandboxRuntime.d.ts +1 -1
- package/bin/runtime/sandbox/types/SandboxRuntime.js +1 -1
- package/bin/runtime/server/http/Server.d.ts +8 -8
- package/bin/runtime/server/http/Server.d.ts.map +1 -1
- package/bin/runtime/server/http/Server.js +8 -30
- package/bin/runtime/server/http/Server.js.map +1 -1
- package/bin/runtime/server/http/control/ExecuteBySession.d.ts +1 -1
- package/bin/runtime/server/http/control/MessageTimeline.d.ts +1 -1
- package/bin/runtime/server/http/control/MessageTimeline.d.ts.map +1 -1
- package/bin/runtime/server/http/control/OverviewRoutes.d.ts +1 -1
- package/bin/runtime/server/http/control/OverviewRoutes.d.ts.map +1 -1
- package/bin/runtime/server/http/control/OverviewRoutes.js +2 -6
- package/bin/runtime/server/http/control/OverviewRoutes.js.map +1 -1
- package/bin/runtime/server/http/control/SessionRoutes.js +1 -1
- package/bin/runtime/server/http/control/SessionRoutes.js.map +1 -1
- package/bin/runtime/server/http/control/TaskRoutes.d.ts +1 -1
- package/bin/runtime/server/http/control/TaskRoutes.js +1 -1
- package/bin/runtime/server/http/plugins/plugins.d.ts +3 -3
- package/bin/runtime/server/http/plugins/plugins.d.ts.map +1 -1
- package/bin/runtime/server/http/plugins/plugins.js +61 -4
- package/bin/runtime/server/http/plugins/plugins.js.map +1 -1
- package/bin/runtime/server/http/sdk/Router.d.ts +2 -2
- package/bin/runtime/server/http/sdk/Router.d.ts.map +1 -1
- package/bin/runtime/server/http/sdk/Router.js +2 -2
- package/bin/runtime/server/http/sdk/Router.js.map +1 -1
- package/bin/runtime/server/http/sdk/SessionRoutes.d.ts +2 -2
- package/bin/runtime/server/http/sdk/SessionRoutes.d.ts.map +1 -1
- package/bin/runtime/server/http/sdk/SessionRoutes.js +72 -13
- package/bin/runtime/server/http/sdk/SessionRoutes.js.map +1 -1
- package/bin/runtime/server/rpc/Server.d.ts +2 -4
- package/bin/runtime/server/rpc/Server.d.ts.map +1 -1
- package/bin/runtime/server/rpc/Server.js +7 -12
- package/bin/runtime/server/rpc/Server.js.map +1 -1
- package/bin/sdk/Agent.d.ts +21 -20
- package/bin/sdk/Agent.d.ts.map +1 -1
- package/bin/sdk/Agent.js +46 -33
- package/bin/sdk/Agent.js.map +1 -1
- package/bin/sdk/AgentSdkTypes.d.ts +310 -38
- package/bin/sdk/AgentSdkTypes.d.ts.map +1 -1
- package/bin/sdk/AgentSdkTypes.js +1 -1
- package/bin/sdk/RemoteAgent.d.ts +9 -57
- package/bin/sdk/RemoteAgent.d.ts.map +1 -1
- package/bin/sdk/RemoteAgent.js +62 -14
- package/bin/sdk/RemoteAgent.js.map +1 -1
- package/bin/sdk/Session.d.ts +15 -16
- package/bin/sdk/Session.d.ts.map +1 -1
- package/bin/sdk/Session.js +47 -35
- package/bin/sdk/Session.js.map +1 -1
- package/bin/sdk/SessionSystemBuilder.d.ts +8 -8
- package/bin/sdk/SessionSystemBuilder.d.ts.map +1 -1
- package/bin/sdk/SessionSystemBuilder.js +6 -6
- package/bin/sdk/SessionSystemBuilder.js.map +1 -1
- package/bin/sdk/session/Browse.d.ts +76 -0
- package/bin/sdk/session/Browse.d.ts.map +1 -0
- package/bin/sdk/session/Browse.js +418 -0
- package/bin/sdk/session/Browse.js.map +1 -0
- package/bin/sdk/session/Metadata.d.ts +1 -1
- package/bin/sdk/session/Metadata.d.ts.map +1 -1
- package/bin/sdk/session/Persistence.d.ts +1 -1
- package/bin/sdk/session/Persistence.d.ts.map +1 -1
- package/bin/sdk/session/Persistence.js +1 -1
- package/bin/sdk/session/Persistence.js.map +1 -1
- package/bin/sdk/session/RuntimeSessionPort.d.ts +4 -4
- package/bin/sdk/session/RuntimeSessionPort.d.ts.map +1 -1
- package/bin/sdk/session/RuntimeSessionPort.js +3 -3
- package/bin/sdk/session/index.d.ts +2 -1
- package/bin/sdk/session/index.d.ts.map +1 -1
- package/bin/sdk/session/index.js +2 -1
- package/bin/sdk/session/index.js.map +1 -1
- package/bin/sdk/session/runtime/SessionPromptRuntime.d.ts +2 -2
- package/bin/sdk/session/runtime/SessionPromptRuntime.d.ts.map +1 -1
- package/bin/types/config/DowncityConfig.d.ts +132 -96
- package/bin/types/config/DowncityConfig.d.ts.map +1 -1
- package/bin/types/runtime/host/AgentHost.d.ts +1 -1
- package/bin/types/runtime/host/AgentHost.js +1 -1
- package/bin/types/runtime/http/InlineInstant.d.ts +2 -2
- package/bin/types/runtime/http/InlineInstant.d.ts.map +1 -1
- package/bin/types/runtime/platform/PlatformGateway.d.ts +10 -10
- package/bin/types/runtime/platform/PlatformGateway.d.ts.map +1 -1
- package/bin/types/sdk/AgentSessionEvent.d.ts +1 -1
- package/bin/types/sdk/AgentSessionEvent.d.ts.map +1 -1
- package/bin/types/sdk/AgentSessionTurn.d.ts +1 -1
- package/bin/types/sdk/AgentSessionTurn.d.ts.map +1 -1
- package/package.json +2 -2
- package/scripts/session-prompt-runtime.test.mjs +30 -10
- package/src/config/Defaults.ts +1 -1
- package/src/config/DowncitySchema.ts +2 -8
- package/src/config/Paths.ts +2 -2
- package/src/config/project/AgentInitializer.ts +4 -5
- package/src/core/AgentContextTypes.ts +10 -10
- package/src/core/AgentCore.ts +86 -93
- package/src/core/AgentCoreTypes.ts +4 -4
- package/src/{session → executor}/Executor.ts +21 -21
- package/src/{session → executor}/README.md +5 -5
- package/src/{session → executor}/SessionRunScope.ts +5 -5
- package/src/{session → executor}/composer/compaction/SessionCompactionComposer.ts +1 -1
- package/src/{session → executor}/composer/compaction/jsonl/JsonlSessionCompactionComposer.ts +1 -1
- package/src/{session → executor}/composer/compaction/jsonl/JsonlSessionCompactionExecutor.ts +2 -2
- package/src/{session → executor}/composer/context/LocalSessionContextComposer.ts +4 -4
- package/src/{session → executor}/composer/context/SessionContextComposer.ts +2 -2
- package/src/{session → executor}/composer/history/SessionHistoryComposer.ts +2 -2
- package/src/{session → executor}/composer/history/SessionHistoryWriter.ts +2 -2
- package/src/{session → executor}/composer/history/jsonl/JsonlSessionHistoryComposer.ts +3 -3
- package/src/{session → executor}/composer/system/default/DefaultSessionSystemComposer.ts +4 -4
- package/src/{session → executor}/composer/system/default/InitPromptAssets.ts +2 -2
- package/src/{session → executor}/composer/system/default/InitPrompts.ts +1 -1
- package/src/{session → executor}/composer/system/default/PromptRenderer.ts +1 -1
- package/src/{session → executor}/composer/system/default/StaticPromptCatalog.ts +1 -1
- package/src/{session → executor}/composer/system/default/SystemDomain.ts +26 -26
- package/src/{session → executor}/composer/system/default/SystemPromptAssets.ts +3 -3
- package/src/{session → executor}/composer/system/default/assets/core.prompt.ts +1 -1
- package/src/{session → executor}/composer/system/default/assets/init/PROFILE.md.ts +1 -1
- package/src/{session → executor}/composer/system/default/assets/init/SOUL.md.ts +1 -1
- package/src/{session → executor}/composer/system/default/assets/plugin.prompt.ts +2 -2
- package/src/{session → executor}/composer/system/default/assets/plugin.prompt.ts.txt +2 -2
- package/src/{session → executor}/composer/system/default/assets/task.prompt.ts +1 -1
- package/src/{session → executor}/composer/system/default/variables/GeoContext.ts +1 -1
- package/src/{session → executor}/composer/system/default/variables/VariableReplacer.ts +2 -2
- package/src/{session → executor}/core-engine/CoreEngineLoopDecision.ts +1 -1
- package/src/{session → executor}/core-engine/CoreEngineMessageState.ts +2 -2
- package/src/{session → executor}/core-engine/CoreEngineSignals.ts +1 -1
- package/src/{session → executor}/core-engine/CoreEngineUiStreamCollector.ts +3 -3
- package/src/{session → executor}/messages/AssistantResultPersistence.ts +1 -1
- package/src/{session → executor}/messages/SessionAttachmentMapper.ts +1 -1
- package/src/{session → executor}/messages/SessionMessageCodec.ts +2 -2
- package/src/{session → executor}/messages/SessionMessageLog.ts +1 -1
- package/src/{session → executor}/messages/SessionStepEventMapper.ts +1 -1
- package/src/{session → executor}/store/history/SessionHistoryStore.ts +2 -2
- package/src/{session → executor}/store/history/jsonl/JsonlSessionHistoryStore.ts +6 -6
- package/src/{session → executor}/tools/shell/ShellToolBridge.ts +6 -6
- package/src/{session → executor}/tools/shell/ShellToolDefinition.ts +2 -2
- package/src/{session → executor}/tools/shell/ShellToolFormatting.ts +3 -3
- package/src/{session → executor}/tools/shell/ShellToolSchemas.ts +1 -1
- package/src/{session → executor}/types/SessionExecutor.ts +1 -1
- package/src/{session → executor}/types/SessionRun.ts +2 -2
- package/src/index.ts +43 -28
- package/src/plugin/builtins/asr/Plugin.ts +24 -11
- package/src/plugin/builtins/auth/Plugin.ts +19 -6
- package/src/plugin/builtins/chat/Action.ts +5 -5
- package/src/plugin/builtins/chat/ChatPlugin.ts +3 -3
- package/src/plugin/builtins/chat/ChatPluginTypes.ts +1 -1
- package/src/plugin/builtins/chat/PROMPT.direct.ts +1 -1
- package/src/plugin/builtins/chat/PROMPT.direct.ts.txt +1 -1
- package/src/plugin/builtins/chat/accounts/{ChannelAccountService.ts → ChannelAccountManager.ts} +3 -3
- package/src/plugin/builtins/chat/channels/feishu/types/FeishuChannel.ts +1 -1
- package/src/plugin/builtins/chat/channels/qq/PROMPT.direct.ts +1 -1
- package/src/plugin/builtins/chat/channels/qq/PROMPT.direct.ts.txt +1 -1
- package/src/plugin/builtins/chat/channels/qq/types/QqChannel.ts +1 -1
- package/src/plugin/builtins/chat/runtime/ChatActionExecution.ts +2 -2
- package/src/plugin/builtins/chat/runtime/ChatActionInput.ts +1 -1
- package/src/plugin/builtins/chat/runtime/ChatChannelConfig.ts +8 -8
- package/src/plugin/builtins/chat/runtime/ChatChannelCore.ts +14 -14
- package/src/plugin/builtins/chat/runtime/ChatChannelFacade.ts +1 -1
- package/src/plugin/builtins/chat/runtime/ChatChannelLifecycle.ts +1 -1
- package/src/plugin/builtins/chat/runtime/ChatMetaStore.ts +2 -2
- package/src/plugin/builtins/chat/runtime/ChatPluginActionRegistry.ts +3 -3
- package/src/plugin/builtins/chat/runtime/ChatPluginSystem.ts +2 -2
- package/src/plugin/builtins/chat/runtime/ChatPromptAssets.ts +4 -4
- package/src/plugin/builtins/chat/runtime/ChatQueueStore.ts +5 -5
- package/src/plugin/builtins/chat/runtime/ChatQueueWorker.ts +3 -3
- package/src/plugin/builtins/chat/runtime/ChatSession.ts +7 -7
- package/src/plugin/builtins/chat/runtime/ChatSessionContextComposer.ts +4 -4
- package/src/plugin/builtins/chat/runtime/ChatSessionTypes.ts +2 -2
- package/src/plugin/builtins/chat/runtime/ChatkeySend.ts +1 -1
- package/src/plugin/builtins/chat/runtime/InboundAugment.ts +1 -1
- package/src/plugin/builtins/chat/runtime/PluginDispatch.ts +2 -2
- package/src/plugin/builtins/chat/runtime/PluginPoints.ts +10 -10
- package/src/plugin/builtins/chat/runtime/SystemPrompt.ts +1 -1
- package/src/plugin/builtins/chat/runtime/UIMessageTransformer.ts +1 -1
- package/src/plugin/builtins/chat/runtime/UserVisibleText.ts +1 -1
- package/src/plugin/builtins/chat/types/ChannelContext.ts +1 -1
- package/src/plugin/builtins/chat/types/ChannelStatus.ts +1 -1
- package/src/plugin/builtins/chat/types/ChatMessageMarkup.ts +1 -1
- package/src/plugin/builtins/chat/types/ChatMeta.ts +2 -2
- package/src/plugin/builtins/chat/types/ChatPlugin.ts +6 -6
- package/src/plugin/builtins/chat/types/ChatPluginActionPayload.ts +2 -2
- package/src/plugin/builtins/chat/types/ChatPromptContext.ts +2 -2
- package/src/plugin/builtins/chat/types/ChatRuntime.ts +3 -3
- package/src/plugin/builtins/contact/Action.ts +3 -3
- package/src/plugin/builtins/contact/ContactPlugin.ts +2 -2
- package/src/plugin/builtins/contact/runtime/ChatRuntime.ts +1 -1
- package/src/plugin/builtins/contact/runtime/ContactPromptAssets.ts +2 -2
- package/src/plugin/builtins/contact/runtime/Paths.ts +1 -1
- package/src/plugin/builtins/contact/runtime/RemoteClient.ts +2 -2
- package/src/plugin/builtins/contact/types/ContactCheck.ts +2 -2
- package/src/plugin/builtins/contact/types/ContactCommand.ts +1 -1
- package/src/plugin/builtins/memory/MemoryPlugin.ts +1 -1
- package/src/plugin/builtins/memory/runtime/Search.ts +1 -1
- package/src/plugin/builtins/memory/runtime/Store.ts +3 -3
- package/src/plugin/builtins/shell/ShellRuntimeTypes.ts +4 -4
- package/src/plugin/builtins/shell/runtime/ShellActionRuntime.ts +2 -2
- package/src/plugin/builtins/shell/runtime/ShellActionRuntimeSupport.ts +2 -2
- package/src/plugin/builtins/shell/runtime/ShellProcessEvents.ts +1 -1
- package/src/plugin/builtins/shell/runtime/ShellRuntimeEnvironment.ts +1 -1
- package/src/plugin/builtins/shell/types/ShellPlugin.ts +4 -4
- package/src/plugin/builtins/skill/Plugin.ts +21 -8
- package/src/plugin/builtins/skill/runtime/SystemProvider.ts +1 -1
- package/src/plugin/builtins/task/PROMPT.ts +1 -1
- package/src/plugin/builtins/task/PROMPT.ts.txt +5 -5
- package/src/plugin/builtins/task/Scheduler.ts +4 -4
- package/src/plugin/builtins/task/runtime/CronTrigger.ts +9 -9
- package/src/plugin/builtins/task/runtime/TaskActionExecution.ts +1 -1
- package/src/plugin/builtins/task/runtime/TaskActionInput.ts +2 -2
- package/src/plugin/builtins/task/runtime/TaskPluginActionRegistry.ts +3 -3
- package/src/plugin/builtins/task/runtime/TaskPromptAssets.ts +2 -2
- package/src/plugin/builtins/task/runtime/TaskRunChatDispatch.ts +2 -2
- package/src/plugin/builtins/task/runtime/TaskRunnerRound.ts +2 -2
- package/src/plugin/builtins/task/runtime/TaskRunnerSession.ts +10 -10
- package/src/plugin/builtins/task/runtime/TaskRunnerTypes.ts +2 -2
- package/src/plugin/builtins/task/types/Cron.ts +3 -3
- package/src/plugin/builtins/task/types/TaskPluginTypes.ts +3 -3
- package/src/plugin/builtins/tts/Plugin.ts +23 -10
- package/src/plugin/builtins/web/Plugin.ts +23 -10
- package/src/plugin/builtins/workboard/Plugin.ts +71 -58
- package/src/plugin/builtins/workboard/runtime/Collector.ts +2 -2
- package/src/plugin/builtins/workboard/runtime/Normalizer.ts +3 -3
- package/src/plugin/core/BasePlugin.ts +2 -2
- package/src/plugin/core/BuiltinPluginClasses.ts +20 -3
- package/src/plugin/core/Catalog.ts +6 -5
- package/src/plugin/core/HttpRoutes.ts +6 -6
- package/src/plugin/core/LocalExecution.ts +15 -0
- package/src/plugin/core/PluginActionRunner.ts +0 -1
- package/src/plugin/core/PluginClassRegistry.ts +33 -4
- package/src/plugin/core/PluginCommand.ts +4 -4
- package/src/plugin/core/PluginCommandRequest.ts +4 -4
- package/src/plugin/core/PluginStateController.ts +2 -2
- package/src/plugin/core/schedule/Store.ts +2 -2
- package/src/plugin/core/schedule/Time.ts +1 -1
- package/src/plugin/types/Plugin.ts +18 -22
- package/src/plugin/types/PluginApi.ts +3 -3
- package/src/plugin/types/PluginState.ts +0 -5
- package/src/plugin/types/Plugins.ts +2 -2
- package/src/runtime/host/AgentHostRuntime.ts +1 -1
- package/src/runtime/host/daemon/Api.ts +2 -2
- package/src/runtime/sandbox/types/SandboxRuntime.ts +1 -1
- package/src/runtime/server/http/Server.ts +19 -51
- package/src/runtime/server/http/control/MessageTimeline.ts +1 -1
- package/src/runtime/server/http/control/OverviewRoutes.ts +2 -6
- package/src/runtime/server/http/control/SessionRoutes.ts +1 -1
- package/src/runtime/server/http/control/TaskRoutes.ts +1 -1
- package/src/runtime/server/http/plugins/plugins.ts +71 -4
- package/src/runtime/server/http/sdk/Router.ts +3 -3
- package/src/runtime/server/http/sdk/SessionRoutes.ts +82 -14
- package/src/runtime/server/rpc/Server.ts +13 -20
- package/src/sdk/Agent.ts +57 -39
- package/src/sdk/AgentSdkTypes.ts +358 -40
- package/src/sdk/RemoteAgent.ts +93 -21
- package/src/sdk/Session.ts +61 -43
- package/src/sdk/SessionSystemBuilder.ts +12 -12
- package/src/sdk/session/Browse.ts +519 -0
- package/src/sdk/session/Metadata.ts +1 -1
- package/src/sdk/session/Persistence.ts +3 -3
- package/src/sdk/session/RuntimeSessionPort.ts +4 -4
- package/src/sdk/session/index.ts +10 -1
- package/src/sdk/session/runtime/SessionPromptRuntime.ts +2 -2
- package/src/types/config/DowncityConfig.ts +143 -96
- package/src/types/runtime/host/AgentHost.ts +1 -1
- package/src/types/runtime/http/InlineInstant.ts +2 -2
- package/src/types/runtime/platform/PlatformGateway.ts +10 -10
- package/src/types/sdk/AgentSessionEvent.ts +1 -1
- package/src/types/sdk/AgentSessionTurn.ts +1 -1
- package/tsconfig.json +1 -2
- package/tsconfig.tsbuildinfo +1 -1
- package/bin/plugin/core/Plugins.d.ts +0 -20
- package/bin/plugin/core/Plugins.d.ts.map +0 -1
- package/bin/plugin/core/Plugins.js +0 -33
- package/bin/plugin/core/Plugins.js.map +0 -1
- package/bin/runtime/host/PluginRuntime.d.ts +0 -24
- package/bin/runtime/host/PluginRuntime.d.ts.map +0 -1
- package/bin/runtime/host/PluginRuntime.js +0 -31
- package/bin/runtime/host/PluginRuntime.js.map +0 -1
- package/bin/runtime/server/http/services/services.d.ts +0 -25
- package/bin/runtime/server/http/services/services.d.ts.map +0 -1
- package/bin/runtime/server/http/services/services.js +0 -82
- package/bin/runtime/server/http/services/services.js.map +0 -1
- package/bin/session/Executor.d.ts.map +0 -1
- package/bin/session/Executor.js.map +0 -1
- package/bin/session/SessionRunScope.d.ts.map +0 -1
- package/bin/session/SessionRunScope.js.map +0 -1
- package/bin/session/composer/compaction/SessionCompactionComposer.d.ts.map +0 -1
- package/bin/session/composer/compaction/SessionCompactionComposer.js.map +0 -1
- package/bin/session/composer/compaction/jsonl/JsonlSessionCompactionComposer.d.ts.map +0 -1
- package/bin/session/composer/compaction/jsonl/JsonlSessionCompactionComposer.js.map +0 -1
- package/bin/session/composer/compaction/jsonl/JsonlSessionCompactionExecutor.d.ts.map +0 -1
- package/bin/session/composer/compaction/jsonl/JsonlSessionCompactionExecutor.js.map +0 -1
- package/bin/session/composer/context/LocalSessionContextComposer.d.ts.map +0 -1
- package/bin/session/composer/context/LocalSessionContextComposer.js.map +0 -1
- package/bin/session/composer/context/SessionContextComposer.d.ts.map +0 -1
- package/bin/session/composer/context/SessionContextComposer.js.map +0 -1
- package/bin/session/composer/history/SessionHistoryComposer.d.ts.map +0 -1
- package/bin/session/composer/history/SessionHistoryComposer.js.map +0 -1
- package/bin/session/composer/history/SessionHistoryWriter.d.ts.map +0 -1
- package/bin/session/composer/history/SessionHistoryWriter.js.map +0 -1
- package/bin/session/composer/history/jsonl/JsonlSessionHistoryComposer.d.ts.map +0 -1
- package/bin/session/composer/history/jsonl/JsonlSessionHistoryComposer.js.map +0 -1
- package/bin/session/composer/system/SessionSystemComposer.d.ts.map +0 -1
- package/bin/session/composer/system/SessionSystemComposer.js.map +0 -1
- package/bin/session/composer/system/default/DefaultSessionSystemComposer.d.ts.map +0 -1
- package/bin/session/composer/system/default/DefaultSessionSystemComposer.js.map +0 -1
- package/bin/session/composer/system/default/InitPromptAssets.d.ts.map +0 -1
- package/bin/session/composer/system/default/InitPromptAssets.js.map +0 -1
- package/bin/session/composer/system/default/InitPrompts.d.ts.map +0 -1
- package/bin/session/composer/system/default/InitPrompts.js.map +0 -1
- package/bin/session/composer/system/default/PromptRenderer.d.ts.map +0 -1
- package/bin/session/composer/system/default/PromptRenderer.js.map +0 -1
- package/bin/session/composer/system/default/StaticPromptCatalog.d.ts.map +0 -1
- package/bin/session/composer/system/default/StaticPromptCatalog.js.map +0 -1
- package/bin/session/composer/system/default/SystemDomain.d.ts.map +0 -1
- package/bin/session/composer/system/default/SystemDomain.js.map +0 -1
- package/bin/session/composer/system/default/SystemPromptAssets.d.ts.map +0 -1
- package/bin/session/composer/system/default/SystemPromptAssets.js.map +0 -1
- package/bin/session/composer/system/default/assets/core.prompt.d.ts.map +0 -1
- package/bin/session/composer/system/default/assets/core.prompt.js.map +0 -1
- package/bin/session/composer/system/default/assets/init/PROFILE.md.d.ts.map +0 -1
- package/bin/session/composer/system/default/assets/init/PROFILE.md.js.map +0 -1
- package/bin/session/composer/system/default/assets/init/SOUL.md.d.ts.map +0 -1
- package/bin/session/composer/system/default/assets/init/SOUL.md.js.map +0 -1
- package/bin/session/composer/system/default/assets/plugin.prompt.d.ts.map +0 -1
- package/bin/session/composer/system/default/assets/plugin.prompt.js +0 -8
- package/bin/session/composer/system/default/assets/plugin.prompt.js.map +0 -1
- package/bin/session/composer/system/default/assets/task.prompt.d.ts.map +0 -1
- package/bin/session/composer/system/default/assets/task.prompt.js.map +0 -1
- package/bin/session/composer/system/default/variables/GeoContext.d.ts.map +0 -1
- package/bin/session/composer/system/default/variables/GeoContext.js.map +0 -1
- package/bin/session/composer/system/default/variables/PromptTypes.d.ts.map +0 -1
- package/bin/session/composer/system/default/variables/PromptTypes.js.map +0 -1
- package/bin/session/composer/system/default/variables/VariableReplacer.d.ts.map +0 -1
- package/bin/session/composer/system/default/variables/VariableReplacer.js.map +0 -1
- package/bin/session/core-engine/CoreEngineError.d.ts.map +0 -1
- package/bin/session/core-engine/CoreEngineError.js.map +0 -1
- package/bin/session/core-engine/CoreEngineLoopDecision.d.ts.map +0 -1
- package/bin/session/core-engine/CoreEngineLoopDecision.js.map +0 -1
- package/bin/session/core-engine/CoreEngineMessageState.d.ts.map +0 -1
- package/bin/session/core-engine/CoreEngineMessageState.js.map +0 -1
- package/bin/session/core-engine/CoreEngineSignals.d.ts.map +0 -1
- package/bin/session/core-engine/CoreEngineSignals.js.map +0 -1
- package/bin/session/core-engine/CoreEngineUiStreamCollector.d.ts.map +0 -1
- package/bin/session/core-engine/CoreEngineUiStreamCollector.js.map +0 -1
- package/bin/session/ids/resolveSessionId.d.ts.map +0 -1
- package/bin/session/ids/resolveSessionId.js.map +0 -1
- package/bin/session/messages/AssistantResultPersistence.d.ts.map +0 -1
- package/bin/session/messages/AssistantResultPersistence.js.map +0 -1
- package/bin/session/messages/SessionAttachmentMapper.d.ts.map +0 -1
- package/bin/session/messages/SessionAttachmentMapper.js.map +0 -1
- package/bin/session/messages/SessionMessageCodec.d.ts.map +0 -1
- package/bin/session/messages/SessionMessageCodec.js.map +0 -1
- package/bin/session/messages/SessionMessageLog.d.ts.map +0 -1
- package/bin/session/messages/SessionMessageLog.js.map +0 -1
- package/bin/session/messages/SessionStepEventMapper.d.ts.map +0 -1
- package/bin/session/messages/SessionStepEventMapper.js.map +0 -1
- package/bin/session/store/history/SessionHistoryStore.d.ts.map +0 -1
- package/bin/session/store/history/SessionHistoryStore.js.map +0 -1
- package/bin/session/store/history/jsonl/JsonlSessionHistoryStore.d.ts.map +0 -1
- package/bin/session/store/history/jsonl/JsonlSessionHistoryStore.js.map +0 -1
- package/bin/session/tools/shell/ShellToolBridge.d.ts.map +0 -1
- package/bin/session/tools/shell/ShellToolBridge.js.map +0 -1
- package/bin/session/tools/shell/ShellToolDefinition.d.ts.map +0 -1
- package/bin/session/tools/shell/ShellToolDefinition.js.map +0 -1
- package/bin/session/tools/shell/ShellToolFormatting.d.ts.map +0 -1
- package/bin/session/tools/shell/ShellToolFormatting.js.map +0 -1
- package/bin/session/tools/shell/ShellToolSchemas.d.ts.map +0 -1
- package/bin/session/tools/shell/ShellToolSchemas.js.map +0 -1
- package/bin/session/types/SessionExecutor.d.ts.map +0 -1
- package/bin/session/types/SessionExecutor.js.map +0 -1
- package/bin/session/types/SessionHistoryMeta.d.ts.map +0 -1
- package/bin/session/types/SessionHistoryMeta.js.map +0 -1
- package/bin/session/types/SessionHistoryPaths.d.ts.map +0 -1
- package/bin/session/types/SessionHistoryPaths.js.map +0 -1
- package/bin/session/types/SessionLoop.d.ts.map +0 -1
- package/bin/session/types/SessionLoop.js.map +0 -1
- package/bin/session/types/SessionMessages.d.ts.map +0 -1
- package/bin/session/types/SessionMessages.js.map +0 -1
- package/bin/session/types/SessionPrompts.d.ts.map +0 -1
- package/bin/session/types/SessionPrompts.js.map +0 -1
- package/bin/session/types/SessionRun.d.ts.map +0 -1
- package/bin/session/types/SessionRun.js.map +0 -1
- package/src/plugin/core/Plugins.ts +0 -39
- package/src/runtime/host/PluginRuntime.ts +0 -42
- package/src/runtime/server/http/services/services.ts +0 -114
- /package/bin/{session → executor}/Executor.js +0 -0
- /package/bin/{session → executor}/composer/compaction/SessionCompactionComposer.js +0 -0
- /package/bin/{session → executor}/composer/compaction/jsonl/JsonlSessionCompactionComposer.d.ts +0 -0
- /package/bin/{session → executor}/composer/compaction/jsonl/JsonlSessionCompactionComposer.js +0 -0
- /package/bin/{session → executor}/composer/compaction/jsonl/JsonlSessionCompactionExecutor.js +0 -0
- /package/bin/{session → executor}/composer/context/LocalSessionContextComposer.js +0 -0
- /package/bin/{session → executor}/composer/context/SessionContextComposer.js +0 -0
- /package/bin/{session → executor}/composer/history/SessionHistoryComposer.js +0 -0
- /package/bin/{session → executor}/composer/history/SessionHistoryWriter.js +0 -0
- /package/bin/{session → executor}/composer/history/jsonl/JsonlSessionHistoryComposer.js +0 -0
- /package/bin/{session → executor}/composer/system/SessionSystemComposer.d.ts +0 -0
- /package/bin/{session → executor}/composer/system/SessionSystemComposer.js +0 -0
- /package/bin/{session → executor}/composer/system/default/DefaultSessionSystemComposer.js +0 -0
- /package/bin/{session → executor}/composer/system/default/InitPromptAssets.d.ts +0 -0
- /package/bin/{session → executor}/composer/system/default/InitPromptAssets.js +0 -0
- /package/bin/{session → executor}/composer/system/default/InitPrompts.d.ts +0 -0
- /package/bin/{session → executor}/composer/system/default/InitPrompts.js +0 -0
- /package/bin/{session → executor}/composer/system/default/PromptRenderer.d.ts +0 -0
- /package/bin/{session → executor}/composer/system/default/PromptRenderer.js +0 -0
- /package/bin/{session → executor}/composer/system/default/StaticPromptCatalog.d.ts +0 -0
- /package/bin/{session → executor}/composer/system/default/StaticPromptCatalog.js +0 -0
- /package/bin/{session → executor}/composer/system/default/SystemPromptAssets.d.ts +0 -0
- /package/bin/{session → executor}/composer/system/default/SystemPromptAssets.js +0 -0
- /package/bin/{session → executor}/composer/system/default/assets/core.prompt.d.ts +0 -0
- /package/bin/{session → executor}/composer/system/default/assets/init/PROFILE.md.d.ts +0 -0
- /package/bin/{session → executor}/composer/system/default/assets/init/SOUL.md.d.ts +0 -0
- /package/bin/{session → executor}/composer/system/default/assets/task.prompt.d.ts +0 -0
- /package/bin/{session → executor}/composer/system/default/variables/GeoContext.d.ts +0 -0
- /package/bin/{session → executor}/composer/system/default/variables/GeoContext.js +0 -0
- /package/bin/{session → executor}/composer/system/default/variables/PromptTypes.d.ts +0 -0
- /package/bin/{session → executor}/composer/system/default/variables/PromptTypes.js +0 -0
- /package/bin/{session → executor}/composer/system/default/variables/VariableReplacer.d.ts +0 -0
- /package/bin/{session → executor}/composer/system/default/variables/VariableReplacer.js +0 -0
- /package/bin/{session → executor}/core-engine/CoreEngineError.d.ts +0 -0
- /package/bin/{session → executor}/core-engine/CoreEngineError.js +0 -0
- /package/bin/{session → executor}/core-engine/CoreEngineLoopDecision.js +0 -0
- /package/bin/{session → executor}/core-engine/CoreEngineMessageState.js +0 -0
- /package/bin/{session → executor}/core-engine/CoreEngineSignals.js +0 -0
- /package/bin/{session → executor}/core-engine/CoreEngineUiStreamCollector.js +0 -0
- /package/bin/{session → executor}/ids/resolveSessionId.d.ts +0 -0
- /package/bin/{session → executor}/ids/resolveSessionId.js +0 -0
- /package/bin/{session → executor}/messages/AssistantResultPersistence.js +0 -0
- /package/bin/{session → executor}/messages/SessionAttachmentMapper.js +0 -0
- /package/bin/{session → executor}/messages/SessionMessageCodec.js +0 -0
- /package/bin/{session → executor}/messages/SessionMessageLog.js +0 -0
- /package/bin/{session → executor}/messages/SessionStepEventMapper.js +0 -0
- /package/bin/{session → executor}/store/history/SessionHistoryStore.js +0 -0
- /package/bin/{session → executor}/store/history/jsonl/JsonlSessionHistoryStore.js +0 -0
- /package/bin/{session → executor}/tools/shell/ShellToolSchemas.d.ts +0 -0
- /package/bin/{session → executor}/types/SessionExecutor.js +0 -0
- /package/bin/{session → executor}/types/SessionHistoryMeta.d.ts +0 -0
- /package/bin/{session → executor}/types/SessionHistoryMeta.js +0 -0
- /package/bin/{session → executor}/types/SessionHistoryPaths.d.ts +0 -0
- /package/bin/{session → executor}/types/SessionHistoryPaths.js +0 -0
- /package/bin/{session → executor}/types/SessionLoop.d.ts +0 -0
- /package/bin/{session → executor}/types/SessionLoop.js +0 -0
- /package/bin/{session → executor}/types/SessionMessages.d.ts +0 -0
- /package/bin/{session → executor}/types/SessionMessages.js +0 -0
- /package/bin/{session → executor}/types/SessionPrompts.d.ts +0 -0
- /package/bin/{session → executor}/types/SessionPrompts.js +0 -0
- /package/bin/{session → executor}/types/SessionRun.js +0 -0
- /package/src/{session → executor}/composer/system/SessionSystemComposer.ts +0 -0
- /package/src/{session → executor}/composer/system/default/assets/core.prompt.ts.txt +0 -0
- /package/src/{session → executor}/composer/system/default/assets/init/PROFILE.md.ts.txt +0 -0
- /package/src/{session → executor}/composer/system/default/assets/init/SOUL.md.ts.txt +0 -0
- /package/src/{session → executor}/composer/system/default/assets/task.prompt.ts.txt +0 -0
- /package/src/{session → executor}/composer/system/default/variables/PromptTypes.ts +0 -0
- /package/src/{session → executor}/core-engine/CoreEngineError.ts +0 -0
- /package/src/{session → executor}/ids/resolveSessionId.ts +0 -0
- /package/src/{session → executor}/types/SessionHistoryMeta.ts +0 -0
- /package/src/{session → executor}/types/SessionHistoryPaths.ts +0 -0
- /package/src/{session → executor}/types/SessionLoop.ts +0 -0
- /package/src/{session → executor}/types/SessionMessages.ts +0 -0
- /package/src/{session → executor}/types/SessionPrompts.ts +0 -0
package/src/config/Paths.ts
CHANGED
|
@@ -111,7 +111,7 @@ export function getDowncityMemoryDailyPath(cwd: string, date: string): string {
|
|
|
111
111
|
}
|
|
112
112
|
|
|
113
113
|
/**
|
|
114
|
-
*
|
|
114
|
+
* Plugin Schedule JSONL 路径。
|
|
115
115
|
*
|
|
116
116
|
* 关键点(中文)
|
|
117
117
|
* - 调度任务属于项目 runtime 本地状态,因此放在项目 `.downcity/` 下。
|
|
@@ -226,7 +226,7 @@ export function getDowncityDebugDirPath(cwd: string): string {
|
|
|
226
226
|
}
|
|
227
227
|
|
|
228
228
|
/**
|
|
229
|
-
* Chat 元信息目录(由
|
|
229
|
+
* Chat 元信息目录(由 chat plugin runtime 维护)。
|
|
230
230
|
*
|
|
231
231
|
* 关键点(中文)
|
|
232
232
|
* - 该目录存放 `sessionId -> chat` 的最近映射快照
|
|
@@ -29,10 +29,11 @@ import {
|
|
|
29
29
|
import { DEFAULT_DOWNCITY_JSON } from "@/config/Defaults.js";
|
|
30
30
|
import { DOWNCITY_JSON_SCHEMA } from "@/config/DowncitySchema.js";
|
|
31
31
|
import type { DowncityConfig } from "@/config/Config.js";
|
|
32
|
+
import type { DowncityChatPluginChannelsConfig } from "@/types/config/DowncityConfig.js";
|
|
32
33
|
import {
|
|
33
34
|
DEFAULT_PROFILE_MD_TEMPLATE,
|
|
34
35
|
DEFAULT_SOUL_MD_TEMPLATE,
|
|
35
|
-
} from "@
|
|
36
|
+
} from "@executor/composer/system/default/InitPrompts.js";
|
|
36
37
|
import { renderTemplateVariables } from "@/utils/Template.js";
|
|
37
38
|
import { ensureDir, saveJson } from "@/utils/storage/index.js";
|
|
38
39
|
import type {
|
|
@@ -325,9 +326,7 @@ export async function initializeAgentProject(
|
|
|
325
326
|
createdFiles.push(file.filename);
|
|
326
327
|
}
|
|
327
328
|
|
|
328
|
-
const channelsConfig:
|
|
329
|
-
NonNullable<NonNullable<DowncityConfig["services"]>["chat"]>["channels"]
|
|
330
|
-
> = {};
|
|
329
|
+
const channelsConfig: DowncityChatPluginChannelsConfig = {};
|
|
331
330
|
if (channels.includes("telegram")) {
|
|
332
331
|
channelsConfig.telegram = { enabled: true };
|
|
333
332
|
}
|
|
@@ -353,7 +352,7 @@ export async function initializeAgentProject(
|
|
|
353
352
|
},
|
|
354
353
|
...(Object.keys(channelsConfig).length > 0
|
|
355
354
|
? {
|
|
356
|
-
|
|
355
|
+
plugins: {
|
|
357
356
|
chat: {
|
|
358
357
|
channels: channelsConfig,
|
|
359
358
|
},
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* AgentCore 执行上下文类型定义。
|
|
3
3
|
*
|
|
4
4
|
* 关键点(中文)
|
|
5
|
-
* - 这里定义 runtime
|
|
5
|
+
* - 这里定义 plugin runtime / plugin / prompt system 共用的统一执行上下文。
|
|
6
6
|
* - `AgentContext` 表达的是“当前一次执行可见的能力面”,不是宿主状态本体。
|
|
7
7
|
* - `AgentRuntime` 负责保存长期状态;`AgentContext` 负责把这些状态暴露成执行接口。
|
|
8
8
|
*/
|
|
@@ -26,12 +26,12 @@ import type {
|
|
|
26
26
|
import type {
|
|
27
27
|
SessionMetadataV1,
|
|
28
28
|
SessionMessageV1,
|
|
29
|
-
} from "@/
|
|
29
|
+
} from "@/executor/types/SessionMessages.js";
|
|
30
30
|
import type {
|
|
31
31
|
SessionRunInput,
|
|
32
32
|
SessionRunResult,
|
|
33
|
-
} from "@/
|
|
34
|
-
import type { SessionHistoryStore } from "@/
|
|
33
|
+
} from "@/executor/types/SessionRun.js";
|
|
34
|
+
import type { SessionHistoryStore } from "@/executor/store/history/SessionHistoryStore.js";
|
|
35
35
|
import type { AgentSessionPromptInput } from "@/types/sdk/AgentSessionPrompt.js";
|
|
36
36
|
import type {
|
|
37
37
|
AgentSessionSubscriber,
|
|
@@ -40,7 +40,7 @@ import type {
|
|
|
40
40
|
import type { AgentSessionTurnHandle } from "@/types/sdk/AgentSessionTurn.js";
|
|
41
41
|
|
|
42
42
|
/**
|
|
43
|
-
* 跨 runtime
|
|
43
|
+
* 跨 plugin runtime 调用参数。
|
|
44
44
|
*/
|
|
45
45
|
export interface InvokePluginParams {
|
|
46
46
|
/**
|
|
@@ -58,7 +58,7 @@ export interface InvokePluginParams {
|
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
/**
|
|
61
|
-
* 跨 runtime
|
|
61
|
+
* 跨 plugin runtime 调用结果。
|
|
62
62
|
*/
|
|
63
63
|
export interface InvokePluginResult {
|
|
64
64
|
/**
|
|
@@ -76,7 +76,7 @@ export interface InvokePluginResult {
|
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
/**
|
|
79
|
-
* 跨 runtime
|
|
79
|
+
* 跨 plugin runtime 调用端口。
|
|
80
80
|
*/
|
|
81
81
|
export interface InvokePluginPort {
|
|
82
82
|
/**
|
|
@@ -214,7 +214,7 @@ export interface SessionCollectionPort {
|
|
|
214
214
|
*
|
|
215
215
|
* 关键点(中文)
|
|
216
216
|
* - 这是当前 agent 已装配好的 chat 运行时视图。
|
|
217
|
-
* - 其他 runtime
|
|
217
|
+
* - 其他 plugin runtime 只能通过这里消费 chat 能力,不能直接 import chat runtime 模块。
|
|
218
218
|
*/
|
|
219
219
|
export interface ChatRuntimePort {
|
|
220
220
|
/**
|
|
@@ -279,12 +279,12 @@ export interface AgentContext {
|
|
|
279
279
|
* Session 能力入口。
|
|
280
280
|
*
|
|
281
281
|
* 关键点(中文)
|
|
282
|
-
* - runtime
|
|
282
|
+
* - plugin runtime 与 plugin 都通过这里访问 session 执行与持久化能力。
|
|
283
283
|
* - 内外统一使用 `sessionId` 语义。
|
|
284
284
|
*/
|
|
285
285
|
session: SessionCollectionPort;
|
|
286
286
|
/**
|
|
287
|
-
* 跨 runtime
|
|
287
|
+
* 跨 plugin runtime 调用主入口。
|
|
288
288
|
*/
|
|
289
289
|
invoke: InvokePluginPort;
|
|
290
290
|
/**
|
package/src/core/AgentCore.ts
CHANGED
|
@@ -19,19 +19,24 @@ import type { DowncityConfig } from "@/types/config/DowncityConfig.js";
|
|
|
19
19
|
import type { JsonValue } from "@/types/common/Json.js";
|
|
20
20
|
import type { AgentPlatformRuntime } from "@/types/runtime/host/AgentHost.js";
|
|
21
21
|
import type {
|
|
22
|
-
Plugin,
|
|
23
22
|
PluginAvailability,
|
|
24
23
|
PluginPort,
|
|
25
24
|
PluginView,
|
|
26
25
|
} from "@/plugin/types/Plugin.js";
|
|
27
26
|
import type {
|
|
27
|
+
AgentMode,
|
|
28
|
+
AgentCreateSessionInput,
|
|
29
|
+
AgentListSessionsInput,
|
|
28
30
|
AgentOptions,
|
|
29
|
-
|
|
31
|
+
AgentSessionSummaryPage,
|
|
30
32
|
AgentSessionSystemBlock,
|
|
31
33
|
} from "@/sdk/AgentSdkTypes.js";
|
|
32
34
|
import { Session } from "@/sdk/Session.js";
|
|
33
|
-
import { DEFAULT_SHIP_PROMPTS } from "@
|
|
34
|
-
import {
|
|
35
|
+
import { DEFAULT_SHIP_PROMPTS } from "@executor/composer/system/default/SystemDomain.js";
|
|
36
|
+
import {
|
|
37
|
+
getSdkAgentSessionDirPath,
|
|
38
|
+
listAgentSessionSummaryPage,
|
|
39
|
+
} from "@/sdk/session/index.js";
|
|
35
40
|
import {
|
|
36
41
|
createAgentPathRuntime,
|
|
37
42
|
createAgentPluginConfigRuntime,
|
|
@@ -42,9 +47,8 @@ import { resolveChatQueueStore } from "@/plugin/builtins/chat/runtime/ChatQueueS
|
|
|
42
47
|
import { HookRegistry } from "@/plugin/core/HookRegistry.js";
|
|
43
48
|
import { PluginRegistry } from "@/plugin/core/PluginRegistry.js";
|
|
44
49
|
import { isPluginEnabled } from "@/plugin/core/Activation.js";
|
|
45
|
-
import { PLUGINS } from "@/plugin/core/Plugins.js";
|
|
46
50
|
import { createRegisteredPluginInstances } from "@/plugin/core/PluginClassRegistry.js";
|
|
47
|
-
import { setShellToolRuntime } from "@
|
|
51
|
+
import { setShellToolRuntime } from "@executor/tools/shell/ShellToolDefinition.js";
|
|
48
52
|
|
|
49
53
|
const EMPTY_SDK_PLATFORM: AgentPlatformRuntime = {
|
|
50
54
|
getGlobalEnv: () => ({}),
|
|
@@ -114,7 +118,7 @@ export class AgentCore {
|
|
|
114
118
|
readonly id: string;
|
|
115
119
|
readonly path: string;
|
|
116
120
|
readonly tools: Record<string, Tool>;
|
|
117
|
-
readonly
|
|
121
|
+
readonly pluginInstances: Map<string, BasePlugin>;
|
|
118
122
|
readonly plugins: PluginPort;
|
|
119
123
|
|
|
120
124
|
private readonly logger: Logger;
|
|
@@ -122,7 +126,6 @@ export class AgentCore {
|
|
|
122
126
|
private readonly runtime: AgentRuntime;
|
|
123
127
|
private readonly agentContext: AgentContext;
|
|
124
128
|
private readonly pluginRegistry: PluginRegistry;
|
|
125
|
-
private readonly pluginSystemProviders: Plugin[];
|
|
126
129
|
private readonly config: DowncityConfig;
|
|
127
130
|
private readonly platform: AgentPlatformRuntime;
|
|
128
131
|
private readonly env: Record<string, string>;
|
|
@@ -130,7 +133,7 @@ export class AgentCore {
|
|
|
130
133
|
private readonly defaultModel?: LanguageModel;
|
|
131
134
|
private readonly configureSessionHook?: AgentOptions["configureSession"];
|
|
132
135
|
private instruction: string[];
|
|
133
|
-
private
|
|
136
|
+
private pluginsStartPromise: Promise<void> | null = null;
|
|
134
137
|
private configuredSessionIds = new Set<string>();
|
|
135
138
|
|
|
136
139
|
constructor(options: AgentOptions) {
|
|
@@ -155,17 +158,13 @@ export class AgentCore {
|
|
|
155
158
|
this.defaultModel = options.model;
|
|
156
159
|
this.configureSessionHook = options.configureSession;
|
|
157
160
|
this.config = this.loadConfig();
|
|
158
|
-
this.
|
|
161
|
+
this.pluginInstances = new Map<string, BasePlugin>();
|
|
159
162
|
this.runtime = this.createRuntime();
|
|
160
|
-
this.
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
});
|
|
164
|
-
this.pluginSystemProviders = this.resolvePlugins({
|
|
165
|
-
explicitPlugins: options.plugins,
|
|
166
|
-
useBuiltinPlugins: options.useBuiltinPlugins === true,
|
|
163
|
+
this.registerPlugins({
|
|
164
|
+
explicitPlugins: options.plugins || [],
|
|
165
|
+
mode: options.mode || "custom",
|
|
167
166
|
});
|
|
168
|
-
this.pluginRegistry = this.createPluginRegistry(this.
|
|
167
|
+
this.pluginRegistry = this.createPluginRegistry([...this.pluginInstances.values()]);
|
|
169
168
|
this.plugins = this.createPluginPort();
|
|
170
169
|
this.agentContext = this.createAgentContext();
|
|
171
170
|
setShellToolRuntime(this.agentContext.invoke);
|
|
@@ -200,53 +199,78 @@ export class AgentCore {
|
|
|
200
199
|
}
|
|
201
200
|
|
|
202
201
|
/**
|
|
203
|
-
*
|
|
202
|
+
* 新建一个 session。
|
|
204
203
|
*/
|
|
205
|
-
async
|
|
206
|
-
const
|
|
204
|
+
async createSession(input?: AgentCreateSessionInput): Promise<Session> {
|
|
205
|
+
const explicitSessionId = String(input?.sessionId || "").trim() || undefined;
|
|
206
|
+
if (
|
|
207
|
+
explicitSessionId &&
|
|
208
|
+
(this.sessionsById.has(explicitSessionId) ||
|
|
209
|
+
(await fs.pathExists(
|
|
210
|
+
getSdkAgentSessionDirPath(this.path, this.id, explicitSessionId),
|
|
211
|
+
)))
|
|
212
|
+
) {
|
|
213
|
+
throw new Error(`Session "${explicitSessionId}" already exists`);
|
|
214
|
+
}
|
|
215
|
+
const session = this.getOrCreateSession(explicitSessionId);
|
|
207
216
|
await session.initialize();
|
|
208
217
|
await this.configureSession(session);
|
|
209
218
|
return session;
|
|
210
219
|
}
|
|
211
220
|
|
|
212
221
|
/**
|
|
213
|
-
*
|
|
222
|
+
* 获取一个已存在的 session。
|
|
214
223
|
*/
|
|
215
|
-
async
|
|
216
|
-
const
|
|
217
|
-
if (!
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
items.push(await session.toMetadata());
|
|
224
|
+
async getSession(sessionId: string): Promise<Session> {
|
|
225
|
+
const resolvedSessionId = String(sessionId || "").trim();
|
|
226
|
+
if (!resolvedSessionId) {
|
|
227
|
+
throw new Error("getSession requires a non-empty sessionId");
|
|
228
|
+
}
|
|
229
|
+
const sessionDirPath = getSdkAgentSessionDirPath(
|
|
230
|
+
this.path,
|
|
231
|
+
this.id,
|
|
232
|
+
resolvedSessionId,
|
|
233
|
+
);
|
|
234
|
+
if (
|
|
235
|
+
!this.sessionsById.has(resolvedSessionId) &&
|
|
236
|
+
!(await fs.pathExists(sessionDirPath))
|
|
237
|
+
) {
|
|
238
|
+
throw new Error(`Session "${resolvedSessionId}" not found`);
|
|
231
239
|
}
|
|
232
|
-
|
|
233
|
-
|
|
240
|
+
const session = this.getOrCreateSession(resolvedSessionId);
|
|
241
|
+
await session.initialize();
|
|
242
|
+
await this.configureSession(session);
|
|
243
|
+
return session;
|
|
234
244
|
}
|
|
235
245
|
|
|
236
246
|
/**
|
|
237
|
-
*
|
|
247
|
+
* 列出当前 agent 的 session 摘要页。
|
|
238
248
|
*/
|
|
239
|
-
async
|
|
240
|
-
|
|
241
|
-
|
|
249
|
+
async listSessions(
|
|
250
|
+
input?: AgentListSessionsInput,
|
|
251
|
+
): Promise<AgentSessionSummaryPage> {
|
|
252
|
+
return await listAgentSessionSummaryPage({
|
|
253
|
+
projectRoot: this.path,
|
|
254
|
+
agentId: this.id,
|
|
255
|
+
input,
|
|
256
|
+
executingSessionIds: new Set(this.runtime.listExecutingSessionIds()),
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* 确保当前 plugins 已启动。
|
|
262
|
+
*/
|
|
263
|
+
async ensurePluginsStarted(): Promise<void> {
|
|
264
|
+
if (this.pluginsStartPromise) {
|
|
265
|
+
await this.pluginsStartPromise;
|
|
242
266
|
return;
|
|
243
267
|
}
|
|
244
|
-
this.
|
|
245
|
-
for (const plugin of this.
|
|
268
|
+
this.pluginsStartPromise = (async () => {
|
|
269
|
+
for (const plugin of this.pluginInstances.values()) {
|
|
246
270
|
await plugin.lifecycle?.start?.(this.agentContext);
|
|
247
271
|
}
|
|
248
272
|
})();
|
|
249
|
-
await this.
|
|
273
|
+
await this.pluginsStartPromise;
|
|
250
274
|
}
|
|
251
275
|
|
|
252
276
|
/**
|
|
@@ -268,39 +292,27 @@ export class AgentCore {
|
|
|
268
292
|
}
|
|
269
293
|
}
|
|
270
294
|
|
|
271
|
-
private
|
|
272
|
-
|
|
273
|
-
|
|
295
|
+
private registerPlugins(input: {
|
|
296
|
+
explicitPlugins: BasePlugin[];
|
|
297
|
+
mode: AgentMode;
|
|
274
298
|
}): void {
|
|
275
|
-
const
|
|
276
|
-
const builtinRuntimePlugins = input.useBuiltinRuntimePlugins
|
|
299
|
+
const presetPlugins = input.mode === "preset"
|
|
277
300
|
? [...createRegisteredPluginInstances(this.runtime).values()]
|
|
278
301
|
: [];
|
|
279
|
-
for (const plugin of [...
|
|
302
|
+
for (const plugin of [...presetPlugins, ...input.explicitPlugins]) {
|
|
280
303
|
const name = String(plugin?.name || "").trim();
|
|
281
304
|
if (!name) {
|
|
282
|
-
throw new Error("Agent received a
|
|
305
|
+
throw new Error("Agent received a plugin without a valid name");
|
|
283
306
|
}
|
|
284
|
-
if (this.
|
|
285
|
-
throw new Error(`Duplicate
|
|
307
|
+
if (this.pluginInstances.has(name)) {
|
|
308
|
+
throw new Error(`Duplicate plugin registration: ${name}`);
|
|
286
309
|
}
|
|
287
310
|
plugin.bindAgent(this.runtime);
|
|
288
|
-
this.
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
private resolvePlugins(input: {
|
|
293
|
-
explicitPlugins?: Plugin[];
|
|
294
|
-
useBuiltinPlugins: boolean;
|
|
295
|
-
}): Plugin[] {
|
|
296
|
-
const plugins = input.useBuiltinPlugins ? [...PLUGINS] : [];
|
|
297
|
-
if (Array.isArray(input.explicitPlugins)) {
|
|
298
|
-
plugins.push(...input.explicitPlugins);
|
|
311
|
+
this.pluginInstances.set(name, plugin);
|
|
299
312
|
}
|
|
300
|
-
return plugins;
|
|
301
313
|
}
|
|
302
314
|
|
|
303
|
-
private createPluginRegistry(input:
|
|
315
|
+
private createPluginRegistry(input: BasePlugin[]): PluginRegistry {
|
|
304
316
|
let pluginRegistryRef: PluginRegistry | null = null;
|
|
305
317
|
const hookRegistry = new HookRegistry({
|
|
306
318
|
contextResolver: () => this.agentContext,
|
|
@@ -349,7 +361,7 @@ export class AgentCore {
|
|
|
349
361
|
|
|
350
362
|
private async loadPluginSystemBlocks(): Promise<AgentSessionSystemBlock[]> {
|
|
351
363
|
const out: AgentSessionSystemBlock[] = [];
|
|
352
|
-
for (const plugin of this.
|
|
364
|
+
for (const plugin of this.pluginInstances.values()) {
|
|
353
365
|
if (typeof plugin.system !== "function") continue;
|
|
354
366
|
try {
|
|
355
367
|
if (!isPluginEnabled({ plugin, context: this.agentContext })) continue;
|
|
@@ -371,25 +383,6 @@ export class AgentCore {
|
|
|
371
383
|
return out;
|
|
372
384
|
}
|
|
373
385
|
|
|
374
|
-
private async loadRuntimePluginSystemBlocks(): Promise<AgentSessionSystemBlock[]> {
|
|
375
|
-
const out: AgentSessionSystemBlock[] = [];
|
|
376
|
-
for (const plugin of this.runtimePlugins.values()) {
|
|
377
|
-
if (typeof plugin.system !== "function") continue;
|
|
378
|
-
try {
|
|
379
|
-
const text = String(await plugin.system(this.agentContext)).trim();
|
|
380
|
-
if (!text) continue;
|
|
381
|
-
out.push({
|
|
382
|
-
source: "plugin",
|
|
383
|
-
name: plugin.name,
|
|
384
|
-
content: text,
|
|
385
|
-
});
|
|
386
|
-
} catch {
|
|
387
|
-
// 单个 runtime plugin system 失败不应阻断 SDK session 主链路。
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
|
-
return out;
|
|
391
|
-
}
|
|
392
|
-
|
|
393
386
|
private createRuntime(): AgentRuntime {
|
|
394
387
|
const runtime = {
|
|
395
388
|
cwd: this.path,
|
|
@@ -410,7 +403,7 @@ export class AgentCore {
|
|
|
410
403
|
.map((session) => session.id),
|
|
411
404
|
getExecutingSessionCount: () =>
|
|
412
405
|
[...this.sessionsById.values()].filter((session) => session.isExecuting()).length,
|
|
413
|
-
|
|
406
|
+
pluginInstances: this.pluginInstances,
|
|
414
407
|
} satisfies AgentRuntime;
|
|
415
408
|
return runtime;
|
|
416
409
|
}
|
|
@@ -434,7 +427,7 @@ export class AgentCore {
|
|
|
434
427
|
listExecutingSessionIds: () => this.runtime.listExecutingSessionIds(),
|
|
435
428
|
getExecutingSessionCount: () => this.runtime.getExecutingSessionCount(),
|
|
436
429
|
resolveModel: async (sessionId) => {
|
|
437
|
-
const session = await this.
|
|
430
|
+
const session = await this.getSession(sessionId);
|
|
438
431
|
return session.config.model;
|
|
439
432
|
},
|
|
440
433
|
},
|
|
@@ -446,7 +439,7 @@ export class AgentCore {
|
|
|
446
439
|
}) => {
|
|
447
440
|
const pluginName = String(params.plugin || "").trim();
|
|
448
441
|
const actionName = String(params.action || "").trim();
|
|
449
|
-
const plugin = this.
|
|
442
|
+
const plugin = this.pluginInstances.get(pluginName);
|
|
450
443
|
if (!plugin) {
|
|
451
444
|
return {
|
|
452
445
|
success: false,
|
|
@@ -505,7 +498,7 @@ export class AgentCore {
|
|
|
505
498
|
tools: this.tools,
|
|
506
499
|
logger: this.logger,
|
|
507
500
|
getInstructionSystemBlocks: () => this.loadInstructionSystemBlocks(),
|
|
508
|
-
|
|
501
|
+
getManagedPluginSystemBlocks: async () => [],
|
|
509
502
|
getPluginSystemBlocks: () => this.loadPluginSystemBlocks(),
|
|
510
503
|
ensureConfigured: async (session) => {
|
|
511
504
|
await this.configureSession(session);
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* 关键点(中文)
|
|
5
5
|
* - 这里表达的是单个 `AgentCore` 实例持有的长期运行状态。
|
|
6
6
|
* - 它不再依赖 `runtime/*` 兼容层,而是作为实例级主类型来源。
|
|
7
|
-
* - Session /
|
|
7
|
+
* - Session / plugin 这些长期对象都从这里挂出。
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import type { Logger } from "@/utils/logger/Logger.js";
|
|
@@ -72,7 +72,7 @@ export interface AgentRuntime extends AgentRuntimeBase {
|
|
|
72
72
|
*
|
|
73
73
|
* 关键点(中文)
|
|
74
74
|
* - 返回值是统一的 `SessionPort`,而不是裸 `Executor`。
|
|
75
|
-
* - 这样 HTTP / runtime
|
|
75
|
+
* - 这样 HTTP / plugin runtime / chat queue / contact 等入口都能复用同一层会话装配与执行兜底。
|
|
76
76
|
*/
|
|
77
77
|
getSession(sessionId: string): SessionPort;
|
|
78
78
|
/**
|
|
@@ -84,7 +84,7 @@ export interface AgentRuntime extends AgentRuntimeBase {
|
|
|
84
84
|
*/
|
|
85
85
|
getExecutingSessionCount(): number;
|
|
86
86
|
/**
|
|
87
|
-
* 当前 agent
|
|
87
|
+
* 当前 agent 持有的插件实例集合。
|
|
88
88
|
*/
|
|
89
|
-
|
|
89
|
+
pluginInstances: Map<string, BasePlugin>;
|
|
90
90
|
}
|
|
@@ -8,17 +8,17 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { streamText, type LanguageModel, type Tool } from "ai";
|
|
11
|
-
import { SessionHistoryWriter } from "@
|
|
12
|
-
import type { SessionHistoryComposer } from "@
|
|
13
|
-
import type { SessionHistoryStore } from "@/
|
|
14
|
-
import { withSessionRunScope } from "@
|
|
15
|
-
import type { SessionRunScope } from "@
|
|
16
|
-
import { buildSessionStepEventMessages } from "@
|
|
17
|
-
import { JsonlSessionCompactionComposer } from "@
|
|
18
|
-
import { LocalSessionContextComposer } from "@
|
|
19
|
-
import type { SessionCompactionComposer } from "@
|
|
20
|
-
import type { SessionContextComposer } from "@
|
|
21
|
-
import type { SessionSystemComposer } from "@
|
|
11
|
+
import { SessionHistoryWriter } from "@executor/composer/history/SessionHistoryWriter.js";
|
|
12
|
+
import type { SessionHistoryComposer } from "@executor/composer/history/SessionHistoryComposer.js";
|
|
13
|
+
import type { SessionHistoryStore } from "@/executor/store/history/SessionHistoryStore.js";
|
|
14
|
+
import { withSessionRunScope } from "@executor/SessionRunScope.js";
|
|
15
|
+
import type { SessionRunScope } from "@executor/SessionRunScope.js";
|
|
16
|
+
import { buildSessionStepEventMessages } from "@executor/messages/SessionStepEventMapper.js";
|
|
17
|
+
import { JsonlSessionCompactionComposer } from "@executor/composer/compaction/jsonl/JsonlSessionCompactionComposer.js";
|
|
18
|
+
import { LocalSessionContextComposer } from "@executor/composer/context/LocalSessionContextComposer.js";
|
|
19
|
+
import type { SessionCompactionComposer } from "@executor/composer/compaction/SessionCompactionComposer.js";
|
|
20
|
+
import type { SessionContextComposer } from "@executor/composer/context/SessionContextComposer.js";
|
|
21
|
+
import type { SessionSystemComposer } from "@executor/composer/system/SessionSystemComposer.js";
|
|
22
22
|
import {
|
|
23
23
|
MAX_INCOMPLETE_RESPONSE_RECOVERIES,
|
|
24
24
|
MAX_TEXT_ONLY_CONTINUATIONS,
|
|
@@ -31,30 +31,30 @@ import {
|
|
|
31
31
|
summarizeStepForDebug,
|
|
32
32
|
summarizeUiMessageForDebug,
|
|
33
33
|
toInlinePreview,
|
|
34
|
-
} from "@
|
|
34
|
+
} from "@executor/core-engine/CoreEngineSignals.js";
|
|
35
35
|
import {
|
|
36
36
|
evaluateCoreEngineLoopDecision,
|
|
37
37
|
shouldContinueForTailMergedUserMessages,
|
|
38
|
-
} from "@
|
|
38
|
+
} from "@executor/core-engine/CoreEngineLoopDecision.js";
|
|
39
39
|
import {
|
|
40
40
|
resolveEffectiveCoreEngineError,
|
|
41
41
|
summarizeStreamError,
|
|
42
|
-
} from "@
|
|
43
|
-
import { collectFinalAssistantMessageFromUiStream } from "@
|
|
44
|
-
import { CoreEngineMessageState } from "@
|
|
42
|
+
} from "@executor/core-engine/CoreEngineError.js";
|
|
43
|
+
import { collectFinalAssistantMessageFromUiStream } from "@executor/core-engine/CoreEngineUiStreamCollector.js";
|
|
44
|
+
import { CoreEngineMessageState } from "@executor/core-engine/CoreEngineMessageState.js";
|
|
45
45
|
import {
|
|
46
46
|
buildOpenAIResponsesProviderOptions,
|
|
47
|
-
} from "@
|
|
48
|
-
import { logAssistantMessageNow } from "@
|
|
47
|
+
} from "@executor/messages/SessionMessageCodec.js";
|
|
48
|
+
import { logAssistantMessageNow } from "@executor/messages/SessionMessageLog.js";
|
|
49
49
|
import type { Logger } from "@/utils/logger/Logger.js";
|
|
50
50
|
import type { JsonObject } from "@/types/common/Json.js";
|
|
51
|
-
import type { SessionMessageV1 } from "@/
|
|
52
|
-
import type { SessionExecutor } from "@/
|
|
51
|
+
import type { SessionMessageV1 } from "@/executor/types/SessionMessages.js";
|
|
52
|
+
import type { SessionExecutor } from "@/executor/types/SessionExecutor.js";
|
|
53
53
|
import type {
|
|
54
54
|
SessionExecuteInput,
|
|
55
55
|
SessionRunInput,
|
|
56
56
|
SessionRunResult,
|
|
57
|
-
} from "@/
|
|
57
|
+
} from "@/executor/types/SessionRun.js";
|
|
58
58
|
|
|
59
59
|
/**
|
|
60
60
|
* 可压缩错误的最大重试次数。
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Executor Module
|
|
2
2
|
|
|
3
|
-
`
|
|
3
|
+
`executor/` 是单 Agent 的内部执行内核。它不直接面向普通 SDK 用户;普通用户通过 `sdk/Session.ts` 使用 `session.prompt()`、`session.subscribe()`、`session.history()` 等 API。
|
|
4
4
|
|
|
5
5
|
## 核心概念
|
|
6
6
|
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
sdk/Session.prompt({ query })
|
|
18
18
|
-> SessionPromptRuntime 绑定 turn
|
|
19
19
|
-> append user message
|
|
20
|
-
->
|
|
20
|
+
-> executor/Executor 执行当前 turn
|
|
21
21
|
-> ContextComposer.compose()
|
|
22
22
|
-> SystemComposer.resolve()
|
|
23
23
|
-> CompactionComposer.run()
|
|
@@ -31,7 +31,7 @@ sdk/Session.prompt({ query })
|
|
|
31
31
|
|
|
32
32
|
## Composer 分工
|
|
33
33
|
|
|
34
|
-
- `composer/system/`:组装本轮 system messages,例如 instruction、
|
|
34
|
+
- `composer/system/`:组装本轮 system messages,例如 instruction、plugin system 和 session context。
|
|
35
35
|
- `composer/history/`:只组装本轮 model messages,不负责历史落盘。
|
|
36
36
|
- `composer/context/`:组装 tools、step hooks、fallback assistant message 等运行上下文。
|
|
37
37
|
- `composer/compaction/`:判断上下文错误和压缩历史,必要时写入 summary 与 archive。
|
|
@@ -83,7 +83,7 @@ Executor.prepareExecuteInput()
|
|
|
83
83
|
## 当前目录结构
|
|
84
84
|
|
|
85
85
|
```text
|
|
86
|
-
|
|
86
|
+
executor/
|
|
87
87
|
├── Executor.ts
|
|
88
88
|
├── SessionRunScope.ts
|
|
89
89
|
├── composer/
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
2
|
-
import type { SessionUserMessageV1 } from "@/
|
|
2
|
+
import type { SessionUserMessageV1 } from "@/executor/types/SessionMessages.js";
|
|
3
3
|
import type {
|
|
4
4
|
SessionAssistantStepCallback,
|
|
5
5
|
SessionUiMessageChunkCallback,
|
|
6
|
-
} from "@/
|
|
6
|
+
} from "@/executor/types/SessionRun.js";
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* SessionRunScope(单次请求作用域)。
|
|
10
10
|
*
|
|
11
11
|
* 关键点(中文)
|
|
12
|
-
* - 这是 session run 层请求作用域上下文,不属于具体
|
|
12
|
+
* - 这是 session run 层请求作用域上下文,不属于具体 plugin 业务模块。
|
|
13
13
|
* - 统一承载请求链需要透传的字段(如 `sessionId`)。
|
|
14
14
|
*/
|
|
15
15
|
export type SessionRunScope = {
|
|
@@ -46,7 +46,7 @@ export type SessionRunScope = {
|
|
|
46
46
|
*
|
|
47
47
|
* 关键点(中文)
|
|
48
48
|
* - 用于在 tool 执行后向下一 step 注入结构化 user 消息。
|
|
49
|
-
* -
|
|
49
|
+
* - 队列内容由上层 plugin runtime 通过统一协议下发,main 不感知业务语义。
|
|
50
50
|
*/
|
|
51
51
|
injectedUserMessages?: SessionUserMessageV1[];
|
|
52
52
|
};
|
|
@@ -56,7 +56,7 @@ export type SessionRunScope = {
|
|
|
56
56
|
*
|
|
57
57
|
* 关键点(中文)
|
|
58
58
|
* - 同一条异步调用链内可读取一致的 SessionRunScope。
|
|
59
|
-
* - 用于把 `sessionId` 从入口透传到
|
|
59
|
+
* - 用于把 `sessionId` 从入口透传到 plugin runtime 与工具层。
|
|
60
60
|
*/
|
|
61
61
|
export const sessionRunScopeStorage = new AsyncLocalStorage<SessionRunScope>();
|
|
62
62
|
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import type { LanguageModel, SystemModelMessage } from "ai";
|
|
10
|
-
import type { SessionHistoryStore } from "@/
|
|
10
|
+
import type { SessionHistoryStore } from "@/executor/store/history/SessionHistoryStore.js";
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* compaction Composer 执行输入。
|
package/src/{session → executor}/composer/compaction/jsonl/JsonlSessionCompactionComposer.ts
RENAMED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
import type {
|
|
10
10
|
SessionCompactionComposer,
|
|
11
11
|
SessionCompactionInput,
|
|
12
|
-
} from "@
|
|
12
|
+
} from "@executor/composer/compaction/SessionCompactionComposer.js";
|
|
13
13
|
|
|
14
14
|
type JsonlSessionCompactionComposerOptions = {
|
|
15
15
|
keepLastMessages?: number;
|
package/src/{session → executor}/composer/compaction/jsonl/JsonlSessionCompactionExecutor.ts
RENAMED
|
@@ -20,8 +20,8 @@ import { getLogger } from "@/utils/logger/Logger.js";
|
|
|
20
20
|
import type {
|
|
21
21
|
SessionMessageV1,
|
|
22
22
|
SessionMetadataV1,
|
|
23
|
-
} from "@/
|
|
24
|
-
import type { SessionHistoryMetaV1 } from "@/
|
|
23
|
+
} from "@/executor/types/SessionMessages.js";
|
|
24
|
+
import type { SessionHistoryMetaV1 } from "@/executor/types/SessionHistoryMeta.js";
|
|
25
25
|
|
|
26
26
|
export type SessionCompactParams = {
|
|
27
27
|
model: LanguageModel;
|