@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/sdk/AgentSdkTypes.ts
CHANGED
|
@@ -3,17 +3,27 @@
|
|
|
3
3
|
*
|
|
4
4
|
* 关键点(中文)
|
|
5
5
|
* - 这里集中声明 `Agent` / `RemoteAgent` / `Session` 面向外部调用方的稳定接口。
|
|
6
|
-
* - SDK 用户通过显式 `tools` / `
|
|
6
|
+
* - SDK 用户通过显式 `tools` / `plugins` 装配能力,不直接依赖内部 runtime 单例。
|
|
7
7
|
* - 本地/远程 session 运行与基础落盘能力仍是 SDK 主路径。
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import type { LanguageModel, Tool } from "ai";
|
|
11
11
|
import type { BasePlugin } from "@/plugin/core/BasePlugin.js";
|
|
12
|
-
import type { Plugin } from "@/plugin/types/Plugin.js";
|
|
13
12
|
import type { AgentPlatformRuntime } from "@/types/runtime/host/AgentHost.js";
|
|
14
13
|
import type { LocalRpcServerHandle } from "@/types/runtime/rpc/LocalRpc.js";
|
|
15
14
|
import type { ServerInstance } from "@/runtime/server/http/Server.js";
|
|
16
|
-
import type {
|
|
15
|
+
import type { SessionMessageV1 } from "@/executor/types/SessionMessages.js";
|
|
16
|
+
import type {
|
|
17
|
+
AgentSessionSubscriber,
|
|
18
|
+
AgentSessionUnsubscribe,
|
|
19
|
+
} from "@/types/sdk/AgentSessionEvent.js";
|
|
20
|
+
import type { AgentSessionPromptInput } from "@/types/sdk/AgentSessionPrompt.js";
|
|
21
|
+
import type { AgentSessionTurnHandle } from "@/types/sdk/AgentSessionTurn.js";
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* SDK Agent 插件装配模式。
|
|
25
|
+
*/
|
|
26
|
+
export type AgentMode = "preset" | "custom";
|
|
17
27
|
|
|
18
28
|
/**
|
|
19
29
|
* 本地 Agent 构造参数。
|
|
@@ -63,42 +73,24 @@ export interface AgentOptions {
|
|
|
63
73
|
model?: LanguageModel;
|
|
64
74
|
|
|
65
75
|
/**
|
|
66
|
-
* 当前 agent
|
|
76
|
+
* 当前 agent 的插件装配模式。
|
|
67
77
|
*
|
|
68
78
|
* 关键点(中文)
|
|
69
|
-
* -
|
|
70
|
-
* - `
|
|
71
|
-
* -
|
|
79
|
+
* - `preset` 会自动装配内建插件集合。
|
|
80
|
+
* - `custom` 只使用显式传入的 `plugins`。
|
|
81
|
+
* - 默认值为 `custom`,避免本地嵌入场景隐式打开额外能力。
|
|
72
82
|
*/
|
|
73
|
-
|
|
83
|
+
mode?: AgentMode;
|
|
74
84
|
|
|
75
85
|
/**
|
|
76
|
-
*
|
|
86
|
+
* 当前 agent 显式持有的插件实例集合。
|
|
77
87
|
*
|
|
78
88
|
* 关键点(中文)
|
|
79
|
-
* -
|
|
80
|
-
* -
|
|
81
|
-
*/
|
|
82
|
-
useBuiltinRuntimePlugins?: boolean;
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* 当前 agent 显式注册的 plugin 定义集合。
|
|
86
|
-
*
|
|
87
|
-
* 关键点(中文)
|
|
88
|
-
* - 这里接收完整 plugin 定义对象,而不是 plugin 名称。
|
|
89
|
-
* - `Agent` 会为当前 SDK 实例创建独立 plugin registry,避免污染全局 runtime。
|
|
89
|
+
* - 这里接收已经实例化好的 `BasePlugin` 对象,而不是 plugin class。
|
|
90
|
+
* - `Agent` 会在构造阶段按名称注册这些实例,并自动绑定到当前 runtime。
|
|
90
91
|
* - 同名 plugin 会直接报错,避免 action / hook / resolve 行为被静默覆盖。
|
|
91
92
|
*/
|
|
92
|
-
plugins?:
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* 是否自动装配全部内建 plugin。
|
|
96
|
-
*
|
|
97
|
-
* 关键点(中文)
|
|
98
|
-
* - 适合 city 这类宿主进程直接 `new Agent(...)` 的场景。
|
|
99
|
-
* - 未开启时,默认只使用显式传入的 `plugins`。
|
|
100
|
-
*/
|
|
101
|
-
useBuiltinPlugins?: boolean;
|
|
93
|
+
plugins?: BasePlugin[];
|
|
102
94
|
|
|
103
95
|
/**
|
|
104
96
|
* 当前 agent 显式注入的平台能力集合。
|
|
@@ -116,9 +108,9 @@ export interface AgentOptions {
|
|
|
116
108
|
* - SDK 不负责默认模型策略,宿主可在这里统一为 session 注入 model 等运行配置。
|
|
117
109
|
* - 若同时传入 `model`,则会先写入默认模型,再执行这里的宿主覆写逻辑。
|
|
118
110
|
* - 该钩子对每个 session 只触发一次,适合做实例级默认装配。
|
|
119
|
-
* - 触发时机可能来自显式 `agent.
|
|
111
|
+
* - 触发时机可能来自显式 `agent.createSession()` / `agent.getSession()`,也可能来自该 session 的首次执行入口。
|
|
120
112
|
*/
|
|
121
|
-
configureSession?: (session:
|
|
113
|
+
configureSession?: (session: AgentSession) => Promise<void> | void;
|
|
122
114
|
}
|
|
123
115
|
|
|
124
116
|
/**
|
|
@@ -145,13 +137,13 @@ export interface AgentStartOptions {
|
|
|
145
137
|
rpc?: boolean;
|
|
146
138
|
|
|
147
139
|
/**
|
|
148
|
-
* 是否启动当前 agent 的
|
|
140
|
+
* 是否启动当前 agent 的 plugins。
|
|
149
141
|
*
|
|
150
142
|
* 关键点(中文)
|
|
151
143
|
* - 默认 `true`。
|
|
152
144
|
* - `false` 适合只需要 session 能力、不希望启动后台能力的嵌入场景。
|
|
153
145
|
*/
|
|
154
|
-
|
|
146
|
+
plugins?: boolean;
|
|
155
147
|
}
|
|
156
148
|
|
|
157
149
|
/**
|
|
@@ -169,9 +161,9 @@ export interface AgentStopResult {
|
|
|
169
161
|
rpcStopped: boolean;
|
|
170
162
|
|
|
171
163
|
/**
|
|
172
|
-
* 本次是否实际停止了
|
|
164
|
+
* 本次是否实际停止了 plugins。
|
|
173
165
|
*/
|
|
174
|
-
|
|
166
|
+
pluginsStopped: boolean;
|
|
175
167
|
}
|
|
176
168
|
|
|
177
169
|
/**
|
|
@@ -189,9 +181,9 @@ export interface AgentStartResult {
|
|
|
189
181
|
rpc?: AgentRpcBinding;
|
|
190
182
|
|
|
191
183
|
/**
|
|
192
|
-
* 当前 agent 是否已启动
|
|
184
|
+
* 当前 agent 是否已启动 plugins。
|
|
193
185
|
*/
|
|
194
|
-
|
|
186
|
+
pluginsStarted: boolean;
|
|
195
187
|
}
|
|
196
188
|
|
|
197
189
|
/**
|
|
@@ -261,6 +253,53 @@ export interface RemoteAgentOptions {
|
|
|
261
253
|
baseUrl: string;
|
|
262
254
|
}
|
|
263
255
|
|
|
256
|
+
/**
|
|
257
|
+
* 新建 session 的输入参数。
|
|
258
|
+
*/
|
|
259
|
+
export interface AgentCreateSessionInput {
|
|
260
|
+
/**
|
|
261
|
+
* 可选显式 sessionId。
|
|
262
|
+
*
|
|
263
|
+
* 关键点(中文)
|
|
264
|
+
* - 传入时表达“创建意图”。
|
|
265
|
+
* - 若该 session 已存在,SDK 应直接报错,而不是静默复用。
|
|
266
|
+
* - 省略时由 SDK 自动生成稳定且不可推导的 sessionId。
|
|
267
|
+
*/
|
|
268
|
+
sessionId?: string;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* Session 列表查询输入。
|
|
273
|
+
*/
|
|
274
|
+
export interface AgentListSessionsInput {
|
|
275
|
+
/**
|
|
276
|
+
* 当前页返回上限。
|
|
277
|
+
*
|
|
278
|
+
* 说明(中文)
|
|
279
|
+
* - 省略时由 SDK 使用默认值。
|
|
280
|
+
* - 建议宿主 UI 明确传入,避免在大量 session 下拉取过多数据。
|
|
281
|
+
*/
|
|
282
|
+
limit?: number;
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* 分页游标。
|
|
286
|
+
*
|
|
287
|
+
* 说明(中文)
|
|
288
|
+
* - 当前使用 SDK 自身生成的透明字符串游标。
|
|
289
|
+
* - 调用方只负责透传,不应自行解析其内部格式。
|
|
290
|
+
*/
|
|
291
|
+
cursor?: string;
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* 关键词过滤。
|
|
295
|
+
*
|
|
296
|
+
* 说明(中文)
|
|
297
|
+
* - 推荐用于匹配 `sessionId`、标题与预览文本。
|
|
298
|
+
* - 属于轻量包含匹配,不承诺复杂搜索语义。
|
|
299
|
+
*/
|
|
300
|
+
query?: string;
|
|
301
|
+
}
|
|
302
|
+
|
|
264
303
|
/**
|
|
265
304
|
* Session 可变配置。
|
|
266
305
|
*/
|
|
@@ -290,6 +329,57 @@ export interface AgentSessionConfigSnapshot {
|
|
|
290
329
|
modelLabel?: string;
|
|
291
330
|
}
|
|
292
331
|
|
|
332
|
+
/**
|
|
333
|
+
* Session 历史视图类型。
|
|
334
|
+
*/
|
|
335
|
+
export type AgentSessionHistoryView = "message" | "timeline";
|
|
336
|
+
|
|
337
|
+
/**
|
|
338
|
+
* Session 时间线事件。
|
|
339
|
+
*/
|
|
340
|
+
export interface AgentSessionTimelineEvent {
|
|
341
|
+
/**
|
|
342
|
+
* 当前事件唯一标识。
|
|
343
|
+
*/
|
|
344
|
+
id: string;
|
|
345
|
+
|
|
346
|
+
/**
|
|
347
|
+
* 当前事件角色。
|
|
348
|
+
*
|
|
349
|
+
* 说明(中文)
|
|
350
|
+
* - `tool-call` / `tool-result` 用于把 assistant 内部工具过程平铺给 UI。
|
|
351
|
+
*/
|
|
352
|
+
role: "user" | "assistant" | "tool-call" | "tool-result";
|
|
353
|
+
|
|
354
|
+
/**
|
|
355
|
+
* 事件时间戳(毫秒)。
|
|
356
|
+
*/
|
|
357
|
+
ts?: number;
|
|
358
|
+
|
|
359
|
+
/**
|
|
360
|
+
* 事件所属消息种类。
|
|
361
|
+
*/
|
|
362
|
+
kind?: string;
|
|
363
|
+
|
|
364
|
+
/**
|
|
365
|
+
* 事件来源。
|
|
366
|
+
*/
|
|
367
|
+
source?: string;
|
|
368
|
+
|
|
369
|
+
/**
|
|
370
|
+
* 当前事件展示文本。
|
|
371
|
+
*/
|
|
372
|
+
text: string;
|
|
373
|
+
|
|
374
|
+
/**
|
|
375
|
+
* 当前事件对应工具名称。
|
|
376
|
+
*
|
|
377
|
+
* 说明(中文)
|
|
378
|
+
* - 仅 `tool-call` / `tool-result` 这类事件通常会携带该字段。
|
|
379
|
+
*/
|
|
380
|
+
toolName?: string;
|
|
381
|
+
}
|
|
382
|
+
|
|
293
383
|
/**
|
|
294
384
|
* Session system block 来源类型。
|
|
295
385
|
*/
|
|
@@ -393,9 +483,9 @@ export interface AgentSessionSystemSnapshot {
|
|
|
393
483
|
}
|
|
394
484
|
|
|
395
485
|
/**
|
|
396
|
-
* Session
|
|
486
|
+
* Session 摘要。
|
|
397
487
|
*/
|
|
398
|
-
export interface
|
|
488
|
+
export interface AgentSessionSummary {
|
|
399
489
|
/**
|
|
400
490
|
* 当前 session 所属 agentId。
|
|
401
491
|
*/
|
|
@@ -406,6 +496,24 @@ export interface AgentSessionMetadata {
|
|
|
406
496
|
*/
|
|
407
497
|
sessionId: string;
|
|
408
498
|
|
|
499
|
+
/**
|
|
500
|
+
* 当前 session 可读标题。
|
|
501
|
+
*
|
|
502
|
+
* 说明(中文)
|
|
503
|
+
* - 当前 SDK 不要求标题一定存在。
|
|
504
|
+
* - 若调用方需要展示列表标题,可优先使用这里;为空时再回退到 `sessionId`。
|
|
505
|
+
*/
|
|
506
|
+
title?: string;
|
|
507
|
+
|
|
508
|
+
/**
|
|
509
|
+
* 当前 session 的最近预览文本。
|
|
510
|
+
*
|
|
511
|
+
* 说明(中文)
|
|
512
|
+
* - 通常来自最后一条用户可见消息的裁剪文本。
|
|
513
|
+
* - 适合用于侧边栏、列表卡片或 session picker。
|
|
514
|
+
*/
|
|
515
|
+
previewText?: string;
|
|
516
|
+
|
|
409
517
|
/**
|
|
410
518
|
* 当前 session 首次创建时间(ms)。
|
|
411
519
|
*/
|
|
@@ -425,6 +533,126 @@ export interface AgentSessionMetadata {
|
|
|
425
533
|
* 当前 session 绑定模型的可读标签。
|
|
426
534
|
*/
|
|
427
535
|
modelLabel?: string;
|
|
536
|
+
|
|
537
|
+
/**
|
|
538
|
+
* 当前 session 是否处于执行中。
|
|
539
|
+
*/
|
|
540
|
+
executing?: boolean;
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
/**
|
|
544
|
+
* Session 详情。
|
|
545
|
+
*/
|
|
546
|
+
export interface AgentSessionInfo extends AgentSessionSummary {
|
|
547
|
+
/**
|
|
548
|
+
* 当前 session 初始化时记录的时区。
|
|
549
|
+
*/
|
|
550
|
+
timezone?: string;
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
/**
|
|
554
|
+
* Session 摘要分页结果。
|
|
555
|
+
*/
|
|
556
|
+
export interface AgentSessionSummaryPage {
|
|
557
|
+
/**
|
|
558
|
+
* 当前页 session 摘要列表。
|
|
559
|
+
*/
|
|
560
|
+
items: AgentSessionSummary[];
|
|
561
|
+
|
|
562
|
+
/**
|
|
563
|
+
* 当前页所对应的总条数。
|
|
564
|
+
*
|
|
565
|
+
* 说明(中文)
|
|
566
|
+
* - 这里表示过滤后的总数,不是仅当前页数量。
|
|
567
|
+
* - 对分页 UI、结果统计和空态判断更友好。
|
|
568
|
+
*/
|
|
569
|
+
total: number;
|
|
570
|
+
|
|
571
|
+
/**
|
|
572
|
+
* 下一页游标。
|
|
573
|
+
*/
|
|
574
|
+
nextCursor?: string;
|
|
575
|
+
|
|
576
|
+
/**
|
|
577
|
+
* 是否仍有更多结果。
|
|
578
|
+
*/
|
|
579
|
+
hasMore: boolean;
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
/**
|
|
583
|
+
* Session 历史读取输入。
|
|
584
|
+
*/
|
|
585
|
+
export interface AgentSessionHistoryInput {
|
|
586
|
+
/**
|
|
587
|
+
* 当前页返回上限。
|
|
588
|
+
*/
|
|
589
|
+
limit?: number;
|
|
590
|
+
|
|
591
|
+
/**
|
|
592
|
+
* 分页游标。
|
|
593
|
+
*/
|
|
594
|
+
cursor?: string;
|
|
595
|
+
|
|
596
|
+
/**
|
|
597
|
+
* 返回顺序。
|
|
598
|
+
*
|
|
599
|
+
* 说明(中文)
|
|
600
|
+
* - `asc`:从旧到新
|
|
601
|
+
* - `desc`:从新到旧
|
|
602
|
+
*/
|
|
603
|
+
order?: "asc" | "desc";
|
|
604
|
+
|
|
605
|
+
/**
|
|
606
|
+
* 返回视图类型。
|
|
607
|
+
*
|
|
608
|
+
* 说明(中文)
|
|
609
|
+
* - `message`:原始 session 消息
|
|
610
|
+
* - `timeline`:适合直接渲染 UI 的平铺事件
|
|
611
|
+
*/
|
|
612
|
+
view?: AgentSessionHistoryView;
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
/**
|
|
616
|
+
* Session 历史分页结果。
|
|
617
|
+
*/
|
|
618
|
+
export interface AgentSessionHistoryPage {
|
|
619
|
+
/**
|
|
620
|
+
* 当前读取所对应的 session 信息。
|
|
621
|
+
*/
|
|
622
|
+
session: AgentSessionInfo;
|
|
623
|
+
|
|
624
|
+
/**
|
|
625
|
+
* 当前页实际返回视图。
|
|
626
|
+
*/
|
|
627
|
+
view: AgentSessionHistoryView;
|
|
628
|
+
|
|
629
|
+
/**
|
|
630
|
+
* 当前页数据列表。
|
|
631
|
+
*
|
|
632
|
+
* 说明(中文)
|
|
633
|
+
* - `view=message` 时返回 `SessionMessageV1[]`
|
|
634
|
+
* - `view=timeline` 时返回 `AgentSessionTimelineEvent[]`
|
|
635
|
+
*/
|
|
636
|
+
items: SessionMessageV1[] | AgentSessionTimelineEvent[];
|
|
637
|
+
|
|
638
|
+
/**
|
|
639
|
+
* 过滤前后的总条数。
|
|
640
|
+
*
|
|
641
|
+
* 说明(中文)
|
|
642
|
+
* - 对 `view=message` 表示消息条数。
|
|
643
|
+
* - 对 `view=timeline` 表示时间线事件条数。
|
|
644
|
+
*/
|
|
645
|
+
total: number;
|
|
646
|
+
|
|
647
|
+
/**
|
|
648
|
+
* 下一页游标。
|
|
649
|
+
*/
|
|
650
|
+
nextCursor?: string;
|
|
651
|
+
|
|
652
|
+
/**
|
|
653
|
+
* 是否仍有更多数据。
|
|
654
|
+
*/
|
|
655
|
+
hasMore: boolean;
|
|
428
656
|
}
|
|
429
657
|
|
|
430
658
|
/**
|
|
@@ -440,3 +668,93 @@ export interface AgentSessionForkInput {
|
|
|
440
668
|
*/
|
|
441
669
|
messageId?: string;
|
|
442
670
|
}
|
|
671
|
+
|
|
672
|
+
/**
|
|
673
|
+
* SDK Session 集合绑定。
|
|
674
|
+
*/
|
|
675
|
+
export interface AgentSessionCollection {
|
|
676
|
+
/**
|
|
677
|
+
* 新建一个 session。
|
|
678
|
+
*/
|
|
679
|
+
createSession(input?: AgentCreateSessionInput): Promise<AgentSession>;
|
|
680
|
+
|
|
681
|
+
/**
|
|
682
|
+
* 获取一个已存在的 session。
|
|
683
|
+
*/
|
|
684
|
+
getSession(sessionId: string): Promise<AgentSession>;
|
|
685
|
+
|
|
686
|
+
/**
|
|
687
|
+
* 列出当前 agent 的 session 摘要页。
|
|
688
|
+
*/
|
|
689
|
+
listSessions(input?: AgentListSessionsInput): Promise<AgentSessionSummaryPage>;
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
/**
|
|
693
|
+
* Session actor 公共能力。
|
|
694
|
+
*/
|
|
695
|
+
export interface AgentSessionActor {
|
|
696
|
+
/**
|
|
697
|
+
* 当前 session 稳定标识。
|
|
698
|
+
*/
|
|
699
|
+
readonly id: string;
|
|
700
|
+
|
|
701
|
+
/**
|
|
702
|
+
* 读取当前 session 详情。
|
|
703
|
+
*/
|
|
704
|
+
getInfo(): Promise<AgentSessionInfo>;
|
|
705
|
+
|
|
706
|
+
/**
|
|
707
|
+
* 追加一条新的 prompt。
|
|
708
|
+
*/
|
|
709
|
+
prompt(input: AgentSessionPromptInput): Promise<AgentSessionTurnHandle>;
|
|
710
|
+
|
|
711
|
+
/**
|
|
712
|
+
* 订阅当前 session 的未来事件。
|
|
713
|
+
*/
|
|
714
|
+
subscribe(subscriber: AgentSessionSubscriber): AgentSessionUnsubscribe;
|
|
715
|
+
|
|
716
|
+
/**
|
|
717
|
+
* 读取当前 session 历史分页。
|
|
718
|
+
*/
|
|
719
|
+
history(input?: AgentSessionHistoryInput): Promise<AgentSessionHistoryPage>;
|
|
720
|
+
|
|
721
|
+
/**
|
|
722
|
+
* 读取当前 session 生效的 system 快照。
|
|
723
|
+
*/
|
|
724
|
+
system(): Promise<AgentSessionSystemSnapshot>;
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
/**
|
|
728
|
+
* 本地 Agent 返回的公开 session 接口。
|
|
729
|
+
*/
|
|
730
|
+
export interface AgentSession extends AgentSessionActor {
|
|
731
|
+
/**
|
|
732
|
+
* 当前 session 所属 agentId。
|
|
733
|
+
*/
|
|
734
|
+
readonly agentId: string;
|
|
735
|
+
|
|
736
|
+
/**
|
|
737
|
+
* 当前 session 配置快照。
|
|
738
|
+
*/
|
|
739
|
+
readonly config: AgentSessionConfigSnapshot;
|
|
740
|
+
|
|
741
|
+
/**
|
|
742
|
+
* 写入当前 session 默认配置。
|
|
743
|
+
*/
|
|
744
|
+
set(input: AgentSessionSetInput): Promise<void>;
|
|
745
|
+
|
|
746
|
+
/**
|
|
747
|
+
* 从当前 session 创建一个分叉会话。
|
|
748
|
+
*/
|
|
749
|
+
fork(input?: AgentSessionForkInput | string): Promise<AgentSession>;
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
/**
|
|
753
|
+
* 远程 Agent 返回的公开 session 接口。
|
|
754
|
+
*/
|
|
755
|
+
export interface RemoteAgentSession extends AgentSessionActor {
|
|
756
|
+
/**
|
|
757
|
+
* 从当前远程 session 创建一个分叉会话。
|
|
758
|
+
*/
|
|
759
|
+
fork(input?: AgentSessionForkInput | string): Promise<RemoteAgentSession>;
|
|
760
|
+
}
|
package/src/sdk/RemoteAgent.ts
CHANGED
|
@@ -8,12 +8,18 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import type {
|
|
11
|
-
|
|
11
|
+
AgentCreateSessionInput,
|
|
12
|
+
AgentListSessionsInput,
|
|
13
|
+
AgentSessionHistoryInput,
|
|
14
|
+
AgentSessionHistoryPage,
|
|
15
|
+
AgentSessionInfo,
|
|
16
|
+
AgentSessionForkInput,
|
|
12
17
|
AgentSessionSetInput,
|
|
18
|
+
AgentSessionSummaryPage,
|
|
13
19
|
AgentSessionSystemSnapshot,
|
|
20
|
+
RemoteAgentSession,
|
|
14
21
|
RemoteAgentOptions,
|
|
15
22
|
} from "@/sdk/AgentSdkTypes.js";
|
|
16
|
-
import type { SessionMessageV1 } from "@/session/types/SessionMessages.js";
|
|
17
23
|
import type {
|
|
18
24
|
AgentSessionEvent,
|
|
19
25
|
AgentSessionSubscriber,
|
|
@@ -77,7 +83,7 @@ type SdkEventsReadyFrame = {
|
|
|
77
83
|
/**
|
|
78
84
|
* 远程 Session 客户端。
|
|
79
85
|
*/
|
|
80
|
-
class RemoteSession {
|
|
86
|
+
class RemoteSession implements RemoteAgentSession {
|
|
81
87
|
readonly id: string;
|
|
82
88
|
private readonly baseUrl: string;
|
|
83
89
|
private readonly eventHub = new SessionEventHub();
|
|
@@ -102,6 +108,24 @@ class RemoteSession {
|
|
|
102
108
|
);
|
|
103
109
|
}
|
|
104
110
|
|
|
111
|
+
/**
|
|
112
|
+
* 读取当前远程 session 详情。
|
|
113
|
+
*/
|
|
114
|
+
async getInfo(): Promise<AgentSessionInfo> {
|
|
115
|
+
const response = await fetch(
|
|
116
|
+
`${this.baseUrl}/api/sdk/sessions/${encodeURIComponent(this.id)}`,
|
|
117
|
+
);
|
|
118
|
+
const payload = (await response.json()) as {
|
|
119
|
+
success?: boolean;
|
|
120
|
+
error?: string;
|
|
121
|
+
session?: AgentSessionInfo;
|
|
122
|
+
};
|
|
123
|
+
if (!response.ok || !payload.success || !payload.session?.sessionId) {
|
|
124
|
+
throw new Error(String(payload.error || "Remote session info failed"));
|
|
125
|
+
}
|
|
126
|
+
return payload.session;
|
|
127
|
+
}
|
|
128
|
+
|
|
105
129
|
/**
|
|
106
130
|
* 向当前远程 session 追加一条新的 prompt。
|
|
107
131
|
*/
|
|
@@ -162,19 +186,31 @@ class RemoteSession {
|
|
|
162
186
|
/**
|
|
163
187
|
* 读取远程消息历史。
|
|
164
188
|
*/
|
|
165
|
-
async history(): Promise<
|
|
189
|
+
async history(input?: AgentSessionHistoryInput): Promise<AgentSessionHistoryPage> {
|
|
190
|
+
const query = new URLSearchParams();
|
|
191
|
+
if (input?.limit !== undefined) query.set("limit", String(input.limit));
|
|
192
|
+
if (input?.cursor) query.set("cursor", input.cursor);
|
|
193
|
+
if (input?.order) query.set("order", input.order);
|
|
194
|
+
if (input?.view) query.set("view", input.view);
|
|
166
195
|
const response = await fetch(
|
|
167
|
-
`${this.baseUrl}/api/sdk/sessions/${encodeURIComponent(this.id)}/
|
|
196
|
+
`${this.baseUrl}/api/sdk/sessions/${encodeURIComponent(this.id)}/history${
|
|
197
|
+
query.size > 0 ? `?${query.toString()}` : ""
|
|
198
|
+
}`,
|
|
168
199
|
);
|
|
169
200
|
const payload = (await response.json()) as {
|
|
170
201
|
success?: boolean;
|
|
171
202
|
error?: string;
|
|
172
|
-
|
|
203
|
+
history?: AgentSessionHistoryPage;
|
|
173
204
|
};
|
|
174
|
-
if (
|
|
205
|
+
if (
|
|
206
|
+
!response.ok ||
|
|
207
|
+
!payload.success ||
|
|
208
|
+
!payload.history ||
|
|
209
|
+
!Array.isArray(payload.history.items)
|
|
210
|
+
) {
|
|
175
211
|
throw new Error(String(payload.error || "Remote session history failed"));
|
|
176
212
|
}
|
|
177
|
-
return payload.
|
|
213
|
+
return payload.history;
|
|
178
214
|
}
|
|
179
215
|
|
|
180
216
|
/**
|
|
@@ -203,7 +239,11 @@ class RemoteSession {
|
|
|
203
239
|
/**
|
|
204
240
|
* 分叉远程 session。
|
|
205
241
|
*/
|
|
206
|
-
async fork(
|
|
242
|
+
async fork(input?: AgentSessionForkInput | string): Promise<RemoteAgentSession> {
|
|
243
|
+
const messageId =
|
|
244
|
+
typeof input === "string"
|
|
245
|
+
? String(input || "").trim() || undefined
|
|
246
|
+
: String(input?.messageId || "").trim() || undefined;
|
|
207
247
|
const response = await fetch(
|
|
208
248
|
`${this.baseUrl}/api/sdk/sessions/${encodeURIComponent(this.id)}/fork`,
|
|
209
249
|
{
|
|
@@ -219,7 +259,7 @@ class RemoteSession {
|
|
|
219
259
|
const payload = (await response.json()) as {
|
|
220
260
|
success?: boolean;
|
|
221
261
|
error?: string;
|
|
222
|
-
session?:
|
|
262
|
+
session?: AgentSessionInfo;
|
|
223
263
|
};
|
|
224
264
|
if (!response.ok || !payload.success || !payload.session?.sessionId) {
|
|
225
265
|
throw new Error(String(payload.error || "Remote session fork failed"));
|
|
@@ -426,43 +466,75 @@ export class RemoteAgent {
|
|
|
426
466
|
}
|
|
427
467
|
|
|
428
468
|
/**
|
|
429
|
-
*
|
|
469
|
+
* 新建一个远程 session。
|
|
430
470
|
*/
|
|
431
|
-
async
|
|
471
|
+
async createSession(
|
|
472
|
+
input?: AgentCreateSessionInput,
|
|
473
|
+
): Promise<RemoteAgentSession> {
|
|
432
474
|
const response = await fetch(`${this.baseUrl}/api/sdk/sessions`, {
|
|
433
475
|
method: "POST",
|
|
434
476
|
headers: {
|
|
435
477
|
"Content-Type": "application/json",
|
|
436
478
|
},
|
|
437
479
|
body: JSON.stringify({
|
|
438
|
-
...(sessionId ? { sessionId } : {}),
|
|
480
|
+
...(input?.sessionId ? { sessionId: input.sessionId } : {}),
|
|
439
481
|
}),
|
|
440
482
|
});
|
|
441
483
|
const payload = (await response.json()) as {
|
|
442
484
|
success?: boolean;
|
|
443
485
|
error?: string;
|
|
444
|
-
session?:
|
|
486
|
+
session?: AgentSessionInfo;
|
|
445
487
|
};
|
|
446
488
|
if (!response.ok || !payload.success || !payload.session?.sessionId) {
|
|
447
|
-
throw new Error(String(payload.error || "Remote session
|
|
489
|
+
throw new Error(String(payload.error || "Remote session create failed"));
|
|
448
490
|
}
|
|
449
491
|
return new RemoteSession(this.baseUrl, payload.session.sessionId);
|
|
450
492
|
}
|
|
451
493
|
|
|
452
494
|
/**
|
|
453
|
-
*
|
|
495
|
+
* 获取一个已存在的远程 session。
|
|
454
496
|
*/
|
|
455
|
-
async
|
|
456
|
-
const
|
|
497
|
+
async getSession(sessionId: string): Promise<RemoteAgentSession> {
|
|
498
|
+
const resolvedSessionId = String(sessionId || "").trim();
|
|
499
|
+
if (!resolvedSessionId) {
|
|
500
|
+
throw new Error("getSession requires a non-empty sessionId");
|
|
501
|
+
}
|
|
502
|
+
const response = await fetch(
|
|
503
|
+
`${this.baseUrl}/api/sdk/sessions/${encodeURIComponent(resolvedSessionId)}`,
|
|
504
|
+
);
|
|
505
|
+
const payload = (await response.json()) as {
|
|
506
|
+
success?: boolean;
|
|
507
|
+
error?: string;
|
|
508
|
+
session?: AgentSessionInfo;
|
|
509
|
+
};
|
|
510
|
+
if (!response.ok || !payload.success || !payload.session?.sessionId) {
|
|
511
|
+
throw new Error(String(payload.error || "Remote session get failed"));
|
|
512
|
+
}
|
|
513
|
+
return new RemoteSession(this.baseUrl, payload.session.sessionId);
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
/**
|
|
517
|
+
* 列出远程 agent 的 session 摘要页。
|
|
518
|
+
*/
|
|
519
|
+
async listSessions(
|
|
520
|
+
input?: AgentListSessionsInput,
|
|
521
|
+
): Promise<AgentSessionSummaryPage> {
|
|
522
|
+
const query = new URLSearchParams();
|
|
523
|
+
if (input?.limit !== undefined) query.set("limit", String(input.limit));
|
|
524
|
+
if (input?.cursor) query.set("cursor", input.cursor);
|
|
525
|
+
if (input?.query) query.set("query", input.query);
|
|
526
|
+
const response = await fetch(
|
|
527
|
+
`${this.baseUrl}/api/sdk/sessions${query.size > 0 ? `?${query.toString()}` : ""}`,
|
|
528
|
+
);
|
|
457
529
|
const payload = (await response.json()) as {
|
|
458
530
|
success?: boolean;
|
|
459
531
|
error?: string;
|
|
460
|
-
|
|
532
|
+
page?: AgentSessionSummaryPage;
|
|
461
533
|
};
|
|
462
|
-
if (!response.ok || !payload.success || !
|
|
534
|
+
if (!response.ok || !payload.success || !payload.page) {
|
|
463
535
|
throw new Error(String(payload.error || "Remote sessions list failed"));
|
|
464
536
|
}
|
|
465
|
-
return payload.
|
|
537
|
+
return payload.page;
|
|
466
538
|
}
|
|
467
539
|
}
|
|
468
540
|
|