@downcity/agent 1.1.337 → 1.1.399
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 +31 -15
- package/bin/agent/Agent.d.ts +42 -91
- package/bin/agent/Agent.d.ts.map +1 -1
- package/bin/agent/Agent.js +115 -200
- package/bin/agent/Agent.js.map +1 -1
- package/bin/agent/AgentModel.d.ts +8 -8
- package/bin/agent/AgentModel.d.ts.map +1 -1
- package/bin/agent/AgentModel.js +5 -5
- package/bin/agent/AgentModel.js.map +1 -1
- package/bin/agent/AgentSessions.d.ts +42 -28
- package/bin/agent/AgentSessions.d.ts.map +1 -1
- package/bin/agent/AgentSessions.js +80 -44
- package/bin/agent/AgentSessions.js.map +1 -1
- package/bin/agent/WorkspaceEntry.d.ts +82 -0
- package/bin/agent/WorkspaceEntry.d.ts.map +1 -0
- package/bin/agent/WorkspaceEntry.js +246 -0
- package/bin/agent/WorkspaceEntry.js.map +1 -0
- package/bin/agent/index.d.ts +5 -0
- package/bin/agent/index.d.ts.map +1 -0
- package/bin/agent/index.js +5 -0
- package/bin/agent/index.js.map +1 -0
- package/bin/city/host/CityHostRegistry.d.ts +44 -0
- package/bin/city/host/CityHostRegistry.d.ts.map +1 -0
- package/bin/city/host/CityHostRegistry.js +225 -0
- package/bin/city/host/CityHostRegistry.js.map +1 -0
- package/bin/city/index.d.ts +22 -0
- package/bin/city/index.d.ts.map +1 -0
- package/bin/city/index.js +10 -0
- package/bin/city/index.js.map +1 -0
- package/bin/city/runtime/City.d.ts +99 -0
- package/bin/city/runtime/City.d.ts.map +1 -0
- package/bin/city/runtime/City.js +376 -0
- package/bin/city/runtime/City.js.map +1 -0
- package/bin/city/transport/SerializedTransport.d.ts +30 -0
- package/bin/city/transport/SerializedTransport.d.ts.map +1 -0
- package/bin/city/transport/SerializedTransport.js +57 -0
- package/bin/city/transport/SerializedTransport.js.map +1 -0
- package/bin/city/transport/http/AgentHTTP.d.ts +66 -0
- package/bin/city/transport/http/AgentHTTP.d.ts.map +1 -0
- package/bin/city/transport/http/AgentHTTP.js +142 -0
- package/bin/city/transport/http/AgentHTTP.js.map +1 -0
- package/bin/city/transport/http/CityHTTP.d.ts +44 -0
- package/bin/city/transport/http/CityHTTP.d.ts.map +1 -0
- package/bin/city/transport/http/CityHTTP.js +171 -0
- package/bin/city/transport/http/CityHTTP.js.map +1 -0
- package/bin/city/transport/http/NodeHttpAdapter.d.ts +27 -0
- package/bin/city/transport/http/NodeHttpAdapter.d.ts.map +1 -0
- package/bin/city/transport/http/NodeHttpAdapter.js +57 -0
- package/bin/city/transport/http/NodeHttpAdapter.js.map +1 -0
- package/bin/city/transport/http/routes/RuntimeRoutes.d.ts +15 -0
- package/bin/city/transport/http/routes/RuntimeRoutes.d.ts.map +1 -0
- package/bin/city/transport/http/routes/RuntimeRoutes.js +38 -0
- package/bin/city/transport/http/routes/RuntimeRoutes.js.map +1 -0
- package/bin/city/transport/http/routes/SessionRoutes.d.ts +17 -0
- package/bin/city/transport/http/routes/SessionRoutes.d.ts.map +1 -0
- package/bin/city/transport/http/routes/SessionRoutes.js +417 -0
- package/bin/city/transport/http/routes/SessionRoutes.js.map +1 -0
- package/bin/city/transport/rpc/AgentRPC.d.ts +47 -0
- package/bin/city/transport/rpc/AgentRPC.d.ts.map +1 -0
- package/bin/city/transport/rpc/AgentRPC.js +89 -0
- package/bin/city/transport/rpc/AgentRPC.js.map +1 -0
- package/bin/city/transport/rpc/CityRPC.d.ts +26 -0
- package/bin/city/transport/rpc/CityRPC.d.ts.map +1 -0
- package/bin/city/transport/rpc/CityRPC.js +110 -0
- package/bin/city/transport/rpc/CityRPC.js.map +1 -0
- package/bin/city/transport/rpc/RpcServer.d.ts +30 -0
- package/bin/city/transport/rpc/RpcServer.d.ts.map +1 -0
- package/bin/city/transport/rpc/RpcServer.js +125 -0
- package/bin/city/transport/rpc/RpcServer.js.map +1 -0
- package/bin/city/transport/rpc/server/InternalHandlers.d.ts +22 -0
- package/bin/city/transport/rpc/server/InternalHandlers.d.ts.map +1 -0
- package/bin/city/transport/rpc/server/InternalHandlers.js +196 -0
- package/bin/city/transport/rpc/server/InternalHandlers.js.map +1 -0
- package/bin/city/transport/rpc/server/RequestDispatcher.d.ts +27 -0
- package/bin/city/transport/rpc/server/RequestDispatcher.d.ts.map +1 -0
- package/bin/city/transport/rpc/server/RequestDispatcher.js +38 -0
- package/bin/city/transport/rpc/server/RequestDispatcher.js.map +1 -0
- package/bin/city/transport/rpc/server/SdkSessionHandlers.d.ts +25 -0
- package/bin/city/transport/rpc/server/SdkSessionHandlers.d.ts.map +1 -0
- package/bin/city/transport/rpc/server/SdkSessionHandlers.js +146 -0
- package/bin/city/transport/rpc/server/SdkSessionHandlers.js.map +1 -0
- package/bin/city/transport/rpc/server/ServerTypes.d.ts +94 -0
- package/bin/city/transport/rpc/server/ServerTypes.d.ts.map +1 -0
- package/bin/city/transport/rpc/server/ServerTypes.js +9 -0
- package/bin/city/transport/rpc/server/ServerTypes.js.map +1 -0
- package/bin/city/transport/session/RemoteSessionConfig.d.ts +15 -0
- package/bin/city/transport/session/RemoteSessionConfig.d.ts.map +1 -0
- package/bin/city/transport/session/RemoteSessionConfig.js +23 -0
- package/bin/city/transport/session/RemoteSessionConfig.js.map +1 -0
- package/bin/city/transport/types/AgentHttpBinding.d.ts +24 -0
- package/bin/city/transport/types/AgentHttpBinding.d.ts.map +1 -0
- package/bin/city/transport/types/AgentHttpBinding.js +5 -0
- package/bin/city/transport/types/AgentHttpBinding.js.map +1 -0
- package/bin/city/transport/types/AgentHttpRuntime.d.ts +12 -0
- package/bin/city/transport/types/AgentHttpRuntime.d.ts.map +1 -0
- package/bin/city/transport/types/AgentHttpRuntime.js +7 -0
- package/bin/city/transport/types/AgentHttpRuntime.js.map +1 -0
- package/bin/city/transport/types/AgentRpcBinding.d.ts +27 -0
- package/bin/city/transport/types/AgentRpcBinding.d.ts.map +1 -0
- package/bin/city/transport/types/AgentRpcBinding.js +8 -0
- package/bin/city/transport/types/AgentRpcBinding.js.map +1 -0
- package/bin/city/transport/types/AgentRpcRuntime.d.ts +18 -0
- package/bin/city/transport/types/AgentRpcRuntime.d.ts.map +1 -0
- package/bin/city/transport/types/AgentRpcRuntime.js +7 -0
- package/bin/city/transport/types/AgentRpcRuntime.js.map +1 -0
- package/bin/city/transport/types/AgentSessionModelResolver.d.ts +11 -0
- package/bin/city/transport/types/AgentSessionModelResolver.d.ts.map +1 -0
- package/bin/city/transport/types/AgentSessionModelResolver.js +7 -0
- package/bin/city/transport/types/AgentSessionModelResolver.js.map +1 -0
- package/bin/city/transport/types/CityHttpRuntime.d.ts +36 -0
- package/bin/city/transport/types/CityHttpRuntime.d.ts.map +1 -0
- package/bin/city/transport/types/CityHttpRuntime.js +8 -0
- package/bin/city/transport/types/CityHttpRuntime.js.map +1 -0
- package/bin/city/transport/types/CityRpcRuntime.d.ts +17 -0
- package/bin/city/transport/types/CityRpcRuntime.d.ts.map +1 -0
- package/bin/city/transport/types/CityRpcRuntime.js +8 -0
- package/bin/city/transport/types/CityRpcRuntime.js.map +1 -0
- package/bin/city/transport/types/RpcProtocol.d.ts +24 -0
- package/bin/city/transport/types/RpcProtocol.d.ts.map +1 -0
- package/bin/city/transport/types/RpcProtocol.js +9 -0
- package/bin/city/transport/types/RpcProtocol.js.map +1 -0
- package/bin/city/types/City.d.ts +84 -0
- package/bin/city/types/City.d.ts.map +1 -0
- package/bin/city/types/City.js +7 -0
- package/bin/city/types/City.js.map +1 -0
- package/bin/city/types/PluginHostContext.d.ts +31 -0
- package/bin/city/types/PluginHostContext.d.ts.map +1 -0
- package/bin/city/types/PluginHostContext.js +11 -0
- package/bin/city/types/PluginHostContext.js.map +1 -0
- package/bin/city/types/SerializedTransport.d.ts +16 -0
- package/bin/city/types/SerializedTransport.d.ts.map +1 -0
- package/bin/city/types/SerializedTransport.js +3 -0
- package/bin/city/types/SerializedTransport.js.map +1 -0
- package/bin/executor/Executor.d.ts +4 -4
- package/bin/executor/Executor.d.ts.map +1 -1
- package/bin/executor/Executor.js +90 -34
- 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 +3 -3
- package/bin/executor/composer/system/default/DefaultSessionSystemComposer.js +1 -1
- package/bin/executor/composer/system/default/PromptRenderer.d.ts +3 -3
- package/bin/executor/composer/system/default/PromptRenderer.d.ts.map +1 -1
- package/bin/executor/composer/system/default/PromptRenderer.js +1 -1
- package/bin/executor/composer/system/default/SystemDomain.d.ts +3 -3
- package/bin/executor/composer/system/default/SystemDomain.d.ts.map +1 -1
- package/bin/executor/composer/system/default/SystemDomain.js +3 -3
- package/bin/executor/composer/system/default/SystemDomain.js.map +1 -1
- package/bin/executor/composer/system/default/SystemPromptAssets.js +2 -2
- 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/VariableReplacer.js +1 -1
- package/bin/executor/core-engine/CoreEngineContextCompaction.d.ts +6 -23
- package/bin/executor/core-engine/CoreEngineContextCompaction.d.ts.map +1 -1
- package/bin/executor/core-engine/CoreEngineContextCompaction.js +112 -344
- package/bin/executor/core-engine/CoreEngineContextCompaction.js.map +1 -1
- package/bin/executor/core-engine/CoreEngineError.d.ts +1 -1
- package/bin/executor/core-engine/CoreEngineError.js +1 -1
- package/bin/executor/core-engine/CoreEngineLoopDecision.d.ts +2 -3
- package/bin/executor/core-engine/CoreEngineLoopDecision.d.ts.map +1 -1
- package/bin/executor/core-engine/CoreEngineLoopDecision.js +1 -15
- package/bin/executor/core-engine/CoreEngineLoopDecision.js.map +1 -1
- package/bin/executor/core-engine/CoreEngineMessageState.d.ts +16 -39
- package/bin/executor/core-engine/CoreEngineMessageState.d.ts.map +1 -1
- package/bin/executor/core-engine/CoreEngineMessageState.js +25 -60
- package/bin/executor/core-engine/CoreEngineMessageState.js.map +1 -1
- package/bin/executor/core-engine/CoreEngineRunner.d.ts +10 -6
- package/bin/executor/core-engine/CoreEngineRunner.d.ts.map +1 -1
- package/bin/executor/core-engine/CoreEngineRunner.js +146 -234
- package/bin/executor/core-engine/CoreEngineRunner.js.map +1 -1
- package/bin/executor/core-engine/CoreEngineSignals.d.ts +20 -58
- package/bin/executor/core-engine/CoreEngineSignals.d.ts.map +1 -1
- package/bin/executor/core-engine/CoreEngineSignals.js +84 -304
- package/bin/executor/core-engine/CoreEngineSignals.js.map +1 -1
- package/bin/executor/messages/SessionAttachmentMapper.d.ts +6 -37
- package/bin/executor/messages/SessionAttachmentMapper.d.ts.map +1 -1
- package/bin/executor/messages/SessionAttachmentMapper.js +12 -243
- package/bin/executor/messages/SessionAttachmentMapper.js.map +1 -1
- package/bin/executor/messages/SessionMessageLog.d.ts +7 -14
- package/bin/executor/messages/SessionMessageLog.d.ts.map +1 -1
- package/bin/executor/messages/SessionMessageLog.js +11 -26
- package/bin/executor/messages/SessionMessageLog.js.map +1 -1
- package/bin/executor/messages/SessionModelMessages.d.ts +14 -0
- package/bin/executor/messages/SessionModelMessages.d.ts.map +1 -0
- package/bin/executor/messages/SessionModelMessages.js +187 -0
- package/bin/executor/messages/SessionModelMessages.js.map +1 -0
- package/bin/executor/model/ModelGenerate.d.ts +22 -0
- package/bin/executor/model/ModelGenerate.d.ts.map +1 -0
- package/bin/executor/model/ModelGenerate.js +54 -0
- package/bin/executor/model/ModelGenerate.js.map +1 -0
- package/bin/executor/model/ModelStepRunner.d.ts +70 -0
- package/bin/executor/model/ModelStepRunner.d.ts.map +1 -0
- package/bin/executor/model/ModelStepRunner.js +284 -0
- package/bin/executor/model/ModelStepRunner.js.map +1 -0
- package/bin/executor/services/ExecutorRecoveryPolicy.d.ts +4 -4
- package/bin/executor/services/ExecutorRecoveryPolicy.d.ts.map +1 -1
- package/bin/executor/types/SessionHistoryMeta.d.ts +7 -2
- package/bin/executor/types/SessionHistoryMeta.d.ts.map +1 -1
- package/bin/executor/types/SessionHistoryMeta.js +1 -1
- package/bin/executor/types/SessionLoop.d.ts +1 -21
- package/bin/executor/types/SessionLoop.d.ts.map +1 -1
- package/bin/executor/types/SessionPrompts.d.ts +8 -7
- package/bin/executor/types/SessionPrompts.d.ts.map +1 -1
- package/bin/executor/types/SessionPrompts.js +1 -2
- package/bin/executor/types/SessionPrompts.js.map +1 -1
- package/bin/group/Group.d.ts +20 -0
- package/bin/group/Group.d.ts.map +1 -0
- package/bin/group/Group.js +42 -0
- package/bin/group/Group.js.map +1 -0
- package/bin/group/GroupSession.d.ts +103 -0
- package/bin/group/GroupSession.d.ts.map +1 -0
- package/bin/group/GroupSession.js +666 -0
- package/bin/group/GroupSession.js.map +1 -0
- package/bin/group/GroupSessions.d.ts +21 -0
- package/bin/group/GroupSessions.d.ts.map +1 -0
- package/bin/group/GroupSessions.js +89 -0
- package/bin/group/GroupSessions.js.map +1 -0
- package/bin/group/index.d.ts +9 -0
- package/bin/group/index.d.ts.map +1 -0
- package/bin/group/index.js +6 -0
- package/bin/group/index.js.map +1 -0
- package/bin/index.d.ts +29 -21
- package/bin/index.d.ts.map +1 -1
- package/bin/index.js +7 -9
- package/bin/index.js.map +1 -1
- package/bin/internal/AgentRuntime.d.ts +43 -0
- package/bin/internal/AgentRuntime.d.ts.map +1 -0
- package/bin/internal/AgentRuntime.js +179 -0
- package/bin/internal/AgentRuntime.js.map +1 -0
- package/bin/internal/GroupRuntime.d.ts +17 -0
- package/bin/internal/GroupRuntime.d.ts.map +1 -0
- package/bin/internal/GroupRuntime.js +66 -0
- package/bin/internal/GroupRuntime.js.map +1 -0
- package/bin/internal/index.d.ts +8 -0
- package/bin/internal/index.d.ts.map +1 -0
- package/bin/internal/index.js +8 -0
- package/bin/internal/index.js.map +1 -0
- package/bin/plugin/core/ActionScheduleExecutor.d.ts +3 -2
- package/bin/plugin/core/ActionScheduleExecutor.d.ts.map +1 -1
- package/bin/plugin/core/ActionScheduleExecutor.js +14 -3
- package/bin/plugin/core/ActionScheduleExecutor.js.map +1 -1
- package/bin/plugin/core/ActionScheduleRuntime.d.ts +3 -1
- package/bin/plugin/core/ActionScheduleRuntime.d.ts.map +1 -1
- package/bin/plugin/core/ActionScheduleRuntime.js +9 -8
- package/bin/plugin/core/ActionScheduleRuntime.js.map +1 -1
- package/bin/plugin/core/ActionScheduleStore.d.ts +7 -3
- package/bin/plugin/core/ActionScheduleStore.d.ts.map +1 -1
- package/bin/plugin/core/ActionScheduleStore.js +32 -9
- package/bin/plugin/core/ActionScheduleStore.js.map +1 -1
- package/bin/plugin/core/HookRegistry.d.ts +4 -6
- package/bin/plugin/core/HookRegistry.d.ts.map +1 -1
- package/bin/plugin/core/HookRegistry.js +8 -14
- package/bin/plugin/core/HookRegistry.js.map +1 -1
- package/bin/plugin/core/PluginActionExecution.d.ts +33 -0
- package/bin/plugin/core/PluginActionExecution.d.ts.map +1 -0
- package/bin/plugin/core/PluginActionExecution.js +168 -0
- package/bin/plugin/core/PluginActionExecution.js.map +1 -0
- package/bin/plugin/core/PluginActionFactory.d.ts +6 -3
- package/bin/plugin/core/PluginActionFactory.d.ts.map +1 -1
- package/bin/plugin/core/PluginActionFactory.js +3 -0
- package/bin/plugin/core/PluginActionFactory.js.map +1 -1
- package/bin/plugin/core/PluginContext.d.ts +14 -4
- package/bin/plugin/core/PluginContext.d.ts.map +1 -1
- package/bin/plugin/core/PluginContext.js +11 -2
- package/bin/plugin/core/PluginContext.js.map +1 -1
- package/bin/plugin/core/PluginHttpRoutes.d.ts +1 -1
- package/bin/plugin/core/PluginHttpRoutes.d.ts.map +1 -1
- package/bin/plugin/core/PluginHttpRoutes.js +1 -1
- package/bin/plugin/core/PluginHttpRoutes.js.map +1 -1
- package/bin/plugin/core/PluginRegistry.d.ts +41 -26
- package/bin/plugin/core/PluginRegistry.d.ts.map +1 -1
- package/bin/plugin/core/PluginRegistry.js +125 -107
- package/bin/plugin/core/PluginRegistry.js.map +1 -1
- package/bin/plugin/tool/PluginToolRuntime.d.ts.map +1 -1
- package/bin/plugin/tool/PluginToolRuntime.js +4 -1
- package/bin/plugin/tool/PluginToolRuntime.js.map +1 -1
- package/bin/plugin/tool/PluginToolSchemas.d.ts +22 -2
- package/bin/plugin/tool/PluginToolSchemas.d.ts.map +1 -1
- package/bin/plugin/tool/PluginToolSchemas.js +3 -4
- package/bin/plugin/tool/PluginToolSchemas.js.map +1 -1
- package/bin/plugin/tool/PluginTools.d.ts +5 -8
- package/bin/plugin/tool/PluginTools.d.ts.map +1 -1
- package/bin/plugin/tool/PluginTools.js +9 -8
- package/bin/plugin/tool/PluginTools.js.map +1 -1
- package/bin/plugin/types/ActionSchedule.d.ts +6 -0
- package/bin/plugin/types/ActionSchedule.d.ts.map +1 -1
- package/bin/remote/RemoteAgent.js +2 -2
- package/bin/remote/RemoteSession.d.ts +1 -1
- package/bin/remote/TransportFactory.d.ts +1 -1
- package/bin/remote/TransportFactory.js +2 -2
- package/bin/remote/transports/HttpRemoteAgentTransport.d.ts +1 -1
- package/bin/remote/transports/HttpRemoteAgentTransport.d.ts.map +1 -1
- package/bin/remote/transports/HttpRemoteAgentTransport.js +3 -3
- package/bin/remote/transports/HttpRemoteAgentTransport.js.map +1 -1
- package/bin/remote/transports/RpcClient.d.ts +1 -0
- package/bin/remote/transports/RpcClient.d.ts.map +1 -1
- package/bin/remote/transports/RpcClient.js +16 -0
- package/bin/remote/transports/RpcClient.js.map +1 -1
- package/bin/remote/transports/RpcRemoteAgentTransport.d.ts +1 -1
- package/bin/remote/transports/RpcRemoteAgentTransport.d.ts.map +1 -1
- package/bin/remote/transports/RpcRemoteAgentTransport.js +2 -1
- package/bin/remote/transports/RpcRemoteAgentTransport.js.map +1 -1
- package/bin/session/DefaultSessionComposer.js +4 -4
- package/bin/session/DefaultSessionComposer.js.map +1 -1
- package/bin/session/Session.d.ts +9 -3
- package/bin/session/Session.d.ts.map +1 -1
- package/bin/session/Session.js +85 -55
- package/bin/session/Session.js.map +1 -1
- package/bin/session/SessionLoop.d.ts.map +1 -1
- package/bin/session/SessionLoop.js +23 -25
- package/bin/session/SessionLoop.js.map +1 -1
- package/bin/session/SessionMessages.d.ts +9 -11
- package/bin/session/SessionMessages.d.ts.map +1 -1
- package/bin/session/SessionMessages.js +56 -104
- package/bin/session/SessionMessages.js.map +1 -1
- package/bin/session/SessionQueue.d.ts +1 -1
- package/bin/session/SessionState.d.ts +3 -0
- package/bin/session/SessionState.d.ts.map +1 -1
- package/bin/session/SessionState.js +42 -12
- package/bin/session/SessionState.js.map +1 -1
- package/bin/session/SessionTitle.d.ts +6 -6
- package/bin/session/SessionTitle.d.ts.map +1 -1
- package/bin/session/SessionTitle.js +11 -39
- package/bin/session/SessionTitle.js.map +1 -1
- package/bin/session/browse/Browse.d.ts +6 -4
- package/bin/session/browse/Browse.d.ts.map +1 -1
- package/bin/session/browse/Browse.js +25 -43
- package/bin/session/browse/Browse.js.map +1 -1
- package/bin/session/control/SessionInteractions.d.ts +2 -2
- package/bin/session/control/SessionInteractions.d.ts.map +1 -1
- package/bin/session/control/SessionInteractions.js +68 -32
- package/bin/session/control/SessionInteractions.js.map +1 -1
- package/bin/session/execution/SessionAssistantOutputAdapter.d.ts +20 -17
- package/bin/session/execution/SessionAssistantOutputAdapter.d.ts.map +1 -1
- package/bin/session/execution/SessionAssistantOutputAdapter.js +35 -35
- package/bin/session/execution/SessionAssistantOutputAdapter.js.map +1 -1
- package/bin/session/execution/tools/SessionShellApprovalAdapter.d.ts +2 -2
- package/bin/session/execution/tools/SessionShellApprovalAdapter.d.ts.map +1 -1
- package/bin/session/execution/tools/SessionShellApprovalAdapter.js +20 -8
- package/bin/session/execution/tools/SessionShellApprovalAdapter.js.map +1 -1
- package/bin/session/messages/SessionAssistantMessageWriter.d.ts +42 -48
- package/bin/session/messages/SessionAssistantMessageWriter.d.ts.map +1 -1
- package/bin/session/messages/SessionAssistantMessageWriter.js +225 -543
- package/bin/session/messages/SessionAssistantMessageWriter.js.map +1 -1
- package/bin/session/messages/SessionJsonValue.d.ts +0 -10
- package/bin/session/messages/SessionJsonValue.d.ts.map +1 -1
- package/bin/session/messages/SessionJsonValue.js +0 -23
- package/bin/session/messages/SessionJsonValue.js.map +1 -1
- package/bin/session/messages/SessionMessageCompaction.d.ts +7 -3
- package/bin/session/messages/SessionMessageCompaction.d.ts.map +1 -1
- package/bin/session/messages/SessionMessageCompaction.js +69 -91
- package/bin/session/messages/SessionMessageCompaction.js.map +1 -1
- package/bin/session/messages/SessionMessageInteractionWriter.d.ts.map +1 -1
- package/bin/session/messages/SessionMessageInteractionWriter.js +22 -21
- package/bin/session/messages/SessionMessageInteractionWriter.js.map +1 -1
- package/bin/session/messages/SessionMessageText.d.ts +25 -0
- package/bin/session/messages/SessionMessageText.d.ts.map +1 -0
- package/bin/session/messages/SessionMessageText.js +52 -0
- package/bin/session/messages/SessionMessageText.js.map +1 -0
- package/bin/session/preview/SessionMessagePreview.d.ts +3 -3
- package/bin/session/preview/SessionMessagePreview.d.ts.map +1 -1
- package/bin/session/preview/SessionMessagePreview.js +10 -30
- package/bin/session/preview/SessionMessagePreview.js.map +1 -1
- package/bin/session/runtime/SessionTurnContext.d.ts.map +1 -1
- package/bin/session/runtime/SessionTurnContext.js +4 -2
- package/bin/session/runtime/SessionTurnContext.js.map +1 -1
- package/bin/session/storage/Metadata.d.ts +5 -3
- package/bin/session/storage/Metadata.d.ts.map +1 -1
- package/bin/session/storage/Metadata.js +26 -7
- package/bin/session/storage/Metadata.js.map +1 -1
- package/bin/tools/ask/AskQuestionsTool.d.ts +2 -16
- package/bin/tools/ask/AskQuestionsTool.d.ts.map +1 -1
- package/bin/tools/ask/AskQuestionsTool.js +21 -17
- package/bin/tools/ask/AskQuestionsTool.js.map +1 -1
- package/bin/types/action/ActionResult.d.ts +15 -10
- package/bin/types/action/ActionResult.d.ts.map +1 -1
- package/bin/types/action/ActionResult.js +2 -2
- package/bin/types/action/ActionResult.js.map +1 -1
- package/bin/types/agent/AgentOptions.d.ts +7 -14
- package/bin/types/agent/AgentOptions.d.ts.map +1 -1
- package/bin/types/agent/AgentSessionCollection.d.ts +42 -0
- package/bin/types/agent/AgentSessionCollection.d.ts.map +1 -0
- package/bin/types/agent/AgentSessionCollection.js +7 -0
- package/bin/types/agent/AgentSessionCollection.js.map +1 -0
- package/bin/types/agent/AgentStorage.d.ts +18 -0
- package/bin/types/agent/AgentStorage.d.ts.map +1 -0
- package/bin/types/agent/AgentStorage.js +8 -0
- package/bin/types/agent/AgentStorage.js.map +1 -0
- package/bin/types/agent/RemoteAgentOptions.d.ts +1 -1
- package/bin/types/agent/RemoteAgentPluginAction.d.ts +2 -2
- package/bin/types/agent/SessionActor.d.ts +15 -8
- package/bin/types/agent/SessionActor.d.ts.map +1 -1
- package/bin/types/agent/SessionTypes.d.ts +39 -12
- package/bin/types/agent/SessionTypes.d.ts.map +1 -1
- package/bin/types/agent/WorkspaceEntryOptions.d.ts +16 -0
- package/bin/types/agent/WorkspaceEntryOptions.d.ts.map +1 -0
- package/bin/types/agent/WorkspaceEntryOptions.js +8 -0
- package/bin/types/agent/WorkspaceEntryOptions.js.map +1 -0
- package/bin/types/executor/SessionAssistantOutput.d.ts +19 -17
- package/bin/types/executor/SessionAssistantOutput.d.ts.map +1 -1
- package/bin/types/executor/SessionAssistantOutput.js +2 -3
- package/bin/types/executor/SessionAssistantOutput.js.map +1 -1
- package/bin/types/executor/SessionToolExecutionContext.d.ts +8 -5
- package/bin/types/executor/SessionToolExecutionContext.d.ts.map +1 -1
- package/bin/types/executor/SessionToolExecutionContext.js +1 -1
- package/bin/types/executor/SessionTurnContext.d.ts +16 -16
- package/bin/types/executor/SessionTurnContext.d.ts.map +1 -1
- package/bin/types/group/DispatchStrategy.d.ts +62 -0
- package/bin/types/group/DispatchStrategy.d.ts.map +1 -0
- package/bin/types/group/DispatchStrategy.js +93 -0
- package/bin/types/group/DispatchStrategy.js.map +1 -0
- package/bin/types/group/Group.d.ts +61 -0
- package/bin/types/group/Group.d.ts.map +1 -0
- package/bin/types/group/Group.js +3 -0
- package/bin/types/group/Group.js.map +1 -0
- package/bin/types/group/GroupSession.d.ts +149 -0
- package/bin/types/group/GroupSession.d.ts.map +1 -0
- package/bin/types/group/GroupSession.js +3 -0
- package/bin/types/group/GroupSession.js.map +1 -0
- package/bin/types/group/GroupSessionStore.d.ts +77 -0
- package/bin/types/group/GroupSessionStore.d.ts.map +1 -0
- package/bin/types/group/GroupSessionStore.js +3 -0
- package/bin/types/group/GroupSessionStore.js.map +1 -0
- package/bin/types/plugin/AgentPluginContext.d.ts +25 -0
- package/bin/types/plugin/AgentPluginContext.d.ts.map +1 -0
- package/bin/types/plugin/AgentPluginContext.js +10 -0
- package/bin/types/plugin/AgentPluginContext.js.map +1 -0
- package/bin/types/plugin/PluginAction.d.ts +10 -8
- package/bin/types/plugin/PluginAction.d.ts.map +1 -1
- package/bin/types/plugin/PluginActionExecution.d.ts +31 -0
- package/bin/types/plugin/PluginActionExecution.d.ts.map +1 -0
- package/bin/types/plugin/PluginActionExecution.js +10 -0
- package/bin/types/plugin/PluginActionExecution.js.map +1 -0
- package/bin/types/plugin/PluginCommand.d.ts +5 -5
- package/bin/types/plugin/PluginCommand.d.ts.map +1 -1
- package/bin/types/plugin/PluginContext.d.ts +19 -8
- package/bin/types/plugin/PluginContext.d.ts.map +1 -1
- package/bin/types/plugin/PluginContext.js +1 -1
- package/bin/types/plugin/PluginDefinition.d.ts +6 -6
- package/bin/types/plugin/PluginExecutionContext.d.ts +4 -10
- package/bin/types/plugin/PluginExecutionContext.d.ts.map +1 -1
- package/bin/types/plugin/PluginExecutionContext.js +3 -5
- package/bin/types/plugin/PluginExecutionContext.js.map +1 -1
- package/bin/types/plugin/PluginHttp.d.ts +1 -1
- package/bin/types/plugin/PluginRuntime.d.ts +13 -8
- package/bin/types/plugin/PluginRuntime.d.ts.map +1 -1
- package/bin/types/plugin/PluginServices.d.ts +10 -0
- package/bin/types/plugin/PluginServices.d.ts.map +1 -0
- package/bin/types/plugin/PluginServices.js +3 -0
- package/bin/types/plugin/PluginServices.js.map +1 -0
- package/bin/types/plugin/PluginState.d.ts +3 -3
- package/bin/types/plugin/PluginState.d.ts.map +1 -1
- package/bin/types/plugin/PluginState.js +1 -1
- package/bin/types/plugin/PluginTool.d.ts +6 -4
- package/bin/types/plugin/PluginTool.d.ts.map +1 -1
- package/bin/types/rpc/RpcProtocol.d.ts +30 -8
- package/bin/types/rpc/RpcProtocol.d.ts.map +1 -1
- package/bin/types/sdk/AgentSessionAction.d.ts +6 -7
- package/bin/types/sdk/AgentSessionAction.d.ts.map +1 -1
- package/bin/types/sdk/AgentSessionAction.js +2 -3
- package/bin/types/sdk/AgentSessionAction.js.map +1 -1
- package/bin/types/sdk/AgentSessionPrompt.d.ts +7 -7
- package/bin/types/sdk/AgentSessionPrompt.d.ts.map +1 -1
- package/bin/types/sdk/AgentSessionPrompt.js +1 -4
- package/bin/types/sdk/AgentSessionPrompt.js.map +1 -1
- package/bin/types/session/SessionAction.d.ts +39 -0
- package/bin/types/session/SessionAction.d.ts.map +1 -0
- package/bin/types/session/SessionAction.js +8 -0
- package/bin/types/session/SessionAction.js.map +1 -0
- package/bin/types/session/SessionComposer.d.ts +10 -11
- package/bin/types/session/SessionComposer.d.ts.map +1 -1
- package/bin/types/session/SessionContent.d.ts +41 -0
- package/bin/types/session/SessionContent.d.ts.map +1 -0
- package/bin/types/session/SessionContent.js +8 -0
- package/bin/types/session/SessionContent.js.map +1 -0
- package/bin/types/session/SessionExecution.d.ts +9 -68
- package/bin/types/session/SessionExecution.d.ts.map +1 -1
- package/bin/types/session/SessionInteraction.d.ts +92 -58
- package/bin/types/session/SessionInteraction.d.ts.map +1 -1
- package/bin/types/session/SessionInteraction.js +11 -4
- package/bin/types/session/SessionInteraction.js.map +1 -1
- package/bin/types/session/SessionInteractions.d.ts +1 -1
- package/bin/types/session/SessionLocalState.d.ts +2 -2
- package/bin/types/session/SessionLoop.d.ts +5 -5
- package/bin/types/session/SessionLoop.d.ts.map +1 -1
- package/bin/types/session/SessionMessage.d.ts +27 -87
- package/bin/types/session/SessionMessage.d.ts.map +1 -1
- package/bin/types/session/SessionMessages.d.ts +14 -14
- package/bin/types/session/SessionMessages.d.ts.map +1 -1
- package/bin/types/session/SessionMutation.d.ts +17 -4
- package/bin/types/session/SessionMutation.d.ts.map +1 -1
- package/bin/types/session/SessionMutation.js.map +1 -1
- package/bin/types/session/SessionOptions.d.ts +14 -9
- package/bin/types/session/SessionOptions.d.ts.map +1 -1
- package/bin/types/session/SessionOrigin.d.ts +19 -0
- package/bin/types/session/SessionOrigin.d.ts.map +1 -0
- package/bin/types/session/SessionOrigin.js +8 -0
- package/bin/types/session/SessionOrigin.js.map +1 -0
- package/bin/types/session/SessionPort.d.ts +16 -20
- package/bin/types/session/SessionPort.d.ts.map +1 -1
- package/bin/types/session/SessionSegment.d.ts +1 -1
- package/bin/types/session/SessionState.d.ts +9 -6
- package/bin/types/session/SessionState.d.ts.map +1 -1
- package/bin/types/session/SessionSystem.d.ts +1 -1
- package/bin/types/session/SessionTool.d.ts +12 -1
- package/bin/types/session/SessionTool.d.ts.map +1 -1
- package/bin/types/store/LocalStore.d.ts +19 -11
- package/bin/types/store/LocalStore.d.ts.map +1 -1
- package/bin/types/store/LocalStore.js +2 -2
- package/bin/types/store/SessionAttachmentStore.d.ts +4 -4
- package/bin/types/store/SessionAttachmentStore.js +3 -3
- package/bin/types/store/SessionDataStore.d.ts +85 -0
- package/bin/types/store/SessionDataStore.d.ts.map +1 -0
- package/bin/types/store/SessionDataStore.js +9 -0
- package/bin/types/store/SessionDataStore.js.map +1 -0
- package/bin/types/store/SessionStore.d.ts +24 -78
- package/bin/types/store/SessionStore.d.ts.map +1 -1
- package/bin/types/store/SessionStore.js +3 -3
- package/bin/types/tools/ToolActionExecutionContext.d.ts +30 -0
- package/bin/types/tools/ToolActionExecutionContext.d.ts.map +1 -0
- package/bin/types/tools/ToolActionExecutionContext.js +8 -0
- package/bin/types/tools/ToolActionExecutionContext.js.map +1 -0
- package/bin/types/tools/ask/AskQuestionsTool.d.ts +1 -1
- package/bin/utils/logger/Logger.d.ts +21 -9
- package/bin/utils/logger/Logger.d.ts.map +1 -1
- package/bin/utils/logger/Logger.js +18 -9
- package/bin/utils/logger/Logger.js.map +1 -1
- package/bin/workspace/WorkspacePaths.d.ts +3 -54
- package/bin/workspace/WorkspacePaths.d.ts.map +1 -1
- package/bin/workspace/WorkspacePaths.js +7 -74
- package/bin/workspace/WorkspacePaths.js.map +1 -1
- package/bin/workspace/store/JsonlSessionMessageStore.d.ts +1 -1
- package/bin/workspace/store/JsonlSessionMessageStore.d.ts.map +1 -1
- package/bin/workspace/store/LocalGroupSessionDataStore.d.ts +46 -0
- package/bin/workspace/store/LocalGroupSessionDataStore.d.ts.map +1 -0
- package/bin/workspace/store/LocalGroupSessionDataStore.js +197 -0
- package/bin/workspace/store/LocalGroupSessionDataStore.js.map +1 -0
- package/bin/workspace/store/LocalGroupSessionStore.d.ts +22 -0
- package/bin/workspace/store/LocalGroupSessionStore.d.ts.map +1 -0
- package/bin/workspace/store/LocalGroupSessionStore.js +75 -0
- package/bin/workspace/store/LocalGroupSessionStore.js.map +1 -0
- package/bin/workspace/store/LocalSessionAttachmentStore.d.ts +2 -2
- package/bin/workspace/store/LocalSessionAttachmentStore.d.ts.map +1 -1
- package/bin/workspace/store/LocalSessionAttachmentStore.js +2 -2
- package/bin/workspace/store/LocalSessionAttachmentStore.js.map +1 -1
- package/bin/workspace/store/LocalSessionDataStore.d.ts +45 -0
- package/bin/workspace/store/LocalSessionDataStore.d.ts.map +1 -0
- package/bin/workspace/store/LocalSessionDataStore.js +100 -0
- package/bin/workspace/store/LocalSessionDataStore.js.map +1 -0
- package/bin/workspace/store/LocalSessionStore.d.ts +38 -28
- package/bin/workspace/store/LocalSessionStore.d.ts.map +1 -1
- package/bin/workspace/store/LocalSessionStore.js +151 -51
- package/bin/workspace/store/LocalSessionStore.js.map +1 -1
- package/bin/workspace/store/LocalStorePaths.d.ts +31 -83
- package/bin/workspace/store/LocalStorePaths.d.ts.map +1 -1
- package/bin/workspace/store/LocalStorePaths.js +43 -101
- package/bin/workspace/store/LocalStorePaths.js.map +1 -1
- package/bin/workspace/store/SessionMessageStoreFactory.d.ts +1 -1
- package/bin/workspace/store/SessionMessageStoreFactory.d.ts.map +1 -1
- package/bin/workspace/store/SessionMessageStoreFactory.js +1 -1
- package/city-test/agent-http.test.mjs +326 -0
- package/city-test/city-container.test.mjs +156 -0
- package/city-test/city-host-registry.test.mjs +68 -0
- package/city-test/city-transport.test.mjs +282 -0
- package/city-test/group.test.mjs +739 -0
- package/city-test/session-model.test.mjs +169 -0
- package/city-test/transport-lifecycle.test.mjs +164 -0
- package/package.json +30 -17
- package/scripts/ModelClientMock.mjs +165 -0
- package/scripts/action-schedule-store.test.mjs +81 -11
- package/scripts/agent-compiler.mjs +10 -6
- package/scripts/agent-env-shell-sandbox.test.mjs +10 -10
- package/scripts/agent-env.test.mjs +6 -8
- package/scripts/agent-multi-workspace.test.mjs +213 -0
- package/scripts/agent-ready.test.mjs +71 -16
- package/scripts/agent-session-maintenance.test.mjs +15 -28
- package/scripts/agent-store.test.mjs +121 -22
- package/scripts/city-model-tool-loop.test.mjs +66 -195
- package/scripts/core-engine-context-compaction.test.mjs +65 -113
- package/scripts/core-engine-model-stream.test.mjs +87 -0
- package/scripts/executor-failure-result.test.mjs +13 -29
- package/scripts/file-tools.test.mjs +6 -6
- package/scripts/image-plugin-job.test.mjs +77 -40
- package/scripts/logger-isolation.test.mjs +2 -2
- package/scripts/multi-agent-plugin-isolation.test.mjs +11 -9
- package/scripts/plugin-tools.test.mjs +153 -18
- package/scripts/public-api-naming.test.mjs +0 -1
- package/scripts/rewrite-build-aliases.mjs +49 -0
- package/scripts/rpc-url-routing.test.mjs +29 -0
- package/scripts/search-tools.test.mjs +4 -4
- package/scripts/session-ask-question.test.mjs +23 -21
- package/scripts/session-attachments.test.mjs +11 -9
- package/scripts/session-compact-handle.test.mjs +6 -5
- package/scripts/session-composer.test.mjs +61 -18
- package/scripts/session-config-turn-boundary.test.mjs +132 -92
- package/scripts/session-dynamic-interaction.test.mjs +75 -0
- package/scripts/session-fork.test.mjs +35 -0
- package/scripts/session-list-title.test.mjs +14 -56
- package/scripts/session-messages.test.mjs +306 -1681
- package/scripts/session-shell-approval.test.mjs +16 -13
- package/scripts/session-system-blocks.test.mjs +1 -1
- package/scripts/session-title-event.test.mjs +38 -24
- package/scripts/session-tool-approval.test.mjs +17 -15
- package/scripts/session-turn-context.test.mjs +31 -28
- package/scripts/session-turn-failure.test.mjs +112 -110
- package/scripts/verify-build-aliases.mjs +32 -0
- package/scripts/workspace.test.mjs +146 -32
- package/src/agent/Agent.ts +138 -238
- package/src/agent/AgentModel.ts +9 -9
- package/src/agent/AgentSessions.ts +116 -65
- package/src/agent/WorkspaceEntry.ts +309 -0
- package/src/agent/index.ts +4 -0
- package/src/city/host/CityHostRegistry.ts +260 -0
- package/src/city/index.ts +49 -0
- package/src/city/runtime/City.ts +425 -0
- package/src/city/transport/SerializedTransport.ts +65 -0
- package/src/city/transport/http/AgentHTTP.ts +176 -0
- package/src/city/transport/http/CityHTTP.ts +196 -0
- package/src/city/transport/http/NodeHttpAdapter.ts +75 -0
- package/src/city/transport/http/routes/RuntimeRoutes.ts +51 -0
- package/src/city/transport/http/routes/SessionRoutes.ts +497 -0
- package/src/city/transport/rpc/AgentRPC.ts +111 -0
- package/src/city/transport/rpc/CityRPC.ts +138 -0
- package/src/city/transport/rpc/RpcServer.ts +158 -0
- package/src/city/transport/rpc/server/InternalHandlers.ts +223 -0
- package/src/city/transport/rpc/server/RequestDispatcher.ts +67 -0
- package/src/city/transport/rpc/server/SdkSessionHandlers.ts +166 -0
- package/src/city/transport/rpc/server/ServerTypes.ts +103 -0
- package/src/city/transport/session/RemoteSessionConfig.ts +34 -0
- package/src/city/transport/types/AgentHttpBinding.ts +25 -0
- package/src/city/transport/types/AgentHttpRuntime.ts +13 -0
- package/src/city/transport/types/AgentRpcBinding.ts +28 -0
- package/src/city/transport/types/AgentRpcRuntime.ts +20 -0
- package/src/city/transport/types/AgentSessionModelResolver.ts +13 -0
- package/src/city/transport/types/CityHttpRuntime.ts +45 -0
- package/src/city/transport/types/CityRpcRuntime.ts +27 -0
- package/src/city/transport/types/RpcProtocol.ts +32 -0
- package/src/city/types/City.ts +99 -0
- package/src/city/types/PluginHostContext.ts +40 -0
- package/src/city/types/SerializedTransport.ts +19 -0
- package/src/executor/Executor.ts +101 -43
- package/src/executor/README.md +11 -8
- package/src/executor/composer/system/SessionSystemComposer.ts +2 -2
- package/src/executor/composer/system/default/PromptRenderer.ts +2 -2
- package/src/executor/composer/system/default/SystemDomain.ts +5 -5
- package/src/executor/composer/system/default/assets/core.prompt.ts +1 -1
- package/src/executor/composer/system/default/assets/core.prompt.ts.txt +4 -12
- package/src/executor/core-engine/CoreEngineContextCompaction.ts +113 -427
- package/src/executor/core-engine/CoreEngineError.ts +1 -1
- package/src/executor/core-engine/CoreEngineLoopDecision.ts +1 -18
- package/src/executor/core-engine/CoreEngineMessageState.ts +32 -101
- package/src/executor/core-engine/CoreEngineRunner.ts +179 -281
- package/src/executor/core-engine/CoreEngineSignals.ts +98 -346
- package/src/executor/messages/SessionAttachmentMapper.ts +15 -273
- package/src/executor/messages/SessionMessageLog.ts +12 -25
- package/src/executor/messages/SessionModelMessages.ts +223 -0
- package/src/executor/model/ModelGenerate.ts +71 -0
- package/src/executor/model/ModelStepRunner.ts +381 -0
- package/src/executor/services/ExecutorRecoveryPolicy.ts +4 -4
- package/src/executor/types/SessionHistoryMeta.ts +8 -2
- package/src/executor/types/SessionLoop.ts +0 -26
- package/src/executor/types/SessionPrompts.ts +8 -8
- package/src/group/Group.ts +45 -0
- package/src/group/GroupSession.ts +728 -0
- package/src/group/GroupSessions.ts +104 -0
- package/src/group/index.ts +29 -0
- package/src/index.ts +110 -60
- package/src/internal/AgentRuntime.ts +229 -0
- package/src/internal/GroupRuntime.ts +89 -0
- package/src/internal/index.ts +33 -0
- package/src/plugin/core/ActionScheduleExecutor.ts +17 -5
- package/src/plugin/core/ActionScheduleRuntime.ts +16 -6
- package/src/plugin/core/ActionScheduleStore.ts +43 -12
- package/src/plugin/core/HookRegistry.ts +24 -14
- package/src/plugin/core/PluginActionExecution.ts +230 -0
- package/src/plugin/core/PluginActionFactory.ts +9 -3
- package/src/plugin/core/PluginContext.ts +25 -6
- package/src/plugin/core/PluginHttpRoutes.ts +2 -2
- package/src/plugin/core/PluginRegistry.ts +193 -107
- package/src/plugin/tool/PluginToolRuntime.ts +4 -1
- package/src/plugin/tool/PluginToolSchemas.ts +3 -4
- package/src/plugin/tool/PluginTools.ts +12 -8
- package/src/plugin/types/ActionSchedule.ts +6 -0
- package/src/remote/transports/HttpRemoteAgentTransport.ts +3 -3
- package/src/remote/transports/RpcClient.ts +17 -0
- package/src/remote/transports/RpcRemoteAgentTransport.ts +1 -0
- package/src/session/DefaultSessionComposer.ts +3 -3
- package/src/session/Session.ts +79 -43
- package/src/session/SessionLoop.ts +27 -34
- package/src/session/SessionMessages.ts +63 -121
- package/src/session/SessionState.ts +46 -21
- package/src/session/SessionTitle.ts +23 -40
- package/src/session/browse/Browse.ts +35 -63
- package/src/session/control/SessionInteractions.ts +72 -51
- package/src/session/execution/SessionAssistantOutputAdapter.ts +44 -45
- package/src/session/execution/tools/SessionShellApprovalAdapter.ts +20 -9
- package/src/session/messages/SessionAssistantMessageWriter.ts +259 -637
- package/src/session/messages/SessionJsonValue.ts +0 -23
- package/src/session/messages/SessionMessageCompaction.ts +78 -103
- package/src/session/messages/SessionMessageInteractionWriter.ts +22 -22
- package/src/session/messages/SessionMessageText.ts +73 -0
- package/src/session/preview/SessionMessagePreview.ts +15 -45
- package/src/session/runtime/SessionTurnContext.ts +11 -9
- package/src/session/storage/Metadata.ts +38 -9
- package/src/tools/ask/AskQuestionsTool.ts +28 -17
- package/src/types/action/ActionResult.ts +20 -11
- package/src/types/agent/AgentOptions.ts +6 -13
- package/src/types/agent/AgentSessionCollection.ts +61 -0
- package/src/types/agent/AgentStorage.ts +19 -0
- package/src/types/agent/RemoteAgentOptions.ts +1 -1
- package/src/types/agent/SessionActor.ts +9 -0
- package/src/types/agent/SessionTypes.ts +41 -12
- package/src/types/agent/WorkspaceEntryOptions.ts +18 -0
- package/src/types/executor/SessionAssistantOutput.ts +22 -17
- package/src/types/executor/SessionToolExecutionContext.ts +9 -4
- package/src/types/executor/SessionTurnContext.ts +11 -11
- package/src/types/group/DispatchStrategy.ts +165 -0
- package/src/types/group/Group.ts +64 -0
- package/src/types/group/GroupSession.ts +154 -0
- package/src/types/group/GroupSessionStore.ts +82 -0
- package/src/types/plugin/AgentPluginContext.ts +30 -0
- package/src/types/plugin/PluginAction.ts +7 -5
- package/src/types/plugin/PluginActionExecution.ts +36 -0
- package/src/types/plugin/PluginCommand.ts +5 -5
- package/src/types/plugin/PluginContext.ts +23 -7
- package/src/types/plugin/PluginExecutionContext.ts +6 -11
- package/src/types/plugin/PluginRuntime.ts +5 -0
- package/src/types/plugin/PluginServices.ts +11 -0
- package/src/types/plugin/PluginState.ts +2 -2
- package/src/types/plugin/PluginTool.ts +4 -1
- package/src/types/rpc/RpcProtocol.ts +24 -2
- package/src/types/sdk/AgentSessionAction.ts +8 -9
- package/src/types/sdk/AgentSessionPrompt.ts +8 -11
- package/src/types/session/SessionAction.ts +41 -0
- package/src/types/session/SessionComposer.ts +8 -13
- package/src/types/session/SessionContent.ts +52 -0
- package/src/types/session/SessionExecution.ts +9 -88
- package/src/types/session/SessionInteraction.ts +106 -73
- package/src/types/session/SessionLoop.ts +1 -1
- package/src/types/session/SessionMessage.ts +27 -94
- package/src/types/session/SessionMessages.ts +12 -9
- package/src/types/session/SessionMutation.ts +17 -2
- package/src/types/session/SessionOptions.ts +11 -4
- package/src/types/session/SessionOrigin.ts +21 -0
- package/src/types/session/SessionPort.ts +12 -20
- package/src/types/session/SessionState.ts +7 -4
- package/src/types/session/SessionTool.ts +12 -0
- package/src/types/store/LocalStore.ts +19 -11
- package/src/types/store/SessionAttachmentStore.ts +4 -4
- package/src/types/store/SessionDataStore.ts +109 -0
- package/src/types/store/SessionStore.ts +37 -94
- package/src/types/tools/ToolActionExecutionContext.ts +32 -0
- package/src/utils/logger/Logger.ts +33 -12
- package/src/workspace/WorkspacePaths.ts +7 -82
- package/src/workspace/store/JsonlSessionMessageStore.ts +2 -2
- package/src/workspace/store/LocalGroupSessionDataStore.ts +232 -0
- package/src/workspace/store/LocalGroupSessionStore.ts +90 -0
- package/src/workspace/store/LocalSessionAttachmentStore.ts +3 -3
- package/src/workspace/store/LocalSessionDataStore.ts +169 -0
- package/src/workspace/store/LocalSessionStore.ts +202 -86
- package/src/workspace/store/LocalStorePaths.ts +65 -147
- package/src/workspace/store/SessionMessageStoreFactory.ts +1 -1
- package/tsconfig.json +2 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/LICENSE +0 -183
- package/bin/agent/AgentState.d.ts +0 -45
- package/bin/agent/AgentState.d.ts.map +0 -1
- package/bin/agent/AgentState.js +0 -74
- package/bin/agent/AgentState.js.map +0 -1
- package/bin/executor/core-engine/CoreEngineUiStreamCollector.d.ts +0 -48
- package/bin/executor/core-engine/CoreEngineUiStreamCollector.d.ts.map +0 -1
- package/bin/executor/core-engine/CoreEngineUiStreamCollector.js +0 -92
- package/bin/executor/core-engine/CoreEngineUiStreamCollector.js.map +0 -1
- package/bin/executor/messages/SessionMessageCodec.d.ts +0 -29
- package/bin/executor/messages/SessionMessageCodec.d.ts.map +0 -1
- package/bin/executor/messages/SessionMessageCodec.js +0 -75
- package/bin/executor/messages/SessionMessageCodec.js.map +0 -1
- package/bin/executor/messages/SessionStepEventMapper.d.ts +0 -19
- package/bin/executor/messages/SessionStepEventMapper.d.ts.map +0 -1
- package/bin/executor/messages/SessionStepEventMapper.js +0 -177
- package/bin/executor/messages/SessionStepEventMapper.js.map +0 -1
- package/bin/executor/messages/UIMessageTransformer.d.ts +0 -29
- package/bin/executor/messages/UIMessageTransformer.d.ts.map +0 -1
- package/bin/executor/messages/UIMessageTransformer.js +0 -114
- package/bin/executor/messages/UIMessageTransformer.js.map +0 -1
- package/bin/executor/messages/UserVisibleText.d.ts +0 -26
- package/bin/executor/messages/UserVisibleText.d.ts.map +0 -1
- package/bin/executor/messages/UserVisibleText.js +0 -65
- package/bin/executor/messages/UserVisibleText.js.map +0 -1
- package/bin/executor/types/SessionRecords.d.ts +0 -162
- package/bin/executor/types/SessionRecords.d.ts.map +0 -1
- package/bin/executor/types/SessionRecords.js +0 -51
- package/bin/executor/types/SessionRecords.js.map +0 -1
- package/bin/plugin/core/PluginActionRunner.d.ts +0 -24
- package/bin/plugin/core/PluginActionRunner.d.ts.map +0 -1
- package/bin/plugin/core/PluginActionRunner.js +0 -19
- package/bin/plugin/core/PluginActionRunner.js.map +0 -1
- package/bin/session/messages/SessionMessageCodec.d.ts +0 -23
- package/bin/session/messages/SessionMessageCodec.d.ts.map +0 -1
- package/bin/session/messages/SessionMessageCodec.js +0 -455
- package/bin/session/messages/SessionMessageCodec.js.map +0 -1
- package/bin/types/agent/AgentState.d.ts +0 -19
- package/bin/types/agent/AgentState.d.ts.map +0 -1
- package/bin/types/agent/AgentState.js +0 -9
- package/bin/types/agent/AgentState.js.map +0 -1
- package/bin/types/store/AgentStore.d.ts +0 -31
- package/bin/types/store/AgentStore.d.ts.map +0 -1
- package/bin/types/store/AgentStore.js +0 -9
- package/bin/types/store/AgentStore.js.map +0 -1
- package/bin/types/workspace/FileSystem.d.ts +0 -55
- package/bin/types/workspace/FileSystem.d.ts.map +0 -1
- package/bin/types/workspace/FileSystem.js +0 -9
- package/bin/types/workspace/FileSystem.js.map +0 -1
- package/bin/types/workspace/FileTool.d.ts +0 -181
- package/bin/types/workspace/FileTool.d.ts.map +0 -1
- package/bin/types/workspace/FileTool.js +0 -10
- package/bin/types/workspace/FileTool.js.map +0 -1
- package/bin/types/workspace/SearchTool.d.ts +0 -131
- package/bin/types/workspace/SearchTool.d.ts.map +0 -1
- package/bin/types/workspace/SearchTool.js +0 -10
- package/bin/types/workspace/SearchTool.js.map +0 -1
- package/bin/types/workspace/Workspace.d.ts +0 -24
- package/bin/types/workspace/Workspace.d.ts.map +0 -1
- package/bin/types/workspace/Workspace.js +0 -9
- package/bin/types/workspace/Workspace.js.map +0 -1
- package/bin/types/workspace/WorkspaceEnv.d.ts +0 -16
- package/bin/types/workspace/WorkspaceEnv.d.ts.map +0 -1
- package/bin/types/workspace/WorkspaceEnv.js +0 -9
- package/bin/types/workspace/WorkspaceEnv.js.map +0 -1
- package/bin/types/workspace/WorkspaceTools.d.ts +0 -20
- package/bin/types/workspace/WorkspaceTools.d.ts.map +0 -1
- package/bin/types/workspace/WorkspaceTools.js +0 -9
- package/bin/types/workspace/WorkspaceTools.js.map +0 -1
- package/bin/utils/cli/CliOutput.d.ts +0 -14
- package/bin/utils/cli/CliOutput.d.ts.map +0 -1
- package/bin/utils/cli/CliOutput.js +0 -98
- package/bin/utils/cli/CliOutput.js.map +0 -1
- package/bin/utils/cli/PrettyStatus.d.ts +0 -25
- package/bin/utils/cli/PrettyStatus.d.ts.map +0 -1
- package/bin/utils/cli/PrettyStatus.js +0 -77
- package/bin/utils/cli/PrettyStatus.js.map +0 -1
- package/bin/utils/logger/FormatRequest.d.ts +0 -29
- package/bin/utils/logger/FormatRequest.d.ts.map +0 -1
- package/bin/utils/logger/FormatRequest.js +0 -309
- package/bin/utils/logger/FormatRequest.js.map +0 -1
- package/bin/utils/logger/FormatResponse.d.ts +0 -46
- package/bin/utils/logger/FormatResponse.d.ts.map +0 -1
- package/bin/utils/logger/FormatResponse.js +0 -186
- package/bin/utils/logger/FormatResponse.js.map +0 -1
- package/bin/utils/logger/FormatShared.d.ts +0 -33
- package/bin/utils/logger/FormatShared.d.ts.map +0 -1
- package/bin/utils/logger/FormatShared.js +0 -215
- package/bin/utils/logger/FormatShared.js.map +0 -1
- package/bin/utils/object/DeepMerge.d.ts +0 -18
- package/bin/utils/object/DeepMerge.d.ts.map +0 -1
- package/bin/utils/object/DeepMerge.js +0 -37
- package/bin/utils/object/DeepMerge.js.map +0 -1
- package/bin/utils/object/ObjectGuards.d.ts +0 -17
- package/bin/utils/object/ObjectGuards.d.ts.map +0 -1
- package/bin/utils/object/ObjectGuards.js +0 -19
- package/bin/utils/object/ObjectGuards.js.map +0 -1
- package/bin/utils/path/AncestorFiles.d.ts +0 -17
- package/bin/utils/path/AncestorFiles.d.ts.map +0 -1
- package/bin/utils/path/AncestorFiles.js +0 -36
- package/bin/utils/path/AncestorFiles.js.map +0 -1
- package/bin/utils/storage/index.d.ts +0 -4
- package/bin/utils/storage/index.d.ts.map +0 -1
- package/bin/utils/storage/index.js +0 -17
- package/bin/utils/storage/index.js.map +0 -1
- package/bin/utils/string/EscapeRegExp.d.ts +0 -17
- package/bin/utils/string/EscapeRegExp.d.ts.map +0 -1
- package/bin/utils/string/EscapeRegExp.js +0 -19
- package/bin/utils/string/EscapeRegExp.js.map +0 -1
- package/bin/workspace/LocalFileSystem.d.ts +0 -44
- package/bin/workspace/LocalFileSystem.d.ts.map +0 -1
- package/bin/workspace/LocalFileSystem.js +0 -153
- package/bin/workspace/LocalFileSystem.js.map +0 -1
- package/bin/workspace/Workspace.d.ts +0 -53
- package/bin/workspace/Workspace.d.ts.map +0 -1
- package/bin/workspace/Workspace.js +0 -151
- package/bin/workspace/Workspace.js.map +0 -1
- package/bin/workspace/WorkspaceBase.d.ts +0 -41
- package/bin/workspace/WorkspaceBase.d.ts.map +0 -1
- package/bin/workspace/WorkspaceBase.js +0 -19
- package/bin/workspace/WorkspaceBase.js.map +0 -1
- package/bin/workspace/WorkspaceEnv.d.ts +0 -19
- package/bin/workspace/WorkspaceEnv.d.ts.map +0 -1
- package/bin/workspace/WorkspaceEnv.js +0 -50
- package/bin/workspace/WorkspaceEnv.js.map +0 -1
- package/bin/workspace/file/FileActionRuntime.d.ts +0 -14
- package/bin/workspace/file/FileActionRuntime.d.ts.map +0 -1
- package/bin/workspace/file/FileActionRuntime.js +0 -386
- package/bin/workspace/file/FileActionRuntime.js.map +0 -1
- package/bin/workspace/file/FileAtomicWriter.d.ts +0 -20
- package/bin/workspace/file/FileAtomicWriter.d.ts.map +0 -1
- package/bin/workspace/file/FileAtomicWriter.js +0 -50
- package/bin/workspace/file/FileAtomicWriter.js.map +0 -1
- package/bin/workspace/file/FileEncoding.d.ts +0 -34
- package/bin/workspace/file/FileEncoding.d.ts.map +0 -1
- package/bin/workspace/file/FileEncoding.js +0 -152
- package/bin/workspace/file/FileEncoding.js.map +0 -1
- package/bin/workspace/file/FilePathPolicy.d.ts +0 -26
- package/bin/workspace/file/FilePathPolicy.d.ts.map +0 -1
- package/bin/workspace/file/FilePathPolicy.js +0 -134
- package/bin/workspace/file/FilePathPolicy.js.map +0 -1
- package/bin/workspace/file/FileToolError.d.ts +0 -30
- package/bin/workspace/file/FileToolError.d.ts.map +0 -1
- package/bin/workspace/file/FileToolError.js +0 -78
- package/bin/workspace/file/FileToolError.js.map +0 -1
- package/bin/workspace/search/SearchActionRuntime.d.ts +0 -14
- package/bin/workspace/search/SearchActionRuntime.d.ts.map +0 -1
- package/bin/workspace/search/SearchActionRuntime.js +0 -359
- package/bin/workspace/search/SearchActionRuntime.js.map +0 -1
- package/bin/workspace/search/SearchToolError.d.ts +0 -26
- package/bin/workspace/search/SearchToolError.d.ts.map +0 -1
- package/bin/workspace/search/SearchToolError.js +0 -76
- package/bin/workspace/search/SearchToolError.js.map +0 -1
- package/bin/workspace/store/LocalAgentStore.d.ts +0 -43
- package/bin/workspace/store/LocalAgentStore.d.ts.map +0 -1
- package/bin/workspace/store/LocalAgentStore.js +0 -135
- package/bin/workspace/store/LocalAgentStore.js.map +0 -1
- package/bin/workspace/tool/FileToolSchemas.d.ts +0 -35
- package/bin/workspace/tool/FileToolSchemas.d.ts.map +0 -1
- package/bin/workspace/tool/FileToolSchemas.js +0 -73
- package/bin/workspace/tool/FileToolSchemas.js.map +0 -1
- package/bin/workspace/tool/FileTools.d.ts +0 -11
- package/bin/workspace/tool/FileTools.d.ts.map +0 -1
- package/bin/workspace/tool/FileTools.js +0 -61
- package/bin/workspace/tool/FileTools.js.map +0 -1
- package/bin/workspace/tool/SearchToolSchemas.d.ts +0 -24
- package/bin/workspace/tool/SearchToolSchemas.d.ts.map +0 -1
- package/bin/workspace/tool/SearchToolSchemas.js +0 -60
- package/bin/workspace/tool/SearchToolSchemas.js.map +0 -1
- package/bin/workspace/tool/SearchTools.d.ts +0 -11
- package/bin/workspace/tool/SearchTools.d.ts.map +0 -1
- package/bin/workspace/tool/SearchTools.js +0 -38
- package/bin/workspace/tool/SearchTools.js.map +0 -1
- package/bin/workspace/tool/WorkspaceTools.d.ts +0 -11
- package/bin/workspace/tool/WorkspaceTools.d.ts.map +0 -1
- package/bin/workspace/tool/WorkspaceTools.js +0 -22
- package/bin/workspace/tool/WorkspaceTools.js.map +0 -1
- package/scripts/core-engine-ui-stream-collector.test.mjs +0 -38
- package/scripts/openai-responses-continuation.test.mjs +0 -78
- package/src/agent/AgentState.ts +0 -96
- package/src/executor/core-engine/CoreEngineUiStreamCollector.ts +0 -136
- package/src/executor/messages/SessionMessageCodec.ts +0 -106
- package/src/executor/messages/SessionStepEventMapper.ts +0 -191
- package/src/executor/messages/UIMessageTransformer.ts +0 -152
- package/src/executor/messages/UserVisibleText.ts +0 -75
- package/src/executor/types/SessionRecords.ts +0 -217
- package/src/plugin/core/PluginActionRunner.ts +0 -36
- package/src/session/messages/SessionMessageCodec.ts +0 -495
- package/src/types/agent/AgentState.ts +0 -22
- package/src/types/store/AgentStore.ts +0 -52
- package/src/types/workspace/FileSystem.ts +0 -76
- package/src/types/workspace/FileTool.ts +0 -225
- package/src/types/workspace/SearchTool.ts +0 -156
- package/src/types/workspace/Workspace.ts +0 -27
- package/src/types/workspace/WorkspaceEnv.ts +0 -19
- package/src/types/workspace/WorkspaceTools.ts +0 -23
- package/src/utils/cli/CliOutput.ts +0 -128
- package/src/utils/cli/PrettyStatus.ts +0 -94
- package/src/utils/logger/FormatRequest.ts +0 -455
- package/src/utils/logger/FormatResponse.ts +0 -265
- package/src/utils/logger/FormatShared.ts +0 -258
- package/src/utils/object/DeepMerge.ts +0 -40
- package/src/utils/object/ObjectGuards.ts +0 -19
- package/src/utils/path/AncestorFiles.ts +0 -40
- package/src/utils/storage/index.ts +0 -19
- package/src/utils/string/EscapeRegExp.ts +0 -19
- package/src/workspace/LocalFileSystem.ts +0 -209
- package/src/workspace/Workspace.ts +0 -178
- package/src/workspace/WorkspaceBase.ts +0 -62
- package/src/workspace/WorkspaceEnv.ts +0 -54
- package/src/workspace/file/FileActionRuntime.ts +0 -433
- package/src/workspace/file/FileAtomicWriter.ts +0 -61
- package/src/workspace/file/FileEncoding.ts +0 -175
- package/src/workspace/file/FilePathPolicy.ts +0 -162
- package/src/workspace/file/FileToolError.ts +0 -99
- package/src/workspace/search/SearchActionRuntime.ts +0 -438
- package/src/workspace/search/SearchToolError.ts +0 -94
- package/src/workspace/store/LocalAgentStore.ts +0 -191
- package/src/workspace/tool/FileToolSchemas.ts +0 -77
- package/src/workspace/tool/FileTools.ts +0 -91
- package/src/workspace/tool/SearchToolSchemas.ts +0 -62
- package/src/workspace/tool/SearchTools.ts +0 -61
- package/src/workspace/tool/WorkspaceTools.ts +0 -31
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Logger.js","sourceRoot":"","sources":["../../../src/utils/logger/Logger.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGhD,OAAO,EAAE,eAAe,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"Log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AED,gBAAgB,CAAC,IAAsB;QACrC,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;IACtD,CAAC;IAED,eAAe,CAAC,QAAgB,EAAE;QAChC,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC;IACjC,CAAC;IAED,UAAU;QACR,IAAI,CAAC,IAAI,GAAG,EAAE,CAAC;IACjB,CAAC;CACF;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,UAAU,CAAC,YAAqB,EAAE,SAAkB;IAClE,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,SAAS,CAAC,CAAC;IACrC,MAAM,IAAI,GAAG,MAAM,CAAC,YAAY,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IAC/C,IAAI,IAAI;QAAE,MAAM,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;IACzC,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -1,67 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* 返回 Agent 内部数据根目录。
|
|
3
3
|
*/
|
|
4
|
-
export declare function get_downcity_dir_path(
|
|
4
|
+
export declare function get_downcity_dir_path(data_path: string): string;
|
|
5
5
|
/**
|
|
6
6
|
* 返回项目日志目录路径。
|
|
7
7
|
*/
|
|
8
8
|
export declare function get_logs_dir_path(cwd: string): string;
|
|
9
|
-
/**
|
|
10
|
-
* 返回项目缓存目录路径。
|
|
11
|
-
*
|
|
12
|
-
* 关键点(中文)
|
|
13
|
-
* - 当前使用隐藏命名 `.cache`,避免与用户业务目录混淆。
|
|
14
|
-
*/
|
|
15
|
-
export declare function get_cache_dir_path(cwd: string): string;
|
|
16
|
-
/**
|
|
17
|
-
* 返回 profile 运行态目录路径。
|
|
18
|
-
*
|
|
19
|
-
* 关键点(中文)
|
|
20
|
-
* - 初始化流程会统一创建该目录,并在其中写入 profile 相关文件。
|
|
21
|
-
* - 单独保留目录级 API,避免调用方散落 `path.join(..., "profile")`。
|
|
22
|
-
*/
|
|
23
|
-
export declare function get_downcity_profile_dir_path(cwd: string): string;
|
|
24
|
-
/**
|
|
25
|
-
* 返回 profile 主记忆文件路径。
|
|
26
|
-
*
|
|
27
|
-
* 关键点(中文)
|
|
28
|
-
* - 该文件通常承载主画像或核心长期 profile 信息。
|
|
29
|
-
*/
|
|
30
|
-
export declare function get_downcity_profile_primary_path(cwd: string): string;
|
|
31
|
-
/**
|
|
32
|
-
* 返回 profile 补充记忆文件路径。
|
|
33
|
-
*
|
|
34
|
-
* 关键点(中文)
|
|
35
|
-
* - 该文件用于存放不适合进入主 profile 的补充材料。
|
|
36
|
-
*/
|
|
37
|
-
export declare function get_downcity_profile_other_path(cwd: string): string;
|
|
38
9
|
/**
|
|
39
10
|
* Plugin Schedule JSONL 路径。
|
|
40
11
|
*
|
|
41
12
|
* 关键点(中文)
|
|
42
|
-
* -
|
|
13
|
+
* - 调度任务属于 Agent,因此放在 Agent 集中式内部数据目录。
|
|
43
14
|
*/
|
|
44
15
|
export declare function get_downcity_schedule_db_path(cwd: string): string;
|
|
45
|
-
/**
|
|
46
|
-
* 返回项目运行时数据目录路径。
|
|
47
|
-
*/
|
|
48
|
-
export declare function get_downcity_data_dir_path(cwd: string): string;
|
|
49
|
-
/**
|
|
50
|
-
* 返回项目公开静态资源目录路径。
|
|
51
|
-
*/
|
|
52
|
-
export declare function get_downcity_public_dir_path(cwd: string): string;
|
|
53
|
-
/**
|
|
54
|
-
* 返回项目任务目录路径。
|
|
55
|
-
*
|
|
56
|
-
* 关键点(中文)
|
|
57
|
-
* - 该目录用于存放任务相关的本地文件与运行时数据。
|
|
58
|
-
*/
|
|
59
|
-
export declare function get_downcity_tasks_dir_path(cwd: string): string;
|
|
60
|
-
/**
|
|
61
|
-
* 返回项目调试目录路径。
|
|
62
|
-
*
|
|
63
|
-
* 关键点(中文)
|
|
64
|
-
* - 当前使用隐藏目录 `.debug`,避免与用户显式业务目录冲突。
|
|
65
|
-
*/
|
|
66
|
-
export declare function get_downcity_debug_dir_path(cwd: string): string;
|
|
67
16
|
//# sourceMappingURL=WorkspacePaths.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WorkspacePaths.d.ts","sourceRoot":"","sources":["../../src/workspace/WorkspacePaths.ts"],"names":[],"mappings":"AAcA;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,
|
|
1
|
+
{"version":3,"file":"WorkspacePaths.d.ts","sourceRoot":"","sources":["../../src/workspace/WorkspacePaths.ts"],"names":[],"mappings":"AAcA;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAE/D;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAErD;AAED;;;;;GAKG;AACH,wBAAgB,6BAA6B,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEjE"}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Agent 内部数据路径规则模块。
|
|
3
3
|
*
|
|
4
4
|
* 职责说明(中文)
|
|
5
|
-
* -
|
|
5
|
+
* - 统一管理 Agent 根目录下的运行时状态路径。
|
|
6
6
|
* - 负责把“路径协议”集中到一个模块,避免各领域模块自行拼接字符串。
|
|
7
7
|
* - 为初始化、日志、任务与调试文件等非 Store 子系统提供一致的路径入口。
|
|
8
8
|
*
|
|
9
9
|
* 边界说明(中文)
|
|
10
10
|
* - 这里只负责路径计算,不负责目录创建、文件读写或存在性校验。
|
|
11
|
-
* -
|
|
11
|
+
* - 这里描述的是 Agent 私有数据约定,不涉及项目目录或平台级全局目录布局。
|
|
12
12
|
*/
|
|
13
13
|
import path from "path";
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
15
|
+
* 返回 Agent 内部数据根目录。
|
|
16
16
|
*/
|
|
17
|
-
export function get_downcity_dir_path(
|
|
18
|
-
return path.
|
|
17
|
+
export function get_downcity_dir_path(data_path) {
|
|
18
|
+
return path.resolve(data_path);
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
21
|
* 返回项目日志目录路径。
|
|
@@ -23,80 +23,13 @@ export function get_downcity_dir_path(cwd) {
|
|
|
23
23
|
export function get_logs_dir_path(cwd) {
|
|
24
24
|
return path.join(get_downcity_dir_path(cwd), "logs");
|
|
25
25
|
}
|
|
26
|
-
/**
|
|
27
|
-
* 返回项目缓存目录路径。
|
|
28
|
-
*
|
|
29
|
-
* 关键点(中文)
|
|
30
|
-
* - 当前使用隐藏命名 `.cache`,避免与用户业务目录混淆。
|
|
31
|
-
*/
|
|
32
|
-
export function get_cache_dir_path(cwd) {
|
|
33
|
-
return path.join(get_downcity_dir_path(cwd), ".cache");
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* 返回 profile 运行态目录路径。
|
|
37
|
-
*
|
|
38
|
-
* 关键点(中文)
|
|
39
|
-
* - 初始化流程会统一创建该目录,并在其中写入 profile 相关文件。
|
|
40
|
-
* - 单独保留目录级 API,避免调用方散落 `path.join(..., "profile")`。
|
|
41
|
-
*/
|
|
42
|
-
export function get_downcity_profile_dir_path(cwd) {
|
|
43
|
-
return path.join(get_downcity_dir_path(cwd), "profile");
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* 返回 profile 主记忆文件路径。
|
|
47
|
-
*
|
|
48
|
-
* 关键点(中文)
|
|
49
|
-
* - 该文件通常承载主画像或核心长期 profile 信息。
|
|
50
|
-
*/
|
|
51
|
-
export function get_downcity_profile_primary_path(cwd) {
|
|
52
|
-
return path.join(get_downcity_profile_dir_path(cwd), "Primary.md");
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* 返回 profile 补充记忆文件路径。
|
|
56
|
-
*
|
|
57
|
-
* 关键点(中文)
|
|
58
|
-
* - 该文件用于存放不适合进入主 profile 的补充材料。
|
|
59
|
-
*/
|
|
60
|
-
export function get_downcity_profile_other_path(cwd) {
|
|
61
|
-
return path.join(get_downcity_profile_dir_path(cwd), "other.md");
|
|
62
|
-
}
|
|
63
26
|
/**
|
|
64
27
|
* Plugin Schedule JSONL 路径。
|
|
65
28
|
*
|
|
66
29
|
* 关键点(中文)
|
|
67
|
-
* -
|
|
30
|
+
* - 调度任务属于 Agent,因此放在 Agent 集中式内部数据目录。
|
|
68
31
|
*/
|
|
69
32
|
export function get_downcity_schedule_db_path(cwd) {
|
|
70
33
|
return path.join(get_downcity_dir_path(cwd), "schedule.jsonl");
|
|
71
34
|
}
|
|
72
|
-
/**
|
|
73
|
-
* 返回项目运行时数据目录路径。
|
|
74
|
-
*/
|
|
75
|
-
export function get_downcity_data_dir_path(cwd) {
|
|
76
|
-
return path.join(get_downcity_dir_path(cwd), "data");
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* 返回项目公开静态资源目录路径。
|
|
80
|
-
*/
|
|
81
|
-
export function get_downcity_public_dir_path(cwd) {
|
|
82
|
-
return path.join(get_downcity_dir_path(cwd), "public");
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* 返回项目任务目录路径。
|
|
86
|
-
*
|
|
87
|
-
* 关键点(中文)
|
|
88
|
-
* - 该目录用于存放任务相关的本地文件与运行时数据。
|
|
89
|
-
*/
|
|
90
|
-
export function get_downcity_tasks_dir_path(cwd) {
|
|
91
|
-
return path.join(get_downcity_dir_path(cwd), "task");
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* 返回项目调试目录路径。
|
|
95
|
-
*
|
|
96
|
-
* 关键点(中文)
|
|
97
|
-
* - 当前使用隐藏目录 `.debug`,避免与用户显式业务目录冲突。
|
|
98
|
-
*/
|
|
99
|
-
export function get_downcity_debug_dir_path(cwd) {
|
|
100
|
-
return path.join(get_downcity_dir_path(cwd), ".debug");
|
|
101
|
-
}
|
|
102
35
|
//# sourceMappingURL=WorkspacePaths.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WorkspacePaths.js","sourceRoot":"","sources":["../../src/workspace/WorkspacePaths.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB;;GAEG;AACH,MAAM,UAAU,qBAAqB,CAAC,
|
|
1
|
+
{"version":3,"file":"WorkspacePaths.js","sourceRoot":"","sources":["../../src/workspace/WorkspacePaths.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB;;GAEG;AACH,MAAM,UAAU,qBAAqB,CAAC,SAAiB;IACrD,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AACjC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,GAAW;IAC3C,OAAO,IAAI,CAAC,IAAI,CAAC,qBAAqB,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,CAAC;AACvD,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,6BAA6B,CAAC,GAAW;IACvD,OAAO,IAAI,CAAC,IAAI,CAAC,qBAAqB,CAAC,GAAG,CAAC,EAAE,gBAAgB,CAAC,CAAC;AACjE,CAAC"}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import type { SessionAssistantMessage, SessionMessage } from "../../types/session/SessionMessage.js";
|
|
8
8
|
import type { SessionMessageStorageStats, SessionSegmentRange, SessionSegmentSnapshot, SessionSegmentSummary } from "../../types/session/SessionSegment.js";
|
|
9
|
-
import type { CompactActiveMessagesInput, CompactActiveMessagesResult, SessionMessageCommitState } from "../../types/store/
|
|
9
|
+
import type { CompactActiveMessagesInput, CompactActiveMessagesResult, SessionMessageCommitState } from "../../types/store/SessionDataStore.js";
|
|
10
10
|
import type { JsonlSessionMessageStoreOptions } from "../../types/store/LocalStore.js";
|
|
11
11
|
/** Active + Segment JSONL 存储。 */
|
|
12
12
|
export declare class JsonlSessionMessageStore {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JsonlSessionMessageStore.d.ts","sourceRoot":"","sources":["../../../src/workspace/store/JsonlSessionMessageStore.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,uBAAuB,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACjG,OAAO,KAAK,EACV,0BAA0B,EAC1B,mBAAmB,EACnB,sBAAsB,EACtB,qBAAqB,EACtB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,KAAK,EACV,0BAA0B,EAC1B,2BAA2B,EAC3B,yBAAyB,EAC1B,MAAM
|
|
1
|
+
{"version":3,"file":"JsonlSessionMessageStore.d.ts","sourceRoot":"","sources":["../../../src/workspace/store/JsonlSessionMessageStore.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,uBAAuB,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACjG,OAAO,KAAK,EACV,0BAA0B,EAC1B,mBAAmB,EACnB,sBAAsB,EACtB,qBAAqB,EACtB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,KAAK,EACV,0BAA0B,EAC1B,2BAA2B,EAC3B,yBAAyB,EAC1B,MAAM,mCAAmC,CAAC;AAC3C,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,6BAA6B,CAAC;AAMnF,iCAAiC;AACjC,qBAAa,wBAAwB;IACnC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,2BAA2B,EAAE,MAAM,CAAC;IAC7C,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;IAEnC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAS;IACxC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAa;gBAEvB,OAAO,EAAE,+BAA+B;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AO,CAAC,mBAAmB,EAAE,CAAC;IAkC3D,0BAA0B;YACZ,YAAY;IAuB1B,0CAA0C;YAC5B,2BAA2B;IAUzC,iDAAiD;YACnC,kCAAkC;IAehD,gCAAgC;YAClB,oBAAoB;IAQlC,yBAAyB;YACX,8BAA8B;IAO5C,8CAA8C;YAChC,4BAA4B;IAO1C,0CAA0C;YAC5B,oBAAoB;IAelC,oCAAoC;IACpC,OAAO,CAAC,iBAAiB;IAMzB,4BAA4B;IAC5B,OAAO,CAAC,gBAAgB;IAiBxB,iCAAiC;IACjC,OAAO,CAAC,gBAAgB;IAexB,4DAA4D;IAC5D,OAAO,CAAC,yBAAyB;IAYjC,gCAAgC;YAClB,aAAa;IAQ3B,uCAAuC;YACzB,eAAe;CAI9B"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/** LocalGroupSessionDataStore:GroupSession 的 metadata 与消息 JSONL 存储。 */
|
|
2
|
+
import type { FileSystem } from "@downcity/workspace";
|
|
3
|
+
import type { GroupMessage } from "../../types/group/Group.js";
|
|
4
|
+
import type { GroupSessionDataStore, GroupSessionHistoryMeta } from "../../types/group/GroupSessionStore.js";
|
|
5
|
+
/** 单个 GroupSession 的本地文件存储。 */
|
|
6
|
+
export declare class LocalGroupSessionDataStore implements GroupSessionDataStore {
|
|
7
|
+
readonly session_id: string;
|
|
8
|
+
private readonly files;
|
|
9
|
+
private readonly group_id;
|
|
10
|
+
private readonly session_root_path;
|
|
11
|
+
private readonly metadata_file_path;
|
|
12
|
+
private readonly messages_file_path;
|
|
13
|
+
private readonly transaction_lock_path;
|
|
14
|
+
constructor(options: {
|
|
15
|
+
/** 当前 Group StorageScope 文件能力。 */
|
|
16
|
+
files: FileSystem;
|
|
17
|
+
/** 当前 Group StorageScope 根路径。 */
|
|
18
|
+
storage_root_path: string;
|
|
19
|
+
/** 当前 GroupSession 标识。 */
|
|
20
|
+
session_id: string;
|
|
21
|
+
/** 所属 Group 标识。 */
|
|
22
|
+
group_id: string;
|
|
23
|
+
});
|
|
24
|
+
/** 初始化当前 GroupSession 目录与 metadata。 */
|
|
25
|
+
initialize(): Promise<void>;
|
|
26
|
+
/** 读取完整共享消息历史。 */
|
|
27
|
+
list_messages(): Promise<GroupMessage[]>;
|
|
28
|
+
/** 追加一条消息并更新 metadata。 */
|
|
29
|
+
append_message(message: GroupMessage): Promise<void>;
|
|
30
|
+
/** 读取当前 metadata。 */
|
|
31
|
+
read_metadata(): Promise<GroupSessionHistoryMeta>;
|
|
32
|
+
/** 在调用方已经持有事务锁时读取 metadata。 */
|
|
33
|
+
private read_metadata_unlocked;
|
|
34
|
+
/** 原子写入当前 metadata。 */
|
|
35
|
+
write_metadata(metadata: GroupSessionHistoryMeta): Promise<void>;
|
|
36
|
+
/** 在调用方已经持有事务锁时写入 metadata。 */
|
|
37
|
+
private write_metadata_unlocked;
|
|
38
|
+
/** 在文件锁内合并 metadata,避免消息追加和成员映射互相覆盖。 */
|
|
39
|
+
update_metadata(patch: Partial<GroupSessionHistoryMeta>): Promise<GroupSessionHistoryMeta>;
|
|
40
|
+
/** 校验消息日志并由真实消息重建可恢复的摘要字段。 */
|
|
41
|
+
private repair_metadata_unlocked;
|
|
42
|
+
/** 读取 JSONL;仅允许自动修复文件尾部不完整的一行。 */
|
|
43
|
+
private read_messages;
|
|
44
|
+
private create_initial_metadata;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=LocalGroupSessionDataStore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LocalGroupSessionDataStore.d.ts","sourceRoot":"","sources":["../../../src/workspace/store/LocalGroupSessionDataStore.ts"],"names":[],"mappings":"AAAA,uEAAuE;AAGvE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,KAAK,EACV,qBAAqB,EACrB,uBAAuB,EAExB,MAAM,oCAAoC,CAAC;AA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roupSessionDataStore:GroupSession 的 metadata 与消息 JSONL 存储。 */
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
/** 单个 GroupSession 的本地文件存储。 */
|
|
4
|
+
export class LocalGroupSessionDataStore {
|
|
5
|
+
session_id;
|
|
6
|
+
files;
|
|
7
|
+
group_id;
|
|
8
|
+
session_root_path;
|
|
9
|
+
metadata_file_path;
|
|
10
|
+
messages_file_path;
|
|
11
|
+
transaction_lock_path;
|
|
12
|
+
constructor(options) {
|
|
13
|
+
this.files = options.files;
|
|
14
|
+
this.group_id = options.group_id;
|
|
15
|
+
this.session_id = String(options.session_id || "").trim();
|
|
16
|
+
if (!this.session_id)
|
|
17
|
+
throw new Error("GroupSession store requires a non-empty session_id");
|
|
18
|
+
this.session_root_path = path.join(path.resolve(options.storage_root_path), "sessions", encodeURIComponent(this.session_id));
|
|
19
|
+
this.metadata_file_path = path.join(this.session_root_path, "meta.json");
|
|
20
|
+
this.messages_file_path = path.join(this.session_root_path, "messages.jsonl");
|
|
21
|
+
this.transaction_lock_path = path.join(this.session_root_path, ".lock");
|
|
22
|
+
}
|
|
23
|
+
/** 初始化当前 GroupSession 目录与 metadata。 */
|
|
24
|
+
async initialize() {
|
|
25
|
+
await this.files.ensure_directory(this.session_root_path);
|
|
26
|
+
await this.files.with_file_lock(this.transaction_lock_path, async () => {
|
|
27
|
+
if (!(await this.files.path_exists(this.metadata_file_path))) {
|
|
28
|
+
await this.write_metadata_unlocked(this.create_initial_metadata());
|
|
29
|
+
}
|
|
30
|
+
await this.repair_metadata_unlocked();
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
/** 读取完整共享消息历史。 */
|
|
34
|
+
async list_messages() {
|
|
35
|
+
return await this.read_messages();
|
|
36
|
+
}
|
|
37
|
+
/** 追加一条消息并更新 metadata。 */
|
|
38
|
+
async append_message(message) {
|
|
39
|
+
if (message.group_id !== this.group_id) {
|
|
40
|
+
throw new Error(`GroupSession message belongs to another Group: ${this.session_id}`);
|
|
41
|
+
}
|
|
42
|
+
await this.initialize();
|
|
43
|
+
await this.files.with_file_lock(this.transaction_lock_path, async () => {
|
|
44
|
+
await this.files.append_file(this.messages_file_path, `${JSON.stringify(message)}\n`);
|
|
45
|
+
const metadata = await this.read_metadata_unlocked();
|
|
46
|
+
await this.write_metadata_unlocked({
|
|
47
|
+
...metadata,
|
|
48
|
+
updated_at: message.created_at,
|
|
49
|
+
message_count: metadata.message_count + 1,
|
|
50
|
+
preview_text: message.text,
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
/** 读取当前 metadata。 */
|
|
55
|
+
async read_metadata() {
|
|
56
|
+
if (!(await this.files.path_exists(this.metadata_file_path))) {
|
|
57
|
+
return this.create_initial_metadata();
|
|
58
|
+
}
|
|
59
|
+
return await this.read_metadata_unlocked();
|
|
60
|
+
}
|
|
61
|
+
/** 在调用方已经持有事务锁时读取 metadata。 */
|
|
62
|
+
async read_metadata_unlocked() {
|
|
63
|
+
if (!(await this.files.path_exists(this.metadata_file_path))) {
|
|
64
|
+
return this.create_initial_metadata();
|
|
65
|
+
}
|
|
66
|
+
const raw = JSON.parse((await this.files.read_file(this.metadata_file_path)).toString("utf8"));
|
|
67
|
+
if (raw.session_id !== this.session_id) {
|
|
68
|
+
throw new Error(`Invalid GroupSession ownership metadata: ${this.session_id}`);
|
|
69
|
+
}
|
|
70
|
+
if (raw.group_id && raw.group_id !== this.group_id) {
|
|
71
|
+
throw new Error(`GroupSession "${this.session_id}" belongs to another Group`);
|
|
72
|
+
}
|
|
73
|
+
return {
|
|
74
|
+
v: 1,
|
|
75
|
+
session_id: this.session_id,
|
|
76
|
+
group_id: String(raw.group_id || this.group_id),
|
|
77
|
+
...(typeof raw.workspace_id === "string" && raw.workspace_id.trim() ? { workspace_id: raw.workspace_id.trim() } : {}),
|
|
78
|
+
created_at: typeof raw.created_at === "number" ? raw.created_at : Date.now(),
|
|
79
|
+
updated_at: typeof raw.updated_at === "number" ? raw.updated_at : 0,
|
|
80
|
+
message_count: typeof raw.message_count === "number" ? raw.message_count : 0,
|
|
81
|
+
...(typeof raw.preview_text === "string" && raw.preview_text ? { preview_text: raw.preview_text } : {}),
|
|
82
|
+
...(raw.member_session_ids && typeof raw.member_session_ids === "object"
|
|
83
|
+
? { member_session_ids: normalize_member_session_ids(raw.member_session_ids) }
|
|
84
|
+
: {}),
|
|
85
|
+
...(Array.isArray(raw.pending_turns)
|
|
86
|
+
? { pending_turns: normalize_pending_turns(raw.pending_turns) }
|
|
87
|
+
: {}),
|
|
88
|
+
...(Array.isArray(raw.auto_frontier_message_ids)
|
|
89
|
+
? { auto_frontier_message_ids: normalize_message_ids(raw.auto_frontier_message_ids) }
|
|
90
|
+
: {}),
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
/** 原子写入当前 metadata。 */
|
|
94
|
+
async write_metadata(metadata) {
|
|
95
|
+
await this.files.with_file_lock(this.transaction_lock_path, async () => {
|
|
96
|
+
await this.write_metadata_unlocked(metadata);
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
/** 在调用方已经持有事务锁时写入 metadata。 */
|
|
100
|
+
async write_metadata_unlocked(metadata) {
|
|
101
|
+
if (metadata.session_id !== this.session_id || metadata.group_id !== this.group_id) {
|
|
102
|
+
throw new Error(`Invalid GroupSession metadata ownership: ${this.session_id}`);
|
|
103
|
+
}
|
|
104
|
+
await this.files.ensure_directory(this.session_root_path);
|
|
105
|
+
await this.files.write_file_atomically(this.metadata_file_path, `${JSON.stringify(metadata, null, 2)}\n`);
|
|
106
|
+
}
|
|
107
|
+
/** 在文件锁内合并 metadata,避免消息追加和成员映射互相覆盖。 */
|
|
108
|
+
async update_metadata(patch) {
|
|
109
|
+
await this.initialize();
|
|
110
|
+
return await this.files.with_file_lock(this.transaction_lock_path, async () => {
|
|
111
|
+
const next_metadata = {
|
|
112
|
+
...(await this.read_metadata_unlocked()),
|
|
113
|
+
...patch,
|
|
114
|
+
session_id: this.session_id,
|
|
115
|
+
group_id: this.group_id,
|
|
116
|
+
v: 1,
|
|
117
|
+
};
|
|
118
|
+
await this.write_metadata_unlocked(next_metadata);
|
|
119
|
+
return next_metadata;
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
/** 校验消息日志并由真实消息重建可恢复的摘要字段。 */
|
|
123
|
+
async repair_metadata_unlocked() {
|
|
124
|
+
const messages = await this.read_messages(true);
|
|
125
|
+
const metadata = await this.read_metadata_unlocked();
|
|
126
|
+
const first_message = messages[0];
|
|
127
|
+
const last_message = messages[messages.length - 1];
|
|
128
|
+
await this.write_metadata_unlocked({
|
|
129
|
+
...metadata,
|
|
130
|
+
created_at: first_message?.created_at || metadata.created_at,
|
|
131
|
+
updated_at: last_message?.created_at || metadata.updated_at,
|
|
132
|
+
message_count: messages.length,
|
|
133
|
+
...(last_message?.text ? { preview_text: last_message.text } : {}),
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
/** 读取 JSONL;仅允许自动修复文件尾部不完整的一行。 */
|
|
137
|
+
async read_messages(repair_tail = false) {
|
|
138
|
+
if (!(await this.files.path_exists(this.messages_file_path)))
|
|
139
|
+
return [];
|
|
140
|
+
const content = (await this.files.read_file(this.messages_file_path)).toString("utf8");
|
|
141
|
+
const lines = content.split("\n");
|
|
142
|
+
const messages = [];
|
|
143
|
+
for (let line_index = 0; line_index < lines.length; line_index += 1) {
|
|
144
|
+
const line = lines[line_index];
|
|
145
|
+
if (!line.trim())
|
|
146
|
+
continue;
|
|
147
|
+
let message;
|
|
148
|
+
try {
|
|
149
|
+
message = JSON.parse(line);
|
|
150
|
+
}
|
|
151
|
+
catch (error) {
|
|
152
|
+
const is_tail = lines.slice(line_index + 1).every((item) => !item.trim());
|
|
153
|
+
if (!repair_tail || !is_tail)
|
|
154
|
+
throw error;
|
|
155
|
+
const repaired_content = messages.map((item) => JSON.stringify(item)).join("\n");
|
|
156
|
+
await this.files.write_file_atomically(this.messages_file_path, repaired_content ? `${repaired_content}\n` : "");
|
|
157
|
+
break;
|
|
158
|
+
}
|
|
159
|
+
if (message.group_id !== this.group_id) {
|
|
160
|
+
throw new Error(`GroupSession message belongs to another Group: ${this.session_id}`);
|
|
161
|
+
}
|
|
162
|
+
messages.push(message);
|
|
163
|
+
}
|
|
164
|
+
return messages;
|
|
165
|
+
}
|
|
166
|
+
create_initial_metadata() {
|
|
167
|
+
const created_at = Date.now();
|
|
168
|
+
return {
|
|
169
|
+
v: 1,
|
|
170
|
+
session_id: this.session_id,
|
|
171
|
+
group_id: this.group_id,
|
|
172
|
+
created_at,
|
|
173
|
+
updated_at: created_at,
|
|
174
|
+
message_count: 0,
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
function normalize_member_session_ids(input) {
|
|
179
|
+
return Object.fromEntries(Object.entries(input).filter(([agent_id, session_id]) => Boolean(agent_id.trim()) && typeof session_id === "string" && session_id.trim()));
|
|
180
|
+
}
|
|
181
|
+
function normalize_pending_turns(input) {
|
|
182
|
+
return input.flatMap((item) => {
|
|
183
|
+
if (!item || typeof item !== "object")
|
|
184
|
+
return [];
|
|
185
|
+
const candidate = item;
|
|
186
|
+
const turn_id = typeof candidate.turn_id === "string" ? candidate.turn_id.trim() : "";
|
|
187
|
+
const root_message_id = typeof candidate.root_message_id === "string" ? candidate.root_message_id.trim() : "";
|
|
188
|
+
const context_message_ids = Array.isArray(candidate.context_message_ids)
|
|
189
|
+
? normalize_message_ids(candidate.context_message_ids)
|
|
190
|
+
: [];
|
|
191
|
+
return turn_id && root_message_id ? [{ turn_id, root_message_id, context_message_ids }] : [];
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
function normalize_message_ids(input) {
|
|
195
|
+
return [...new Set(input.filter((item) => typeof item === "string").map((item) => item.trim()).filter(Boolean))];
|
|
196
|
+
}
|
|
197
|
+
//# sourceMappingURL=LocalGroupSessionDataStore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LocalGroupSessionDataStore.js","sourceRo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O,EAAE,eAAe,EAAE,mBAAmB,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAC/F,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,qBAAqB,CAAC,KAAgB;IAC7C,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAkB,EAAE,CAAC,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AACnI,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/** LocalGroupSessionStore:基于 City StorageScope 的 GroupSession 集合存储。 */
|
|
2
|
+
import type { GroupSessionDataStore, GroupSessionHistoryMeta, GroupSessionStore, GroupSessionStoreOptions } from "../../types/group/GroupSessionStore.js";
|
|
3
|
+
/** GroupSession 的底层文件 Store。 */
|
|
4
|
+
export declare class LocalGroupSessionStore implements GroupSessionStore {
|
|
5
|
+
private readonly files;
|
|
6
|
+
private readonly storage_root_path;
|
|
7
|
+
private readonly group_id;
|
|
8
|
+
private readonly sessions_by_id;
|
|
9
|
+
constructor(options: GroupSessionStoreOptions);
|
|
10
|
+
/** 返回指定 GroupSession 的持久化视图。 */
|
|
11
|
+
session(session_id: string): GroupSessionDataStore;
|
|
12
|
+
/** 判断指定 GroupSession 是否存在。 */
|
|
13
|
+
has_session(session_id: string): Promise<boolean>;
|
|
14
|
+
/** 列出当前 Group 的全部 Session metadata。 */
|
|
15
|
+
list_session_metadata(): Promise<GroupSessionHistoryMeta[]>;
|
|
16
|
+
/** 删除指定 GroupSession 的全部数据。 */
|
|
17
|
+
remove_session(session_id: string): Promise<boolean>;
|
|
18
|
+
/** 释放当前 Store 的运行时缓存。 */
|
|
19
|
+
dispose(): Promise<void>;
|
|
20
|
+
private session_path;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=LocalGroupSessionStore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LocalGroupSessionStore.d.ts","sourceRoot":"","sources":["../../../src/workspace/store/LocalGroupSessionStore.ts"],"names":[],"mappings":"AAAA,uEAAuE;AAIvE,OAAO,KAAK,EACV,qBAAqB,EACrB,uBAAuB,EACvB,iBAAiB,EACjB,wBAAwB,EACzB,MAAM,oCAAoC,CAAC;AAG5C,gCAAgC;AAChC,qBAAa,sBAAuB,YAAW,iBAAiB;IAC9D,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAa;IACnC,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAS;IAC3C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAClC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAiD;gBAEpE,OAAO,EAAE,wBAAwB;IAM7C,gCAAgC;IAChC,OAAO,CAAC,UAAU,EAAE,MAAM,GAAG,qBAAqB;IAelD,8BAA8B;IACxB,WAAW,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAIvD,uCAAuC;IACjC,qBAAqB,IAAI,OAAO,CAAC,uBAAuB,EAAE,CAAC;IAYjE,+BAA+B;IACzB,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAS1D,yBAAyB;IACnB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAI9B,OAAO,CAAC,YAAY;CAOrB"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/** LocalGroupSessionStore:基于 City StorageScope 的 GroupSession 集合存储。 */
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { LocalGroupSessionDataStore } from "./LocalGroupSessionDataStore.js";
|
|
4
|
+
/** GroupSession 的底层文件 Store。 */
|
|
5
|
+
export class LocalGroupSessionStore {
|
|
6
|
+
files;
|
|
7
|
+
storage_root_path;
|
|
8
|
+
group_id;
|
|
9
|
+
sessions_by_id = new Map();
|
|
10
|
+
constructor(options) {
|
|
11
|
+
this.files = options.files;
|
|
12
|
+
this.storage_root_path = options.storage_root_path;
|
|
13
|
+
this.group_id = options.group_id;
|
|
14
|
+
}
|
|
15
|
+
/** 返回指定 GroupSession 的持久化视图。 */
|
|
16
|
+
session(session_id) {
|
|
17
|
+
const resolved_session_id = String(session_id || "").trim();
|
|
18
|
+
if (!resolved_session_id)
|
|
19
|
+
throw new Error("GroupSessionStore.session requires a non-empty session_id");
|
|
20
|
+
const cached = this.sessions_by_id.get(resolved_session_id);
|
|
21
|
+
if (cached)
|
|
22
|
+
return cached;
|
|
23
|
+
const created = new LocalGroupSessionDataStore({
|
|
24
|
+
files: this.files,
|
|
25
|
+
storage_root_path: this.storage_root_path,
|
|
26
|
+
session_id: resolved_session_id,
|
|
27
|
+
group_id: this.group_id,
|
|
28
|
+
});
|
|
29
|
+
this.sessions_by_id.set(resolved_session_id, created);
|
|
30
|
+
return created;
|
|
31
|
+
}
|
|
32
|
+
/** 判断指定 GroupSession 是否存在。 */
|
|
33
|
+
async has_session(session_id) {
|
|
34
|
+
return await this.files.path_exists(this.session_path(session_id));
|
|
35
|
+
}
|
|
36
|
+
/** 列出当前 Group 的全部 Session metadata。 */
|
|
37
|
+
async list_session_metadata() {
|
|
38
|
+
const sessions_path = path.join(path.resolve(this.storage_root_path), "sessions");
|
|
39
|
+
if (!(await this.files.path_exists(sessions_path)))
|
|
40
|
+
return [];
|
|
41
|
+
const entries = await this.files.read_directory(sessions_path);
|
|
42
|
+
const metadata = [];
|
|
43
|
+
for (const entry of entries.filter((item) => item.is_directory)) {
|
|
44
|
+
const session_id = decode_session_id(entry.name);
|
|
45
|
+
metadata.push(await this.session(session_id).read_metadata());
|
|
46
|
+
}
|
|
47
|
+
return metadata.sort((left, right) => right.updated_at - left.updated_at);
|
|
48
|
+
}
|
|
49
|
+
/** 删除指定 GroupSession 的全部数据。 */
|
|
50
|
+
async remove_session(session_id) {
|
|
51
|
+
const resolved_session_id = String(session_id || "").trim();
|
|
52
|
+
const session_path = this.session_path(resolved_session_id);
|
|
53
|
+
const existed = await this.files.path_exists(session_path);
|
|
54
|
+
if (existed)
|
|
55
|
+
await this.files.remove_path(session_path);
|
|
56
|
+
this.sessions_by_id.delete(resolved_session_id);
|
|
57
|
+
return existed;
|
|
58
|
+
}
|
|
59
|
+
/** 释放当前 Store 的运行时缓存。 */
|
|
60
|
+
async dispose() {
|
|
61
|
+
this.sessions_by_id.clear();
|
|
62
|
+
}
|
|
63
|
+
session_path(session_id) {
|
|
64
|
+
return path.join(path.resolve(this.storage_root_path), "sessions", encodeURIComponent(String(session_id || "").trim()));
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
function decode_session_id(input) {
|
|
68
|
+
try {
|
|
69
|
+
return decodeURIComponent(input);
|
|
70
|
+
}
|
|
71
|
+
catch {
|
|
72
|
+
return input;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=LocalGroupSessionStore.js.map
|