@downcity/agent 1.1.287 → 1.1.310
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 +23 -16
- package/bin/agent/Agent.d.ts +35 -45
- package/bin/agent/Agent.d.ts.map +1 -1
- package/bin/agent/Agent.js +131 -107
- package/bin/agent/Agent.js.map +1 -1
- package/bin/agent/AgentInstructions.d.ts +2 -2
- package/bin/agent/AgentInstructions.d.ts.map +1 -1
- package/bin/agent/AgentInstructions.js +2 -2
- package/bin/agent/AgentInstructions.js.map +1 -1
- package/bin/agent/AgentModel.d.ts +2 -2
- package/bin/agent/AgentModel.d.ts.map +1 -1
- package/bin/agent/AgentModel.js +2 -2
- package/bin/agent/AgentModel.js.map +1 -1
- package/bin/agent/AgentSessions.d.ts +11 -7
- package/bin/agent/AgentSessions.d.ts.map +1 -1
- package/bin/agent/AgentSessions.js +39 -97
- package/bin/agent/AgentSessions.js.map +1 -1
- package/bin/agent/AgentState.d.ts +2 -21
- package/bin/agent/AgentState.d.ts.map +1 -1
- package/bin/agent/AgentState.js +6 -50
- package/bin/agent/AgentState.js.map +1 -1
- package/bin/executor/Executor.d.ts +25 -55
- package/bin/executor/Executor.d.ts.map +1 -1
- package/bin/executor/Executor.js +93 -178
- package/bin/executor/Executor.js.map +1 -1
- package/bin/executor/composer/system/SessionSystemComposer.d.ts +2 -2
- package/bin/executor/composer/system/SessionSystemComposer.d.ts.map +1 -1
- package/bin/executor/composer/system/default/DefaultSessionSystemComposer.d.ts +9 -9
- package/bin/executor/composer/system/default/DefaultSessionSystemComposer.d.ts.map +1 -1
- package/bin/executor/composer/system/default/DefaultSessionSystemComposer.js +19 -19
- package/bin/executor/composer/system/default/DefaultSessionSystemComposer.js.map +1 -1
- package/bin/executor/composer/system/default/PromptRenderer.d.ts +2 -2
- package/bin/executor/composer/system/default/PromptRenderer.d.ts.map +1 -1
- package/bin/executor/composer/system/default/PromptRenderer.js +3 -3
- package/bin/executor/composer/system/default/PromptRenderer.js.map +1 -1
- package/bin/executor/composer/system/default/SystemDomain.d.ts +27 -27
- package/bin/executor/composer/system/default/SystemDomain.d.ts.map +1 -1
- package/bin/executor/composer/system/default/SystemDomain.js +44 -44
- package/bin/executor/composer/system/default/SystemDomain.js.map +1 -1
- package/bin/executor/composer/system/default/assets/core.prompt.d.ts +1 -1
- package/bin/executor/composer/system/default/assets/core.prompt.d.ts.map +1 -1
- package/bin/executor/composer/system/default/assets/core.prompt.js +1 -1
- package/bin/executor/composer/system/default/assets/core.prompt.js.map +1 -1
- package/bin/executor/composer/system/default/variables/GeoContext.d.ts +1 -1
- package/bin/executor/composer/system/default/variables/GeoContext.d.ts.map +1 -1
- package/bin/executor/composer/system/default/variables/GeoContext.js +3 -3
- package/bin/executor/composer/system/default/variables/GeoContext.js.map +1 -1
- package/bin/executor/composer/system/default/variables/PromptTypes.d.ts +2 -2
- package/bin/executor/composer/system/default/variables/PromptTypes.d.ts.map +1 -1
- package/bin/executor/composer/system/default/variables/VariableReplacer.d.ts +4 -4
- package/bin/executor/composer/system/default/variables/VariableReplacer.d.ts.map +1 -1
- package/bin/executor/composer/system/default/variables/VariableReplacer.js +24 -24
- package/bin/executor/composer/system/default/variables/VariableReplacer.js.map +1 -1
- package/bin/executor/core-engine/CoreEngineError.d.ts +2 -2
- package/bin/executor/core-engine/CoreEngineError.d.ts.map +1 -1
- package/bin/executor/core-engine/CoreEngineError.js +2 -2
- package/bin/executor/core-engine/CoreEngineError.js.map +1 -1
- package/bin/executor/core-engine/CoreEngineLoopDecision.d.ts +2 -2
- package/bin/executor/core-engine/CoreEngineLoopDecision.d.ts.map +1 -1
- package/bin/executor/core-engine/CoreEngineLoopDecision.js +2 -2
- package/bin/executor/core-engine/CoreEngineLoopDecision.js.map +1 -1
- package/bin/executor/core-engine/CoreEngineMessageState.d.ts +2 -2
- package/bin/executor/core-engine/CoreEngineMessageState.d.ts.map +1 -1
- package/bin/executor/core-engine/CoreEngineMessageState.js +9 -9
- package/bin/executor/core-engine/CoreEngineMessageState.js.map +1 -1
- package/bin/executor/core-engine/CoreEngineRunner.d.ts +8 -8
- package/bin/executor/core-engine/CoreEngineRunner.d.ts.map +1 -1
- package/bin/executor/core-engine/CoreEngineRunner.js +94 -108
- package/bin/executor/core-engine/CoreEngineRunner.js.map +1 -1
- package/bin/executor/core-engine/CoreEngineSignals.d.ts +10 -10
- package/bin/executor/core-engine/CoreEngineSignals.d.ts.map +1 -1
- package/bin/executor/core-engine/CoreEngineSignals.js +19 -19
- package/bin/executor/core-engine/CoreEngineSignals.js.map +1 -1
- package/bin/executor/core-engine/CoreEngineUiStreamCollector.d.ts +6 -6
- package/bin/executor/core-engine/CoreEngineUiStreamCollector.d.ts.map +1 -1
- package/bin/executor/core-engine/CoreEngineUiStreamCollector.js +12 -12
- package/bin/executor/core-engine/CoreEngineUiStreamCollector.js.map +1 -1
- package/bin/executor/ids/resolveSessionId.d.ts +4 -4
- package/bin/executor/ids/resolveSessionId.d.ts.map +1 -1
- package/bin/executor/ids/resolveSessionId.js +4 -4
- package/bin/executor/ids/resolveSessionId.js.map +1 -1
- package/bin/executor/messages/ChatMessageMarkup.d.ts +10 -10
- package/bin/executor/messages/ChatMessageMarkup.d.ts.map +1 -1
- package/bin/executor/messages/ChatMessageMarkup.js +22 -22
- package/bin/executor/messages/ChatMessageMarkup.js.map +1 -1
- package/bin/executor/messages/ChatMessageMarkupTypes.d.ts +10 -10
- package/bin/executor/messages/ChatMessageMarkupTypes.d.ts.map +1 -1
- package/bin/executor/messages/SessionAttachmentMapper.d.ts +4 -4
- package/bin/executor/messages/SessionAttachmentMapper.d.ts.map +1 -1
- package/bin/executor/messages/SessionAttachmentMapper.js +12 -12
- package/bin/executor/messages/SessionAttachmentMapper.js.map +1 -1
- package/bin/executor/messages/SessionMessageCodec.d.ts +5 -5
- package/bin/executor/messages/SessionMessageCodec.d.ts.map +1 -1
- package/bin/executor/messages/SessionMessageCodec.js +12 -22
- package/bin/executor/messages/SessionMessageCodec.js.map +1 -1
- package/bin/executor/messages/SessionMessageLog.d.ts +2 -2
- package/bin/executor/messages/SessionMessageLog.d.ts.map +1 -1
- package/bin/executor/messages/SessionMessageLog.js +3 -3
- package/bin/executor/messages/SessionMessageLog.js.map +1 -1
- package/bin/executor/messages/SessionStepEventMapper.d.ts +4 -4
- package/bin/executor/messages/SessionStepEventMapper.d.ts.map +1 -1
- package/bin/executor/messages/SessionStepEventMapper.js +7 -7
- package/bin/executor/messages/SessionStepEventMapper.js.map +1 -1
- package/bin/executor/messages/UIMessageTransformer.d.ts +3 -3
- package/bin/executor/messages/UIMessageTransformer.d.ts.map +1 -1
- package/bin/executor/messages/UIMessageTransformer.js +6 -6
- package/bin/executor/messages/UIMessageTransformer.js.map +1 -1
- package/bin/executor/messages/UserVisibleText.d.ts +2 -2
- package/bin/executor/messages/UserVisibleText.d.ts.map +1 -1
- package/bin/executor/messages/UserVisibleText.js +5 -5
- package/bin/executor/messages/UserVisibleText.js.map +1 -1
- package/bin/executor/services/ExecutorRecoveryPolicy.d.ts +15 -15
- package/bin/executor/services/ExecutorRecoveryPolicy.d.ts.map +1 -1
- package/bin/executor/services/ExecutorRecoveryPolicy.js +13 -12
- package/bin/executor/services/ExecutorRecoveryPolicy.js.map +1 -1
- package/bin/executor/types/SessionHistoryMeta.d.ts +10 -10
- package/bin/executor/types/SessionHistoryMeta.d.ts.map +1 -1
- package/bin/executor/types/SessionHistoryMeta.js +1 -1
- package/bin/executor/types/SessionRecords.d.ts +9 -9
- package/bin/executor/types/SessionRecords.d.ts.map +1 -1
- package/bin/executor/types/SessionRecords.js +4 -4
- package/bin/executor/types/SessionRecords.js.map +1 -1
- package/bin/index.d.ts +41 -55
- package/bin/index.d.ts.map +1 -1
- package/bin/index.js +24 -31
- package/bin/index.js.map +1 -1
- package/bin/plugin/core/ActionScheduleExecutor.d.ts +4 -4
- package/bin/plugin/core/ActionScheduleExecutor.d.ts.map +1 -1
- package/bin/plugin/core/ActionScheduleExecutor.js +18 -20
- package/bin/plugin/core/ActionScheduleExecutor.js.map +1 -1
- package/bin/plugin/core/ActionScheduleRuntime.d.ts +2 -2
- package/bin/plugin/core/ActionScheduleRuntime.d.ts.map +1 -1
- package/bin/plugin/core/ActionScheduleRuntime.js +6 -6
- package/bin/plugin/core/ActionScheduleRuntime.js.map +1 -1
- package/bin/plugin/core/ActionScheduleStore.d.ts +23 -22
- package/bin/plugin/core/ActionScheduleStore.d.ts.map +1 -1
- package/bin/plugin/core/ActionScheduleStore.js +120 -117
- package/bin/plugin/core/ActionScheduleStore.js.map +1 -1
- package/bin/plugin/core/ActionScheduleTime.d.ts +5 -5
- package/bin/plugin/core/ActionScheduleTime.d.ts.map +1 -1
- package/bin/plugin/core/ActionScheduleTime.js +6 -6
- package/bin/plugin/core/ActionScheduleTime.js.map +1 -1
- package/bin/plugin/core/BasePlugin.d.ts +6 -20
- package/bin/plugin/core/BasePlugin.d.ts.map +1 -1
- package/bin/plugin/core/BasePlugin.js +0 -12
- package/bin/plugin/core/BasePlugin.js.map +1 -1
- package/bin/plugin/core/HookRegistry.d.ts +11 -11
- package/bin/plugin/core/HookRegistry.d.ts.map +1 -1
- package/bin/plugin/core/HookRegistry.js +45 -45
- package/bin/plugin/core/HookRegistry.js.map +1 -1
- package/bin/plugin/core/PluginActionFactory.d.ts +18 -26
- package/bin/plugin/core/PluginActionFactory.d.ts.map +1 -1
- package/bin/plugin/core/PluginActionFactory.js +5 -8
- package/bin/plugin/core/PluginActionFactory.js.map +1 -1
- package/bin/plugin/core/PluginActionRunner.d.ts +15 -33
- package/bin/plugin/core/PluginActionRunner.d.ts.map +1 -1
- package/bin/plugin/core/PluginActionRunner.js +11 -147
- package/bin/plugin/core/PluginActionRunner.js.map +1 -1
- package/bin/plugin/core/PluginCatalog.d.ts +12 -12
- package/bin/plugin/core/PluginCatalog.d.ts.map +1 -1
- package/bin/plugin/core/PluginCatalog.js +18 -18
- package/bin/plugin/core/PluginCatalog.js.map +1 -1
- package/bin/plugin/core/PluginContext.d.ts +32 -0
- package/bin/plugin/core/PluginContext.d.ts.map +1 -0
- package/bin/plugin/core/PluginContext.js +26 -0
- package/bin/plugin/core/PluginContext.js.map +1 -0
- package/bin/plugin/core/PluginHttpRoutes.d.ts +5 -5
- package/bin/plugin/core/PluginHttpRoutes.d.ts.map +1 -1
- package/bin/plugin/core/PluginHttpRoutes.js +5 -5
- package/bin/plugin/core/PluginHttpRoutes.js.map +1 -1
- package/bin/plugin/core/PluginRegistry.d.ts +35 -24
- package/bin/plugin/core/PluginRegistry.d.ts.map +1 -1
- package/bin/plugin/core/PluginRegistry.js +99 -71
- package/bin/plugin/core/PluginRegistry.js.map +1 -1
- package/bin/plugin/core/PluginStateController.d.ts +5 -13
- package/bin/plugin/core/PluginStateController.d.ts.map +1 -1
- package/bin/plugin/core/PluginStateController.js +2 -32
- package/bin/plugin/core/PluginStateController.js.map +1 -1
- package/bin/plugin/tool/PluginToolRuntime.d.ts +15 -0
- package/bin/plugin/tool/PluginToolRuntime.d.ts.map +1 -0
- package/bin/plugin/tool/PluginToolRuntime.js +105 -0
- package/bin/plugin/tool/PluginToolRuntime.js.map +1 -0
- package/bin/{executor/tools/plugin → plugin/tool}/PluginToolSchemas.d.ts +1 -1
- package/bin/plugin/tool/PluginToolSchemas.d.ts.map +1 -0
- package/bin/{executor/tools/plugin → plugin/tool}/PluginToolSchemas.js +1 -1
- package/bin/plugin/tool/PluginToolSchemas.js.map +1 -0
- package/bin/plugin/tool/PluginTools.d.ts +25 -0
- package/bin/plugin/tool/PluginTools.d.ts.map +1 -0
- package/bin/{executor/tools/plugin/PluginToolDefinition.js → plugin/tool/PluginTools.js} +19 -19
- package/bin/plugin/tool/PluginTools.js.map +1 -0
- package/bin/plugin/types/ActionSchedule.d.ts +10 -10
- package/bin/plugin/types/ActionSchedule.d.ts.map +1 -1
- package/bin/plugin/types/ActionSchedule.js +1 -1
- package/bin/plugin/types/PluginApi.d.ts +3 -3
- package/bin/plugin/types/PluginApi.d.ts.map +1 -1
- package/bin/remote/RemoteAgent.d.ts +1 -1
- package/bin/remote/RemoteAgent.d.ts.map +1 -1
- package/bin/remote/RemoteAgent.js +3 -3
- package/bin/remote/RemoteAgent.js.map +1 -1
- package/bin/remote/RemoteSession.d.ts +18 -12
- package/bin/remote/RemoteSession.d.ts.map +1 -1
- package/bin/remote/RemoteSession.js +87 -21
- package/bin/remote/RemoteSession.js.map +1 -1
- package/bin/remote/RemoteTransport.d.ts +13 -11
- package/bin/remote/RemoteTransport.d.ts.map +1 -1
- package/bin/remote/transports/HttpRemoteAgentTransport.d.ts +9 -7
- package/bin/remote/transports/HttpRemoteAgentTransport.d.ts.map +1 -1
- package/bin/remote/transports/HttpRemoteAgentTransport.js +36 -39
- package/bin/remote/transports/HttpRemoteAgentTransport.js.map +1 -1
- package/bin/remote/transports/RpcClient.d.ts +14 -31
- package/bin/remote/transports/RpcClient.d.ts.map +1 -1
- package/bin/remote/transports/RpcClient.js +40 -66
- package/bin/remote/transports/RpcClient.js.map +1 -1
- package/bin/remote/transports/RpcRemoteAgentTransport.d.ts +9 -7
- package/bin/remote/transports/RpcRemoteAgentTransport.d.ts.map +1 -1
- package/bin/remote/transports/RpcRemoteAgentTransport.js +10 -10
- package/bin/remote/transports/RpcRemoteAgentTransport.js.map +1 -1
- package/bin/session/DefaultSessionComposer.d.ts.map +1 -1
- package/bin/session/DefaultSessionComposer.js +2 -4
- package/bin/session/DefaultSessionComposer.js.map +1 -1
- package/bin/session/Session.d.ts +49 -31
- package/bin/session/Session.d.ts.map +1 -1
- package/bin/session/Session.js +303 -243
- package/bin/session/Session.js.map +1 -1
- package/bin/session/SessionCommand.d.ts +24 -0
- package/bin/session/SessionCommand.d.ts.map +1 -0
- package/bin/session/SessionCommand.js +35 -0
- package/bin/session/SessionCommand.js.map +1 -0
- package/bin/session/SessionLoop.d.ts +96 -0
- package/bin/session/SessionLoop.d.ts.map +1 -0
- package/bin/session/SessionLoop.js +554 -0
- package/bin/session/SessionLoop.js.map +1 -0
- package/bin/session/SessionMessages.d.ts +20 -16
- package/bin/session/SessionMessages.d.ts.map +1 -1
- package/bin/session/SessionMessages.js +102 -81
- package/bin/session/SessionMessages.js.map +1 -1
- package/bin/session/SessionQueue.d.ts +15 -25
- package/bin/session/SessionQueue.d.ts.map +1 -1
- package/bin/session/SessionQueue.js +31 -45
- package/bin/session/SessionQueue.js.map +1 -1
- package/bin/session/SessionState.d.ts +6 -6
- package/bin/session/SessionState.d.ts.map +1 -1
- package/bin/session/SessionState.js +45 -93
- package/bin/session/SessionState.js.map +1 -1
- package/bin/session/SessionSystem.js +7 -7
- package/bin/session/SessionSystem.js.map +1 -1
- package/bin/session/SessionTitle.d.ts +7 -12
- package/bin/session/SessionTitle.d.ts.map +1 -1
- package/bin/session/SessionTitle.js +15 -20
- package/bin/session/SessionTitle.js.map +1 -1
- package/bin/session/browse/Browse.d.ts +17 -26
- package/bin/session/browse/Browse.d.ts.map +1 -1
- package/bin/session/browse/Browse.js +106 -303
- package/bin/session/browse/Browse.js.map +1 -1
- package/bin/session/browse/SessionMessageTimeline.d.ts +13 -0
- package/bin/session/browse/SessionMessageTimeline.d.ts.map +1 -0
- package/bin/session/browse/SessionMessageTimeline.js +110 -0
- package/bin/session/browse/SessionMessageTimeline.js.map +1 -0
- package/bin/session/control/SessionInteractions.d.ts +39 -0
- package/bin/session/control/SessionInteractions.d.ts.map +1 -0
- package/bin/session/control/SessionInteractions.js +219 -0
- package/bin/session/control/SessionInteractions.js.map +1 -0
- package/bin/session/execution/SessionAssistantOutputAdapter.d.ts +49 -0
- package/bin/session/execution/SessionAssistantOutputAdapter.d.ts.map +1 -0
- package/bin/session/execution/SessionAssistantOutputAdapter.js +117 -0
- package/bin/session/execution/SessionAssistantOutputAdapter.js.map +1 -0
- package/bin/session/execution/tools/SessionShellApprovalAdapter.d.ts +28 -0
- package/bin/session/execution/tools/SessionShellApprovalAdapter.d.ts.map +1 -0
- package/bin/session/execution/tools/SessionShellApprovalAdapter.js +75 -0
- package/bin/session/execution/tools/SessionShellApprovalAdapter.js.map +1 -0
- package/bin/session/messages/SessionAssistantMessageWriter.d.ts +6 -4
- package/bin/session/messages/SessionAssistantMessageWriter.d.ts.map +1 -1
- package/bin/session/messages/SessionAssistantMessageWriter.js +34 -18
- package/bin/session/messages/SessionAssistantMessageWriter.js.map +1 -1
- package/bin/session/messages/SessionJsonValue.d.ts +2 -2
- package/bin/session/messages/SessionJsonValue.d.ts.map +1 -1
- package/bin/session/messages/SessionJsonValue.js.map +1 -1
- package/bin/session/messages/SessionMessageCodec.d.ts.map +1 -1
- package/bin/session/messages/SessionMessageCodec.js +30 -84
- package/bin/session/messages/SessionMessageCodec.js.map +1 -1
- package/bin/session/messages/SessionMessageCompaction.js +2 -2
- package/bin/session/messages/SessionMessageCompaction.js.map +1 -1
- package/bin/session/messages/SessionMessageInteractionWriter.d.ts +51 -0
- package/bin/session/messages/SessionMessageInteractionWriter.d.ts.map +1 -0
- package/bin/session/messages/SessionMessageInteractionWriter.js +177 -0
- package/bin/session/messages/SessionMessageInteractionWriter.js.map +1 -0
- package/bin/session/preview/SessionMessagePreview.js +2 -2
- package/bin/session/preview/SessionMessagePreview.js.map +1 -1
- package/bin/session/runtime/SessionCompactOperation.d.ts +29 -0
- package/bin/session/runtime/SessionCompactOperation.d.ts.map +1 -0
- package/bin/session/runtime/SessionCompactOperation.js +66 -0
- package/bin/session/runtime/SessionCompactOperation.js.map +1 -0
- package/bin/session/runtime/SessionHistoryCompaction.d.ts +22 -0
- package/bin/session/runtime/SessionHistoryCompaction.d.ts.map +1 -0
- package/bin/session/runtime/SessionHistoryCompaction.js +31 -0
- package/bin/session/runtime/SessionHistoryCompaction.js.map +1 -0
- package/bin/session/runtime/SessionTurnContext.d.ts +26 -0
- package/bin/session/runtime/SessionTurnContext.d.ts.map +1 -0
- package/bin/session/runtime/SessionTurnContext.js +181 -0
- package/bin/session/runtime/SessionTurnContext.js.map +1 -0
- package/bin/session/storage/Metadata.d.ts +13 -70
- package/bin/session/storage/Metadata.d.ts.map +1 -1
- package/bin/session/storage/Metadata.js +31 -116
- package/bin/session/storage/Metadata.js.map +1 -1
- package/bin/session/storage/RuntimeSessionPort.d.ts +7 -7
- package/bin/session/storage/RuntimeSessionPort.d.ts.map +1 -1
- package/bin/session/storage/RuntimeSessionPort.js +7 -7
- package/bin/session/storage/RuntimeSessionPort.js.map +1 -1
- package/bin/tools/ask/AskQuestionsTool.d.ts +39 -0
- package/bin/tools/ask/AskQuestionsTool.d.ts.map +1 -0
- package/bin/tools/ask/AskQuestionsTool.js +67 -0
- package/bin/tools/ask/AskQuestionsTool.js.map +1 -0
- package/bin/tools/ask/AskQuestionsToolSchemas.d.ts +29 -0
- package/bin/tools/ask/AskQuestionsToolSchemas.d.ts.map +1 -0
- package/bin/tools/ask/AskQuestionsToolSchemas.js +51 -0
- package/bin/tools/ask/AskQuestionsToolSchemas.js.map +1 -0
- package/bin/tools/index.d.ts +9 -0
- package/bin/tools/index.d.ts.map +1 -0
- package/bin/tools/index.js +8 -0
- package/bin/tools/index.js.map +1 -0
- package/bin/types/action/ActionResult.d.ts +26 -0
- package/bin/types/action/ActionResult.d.ts.map +1 -0
- package/bin/types/action/ActionResult.js +17 -0
- package/bin/types/action/ActionResult.js.map +1 -0
- package/bin/types/agent/AgentOptions.d.ts +13 -23
- package/bin/types/agent/AgentOptions.d.ts.map +1 -1
- package/bin/types/agent/AgentState.d.ts +4 -13
- package/bin/types/agent/AgentState.d.ts.map +1 -1
- package/bin/types/agent/AgentState.js +2 -2
- package/bin/types/agent/RemoteAgentPluginAction.d.ts +2 -2
- package/bin/types/agent/RemoteAgentPluginAction.d.ts.map +1 -1
- package/bin/types/agent/SessionActor.d.ts +16 -15
- package/bin/types/agent/SessionActor.d.ts.map +1 -1
- package/bin/types/agent/SessionTypes.d.ts +69 -91
- package/bin/types/agent/SessionTypes.d.ts.map +1 -1
- package/bin/types/executor/SessionAssistantOutput.d.ts +34 -0
- package/bin/types/executor/SessionAssistantOutput.d.ts.map +1 -0
- package/bin/types/executor/SessionAssistantOutput.js +8 -0
- package/bin/types/executor/SessionAssistantOutput.js.map +1 -0
- package/bin/types/executor/SessionToolExecutionContext.d.ts +5 -5
- package/bin/types/executor/SessionToolExecutionContext.d.ts.map +1 -1
- package/bin/types/executor/SessionToolExecutionContext.js +2 -2
- package/bin/types/executor/SessionTurnContext.d.ts +125 -0
- package/bin/types/executor/SessionTurnContext.d.ts.map +1 -0
- package/bin/types/executor/SessionTurnContext.js +10 -0
- package/bin/types/executor/SessionTurnContext.js.map +1 -0
- package/bin/types/plugin/PluginAction.d.ts +13 -10
- package/bin/types/plugin/PluginAction.d.ts.map +1 -1
- package/bin/types/plugin/PluginCommand.d.ts +8 -65
- package/bin/types/plugin/PluginCommand.d.ts.map +1 -1
- package/bin/types/plugin/PluginCommand.js +2 -4
- package/bin/types/plugin/PluginCommand.js.map +1 -1
- package/bin/types/plugin/PluginContext.d.ts +34 -0
- package/bin/types/plugin/PluginContext.d.ts.map +1 -0
- package/bin/types/plugin/PluginContext.js +9 -0
- package/bin/types/plugin/PluginContext.js.map +1 -0
- package/bin/types/plugin/PluginDefinition.d.ts +8 -28
- package/bin/types/plugin/PluginDefinition.d.ts.map +1 -1
- package/bin/types/plugin/PluginDefinition.js +1 -1
- package/bin/types/plugin/PluginExecutionContext.d.ts +29 -0
- package/bin/types/plugin/PluginExecutionContext.d.ts.map +1 -0
- package/bin/types/plugin/{PluginRunContext.js → PluginExecutionContext.js} +2 -2
- package/bin/types/plugin/PluginExecutionContext.js.map +1 -0
- package/bin/types/plugin/PluginHttp.d.ts +5 -5
- package/bin/types/plugin/PluginHttp.d.ts.map +1 -1
- package/bin/types/plugin/PluginRegistry.d.ts +21 -0
- package/bin/types/plugin/PluginRegistry.d.ts.map +1 -0
- package/bin/types/plugin/PluginRegistry.js +9 -0
- package/bin/types/plugin/PluginRegistry.js.map +1 -0
- package/bin/types/plugin/PluginRuntime.d.ts +28 -40
- package/bin/types/plugin/PluginRuntime.d.ts.map +1 -1
- package/bin/types/plugin/PluginState.d.ts +0 -15
- package/bin/types/plugin/PluginState.d.ts.map +1 -1
- package/bin/types/plugin/PluginTool.d.ts +90 -0
- package/bin/types/plugin/PluginTool.d.ts.map +1 -0
- package/bin/types/plugin/PluginTool.js.map +1 -0
- package/bin/types/rpc/RpcProtocol.d.ts +50 -72
- package/bin/types/rpc/RpcProtocol.d.ts.map +1 -1
- package/bin/types/sdk/AgentSessionCompact.d.ts +31 -0
- package/bin/types/sdk/AgentSessionCompact.d.ts.map +1 -0
- package/bin/types/sdk/AgentSessionCompact.js +8 -0
- package/bin/types/sdk/AgentSessionCompact.js.map +1 -0
- package/bin/types/sdk/AgentSessionPrompt.d.ts +1 -1
- package/bin/types/sdk/AgentSessionPrompt.d.ts.map +1 -1
- package/bin/types/sdk/AgentSessionPrompt.js +1 -1
- package/bin/types/sdk/AgentSessionPrompt.js.map +1 -1
- package/bin/types/sdk/AgentSessionStop.d.ts +2 -2
- package/bin/types/sdk/AgentSessionStop.d.ts.map +1 -1
- package/bin/types/sdk/AgentSessionTurn.d.ts +3 -13
- package/bin/types/sdk/AgentSessionTurn.d.ts.map +1 -1
- package/bin/types/session/SessionCommand.d.ts +26 -0
- package/bin/types/session/SessionCommand.d.ts.map +1 -0
- package/bin/types/session/SessionCommand.js +7 -0
- package/bin/types/session/SessionCommand.js.map +1 -0
- package/bin/types/session/SessionComposer.d.ts +8 -4
- package/bin/types/session/SessionComposer.d.ts.map +1 -1
- package/bin/{executor/types/SessionRun.d.ts → types/session/SessionExecution.d.ts} +37 -33
- package/bin/types/session/SessionExecution.d.ts.map +1 -0
- package/bin/types/session/SessionExecution.js +10 -0
- package/bin/types/session/SessionExecution.js.map +1 -0
- package/bin/types/session/SessionInteraction.d.ts +165 -0
- package/bin/types/session/SessionInteraction.d.ts.map +1 -0
- package/bin/types/session/SessionInteraction.js +8 -0
- package/bin/types/session/SessionInteraction.js.map +1 -0
- package/bin/types/session/SessionInteractions.d.ts +17 -0
- package/bin/types/session/SessionInteractions.d.ts.map +1 -0
- package/bin/types/session/SessionInteractions.js +8 -0
- package/bin/types/session/SessionInteractions.js.map +1 -0
- package/bin/types/session/SessionLocalState.d.ts +1 -1
- package/bin/types/session/SessionLoop.d.ts +63 -0
- package/bin/types/session/SessionLoop.d.ts.map +1 -0
- package/bin/types/session/{SessionTurn.js → SessionLoop.js} +2 -2
- package/bin/types/session/SessionLoop.js.map +1 -0
- package/bin/types/session/SessionMessage.d.ts +37 -28
- package/bin/types/session/SessionMessage.d.ts.map +1 -1
- package/bin/types/session/SessionMessages.d.ts +2 -4
- package/bin/types/session/SessionMessages.d.ts.map +1 -1
- package/bin/types/session/SessionMutation.d.ts +19 -1
- package/bin/types/session/SessionMutation.d.ts.map +1 -1
- package/bin/types/session/SessionMutation.js +1 -0
- package/bin/types/session/SessionMutation.js.map +1 -1
- package/bin/types/session/SessionOptions.d.ts +34 -20
- package/bin/types/session/SessionOptions.d.ts.map +1 -1
- package/bin/types/session/SessionPort.d.ts +6 -19
- package/bin/types/session/SessionPort.d.ts.map +1 -1
- package/bin/types/session/SessionState.d.ts +3 -13
- package/bin/types/session/SessionState.d.ts.map +1 -1
- package/bin/types/store/AgentStore.d.ts +31 -0
- package/bin/types/store/AgentStore.d.ts.map +1 -0
- package/bin/types/store/AgentStore.js +9 -0
- package/bin/types/store/AgentStore.js.map +1 -0
- package/bin/types/store/LocalStore.d.ts +36 -0
- package/bin/types/store/LocalStore.d.ts.map +1 -0
- package/bin/types/store/LocalStore.js +9 -0
- package/bin/types/store/LocalStore.js.map +1 -0
- package/bin/types/store/SessionStore.d.ts +82 -0
- package/bin/types/store/SessionStore.d.ts.map +1 -0
- package/bin/types/store/SessionStore.js +9 -0
- package/bin/types/store/SessionStore.js.map +1 -0
- package/bin/types/tools/ask/AskQuestionsTool.d.ts +22 -0
- package/bin/types/tools/ask/AskQuestionsTool.d.ts.map +1 -0
- package/bin/types/tools/ask/AskQuestionsTool.js +8 -0
- package/bin/types/tools/ask/AskQuestionsTool.js.map +1 -0
- package/bin/types/workspace/FileSystem.d.ts +55 -0
- package/bin/types/workspace/FileSystem.d.ts.map +1 -0
- package/bin/types/workspace/FileSystem.js +9 -0
- package/bin/types/workspace/FileSystem.js.map +1 -0
- package/bin/types/workspace/FileTool.d.ts +181 -0
- package/bin/types/workspace/FileTool.d.ts.map +1 -0
- package/bin/types/workspace/FileTool.js +10 -0
- package/bin/types/workspace/FileTool.js.map +1 -0
- package/bin/types/workspace/SearchTool.d.ts +131 -0
- package/bin/types/workspace/SearchTool.d.ts.map +1 -0
- package/bin/types/workspace/SearchTool.js +10 -0
- package/bin/types/workspace/SearchTool.js.map +1 -0
- package/bin/types/workspace/Workspace.d.ts +24 -0
- package/bin/types/workspace/Workspace.d.ts.map +1 -0
- package/bin/types/workspace/Workspace.js +9 -0
- package/bin/types/workspace/Workspace.js.map +1 -0
- package/bin/types/workspace/WorkspaceEnv.d.ts +16 -0
- package/bin/types/workspace/WorkspaceEnv.d.ts.map +1 -0
- package/bin/types/workspace/WorkspaceEnv.js +9 -0
- package/bin/types/workspace/WorkspaceEnv.js.map +1 -0
- package/bin/types/workspace/WorkspaceTools.d.ts +20 -0
- package/bin/types/workspace/WorkspaceTools.d.ts.map +1 -0
- package/bin/types/workspace/WorkspaceTools.js +9 -0
- package/bin/types/workspace/WorkspaceTools.js.map +1 -0
- package/bin/utils/Id.d.ts +1 -1
- package/bin/utils/Id.d.ts.map +1 -1
- package/bin/utils/Id.js +1 -1
- package/bin/utils/Id.js.map +1 -1
- package/bin/utils/Template.d.ts +1 -1
- package/bin/utils/Template.d.ts.map +1 -1
- package/bin/utils/Template.js +1 -1
- package/bin/utils/Template.js.map +1 -1
- package/bin/utils/Time.d.ts +5 -5
- package/bin/utils/Time.d.ts.map +1 -1
- package/bin/utils/Time.js +5 -5
- package/bin/utils/Time.js.map +1 -1
- package/bin/utils/cli/CliOutput.d.ts +1 -1
- package/bin/utils/cli/CliOutput.d.ts.map +1 -1
- package/bin/utils/cli/CliOutput.js +6 -6
- package/bin/utils/cli/CliOutput.js.map +1 -1
- package/bin/utils/cli/PrettyStatus.d.ts +3 -3
- package/bin/utils/cli/PrettyStatus.d.ts.map +1 -1
- package/bin/utils/cli/PrettyStatus.js +4 -4
- package/bin/utils/cli/PrettyStatus.js.map +1 -1
- package/bin/utils/logger/FormatRequest.d.ts +2 -2
- package/bin/utils/logger/FormatRequest.d.ts.map +1 -1
- package/bin/utils/logger/FormatRequest.js +49 -49
- package/bin/utils/logger/FormatRequest.js.map +1 -1
- package/bin/utils/logger/FormatResponse.d.ts +1 -1
- package/bin/utils/logger/FormatResponse.d.ts.map +1 -1
- package/bin/utils/logger/FormatResponse.js +36 -36
- package/bin/utils/logger/FormatResponse.js.map +1 -1
- package/bin/utils/logger/FormatShared.d.ts +16 -16
- package/bin/utils/logger/FormatShared.d.ts.map +1 -1
- package/bin/utils/logger/FormatShared.js +28 -28
- package/bin/utils/logger/FormatShared.js.map +1 -1
- package/bin/utils/logger/Logger.d.ts +15 -12
- package/bin/utils/logger/Logger.d.ts.map +1 -1
- package/bin/utils/logger/Logger.js +28 -26
- package/bin/utils/logger/Logger.js.map +1 -1
- package/bin/utils/object/DeepMerge.d.ts +1 -1
- package/bin/utils/object/DeepMerge.d.ts.map +1 -1
- package/bin/utils/object/DeepMerge.js +5 -5
- package/bin/utils/object/DeepMerge.js.map +1 -1
- package/bin/utils/object/ObjectGuards.d.ts +1 -1
- package/bin/utils/object/ObjectGuards.d.ts.map +1 -1
- package/bin/utils/object/ObjectGuards.js +1 -1
- package/bin/utils/object/ObjectGuards.js.map +1 -1
- package/bin/utils/path/AncestorFiles.d.ts +1 -1
- package/bin/utils/path/AncestorFiles.d.ts.map +1 -1
- package/bin/utils/path/AncestorFiles.js +2 -2
- package/bin/utils/path/AncestorFiles.js.map +1 -1
- package/bin/utils/storage/index.d.ts +2 -2
- package/bin/utils/storage/index.d.ts.map +1 -1
- package/bin/utils/storage/index.js +2 -2
- package/bin/utils/storage/index.js.map +1 -1
- package/bin/utils/string/EscapeRegExp.d.ts +1 -1
- package/bin/utils/string/EscapeRegExp.d.ts.map +1 -1
- package/bin/utils/string/EscapeRegExp.js +1 -1
- package/bin/utils/string/EscapeRegExp.js.map +1 -1
- package/bin/workspace/LocalFileSystem.d.ts +44 -0
- package/bin/workspace/LocalFileSystem.d.ts.map +1 -0
- package/bin/workspace/LocalFileSystem.js +153 -0
- package/bin/workspace/LocalFileSystem.js.map +1 -0
- package/bin/workspace/Workspace.d.ts +52 -0
- package/bin/workspace/Workspace.d.ts.map +1 -0
- package/bin/workspace/Workspace.js +153 -0
- package/bin/workspace/Workspace.js.map +1 -0
- package/bin/workspace/WorkspaceEnv.d.ts +19 -0
- package/bin/workspace/WorkspaceEnv.d.ts.map +1 -0
- package/bin/workspace/WorkspaceEnv.js +50 -0
- package/bin/workspace/WorkspaceEnv.js.map +1 -0
- package/bin/workspace/WorkspacePaths.d.ts +67 -0
- package/bin/workspace/WorkspacePaths.d.ts.map +1 -0
- package/bin/workspace/WorkspacePaths.js +102 -0
- package/bin/workspace/WorkspacePaths.js.map +1 -0
- package/bin/workspace/file/FileActionRuntime.d.ts +14 -0
- package/bin/workspace/file/FileActionRuntime.d.ts.map +1 -0
- package/bin/workspace/file/FileActionRuntime.js +386 -0
- package/bin/workspace/file/FileActionRuntime.js.map +1 -0
- package/bin/workspace/file/FileAtomicWriter.d.ts +20 -0
- package/bin/workspace/file/FileAtomicWriter.d.ts.map +1 -0
- package/bin/workspace/file/FileAtomicWriter.js +50 -0
- package/bin/workspace/file/FileAtomicWriter.js.map +1 -0
- package/bin/workspace/file/FileEncoding.d.ts +34 -0
- package/bin/workspace/file/FileEncoding.d.ts.map +1 -0
- package/bin/workspace/file/FileEncoding.js +152 -0
- package/bin/workspace/file/FileEncoding.js.map +1 -0
- package/bin/workspace/file/FilePathPolicy.d.ts +26 -0
- package/bin/workspace/file/FilePathPolicy.d.ts.map +1 -0
- package/bin/workspace/file/FilePathPolicy.js +134 -0
- package/bin/workspace/file/FilePathPolicy.js.map +1 -0
- package/bin/workspace/file/FileToolError.d.ts +30 -0
- package/bin/workspace/file/FileToolError.d.ts.map +1 -0
- package/bin/workspace/file/FileToolError.js +78 -0
- package/bin/workspace/file/FileToolError.js.map +1 -0
- package/bin/workspace/search/SearchActionRuntime.d.ts +14 -0
- package/bin/workspace/search/SearchActionRuntime.d.ts.map +1 -0
- package/bin/workspace/search/SearchActionRuntime.js +359 -0
- package/bin/workspace/search/SearchActionRuntime.js.map +1 -0
- package/bin/workspace/search/SearchToolError.d.ts +26 -0
- package/bin/workspace/search/SearchToolError.d.ts.map +1 -0
- package/bin/workspace/search/SearchToolError.js +76 -0
- package/bin/workspace/search/SearchToolError.js.map +1 -0
- package/bin/{session/messages → workspace/store}/JsonlSessionMessageStore.d.ts +4 -31
- package/bin/workspace/store/JsonlSessionMessageStore.d.ts.map +1 -0
- package/bin/{session/messages → workspace/store}/JsonlSessionMessageStore.js +28 -63
- package/bin/workspace/store/JsonlSessionMessageStore.js.map +1 -0
- package/bin/workspace/store/LocalAgentStore.d.ts +43 -0
- package/bin/workspace/store/LocalAgentStore.d.ts.map +1 -0
- package/bin/workspace/store/LocalAgentStore.js +135 -0
- package/bin/workspace/store/LocalAgentStore.js.map +1 -0
- package/bin/workspace/store/LocalSessionStore.d.ts +38 -0
- package/bin/workspace/store/LocalSessionStore.d.ts.map +1 -0
- package/bin/workspace/store/LocalSessionStore.js +70 -0
- package/bin/workspace/store/LocalSessionStore.js.map +1 -0
- package/bin/workspace/store/LocalStorePaths.d.ts +81 -0
- package/bin/workspace/store/LocalStorePaths.d.ts.map +1 -0
- package/bin/workspace/store/LocalStorePaths.js +112 -0
- package/bin/workspace/store/LocalStorePaths.js.map +1 -0
- package/bin/workspace/store/SessionMessageStoreFactory.d.ts +12 -0
- package/bin/workspace/store/SessionMessageStoreFactory.d.ts.map +1 -0
- package/bin/workspace/store/SessionMessageStoreFactory.js +13 -0
- package/bin/workspace/store/SessionMessageStoreFactory.js.map +1 -0
- package/bin/workspace/tool/FileToolSchemas.d.ts +35 -0
- package/bin/workspace/tool/FileToolSchemas.d.ts.map +1 -0
- package/bin/workspace/tool/FileToolSchemas.js +73 -0
- package/bin/workspace/tool/FileToolSchemas.js.map +1 -0
- package/bin/workspace/tool/FileTools.d.ts +11 -0
- package/bin/workspace/tool/FileTools.d.ts.map +1 -0
- package/bin/workspace/tool/FileTools.js +61 -0
- package/bin/workspace/tool/FileTools.js.map +1 -0
- package/bin/workspace/tool/SearchToolSchemas.d.ts +24 -0
- package/bin/workspace/tool/SearchToolSchemas.d.ts.map +1 -0
- package/bin/workspace/tool/SearchToolSchemas.js +60 -0
- package/bin/workspace/tool/SearchToolSchemas.js.map +1 -0
- package/bin/workspace/tool/SearchTools.d.ts +11 -0
- package/bin/workspace/tool/SearchTools.d.ts.map +1 -0
- package/bin/workspace/tool/SearchTools.js +38 -0
- package/bin/workspace/tool/SearchTools.js.map +1 -0
- package/bin/workspace/tool/WorkspaceTools.d.ts +11 -0
- package/bin/workspace/tool/WorkspaceTools.d.ts.map +1 -0
- package/bin/workspace/tool/WorkspaceTools.js +22 -0
- package/bin/workspace/tool/WorkspaceTools.js.map +1 -0
- package/package.json +11 -6
- package/scripts/action-schedule-store.test.mjs +101 -0
- package/scripts/agent-env-shell-sandbox.test.mjs +9 -19
- package/scripts/agent-env.test.mjs +10 -39
- package/scripts/agent-ready.test.mjs +16 -11
- package/scripts/agent-session-maintenance.test.mjs +9 -7
- package/scripts/agent-store.test.mjs +83 -0
- package/scripts/city-model-tool-loop.test.mjs +48 -22
- package/scripts/core-engine-context-compaction.test.mjs +29 -26
- package/scripts/core-engine-ui-stream-collector.test.mjs +4 -4
- package/scripts/executor-failure-result.test.mjs +36 -33
- package/scripts/file-tools.test.mjs +282 -0
- package/scripts/image-plugin-job.test.mjs +43 -34
- package/scripts/logger-isolation.test.mjs +6 -6
- package/scripts/multi-agent-plugin-isolation.test.mjs +8 -8
- package/scripts/{plugin-tool-bridge.test.mjs → plugin-tools.test.mjs} +106 -102
- package/scripts/public-api-naming.test.mjs +108 -0
- package/scripts/remote-session-reconnect.test.mjs +78 -9
- package/scripts/search-tools.test.mjs +188 -0
- package/scripts/session-ask-question.test.mjs +216 -0
- package/scripts/session-compact-handle.test.mjs +117 -0
- package/scripts/session-composer.test.mjs +7 -5
- package/scripts/session-config-turn-boundary.test.mjs +177 -43
- package/scripts/session-list-title.test.mjs +23 -23
- package/scripts/session-message-timeline.test.mjs +65 -0
- package/scripts/session-messages-error.test.mjs +0 -1
- package/scripts/session-messages.test.mjs +305 -68
- package/scripts/session-queue.test.mjs +75 -40
- package/scripts/session-shell-approval.test.mjs +25 -22
- package/scripts/session-system-blocks.test.mjs +3 -3
- package/scripts/session-title-event.test.mjs +7 -7
- package/scripts/session-turn-context.test.mjs +99 -0
- package/scripts/session-turn-failure.test.mjs +158 -38
- package/scripts/workspace.test.mjs +146 -0
- package/src/agent/Agent.ts +159 -109
- package/src/agent/AgentInstructions.ts +2 -2
- package/src/agent/AgentModel.ts +2 -2
- package/src/agent/AgentSessions.ts +50 -148
- package/src/agent/AgentState.ts +8 -63
- package/src/executor/Executor.ts +120 -226
- package/src/executor/README.md +13 -11
- package/src/executor/composer/system/SessionSystemComposer.ts +2 -2
- package/src/executor/composer/system/default/DefaultSessionSystemComposer.ts +24 -24
- package/src/executor/composer/system/default/PromptRenderer.ts +4 -4
- package/src/executor/composer/system/default/SystemDomain.ts +68 -68
- package/src/executor/composer/system/default/assets/core.prompt.ts +1 -1
- package/src/executor/composer/system/default/assets/core.prompt.ts.txt +1 -1
- package/src/executor/composer/system/default/variables/GeoContext.ts +4 -4
- package/src/executor/composer/system/default/variables/PromptTypes.ts +2 -2
- package/src/executor/composer/system/default/variables/VariableReplacer.ts +30 -30
- package/src/executor/core-engine/CoreEngineError.ts +2 -2
- package/src/executor/core-engine/CoreEngineLoopDecision.ts +2 -2
- package/src/executor/core-engine/CoreEngineMessageState.ts +16 -16
- package/src/executor/core-engine/CoreEngineRunner.ts +124 -134
- package/src/executor/core-engine/CoreEngineSignals.ts +24 -24
- package/src/executor/core-engine/CoreEngineUiStreamCollector.ts +18 -18
- package/src/executor/ids/resolveSessionId.ts +5 -5
- package/src/executor/messages/ChatMessageMarkup.ts +23 -23
- package/src/executor/messages/ChatMessageMarkupTypes.ts +10 -10
- package/src/executor/messages/SessionAttachmentMapper.ts +14 -14
- package/src/executor/messages/SessionMessageCodec.ts +17 -27
- package/src/executor/messages/SessionMessageLog.ts +3 -3
- package/src/executor/messages/SessionStepEventMapper.ts +9 -9
- package/src/executor/messages/UIMessageTransformer.ts +6 -6
- package/src/executor/messages/UserVisibleText.ts +6 -6
- package/src/executor/services/ExecutorRecoveryPolicy.ts +33 -32
- package/src/executor/types/SessionHistoryMeta.ts +10 -10
- package/src/executor/types/SessionRecords.ts +13 -13
- package/src/index.ts +108 -184
- package/src/plugin/core/ActionScheduleExecutor.ts +21 -23
- package/src/plugin/core/ActionScheduleRuntime.ts +8 -8
- package/src/plugin/core/ActionScheduleStore.ts +140 -128
- package/src/plugin/core/ActionScheduleTime.ts +6 -6
- package/src/plugin/core/BasePlugin.ts +6 -27
- package/src/plugin/core/HookRegistry.ts +56 -56
- package/src/plugin/core/PluginActionFactory.ts +20 -38
- package/src/plugin/core/PluginActionRunner.ts +21 -181
- package/src/plugin/core/PluginCatalog.ts +23 -23
- package/src/plugin/core/PluginContext.ts +52 -0
- package/src/plugin/core/PluginHttpRoutes.ts +8 -8
- package/src/plugin/core/PluginRegistry.ts +125 -88
- package/src/plugin/core/PluginStateController.ts +5 -47
- package/src/plugin/tool/PluginToolRuntime.ts +121 -0
- package/src/{executor/tools/plugin → plugin/tool}/PluginToolSchemas.ts +1 -1
- package/src/{executor/tools/plugin/PluginToolDefinition.ts → plugin/tool/PluginTools.ts} +25 -27
- package/src/plugin/types/ActionSchedule.ts +10 -10
- package/src/plugin/types/PluginApi.ts +3 -3
- package/src/remote/RemoteAgent.ts +3 -3
- package/src/remote/RemoteSession.ts +110 -28
- package/src/remote/RemoteTransport.ts +17 -20
- package/src/remote/transports/HttpRemoteAgentTransport.ts +59 -59
- package/src/remote/transports/RpcClient.ts +65 -106
- package/src/remote/transports/RpcRemoteAgentTransport.ts +21 -21
- package/src/session/DefaultSessionComposer.ts +2 -3
- package/src/session/Session.ts +352 -298
- package/src/session/SessionCommand.ts +42 -0
- package/src/session/SessionLoop.ts +661 -0
- package/src/session/SessionMessages.ts +141 -94
- package/src/session/SessionQueue.ts +31 -64
- package/src/session/SessionState.ts +48 -116
- package/src/session/SessionSystem.ts +7 -7
- package/src/session/SessionTitle.ts +24 -39
- package/src/session/browse/Browse.ts +160 -384
- package/src/session/browse/SessionMessageTimeline.ts +135 -0
- package/src/session/control/SessionInteractions.ts +290 -0
- package/src/session/execution/SessionAssistantOutputAdapter.ts +144 -0
- package/src/session/execution/tools/SessionShellApprovalAdapter.ts +94 -0
- package/src/session/messages/SessionAssistantMessageWriter.ts +33 -21
- package/src/session/messages/SessionJsonValue.ts +3 -3
- package/src/session/messages/SessionMessageCodec.ts +29 -84
- package/src/session/messages/SessionMessageCompaction.ts +2 -2
- package/src/session/messages/SessionMessageInteractionWriter.ts +277 -0
- package/src/session/preview/SessionMessagePreview.ts +2 -2
- package/src/session/runtime/SessionCompactOperation.ts +93 -0
- package/src/session/runtime/SessionHistoryCompaction.ts +45 -0
- package/src/session/runtime/SessionTurnContext.ts +222 -0
- package/src/session/storage/Metadata.ts +46 -195
- package/src/session/storage/RuntimeSessionPort.ts +13 -13
- package/src/tools/ask/AskQuestionsTool.ts +85 -0
- package/src/tools/ask/AskQuestionsToolSchemas.ts +55 -0
- package/src/tools/index.ts +12 -0
- package/src/types/action/ActionResult.ts +36 -0
- package/src/types/agent/AgentOptions.ts +13 -25
- package/src/types/agent/AgentState.ts +4 -15
- package/src/types/agent/RemoteAgentPluginAction.ts +2 -2
- package/src/types/agent/SessionActor.ts +21 -20
- package/src/types/agent/SessionTypes.ts +74 -94
- package/src/types/executor/SessionAssistantOutput.ts +35 -0
- package/src/types/executor/SessionToolExecutionContext.ts +5 -5
- package/src/types/executor/SessionTurnContext.ts +171 -0
- package/src/types/plugin/PluginAction.ts +13 -10
- package/src/types/plugin/PluginCommand.ts +8 -70
- package/src/types/plugin/PluginContext.ts +43 -0
- package/src/types/plugin/PluginDefinition.ts +8 -35
- package/src/types/plugin/PluginExecutionContext.ts +34 -0
- package/src/types/plugin/PluginHttp.ts +5 -5
- package/src/types/plugin/PluginRegistry.ts +25 -0
- package/src/types/plugin/PluginRuntime.ts +30 -43
- package/src/types/plugin/PluginState.ts +0 -17
- package/src/{executor/tools/plugin/types → types/plugin}/PluginTool.ts +42 -20
- package/src/types/rpc/RpcProtocol.ts +49 -74
- package/src/types/sdk/AgentSessionCompact.ts +36 -0
- package/src/types/sdk/AgentSessionPrompt.ts +1 -1
- package/src/types/sdk/AgentSessionStop.ts +2 -2
- package/src/types/sdk/AgentSessionTurn.ts +3 -15
- package/src/types/session/SessionCommand.ts +27 -0
- package/src/types/session/SessionComposer.ts +8 -4
- package/src/{executor/types/SessionRun.ts → types/session/SessionExecution.ts} +41 -34
- package/src/types/session/SessionInteraction.ts +209 -0
- package/src/types/session/SessionInteractions.ts +21 -0
- package/src/types/session/SessionLocalState.ts +1 -1
- package/src/types/session/SessionLoop.ts +72 -0
- package/src/types/session/SessionMessage.ts +43 -28
- package/src/types/session/SessionMessages.ts +2 -4
- package/src/types/session/SessionMutation.ts +21 -0
- package/src/types/session/SessionOptions.ts +38 -23
- package/src/types/session/SessionPort.ts +6 -24
- package/src/types/session/SessionState.ts +3 -16
- package/src/types/store/AgentStore.ts +52 -0
- package/src/types/store/LocalStore.ts +39 -0
- package/src/types/store/SessionStore.ts +105 -0
- package/src/types/tools/ask/AskQuestionsTool.ts +27 -0
- package/src/types/workspace/FileSystem.ts +76 -0
- package/src/types/workspace/FileTool.ts +225 -0
- package/src/types/workspace/SearchTool.ts +156 -0
- package/src/types/workspace/Workspace.ts +27 -0
- package/src/types/workspace/WorkspaceEnv.ts +19 -0
- package/src/types/workspace/WorkspaceTools.ts +23 -0
- package/src/utils/Id.ts +1 -1
- package/src/utils/Template.ts +1 -1
- package/src/utils/Time.ts +8 -8
- package/src/utils/cli/CliOutput.ts +7 -7
- package/src/utils/cli/PrettyStatus.ts +4 -4
- package/src/utils/logger/FormatRequest.ts +64 -64
- package/src/utils/logger/FormatResponse.ts +44 -44
- package/src/utils/logger/FormatShared.ts +28 -28
- package/src/utils/logger/Logger.ts +30 -26
- package/src/utils/object/DeepMerge.ts +5 -5
- package/src/utils/object/ObjectGuards.ts +1 -1
- package/src/utils/path/AncestorFiles.ts +3 -3
- package/src/utils/storage/index.ts +2 -2
- package/src/utils/string/EscapeRegExp.ts +1 -1
- package/src/workspace/LocalFileSystem.ts +209 -0
- package/src/workspace/Workspace.ts +180 -0
- package/src/workspace/WorkspaceEnv.ts +54 -0
- package/src/workspace/WorkspacePaths.ts +112 -0
- package/src/workspace/file/FileActionRuntime.ts +433 -0
- package/src/workspace/file/FileAtomicWriter.ts +61 -0
- package/src/workspace/file/FileEncoding.ts +175 -0
- package/src/workspace/file/FilePathPolicy.ts +162 -0
- package/src/workspace/file/FileToolError.ts +99 -0
- package/src/workspace/search/SearchActionRuntime.ts +438 -0
- package/src/workspace/search/SearchToolError.ts +94 -0
- package/src/{session/messages → workspace/store}/JsonlSessionMessageStore.ts +40 -91
- package/src/workspace/store/LocalAgentStore.ts +191 -0
- package/src/workspace/store/LocalSessionStore.ts +114 -0
- package/src/workspace/store/LocalStorePaths.ts +209 -0
- package/src/workspace/store/SessionMessageStoreFactory.ts +18 -0
- package/src/workspace/tool/FileToolSchemas.ts +77 -0
- package/src/workspace/tool/FileTools.ts +91 -0
- package/src/workspace/tool/SearchToolSchemas.ts +62 -0
- package/src/workspace/tool/SearchTools.ts +61 -0
- package/src/workspace/tool/WorkspaceTools.ts +31 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/bin/agent/AgentContext.d.ts +0 -69
- package/bin/agent/AgentContext.d.ts.map +0 -1
- package/bin/agent/AgentContext.js +0 -56
- package/bin/agent/AgentContext.js.map +0 -1
- package/bin/config/AgentEnv.d.ts +0 -9
- package/bin/config/AgentEnv.d.ts.map +0 -1
- package/bin/config/AgentEnv.js +0 -48
- package/bin/config/AgentEnv.js.map +0 -1
- package/bin/config/AgentInitializer.d.ts +0 -31
- package/bin/config/AgentInitializer.d.ts.map +0 -1
- package/bin/config/AgentInitializer.js +0 -131
- package/bin/config/AgentInitializer.js.map +0 -1
- package/bin/config/EnvFile.d.ts +0 -31
- package/bin/config/EnvFile.d.ts.map +0 -1
- package/bin/config/EnvFile.js +0 -89
- package/bin/config/EnvFile.js.map +0 -1
- package/bin/config/ExecutionBinding.d.ts +0 -31
- package/bin/config/ExecutionBinding.d.ts.map +0 -1
- package/bin/config/ExecutionBinding.js +0 -46
- package/bin/config/ExecutionBinding.js.map +0 -1
- package/bin/config/Gitignore.d.ts +0 -21
- package/bin/config/Gitignore.d.ts.map +0 -1
- package/bin/config/Gitignore.js +0 -46
- package/bin/config/Gitignore.js.map +0 -1
- package/bin/config/Paths.d.ts +0 -122
- package/bin/config/Paths.d.ts.map +0 -1
- package/bin/config/Paths.js +0 -183
- package/bin/config/Paths.js.map +0 -1
- package/bin/config/PlatformPaths.d.ts +0 -31
- package/bin/config/PlatformPaths.d.ts.map +0 -1
- package/bin/config/PlatformPaths.js +0 -53
- package/bin/config/PlatformPaths.js.map +0 -1
- package/bin/config/ProjectSetup.d.ts +0 -11
- package/bin/config/ProjectSetup.d.ts.map +0 -1
- package/bin/config/ProjectSetup.js +0 -32
- package/bin/config/ProjectSetup.js.map +0 -1
- package/bin/executor/messages/AssistantFileResource.d.ts +0 -63
- package/bin/executor/messages/AssistantFileResource.d.ts.map +0 -1
- package/bin/executor/messages/AssistantFileResource.js +0 -352
- package/bin/executor/messages/AssistantFileResource.js.map +0 -1
- package/bin/executor/tools/file/ReadImageToolBridge.d.ts +0 -21
- package/bin/executor/tools/file/ReadImageToolBridge.d.ts.map +0 -1
- package/bin/executor/tools/file/ReadImageToolBridge.js +0 -69
- package/bin/executor/tools/file/ReadImageToolBridge.js.map +0 -1
- package/bin/executor/tools/plugin/PluginToolBridge.d.ts +0 -19
- package/bin/executor/tools/plugin/PluginToolBridge.d.ts.map +0 -1
- package/bin/executor/tools/plugin/PluginToolBridge.js +0 -181
- package/bin/executor/tools/plugin/PluginToolBridge.js.map +0 -1
- package/bin/executor/tools/plugin/PluginToolDefinition.d.ts +0 -25
- package/bin/executor/tools/plugin/PluginToolDefinition.d.ts.map +0 -1
- package/bin/executor/tools/plugin/PluginToolDefinition.js.map +0 -1
- package/bin/executor/tools/plugin/PluginToolSchemas.d.ts.map +0 -1
- package/bin/executor/tools/plugin/PluginToolSchemas.js.map +0 -1
- package/bin/executor/tools/plugin/types/PluginTool.d.ts +0 -76
- package/bin/executor/tools/plugin/types/PluginTool.d.ts.map +0 -1
- package/bin/executor/tools/plugin/types/PluginTool.js.map +0 -1
- package/bin/executor/types/SessionExecutor.d.ts +0 -26
- package/bin/executor/types/SessionExecutor.d.ts.map +0 -1
- package/bin/executor/types/SessionExecutor.js +0 -9
- package/bin/executor/types/SessionExecutor.js.map +0 -1
- package/bin/executor/types/SessionRun.d.ts.map +0 -1
- package/bin/executor/types/SessionRun.js +0 -10
- package/bin/executor/types/SessionRun.js.map +0 -1
- package/bin/plugin/core/PluginCommand.d.ts +0 -17
- package/bin/plugin/core/PluginCommand.d.ts.map +0 -1
- package/bin/plugin/core/PluginCommand.js +0 -189
- package/bin/plugin/core/PluginCommand.js.map +0 -1
- package/bin/plugin/core/PluginCommandRequest.d.ts +0 -36
- package/bin/plugin/core/PluginCommandRequest.d.ts.map +0 -1
- package/bin/plugin/core/PluginCommandRequest.js +0 -53
- package/bin/plugin/core/PluginCommandRequest.js.map +0 -1
- package/bin/plugin/core/PluginLocalExecution.d.ts +0 -45
- package/bin/plugin/core/PluginLocalExecution.d.ts.map +0 -1
- package/bin/plugin/core/PluginLocalExecution.js +0 -115
- package/bin/plugin/core/PluginLocalExecution.js.map +0 -1
- package/bin/session/SessionTurn.d.ts +0 -84
- package/bin/session/SessionTurn.d.ts.map +0 -1
- package/bin/session/SessionTurn.js +0 -579
- package/bin/session/SessionTurn.js.map +0 -1
- package/bin/session/approval/SessionApprovalBroker.d.ts +0 -48
- package/bin/session/approval/SessionApprovalBroker.d.ts.map +0 -1
- package/bin/session/approval/SessionApprovalBroker.js +0 -126
- package/bin/session/approval/SessionApprovalBroker.js.map +0 -1
- package/bin/session/messages/JsonlSessionMessageStore.d.ts.map +0 -1
- package/bin/session/messages/JsonlSessionMessageStore.js.map +0 -1
- package/bin/session/storage/Instruction.d.ts +0 -16
- package/bin/session/storage/Instruction.d.ts.map +0 -1
- package/bin/session/storage/Instruction.js +0 -48
- package/bin/session/storage/Instruction.js.map +0 -1
- package/bin/session/storage/Paths.d.ts +0 -81
- package/bin/session/storage/Paths.d.ts.map +0 -1
- package/bin/session/storage/Paths.js +0 -112
- package/bin/session/storage/Paths.js.map +0 -1
- package/bin/types/common/EnvFile.d.ts +0 -30
- package/bin/types/common/EnvFile.d.ts.map +0 -1
- package/bin/types/common/EnvFile.js +0 -10
- package/bin/types/common/EnvFile.js.map +0 -1
- package/bin/types/config/AgentProject.d.ts +0 -73
- package/bin/types/config/AgentProject.d.ts.map +0 -1
- package/bin/types/config/AgentProject.js +0 -9
- package/bin/types/config/AgentProject.js.map +0 -1
- package/bin/types/config/DowncityConfig.d.ts +0 -145
- package/bin/types/config/DowncityConfig.d.ts.map +0 -1
- package/bin/types/config/DowncityConfig.js +0 -2
- package/bin/types/config/DowncityConfig.js.map +0 -1
- package/bin/types/config/ExecutionBinding.d.ts +0 -26
- package/bin/types/config/ExecutionBinding.d.ts.map +0 -1
- package/bin/types/config/ExecutionBinding.js +0 -10
- package/bin/types/config/ExecutionBinding.js.map +0 -1
- package/bin/types/config/LlmConfig.d.ts +0 -100
- package/bin/types/config/LlmConfig.d.ts.map +0 -1
- package/bin/types/config/LlmConfig.js +0 -10
- package/bin/types/config/LlmConfig.js.map +0 -1
- package/bin/types/executor/SessionRunContext.d.ts +0 -155
- package/bin/types/executor/SessionRunContext.d.ts.map +0 -1
- package/bin/types/executor/SessionRunContext.js +0 -10
- package/bin/types/executor/SessionRunContext.js.map +0 -1
- package/bin/types/platform/Store.d.ts +0 -191
- package/bin/types/platform/Store.d.ts.map +0 -1
- package/bin/types/platform/Store.js +0 -9
- package/bin/types/platform/Store.js.map +0 -1
- package/bin/types/plugin/PluginConfig.d.ts +0 -12
- package/bin/types/plugin/PluginConfig.d.ts.map +0 -1
- package/bin/types/plugin/PluginConfig.js +0 -5
- package/bin/types/plugin/PluginConfig.js.map +0 -1
- package/bin/types/plugin/PluginControl.d.ts +0 -74
- package/bin/types/plugin/PluginControl.d.ts.map +0 -1
- package/bin/types/plugin/PluginControl.js +0 -9
- package/bin/types/plugin/PluginControl.js.map +0 -1
- package/bin/types/plugin/PluginRunContext.d.ts +0 -26
- package/bin/types/plugin/PluginRunContext.d.ts.map +0 -1
- package/bin/types/plugin/PluginRunContext.js.map +0 -1
- package/bin/types/plugin/PluginSetup.d.ts +0 -133
- package/bin/types/plugin/PluginSetup.d.ts.map +0 -1
- package/bin/types/plugin/PluginSetup.js +0 -9
- package/bin/types/plugin/PluginSetup.js.map +0 -1
- package/bin/types/plugin/PluginToolRuntime.d.ts +0 -86
- package/bin/types/plugin/PluginToolRuntime.d.ts.map +0 -1
- package/bin/types/plugin/PluginToolRuntime.js +0 -9
- package/bin/types/plugin/PluginToolRuntime.js.map +0 -1
- package/bin/types/runtime/auth/AuthPermission.d.ts +0 -49
- package/bin/types/runtime/auth/AuthPermission.d.ts.map +0 -1
- package/bin/types/runtime/auth/AuthPermission.js +0 -87
- package/bin/types/runtime/auth/AuthPermission.js.map +0 -1
- package/bin/types/runtime/auth/AuthRoute.d.ts +0 -29
- package/bin/types/runtime/auth/AuthRoute.d.ts.map +0 -1
- package/bin/types/runtime/auth/AuthRoute.js +0 -8
- package/bin/types/runtime/auth/AuthRoute.js.map +0 -1
- package/bin/types/runtime/auth/AuthToken.d.ts +0 -46
- package/bin/types/runtime/auth/AuthToken.d.ts.map +0 -1
- package/bin/types/runtime/auth/AuthToken.js +0 -9
- package/bin/types/runtime/auth/AuthToken.js.map +0 -1
- package/bin/types/runtime/auth/AuthTypes.d.ts +0 -227
- package/bin/types/runtime/auth/AuthTypes.d.ts.map +0 -1
- package/bin/types/runtime/auth/AuthTypes.js +0 -9
- package/bin/types/runtime/auth/AuthTypes.js.map +0 -1
- package/bin/types/runtime/http/InlineInstant.d.ts +0 -82
- package/bin/types/runtime/http/InlineInstant.d.ts.map +0 -1
- package/bin/types/runtime/http/InlineInstant.js +0 -10
- package/bin/types/runtime/http/InlineInstant.js.map +0 -1
- package/bin/types/runtime/platform/Platform.d.ts +0 -362
- package/bin/types/runtime/platform/Platform.d.ts.map +0 -1
- package/bin/types/runtime/platform/Platform.js +0 -10
- package/bin/types/runtime/platform/Platform.js.map +0 -1
- package/bin/types/runtime/platform/PlatformGateway.d.ts +0 -41
- package/bin/types/runtime/platform/PlatformGateway.d.ts.map +0 -1
- package/bin/types/runtime/platform/PlatformGateway.js +0 -2
- package/bin/types/runtime/platform/PlatformGateway.js.map +0 -1
- package/bin/types/session/SessionApproval.d.ts +0 -63
- package/bin/types/session/SessionApproval.d.ts.map +0 -1
- package/bin/types/session/SessionApproval.js +0 -7
- package/bin/types/session/SessionApproval.js.map +0 -1
- package/bin/types/session/SessionApprovalBroker.d.ts +0 -17
- package/bin/types/session/SessionApprovalBroker.d.ts.map +0 -1
- package/bin/types/session/SessionApprovalBroker.js +0 -7
- package/bin/types/session/SessionApprovalBroker.js.map +0 -1
- package/bin/types/session/SessionInstruction.d.ts +0 -22
- package/bin/types/session/SessionInstruction.d.ts.map +0 -1
- package/bin/types/session/SessionInstruction.js +0 -9
- package/bin/types/session/SessionInstruction.js.map +0 -1
- package/bin/types/session/SessionQueue.d.ts +0 -88
- package/bin/types/session/SessionQueue.d.ts.map +0 -1
- package/bin/types/session/SessionQueue.js +0 -7
- package/bin/types/session/SessionQueue.js.map +0 -1
- package/bin/types/session/SessionTurn.d.ts +0 -52
- package/bin/types/session/SessionTurn.d.ts.map +0 -1
- package/bin/types/session/SessionTurn.js.map +0 -1
- package/scripts/assistant-file-resource.test.mjs +0 -344
- package/scripts/read-image-tool-bridge.test.mjs +0 -71
- package/src/agent/AgentContext.ts +0 -98
- package/src/config/AgentEnv.ts +0 -49
- package/src/config/AgentInitializer.ts +0 -167
- package/src/config/EnvFile.ts +0 -99
- package/src/config/ExecutionBinding.ts +0 -50
- package/src/config/Gitignore.ts +0 -52
- package/src/config/Paths.ts +0 -241
- package/src/config/PlatformPaths.ts +0 -57
- package/src/config/ProjectSetup.ts +0 -44
- package/src/executor/messages/AssistantFileResource.ts +0 -446
- package/src/executor/tools/file/ReadImageToolBridge.ts +0 -79
- package/src/executor/tools/plugin/PluginToolBridge.ts +0 -212
- package/src/executor/types/SessionExecutor.ts +0 -34
- package/src/plugin/core/PluginCommand.ts +0 -230
- package/src/plugin/core/PluginCommandRequest.ts +0 -93
- package/src/plugin/core/PluginLocalExecution.ts +0 -154
- package/src/session/SessionTurn.ts +0 -669
- package/src/session/approval/SessionApprovalBroker.ts +0 -164
- package/src/session/storage/Instruction.ts +0 -72
- package/src/session/storage/Paths.ts +0 -209
- package/src/types/common/EnvFile.ts +0 -31
- package/src/types/config/AgentProject.ts +0 -85
- package/src/types/config/DowncityConfig.ts +0 -153
- package/src/types/config/ExecutionBinding.ts +0 -27
- package/src/types/config/LlmConfig.ts +0 -115
- package/src/types/executor/SessionRunContext.ts +0 -191
- package/src/types/platform/Store.ts +0 -197
- package/src/types/plugin/PluginConfig.ts +0 -13
- package/src/types/plugin/PluginControl.ts +0 -80
- package/src/types/plugin/PluginRunContext.ts +0 -31
- package/src/types/plugin/PluginSetup.ts +0 -138
- package/src/types/plugin/PluginToolRuntime.ts +0 -98
- package/src/types/runtime/auth/AuthPermission.ts +0 -120
- package/src/types/runtime/auth/AuthRoute.ts +0 -31
- package/src/types/runtime/auth/AuthToken.ts +0 -47
- package/src/types/runtime/auth/AuthTypes.ts +0 -235
- package/src/types/runtime/http/InlineInstant.ts +0 -96
- package/src/types/runtime/platform/Platform.ts +0 -432
- package/src/types/runtime/platform/PlatformGateway.ts +0 -46
- package/src/types/session/SessionApproval.ts +0 -69
- package/src/types/session/SessionApprovalBroker.ts +0 -18
- package/src/types/session/SessionInstruction.ts +0 -24
- package/src/types/session/SessionQueue.ts +0 -102
- package/src/types/session/SessionTurn.ts +0 -56
- /package/bin/{executor/tools/plugin/types → types/plugin}/PluginTool.js +0 -0
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
- 本地 SDK:`Agent`、`Session`、`RemoteAgent`
|
|
8
8
|
- 内部执行内核:Session Composer、LLM/Tool Loop、增量输出
|
|
9
|
-
- Plugin 框架:registry、action、tool
|
|
9
|
+
- Plugin 框架:registry、action、tool runtime 与执行生命周期
|
|
10
10
|
- 远程访问:`RemoteAgent`、HTTP/RPC transport
|
|
11
11
|
|
|
12
12
|
`downcity` 负责多 Agent 管理、控制面网关、平台 CLI、共享模型目录接入与 daemon 进程管理;`@downcity/agent` 只负责单 Agent 的执行面。
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
- `downcity`
|
|
28
28
|
- 多 Agent registry
|
|
29
29
|
- control plane / gateway
|
|
30
|
-
- 平台 CLI、共享模型目录接入、模型运行时绑定、全局 env、
|
|
30
|
+
- 平台 CLI、共享模型目录接入、模型运行时绑定、全局 env、Plugin Resource Store
|
|
31
31
|
- agent daemon 进程管理
|
|
32
32
|
- `@downcity/ui`
|
|
33
33
|
- React UI 组件与展示层
|
|
@@ -49,35 +49,39 @@ packages/agent
|
|
|
49
49
|
```text
|
|
50
50
|
src/
|
|
51
51
|
├── index.ts # 包公开入口
|
|
52
|
-
├── agent/ # Agent facade
|
|
53
|
-
├── config/ # 项目环境、运行路径与初始化能力
|
|
52
|
+
├── agent/ # Agent facade、状态、模型、环境与执行绑定
|
|
54
53
|
├── executor/ # LLM/Tool Loop、执行恢复与内存上下文折叠
|
|
55
54
|
├── plugin/ # Plugin registry、执行视图、工具桥接与生命周期
|
|
56
55
|
├── remote/ # RemoteAgent、RemoteSession 与 HTTP/RPC transport
|
|
57
56
|
├── session/ # Session facade、State、Turn、Queue、Messages 与 Composer
|
|
58
57
|
├── types/ # agent / executor / session / plugin 等共享协议类型
|
|
59
|
-
|
|
58
|
+
├── utils/ # 日志、资源和通用辅助能力
|
|
59
|
+
└── workspace/ # 项目文件、工具、初始化、路径与结构化存储
|
|
60
60
|
```
|
|
61
61
|
|
|
62
62
|
## 顶层目录职责
|
|
63
63
|
|
|
64
|
-
- `src/config/`
|
|
65
|
-
- 项目配置、项目级路径解析与项目初始化
|
|
66
|
-
- `project/` 收口 agent 项目脚手架与初始化结果类型
|
|
67
|
-
- 负责项目 `.env`、`.downcity/*` 路径规则与 execution binding
|
|
68
|
-
|
|
69
64
|
- `src/agent/`
|
|
70
65
|
- SDK facade 层
|
|
71
66
|
- `Agent.ts` 负责本地 Agent 实例装配
|
|
72
67
|
- `AgentSessions.ts` 负责 Session 集合生命周期
|
|
68
|
+
- `ExecutionBinding.ts` 负责 Agent 执行目标绑定
|
|
69
|
+
|
|
70
|
+
- `src/workspace/`
|
|
71
|
+
- 统一承载项目根目录、文件系统、模型工具、初始化和结构化存储
|
|
72
|
+
- `setup/` 负责项目 `.env`、`.gitignore` 与 `.downcity` 初始化
|
|
73
|
+
- `store/` 负责 Agent、Session 和 JSONL Message 的本地持久化
|
|
74
|
+
- `WorkspaceEnv.ts` 负责 Workspace 环境变量装配
|
|
75
|
+
- `tool/WorkspaceTools.ts` 组合文件、搜索与可选 Shell 工具
|
|
76
|
+
- `WorkspacePaths.ts` 负责 Workspace 内部路径布局
|
|
73
77
|
|
|
74
78
|
- `src/session/`
|
|
75
79
|
- `Session.ts` 是公开 facade 与 Session 对象装配入口
|
|
76
80
|
- `SessionState.ts` 管理配置与 metadata
|
|
77
|
-
- `
|
|
81
|
+
- `SessionLoop.ts` 管理输入队列和 Turn 生命周期
|
|
78
82
|
- `SessionMessages.ts` 是 canonical Message 唯一事实源
|
|
79
83
|
- `DefaultSessionComposer.ts` 负责 system/history/tools 与压缩计划定制
|
|
80
|
-
- `messages/` 放
|
|
84
|
+
- `messages/` 放 Assistant writer、Message codec 与 compaction;JSONL Store 位于 `workspace/store/`
|
|
81
85
|
- 完整设计见 [`docs/session-runtime-architecture.md`](../../docs/session-runtime-architecture.md)
|
|
82
86
|
|
|
83
87
|
- `src/executor/`
|
|
@@ -108,15 +112,18 @@ src/
|
|
|
108
112
|
`@downcity/agent` 的核心是一条单 Agent 执行链:
|
|
109
113
|
|
|
110
114
|
```text
|
|
111
|
-
入口协议 -> Agent facade ->
|
|
115
|
+
入口协议 -> Agent facade -> SessionLoop -> SessionComposer -> Executor -> SessionMessages
|
|
112
116
|
```
|
|
113
117
|
|
|
114
118
|
其中:
|
|
115
119
|
|
|
116
120
|
- `agent` 承载本地 Agent 核心运行时,`remote` 承载独立的远程 SDK 客户端
|
|
117
|
-
- `
|
|
118
|
-
- `Agent` facade
|
|
119
|
-
- `
|
|
121
|
+
- `workspace` 承载项目资源、初始化和持久化能力,`platform` 只处理系统级路径
|
|
122
|
+
- `Agent` facade 是实例级装配中心,持有 instruction、model、tools、plugins 与 sessions;env 由 Workspace 持有
|
|
123
|
+
- `PluginContext` 只在 Agent 内部向 Plugin 投影稳定能力,不向宿主暴露
|
|
120
124
|
- `session / executor / plugin` 是三大核心分层
|
|
121
125
|
- `SessionMessages` 是 Message 唯一事实源,Executor 不持有 Store
|
|
122
126
|
- `types / utils` 提供横向公共支撑
|
|
127
|
+
|
|
128
|
+
完整架构、执行链、持久化、Plugin、Shell 与跨平台设计见
|
|
129
|
+
[`docs/agent-sdk-architecture.md`](../../docs/agent-sdk-architecture.md)。
|
package/bin/agent/Agent.d.ts
CHANGED
|
@@ -8,20 +8,24 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import type { Tool } from "ai";
|
|
10
10
|
import type { AgentModel } from "../agent/AgentModel.js";
|
|
11
|
-
import { AgentContext } from "../agent/AgentContext.js";
|
|
12
11
|
import type { AgentOptions } from "../types/agent/AgentOptions.js";
|
|
13
12
|
import type { Shell } from "@downcity/shell";
|
|
13
|
+
import type { Workspace } from "../workspace/Workspace.js";
|
|
14
14
|
import { Logger } from "../utils/logger/Logger.js";
|
|
15
15
|
import { AgentSessions } from "../agent/AgentSessions.js";
|
|
16
16
|
import { PluginRegistry } from "../plugin/core/PluginRegistry.js";
|
|
17
|
+
import type { Hono } from "hono";
|
|
18
|
+
import type { PluginSnapshot } from "../types/plugin/PluginState.js";
|
|
19
|
+
import { type SystemProfile } from "../executor/composer/system/default/SystemDomain.js";
|
|
20
|
+
import type { SystemModelMessage } from "ai";
|
|
17
21
|
/**
|
|
18
22
|
* SDK 本地 Agent。
|
|
19
23
|
*/
|
|
20
24
|
export declare class Agent {
|
|
21
25
|
/** 当前 Agent 的稳定标识,用于区分 Session 存储目录与运行时归属。 */
|
|
22
26
|
readonly id: string;
|
|
23
|
-
/** 当前 Agent
|
|
24
|
-
readonly
|
|
27
|
+
/** 当前 Agent 引用的项目资源与安全边界。 */
|
|
28
|
+
readonly workspace: Workspace;
|
|
25
29
|
/** 当前 Agent 向所有 Session 提供的工具集合。 */
|
|
26
30
|
readonly tools: Record<string, Tool>;
|
|
27
31
|
/** 当前 Agent 已装配的 Plugin 调用与注册入口。 */
|
|
@@ -39,17 +43,19 @@ export declare class Agent {
|
|
|
39
43
|
/** 当前 Agent 独享的运行日志器。 */
|
|
40
44
|
private readonly logger;
|
|
41
45
|
/** 提供给 Plugin、Session 与宿主集成层共享的 Agent 执行上下文。 */
|
|
42
|
-
private readonly
|
|
43
|
-
/** 当前 Agent configured env 的可变共享对象。 */
|
|
44
|
-
private readonly env;
|
|
46
|
+
private readonly plugin_context;
|
|
45
47
|
/** 调用方提供的自定义 Session 类;省略时使用 SDK 默认实现。 */
|
|
46
|
-
private readonly
|
|
48
|
+
private readonly session_class;
|
|
47
49
|
/** 当前 Agent 的长期运行状态与生命周期。 */
|
|
48
50
|
private readonly state;
|
|
49
|
-
/** 当前 Agent 可选的内建 Shell 实例。 */
|
|
50
|
-
private readonly shell?;
|
|
51
51
|
/** 当前 Agent configured instruction 的可变有序集合。 */
|
|
52
52
|
private instruction;
|
|
53
|
+
/** 取消 Workspace env 变化订阅的函数。 */
|
|
54
|
+
private readonly unsubscribe_workspace_env;
|
|
55
|
+
/** 取消 PluginRegistry 变化订阅的函数。 */
|
|
56
|
+
private readonly unsubscribe_plugin_change;
|
|
57
|
+
/** 当前由 PluginRegistry 注册到 Agent 的 Tool 名称。 */
|
|
58
|
+
private readonly plugin_tool_names;
|
|
53
59
|
constructor(options: AgentOptions);
|
|
54
60
|
/**
|
|
55
61
|
* 等待 Agent 持有的长期运行时启动完成。
|
|
@@ -63,53 +69,37 @@ export declare class Agent {
|
|
|
63
69
|
* 释放当前 Agent 持有的长期运行时对象。
|
|
64
70
|
*
|
|
65
71
|
* 关键点(中文)
|
|
66
|
-
* - 关闭 plugin lifecycle
|
|
72
|
+
* - 关闭 plugin lifecycle 与 ActionSchedule 等 Agent 自有资源。
|
|
73
|
+
* - Workspace 与 Agent 一对一绑定,因此这里同时关闭 Shell 与 Sandbox。
|
|
67
74
|
* - 不负责任何 transport(RPC / HTTP);transport 由 `@downcity/server` 自行管理。
|
|
68
75
|
*/
|
|
69
76
|
dispose(): Promise<void>;
|
|
70
77
|
/**
|
|
71
78
|
* 更新当前 SDK Agent 的静态基础指令。
|
|
72
79
|
*/
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* 返回当前 agent env 的浅拷贝快照。
|
|
76
|
-
*
|
|
77
|
-
* 关键点(中文)
|
|
78
|
-
* - 返回的是拷贝,调用方修改它不会影响 agent 真实状态。
|
|
79
|
-
* - 想改 env 请使用 `setEnv` / `patchEnv`。
|
|
80
|
-
*/
|
|
81
|
-
getEnv(): Record<string, string>;
|
|
82
|
-
/**
|
|
83
|
-
* 整体覆盖 agent env。
|
|
84
|
-
*
|
|
85
|
-
* 关键点(中文)
|
|
86
|
-
* - 直接清空当前共享 env 对象,再写入新值,保证 plugin / runtime / shell 看到的是同一引用。
|
|
87
|
-
* - 仅写入字符串值,`null` / `undefined` 表示删除该 key。
|
|
88
|
-
*/
|
|
89
|
-
setEnv(next: Record<string, string | null | undefined>): void;
|
|
90
|
-
/**
|
|
91
|
-
* 增量合并 agent env。
|
|
92
|
-
*
|
|
93
|
-
* 关键点(中文)
|
|
94
|
-
* - `null` / `undefined` 表示删除该 key;其他值会强制转字符串后写入。
|
|
95
|
-
* - configured env 原地更新;已有 Session 在下一 step 检查点提交 effective env。
|
|
96
|
-
*/
|
|
97
|
-
patchEnv(patch: Record<string, string | null | undefined>): void;
|
|
98
|
-
/**
|
|
99
|
-
* 原地应用一次 env patch,不触发重复广播。
|
|
100
|
-
*/
|
|
101
|
-
private apply_env_patch;
|
|
80
|
+
set_instruction(input: string | string[]): void;
|
|
102
81
|
/**
|
|
103
82
|
* 返回当前 agent 绑定的统一日志器。
|
|
104
83
|
*/
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* 返回当前 agent context。
|
|
108
|
-
*/
|
|
109
|
-
getContext(): AgentContext;
|
|
84
|
+
get_logger(): Logger;
|
|
110
85
|
/**
|
|
111
86
|
* 返回当前 agent 挂载的 Shell。
|
|
112
87
|
*/
|
|
113
|
-
|
|
88
|
+
get_shell(): Shell | undefined;
|
|
89
|
+
/** 返回当前 Agent 已配置的静态指令快照。 */
|
|
90
|
+
get_instructions(): readonly string[];
|
|
91
|
+
/** 列出当前 Agent 已注册的 Plugin 状态。 */
|
|
92
|
+
list_plugin_states(): PluginSnapshot[];
|
|
93
|
+
/** 把当前 Agent 已注册 Plugin 的 HTTP 路由装配到宿主应用。 */
|
|
94
|
+
register_plugin_http_routes(app: Hono): void;
|
|
95
|
+
/** 解析指定 Session 当前可见的完整 system messages。 */
|
|
96
|
+
resolve_system_messages(input: {
|
|
97
|
+
/** 需要解析 system 的 Session 标识。 */
|
|
98
|
+
session_id: string;
|
|
99
|
+
/** system 组合档位;省略时使用 chat。 */
|
|
100
|
+
profile?: SystemProfile;
|
|
101
|
+
}): Promise<SystemModelMessage[]>;
|
|
102
|
+
/** 将 PluginRegistry 当前 Tool Set 同步到 Agent 持有的工具集合。 */
|
|
103
|
+
private sync_plugin_tools;
|
|
114
104
|
}
|
|
115
105
|
//# sourceMappingURL=Agent.d.ts.map
|
package/bin/agent/Agent.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Agent.d.ts","sourceRoot":"","sources":["../../src/agent/Agent.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAC/B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"Agent.d.ts","sourceRoot":"","sources":["../../src/agent/Agent.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAC/B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAGxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAElD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAGzD,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAGjE,OAAO,KAAK,EAAE,IAAI,EAAE,M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AAI,CAAC;IAc9B;;OAEG;IACH,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI;IAK/C;;OAEG;IACH,UAAU,IAAI,MAAM;IAIpB;;OAEG;IACH,SAAS,IAAI,KAAK,GAAG,SAAS;IAI9B,6BAA6B;IAC7B,gBAAgB,IAAI,SAAS,MAAM,EAAE;IAIrC,iCAAiC;IACjC,kBAAkB,IAAI,cAAc,EAAE;IAItC,6CAA6C;IAC7C,2BAA2B,CAAC,GAAG,EAAE,IAAI,GAAG,IAAI;IAU5C,4CAA4C;IACtC,uBAAuB,CAAC,KAAK,EAAE;QACnC,gCAAgC;QAChC,UAAU,EAAE,MAAM,CAAC;QACnB,8BAA8B;QAC9B,OAAO,CAAC,EAAE,aAAa,CAAC;KACzB,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC;IAUjC,sDAAsD;IACtD,OAAO,CAAC,iBAAiB;CAW1B"}
|
package/bin/agent/Agent.js
CHANGED
|
@@ -6,22 +6,34 @@
|
|
|
6
6
|
* - Agent 直接持有自身状态与长期运行时对象,避免额外 Assembly 复制同一批字段。
|
|
7
7
|
* - Session 集合由 `AgentSessions` 管理;长期运行状态由 `AgentState` 管理。
|
|
8
8
|
*/
|
|
9
|
-
import {
|
|
9
|
+
import { create_plugin_context } from "../plugin/core/PluginContext.js";
|
|
10
10
|
import { Logger } from "../utils/logger/Logger.js";
|
|
11
|
-
import {
|
|
12
|
-
import { normalizeInstructionInput } from "../agent/AgentInstructions.js";
|
|
11
|
+
import { normalize_instruction_input } from "../agent/AgentInstructions.js";
|
|
13
12
|
import { AgentSessions } from "../agent/AgentSessions.js";
|
|
14
13
|
import { AgentState } from "../agent/AgentState.js";
|
|
15
|
-
import {
|
|
14
|
+
import { generate_id } from "../utils/Id.js";
|
|
16
15
|
import { PluginRegistry } from "../plugin/core/PluginRegistry.js";
|
|
16
|
+
import { list_plugin_states } from "../plugin/core/PluginStateController.js";
|
|
17
|
+
import { register_plugin_http_routes } from "../plugin/core/PluginHttpRoutes.js";
|
|
18
|
+
import { resolve_session_system_messages, } from "../executor/composer/system/default/SystemDomain.js";
|
|
19
|
+
const RESERVED_PLUGIN_TOOL_NAMES = new Set(["plugin_read", "plugin_call"]);
|
|
20
|
+
/** 将一个来源明确的 Tool Set 注册到 Agent,并拒绝静默覆盖。 */
|
|
21
|
+
function register_agent_tools(target, source, source_name) {
|
|
22
|
+
for (const [tool_name, tool_definition] of Object.entries(source)) {
|
|
23
|
+
if (Object.prototype.hasOwnProperty.call(target, tool_name)) {
|
|
24
|
+
throw new Error(`Agent tool name conflict: "${tool_name}" from ${source_name}`);
|
|
25
|
+
}
|
|
26
|
+
target[tool_name] = tool_definition;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
17
29
|
/**
|
|
18
30
|
* SDK 本地 Agent。
|
|
19
31
|
*/
|
|
20
32
|
export class Agent {
|
|
21
33
|
/** 当前 Agent 的稳定标识,用于区分 Session 存储目录与运行时归属。 */
|
|
22
34
|
id;
|
|
23
|
-
/** 当前 Agent
|
|
24
|
-
|
|
35
|
+
/** 当前 Agent 引用的项目资源与安全边界。 */
|
|
36
|
+
workspace;
|
|
25
37
|
/** 当前 Agent 向所有 Session 提供的工具集合。 */
|
|
26
38
|
tools;
|
|
27
39
|
/** 当前 Agent 已装配的 Plugin 调用与注册入口。 */
|
|
@@ -39,75 +51,92 @@ export class Agent {
|
|
|
39
51
|
/** 当前 Agent 独享的运行日志器。 */
|
|
40
52
|
logger;
|
|
41
53
|
/** 提供给 Plugin、Session 与宿主集成层共享的 Agent 执行上下文。 */
|
|
42
|
-
|
|
43
|
-
/** 当前 Agent configured env 的可变共享对象。 */
|
|
44
|
-
env;
|
|
54
|
+
plugin_context;
|
|
45
55
|
/** 调用方提供的自定义 Session 类;省略时使用 SDK 默认实现。 */
|
|
46
|
-
|
|
56
|
+
session_class;
|
|
47
57
|
/** 当前 Agent 的长期运行状态与生命周期。 */
|
|
48
58
|
state;
|
|
49
|
-
/** 当前 Agent 可选的内建 Shell 实例。 */
|
|
50
|
-
shell;
|
|
51
59
|
/** 当前 Agent configured instruction 的可变有序集合。 */
|
|
52
60
|
instruction;
|
|
61
|
+
/** 取消 Workspace env 变化订阅的函数。 */
|
|
62
|
+
unsubscribe_workspace_env;
|
|
63
|
+
/** 取消 PluginRegistry 变化订阅的函数。 */
|
|
64
|
+
unsubscribe_plugin_change;
|
|
65
|
+
/** 当前由 PluginRegistry 注册到 Agent 的 Tool 名称。 */
|
|
66
|
+
plugin_tool_names = new Set();
|
|
53
67
|
constructor(options) {
|
|
54
68
|
this.id = String(options.id || "").trim();
|
|
55
|
-
this.path = String(options.path || "").trim();
|
|
56
69
|
if (!this.id)
|
|
57
70
|
throw new Error("Agent requires a non-empty id");
|
|
58
|
-
if (!
|
|
59
|
-
throw new Error("Agent requires a
|
|
60
|
-
this.
|
|
71
|
+
if (!options.workspace)
|
|
72
|
+
throw new Error("Agent requires a Workspace");
|
|
73
|
+
this.workspace = options.workspace;
|
|
74
|
+
this.session_class = options.session_class;
|
|
61
75
|
this.model = options.model;
|
|
62
|
-
this.tools = options.tools && typeof options.tools === "object"
|
|
63
|
-
? { ...options.tools }
|
|
64
|
-
: {};
|
|
65
|
-
this.logger = new Logger();
|
|
66
|
-
this.logger.bindProjectRoot(this.path);
|
|
67
|
-
this.env = resolve_agent_env(this.path, options.env);
|
|
68
|
-
this.instruction = normalizeInstructionInput(options.instruction);
|
|
69
|
-
this.shell = options.shell;
|
|
70
76
|
this.plugins = new PluginRegistry(options.plugins || []);
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
logger: this.logger,
|
|
77
|
-
});
|
|
78
|
-
Object.assign(this.tools, this.shell.tools);
|
|
77
|
+
this.tools = {};
|
|
78
|
+
for (const tool_name of Object.keys(this.workspace.tools)) {
|
|
79
|
+
if (RESERVED_PLUGIN_TOOL_NAMES.has(tool_name)) {
|
|
80
|
+
throw new Error(`Agent tool name conflict: "${tool_name}" is reserved for PluginRegistry`);
|
|
81
|
+
}
|
|
79
82
|
}
|
|
83
|
+
register_agent_tools(this.tools, this.workspace.tools, "WorkspaceTools");
|
|
84
|
+
this.sync_plugin_tools();
|
|
85
|
+
const custom_tools = options.tools && typeof options.tools === "object"
|
|
86
|
+
? options.tools
|
|
87
|
+
: {};
|
|
88
|
+
for (const tool_name of Object.keys(custom_tools)) {
|
|
89
|
+
if (RESERVED_PLUGIN_TOOL_NAMES.has(tool_name)) {
|
|
90
|
+
throw new Error(`Agent tool name conflict: "${tool_name}" is reserved for PluginRegistry`);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
register_agent_tools(this.tools, custom_tools, "AgentOptions.tools");
|
|
94
|
+
this.logger = new Logger();
|
|
95
|
+
this.logger.bind_workspace(this.workspace.files);
|
|
96
|
+
this.instruction = normalize_instruction_input(options.instruction);
|
|
97
|
+
const store = this.workspace.bind_agent(this.id);
|
|
80
98
|
this.sessions = new AgentSessions({
|
|
81
99
|
agent_id: this.id,
|
|
82
|
-
|
|
100
|
+
workspace_path: this.workspace.path,
|
|
101
|
+
store,
|
|
83
102
|
tools: this.tools,
|
|
84
103
|
logger: this.logger,
|
|
85
104
|
get_instruction: () => this.instruction,
|
|
86
|
-
|
|
105
|
+
get_workspace_env: () => this.workspace.get_env(),
|
|
87
106
|
get_agent_plugins: () => this.plugins.execution_view(),
|
|
88
107
|
ensure_agent_ready: async () => {
|
|
89
108
|
await this.ready();
|
|
90
109
|
},
|
|
91
110
|
get_agent_model: () => this.model,
|
|
92
|
-
|
|
111
|
+
session_class: this.session_class,
|
|
93
112
|
});
|
|
94
|
-
this.
|
|
95
|
-
...(this.shell ? { shell: this.shell } : {}),
|
|
113
|
+
this.plugin_context = create_plugin_context({
|
|
114
|
+
...(this.workspace.shell ? { shell: this.workspace.shell } : {}),
|
|
96
115
|
agent_id: this.id,
|
|
97
|
-
|
|
116
|
+
workspace_path: this.workspace.path,
|
|
117
|
+
files: this.workspace.files,
|
|
98
118
|
logger: this.logger,
|
|
99
|
-
|
|
100
|
-
|
|
119
|
+
get_workspace_env: () => this.workspace.get_env(),
|
|
120
|
+
get_instructions: () => this.instruction,
|
|
101
121
|
sessions: this.sessions,
|
|
102
122
|
plugins: this.plugins,
|
|
103
123
|
});
|
|
124
|
+
this.unsubscribe_workspace_env = this.workspace.subscribe_env((env) => {
|
|
125
|
+
this.sessions.broadcast_env({ ...env }, generate_id());
|
|
126
|
+
});
|
|
127
|
+
this.unsubscribe_plugin_change = this.plugins.subscribe_change((change) => {
|
|
128
|
+
this.sync_plugin_tools();
|
|
129
|
+
const verb = change.type === "register" ? "registered" : "unregistered";
|
|
130
|
+
this.sessions.broadcast_plugins({
|
|
131
|
+
command_id: generate_id(),
|
|
132
|
+
title: `Agent plugin ${change.plugin_name} ${verb}`,
|
|
133
|
+
plugins: this.plugins.execution_view(),
|
|
134
|
+
});
|
|
135
|
+
});
|
|
104
136
|
// 关键点(中文):装配完成后创建唯一状态对象,并立即启动长期运行时。
|
|
105
137
|
this.state = new AgentState({
|
|
106
|
-
context: this.
|
|
138
|
+
context: this.plugin_context,
|
|
107
139
|
plugins: this.plugins,
|
|
108
|
-
sessions: this.sessions,
|
|
109
|
-
tools: this.tools,
|
|
110
|
-
shell: this.shell,
|
|
111
140
|
});
|
|
112
141
|
}
|
|
113
142
|
/**
|
|
@@ -124,88 +153,83 @@ export class Agent {
|
|
|
124
153
|
* 释放当前 Agent 持有的长期运行时对象。
|
|
125
154
|
*
|
|
126
155
|
* 关键点(中文)
|
|
127
|
-
* - 关闭 plugin lifecycle
|
|
156
|
+
* - 关闭 plugin lifecycle 与 ActionSchedule 等 Agent 自有资源。
|
|
157
|
+
* - Workspace 与 Agent 一对一绑定,因此这里同时关闭 Shell 与 Sandbox。
|
|
128
158
|
* - 不负责任何 transport(RPC / HTTP);transport 由 `@downcity/server` 自行管理。
|
|
129
159
|
*/
|
|
130
160
|
async dispose() {
|
|
131
|
-
|
|
161
|
+
this.unsubscribe_workspace_env();
|
|
162
|
+
this.unsubscribe_plugin_change();
|
|
163
|
+
try {
|
|
164
|
+
await this.state.dispose();
|
|
165
|
+
}
|
|
166
|
+
finally {
|
|
167
|
+
try {
|
|
168
|
+
await this.logger.save_all_logs();
|
|
169
|
+
}
|
|
170
|
+
finally {
|
|
171
|
+
await this.workspace.dispose();
|
|
172
|
+
}
|
|
173
|
+
}
|
|
132
174
|
}
|
|
133
175
|
/**
|
|
134
176
|
* 更新当前 SDK Agent 的静态基础指令。
|
|
135
177
|
*/
|
|
136
|
-
|
|
137
|
-
const next_instruction =
|
|
178
|
+
set_instruction(input) {
|
|
179
|
+
const next_instruction = normalize_instruction_input(input);
|
|
138
180
|
this.instruction.splice(0, this.instruction.length, ...next_instruction);
|
|
139
181
|
}
|
|
140
182
|
/**
|
|
141
|
-
* 返回当前 agent
|
|
142
|
-
*
|
|
143
|
-
* 关键点(中文)
|
|
144
|
-
* - 返回的是拷贝,调用方修改它不会影响 agent 真实状态。
|
|
145
|
-
* - 想改 env 请使用 `setEnv` / `patchEnv`。
|
|
183
|
+
* 返回当前 agent 绑定的统一日志器。
|
|
146
184
|
*/
|
|
147
|
-
|
|
148
|
-
return
|
|
185
|
+
get_logger() {
|
|
186
|
+
return this.logger;
|
|
149
187
|
}
|
|
150
188
|
/**
|
|
151
|
-
*
|
|
152
|
-
*
|
|
153
|
-
* 关键点(中文)
|
|
154
|
-
* - 直接清空当前共享 env 对象,再写入新值,保证 plugin / runtime / shell 看到的是同一引用。
|
|
155
|
-
* - 仅写入字符串值,`null` / `undefined` 表示删除该 key。
|
|
189
|
+
* 返回当前 agent 挂载的 Shell。
|
|
156
190
|
*/
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
delete this.env[key];
|
|
160
|
-
}
|
|
161
|
-
this.apply_env_patch(next);
|
|
162
|
-
this.sessions.broadcast_env(this.env, generateId());
|
|
191
|
+
get_shell() {
|
|
192
|
+
return this.workspace.shell;
|
|
163
193
|
}
|
|
164
|
-
/**
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
* 关键点(中文)
|
|
168
|
-
* - `null` / `undefined` 表示删除该 key;其他值会强制转字符串后写入。
|
|
169
|
-
* - configured env 原地更新;已有 Session 在下一 step 检查点提交 effective env。
|
|
170
|
-
*/
|
|
171
|
-
patchEnv(patch) {
|
|
172
|
-
this.apply_env_patch(patch);
|
|
173
|
-
this.sessions.broadcast_env(this.env, generateId());
|
|
194
|
+
/** 返回当前 Agent 已配置的静态指令快照。 */
|
|
195
|
+
get_instructions() {
|
|
196
|
+
return [...this.instruction];
|
|
174
197
|
}
|
|
175
|
-
/**
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
apply_env_patch(patch) {
|
|
179
|
-
if (!patch || typeof patch !== "object")
|
|
180
|
-
return;
|
|
181
|
-
for (const [raw_key, raw_value] of Object.entries(patch)) {
|
|
182
|
-
const key = String(raw_key || "").trim();
|
|
183
|
-
if (!key)
|
|
184
|
-
continue;
|
|
185
|
-
if (raw_value === null || raw_value === undefined) {
|
|
186
|
-
delete this.env[key];
|
|
187
|
-
continue;
|
|
188
|
-
}
|
|
189
|
-
this.env[key] = String(raw_value);
|
|
190
|
-
}
|
|
198
|
+
/** 列出当前 Agent 已注册的 Plugin 状态。 */
|
|
199
|
+
list_plugin_states() {
|
|
200
|
+
return list_plugin_states({ context: this.plugin_context });
|
|
191
201
|
}
|
|
192
|
-
/**
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
202
|
+
/** 把当前 Agent 已注册 Plugin 的 HTTP 路由装配到宿主应用。 */
|
|
203
|
+
register_plugin_http_routes(app) {
|
|
204
|
+
register_plugin_http_routes({
|
|
205
|
+
app,
|
|
206
|
+
get_context: () => this.plugin_context,
|
|
207
|
+
plugins: this.plugins.snapshots()
|
|
208
|
+
.map((snapshot) => this.plugins.get(snapshot.name))
|
|
209
|
+
.filter((plugin) => plugin !== null),
|
|
210
|
+
});
|
|
197
211
|
}
|
|
198
|
-
/**
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
212
|
+
/** 解析指定 Session 当前可见的完整 system messages。 */
|
|
213
|
+
async resolve_system_messages(input) {
|
|
214
|
+
return await resolve_session_system_messages({
|
|
215
|
+
project_root: this.workspace.path,
|
|
216
|
+
session_id: input.session_id,
|
|
217
|
+
profile: input.profile || "chat",
|
|
218
|
+
static_system_prompts: [...this.instruction],
|
|
219
|
+
context: this.plugin_context,
|
|
220
|
+
});
|
|
203
221
|
}
|
|
204
|
-
/**
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
222
|
+
/** 将 PluginRegistry 当前 Tool Set 同步到 Agent 持有的工具集合。 */
|
|
223
|
+
sync_plugin_tools() {
|
|
224
|
+
for (const tool_name of this.plugin_tool_names) {
|
|
225
|
+
delete this.tools[tool_name];
|
|
226
|
+
}
|
|
227
|
+
this.plugin_tool_names.clear();
|
|
228
|
+
const plugin_tools = this.plugins.tools();
|
|
229
|
+
register_agent_tools(this.tools, plugin_tools, "PluginRegistry");
|
|
230
|
+
for (const tool_name of Object.keys(plugin_tools)) {
|
|
231
|
+
this.plugin_tool_names.add(tool_name);
|
|
232
|
+
}
|
|
209
233
|
}
|
|
210
234
|
}
|
|
211
235
|
//# sourceMappingURL=Agent.js.map
|
package/bin/agent/Agent.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Agent.js","sourceRoot":"","sources":["../../src/agent/Agent.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"Agent.js","sourceRoot":"","sources":["../../src/agent/Agent.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAKvE,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,2BAA2B,EAAE,MAAM,8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AE,CAAC;QAC1C,oBAAoB,CAAC,IAAI,CAAC,KAAK,EAAE,YAAY,EAAE,gBAAgB,CAAC,CAAC;QACjE,KAAK,MAAM,SAAS,IAAI,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC;YAClD,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QACxC,CAAC;IACH,CAAC;CACF"}
|
|
@@ -10,9 +10,9 @@ import type { AgentSessionSystemBlock } from "../types/agent/SessionTypes.js";
|
|
|
10
10
|
/**
|
|
11
11
|
* 归一化调用方传入的静态 instruction。
|
|
12
12
|
*/
|
|
13
|
-
export declare function
|
|
13
|
+
export declare function normalize_instruction_input(input: string | string[] | undefined): string[];
|
|
14
14
|
/**
|
|
15
15
|
* 构造进入 session system prompt 的 instruction block。
|
|
16
16
|
*/
|
|
17
|
-
export declare function
|
|
17
|
+
export declare function create_instruction_system_blocks(instruction: string[], project_root: string): AgentSessionSystemBlock[];
|
|
18
18
|
//# sourceMappingURL=AgentInstructions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentInstructions.d.ts","sourceRoot":"","sources":["../../src/agent/AgentInstructions.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AAG7E;;GAEG;AACH,wBAAgB,
|
|
1
|
+
{"version":3,"file":"AgentInstructions.d.ts","sourceRoot":"","sources":["../../src/agent/AgentInstructions.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AAG7E;;GAEG;AACH,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,GACnC,MAAM,EAAE,CASV;AAUD;;GAEG;AACH,wBAAgB,gCAAgC,CAC9C,WAAW,EAAE,MAAM,EAAE,EACrB,YAAY,EAAE,MAAM,GACnB,uBAAuB,EAAE,CAc3B"}
|
|
@@ -10,7 +10,7 @@ import { DEFAULT_SHIP_PROMPTS } from "../executor/composer/system/default/System
|
|
|
10
10
|
/**
|
|
11
11
|
* 归一化调用方传入的静态 instruction。
|
|
12
12
|
*/
|
|
13
|
-
export function
|
|
13
|
+
export function normalize_instruction_input(input) {
|
|
14
14
|
const items = Array.isArray(input)
|
|
15
15
|
? input
|
|
16
16
|
: typeof input === "string"
|
|
@@ -30,7 +30,7 @@ function createCoreInstructionContent(project_root) {
|
|
|
30
30
|
/**
|
|
31
31
|
* 构造进入 session system prompt 的 instruction block。
|
|
32
32
|
*/
|
|
33
|
-
export function
|
|
33
|
+
export function create_instruction_system_blocks(instruction, project_root) {
|
|
34
34
|
const instruction_blocks = instruction.map((content, index) => ({
|
|
35
35
|
source: "instruction",
|
|
36
36
|
name: instruction.length === 1 ? "agent" : `agent:${index + 1}`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentInstructions.js","sourceRoot":"","sources":["../../src/agent/AgentInstructions.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,oBAAoB,EAAE,MAAM,mDAAmD,CAAC;AAEzF;;GAEG;AACH,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"AgentInstructions.js","sourceRoot":"","sources":["../../src/agent/AgentInstructions.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,oBAAoB,EAAE,MAAM,mDAAmD,CAAC;AAEzF;;GAEG;AACH,MAAM,UAAU,2BAA2B,CACzC,KAAoC;IAEpC,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAChC,CAAC,CAAC,KAAK;QACP,CAAC,CAAC,OAAO,KAAK,KAAK,QAAQ;YACzB,CAAC,CAAC,CAAC,KAAK,CAAC;YACT,CAAC,CAAC,EAAE,CAAC;IACT,OAAO,KAAK;SACT,GAAG,CAAC,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