@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,72 +1,34 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* CoreEngine Tool Loop 的纯信号与诊断模块。
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
* - 这里只放“如何判断继续执行 / 如何输出调试摘要”的纯函数。
|
|
6
|
-
* - 不放 tool-loop 主流程,避免执行内核被大量辅助细节淹没。
|
|
7
|
-
* - 目标是让 tool-loop 保持“只看主链路就能理解”的结构。
|
|
4
|
+
* 所有消息判断都直接读取 canonical `SessionAssistantMessagePart`,不依赖 UI 投影。
|
|
8
5
|
*/
|
|
9
|
-
import type { SessionMessageRecordV1 } from "../../executor/types/SessionRecords.js";
|
|
10
6
|
import type { JsonObject } from "../../types/common/Json.js";
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
*/
|
|
7
|
+
import type { SessionAssistantMessagePart } from "../../types/session/SessionMessage.js";
|
|
8
|
+
/** 单次 Tool Loop 允许的最大 Step 数。 */
|
|
14
9
|
export declare const MAX_TOOL_LOOP_STEPS = 64;
|
|
15
|
-
/**
|
|
16
|
-
* text-only 提醒续跑的最大次数。
|
|
17
|
-
*
|
|
18
|
-
* 关键点(中文)
|
|
19
|
-
* - 仅用于“模型明显承诺下一步、但没有实际调用工具”的兜底。
|
|
20
|
-
* - 设置较小上限,避免进入无界自催促循环。
|
|
21
|
-
*/
|
|
22
|
-
export declare const MAX_TEXT_ONLY_CONTINUATIONS = 3;
|
|
23
|
-
/**
|
|
24
|
-
* 不完整响应自动恢复的最大次数。
|
|
25
|
-
*
|
|
26
|
-
* 关键点(中文)
|
|
27
|
-
* - 仅针对 provider 流异常结束这类“本该继续、但响应被截断”的情况。
|
|
28
|
-
* - 只补一次,避免在 provider 异常持续时进入长时间空转。
|
|
29
|
-
*/
|
|
10
|
+
/** 不完整响应自动恢复的最大次数。 */
|
|
30
11
|
export declare const MAX_INCOMPLETE_RESPONSE_RECOVERIES = 1;
|
|
31
|
-
/**
|
|
32
|
-
* 生成日志友好的单行预览文本。
|
|
33
|
-
*/
|
|
12
|
+
/** 生成日志友好的单行预览文本。 */
|
|
34
13
|
export declare function to_inline_preview(value: unknown): string;
|
|
35
|
-
/**
|
|
36
|
-
* 汇总单个 step 的关键信号,便于定位“为什么没有继续下一轮”。
|
|
37
|
-
*/
|
|
14
|
+
/** 汇总单个 Step 的关键信号。 */
|
|
38
15
|
export declare function summarize_step_for_debug(step_result: unknown): JsonObject;
|
|
39
|
-
/**
|
|
40
|
-
|
|
41
|
-
*/
|
|
42
|
-
export declare function
|
|
43
|
-
/**
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* 构造“不完整响应恢复”提示。
|
|
52
|
-
*/
|
|
53
|
-
export declare function build_incomplete_response_recovery_nudge(recoveryIndex: number): string;
|
|
54
|
-
/**
|
|
55
|
-
* 检测“响应被中断但模型没有正常完成”的情况。
|
|
56
|
-
*/
|
|
57
|
-
export declare function detect_incomplete_response(params: {
|
|
16
|
+
/** 汇总最终 canonical Assistant Parts。 */
|
|
17
|
+
export declare function summarize_assistant_parts_for_debug(parts: readonly SessionAssistantMessagePart[]): JsonObject;
|
|
18
|
+
/** 按 Step 顺序合并 canonical Assistant Parts。 */
|
|
19
|
+
export declare function merge_assistant_parts(base: readonly SessionAssistantMessagePart[], incoming: readonly SessionAssistantMessagePart[]): SessionAssistantMessagePart[];
|
|
20
|
+
/** 从 canonical Assistant Parts 提取用户可见文本。 */
|
|
21
|
+
export declare function extract_assistant_text(parts: readonly SessionAssistantMessagePart[]): string;
|
|
22
|
+
/** 构造不完整响应恢复提示。 */
|
|
23
|
+
export declare function build_incomplete_response_recovery_nudge(recovery_index: number): string;
|
|
24
|
+
/** 检测模型报告未知完成原因或存在未完成 Tool Part 的情况。 */
|
|
25
|
+
export declare function detect_incomplete_response(input: {
|
|
26
|
+
/** 当前 Step 结果。 */
|
|
58
27
|
step_result: unknown;
|
|
59
|
-
|
|
28
|
+
/** 当前 Step canonical Assistant Parts。 */
|
|
29
|
+
assistant_parts: readonly SessionAssistantMessagePart[];
|
|
60
30
|
}): {
|
|
61
31
|
reason: string;
|
|
62
32
|
details: JsonObject;
|
|
63
33
|
} | null;
|
|
64
|
-
/**
|
|
65
|
-
* 检测“只有口头计划,没有真正执行”的续跑信号。
|
|
66
|
-
*/
|
|
67
|
-
export declare function detect_text_only_continuation_reason(step_result: unknown): string | null;
|
|
68
|
-
/**
|
|
69
|
-
* 构造“text-only 续跑”提示。
|
|
70
|
-
*/
|
|
71
|
-
export declare function build_text_only_continuation_nudge(continuationIndex: number): string;
|
|
72
34
|
//# sourceMappingURL=CoreEngineSignals.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CoreEngineSignals.d.ts","sourceRoot":"","sources":["../../../src/executor/core-engine/CoreEngineSignals.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"CoreEngineSignals.d.ts","sourceRoot":"","sources":["../../../src/executor/core-engine/CoreEngineSignals.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,mCAAmC,CAAC;AAErF,iCAAiC;AACjC,eAAO,MAAM,mBAAmB,KAAK,CAAC;AAEtC,sBAAsB;AACtB,eAAO,MAAM,kCAAkC,IAAI,CAAC;AAKpD,qBAAqB;AACrB,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAMxD;AAED,uBAAuB;AACvB,wBAAgB,wBAAwB,CAAC,WAAW,EAAE,OAAO,GAAG,UAAU,CA8BzE;AAED,sCAAsC;AACtC,wBAAgB,mCAAmC,CACjD,KAAK,EAAE,SAAS,2BAA2B,EAAE,GAC5C,UAAU,CAcZ;AAED,6CAA6C;AAC7C,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,SAAS,2BAA2B,EAAE,EAC5C,QAAQ,EAAE,SAAS,2BAA2B,EAAE,GAC/C,2BAA2B,EAAE,CAK/B;AAED,4CAA4C;AAC5C,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,SAAS,2BAA2B,EAAE,GAC5C,MAAM,CAaR;AAED,mBAAmB;AACnB,wBAAgB,wCAAwC,CACtD,cAAc,EAAE,MAAM,GACrB,MAAM,CAQR;AAED,wCAAwC;AACxC,wBAAgB,0BAA0B,CAAC,KAAK,EAAE;IAChD,kBAAkB;IAClB,WAAW,EAAE,OAAO,CAAC;IACrB,yCAAyC;IACzC,eAAe,EAAE,SAAS,2BAA2B,EAAE,CAAC;CACzD,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,UAAU,CAAA;CAAE,GAAG,IAAI,CAgCjD"}
|
|
@@ -1,264 +1,91 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* CoreEngine Tool Loop 的纯信号与诊断模块。
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
* - 这里只放“如何判断继续执行 / 如何输出调试摘要”的纯函数。
|
|
6
|
-
* - 不放 tool-loop 主流程,避免执行内核被大量辅助细节淹没。
|
|
7
|
-
* - 目标是让 tool-loop 保持“只看主链路就能理解”的结构。
|
|
8
|
-
*/
|
|
9
|
-
import { getToolName, isTextUIPart, isToolUIPart, } from "ai";
|
|
10
|
-
/**
|
|
11
|
-
* 单次 tool-loop 允许的最大 step 数。
|
|
4
|
+
* 所有消息判断都直接读取 canonical `SessionAssistantMessagePart`,不依赖 UI 投影。
|
|
12
5
|
*/
|
|
6
|
+
/** 单次 Tool Loop 允许的最大 Step 数。 */
|
|
13
7
|
export const MAX_TOOL_LOOP_STEPS = 64;
|
|
14
|
-
/**
|
|
15
|
-
* text-only 提醒续跑的最大次数。
|
|
16
|
-
*
|
|
17
|
-
* 关键点(中文)
|
|
18
|
-
* - 仅用于“模型明显承诺下一步、但没有实际调用工具”的兜底。
|
|
19
|
-
* - 设置较小上限,避免进入无界自催促循环。
|
|
20
|
-
*/
|
|
21
|
-
export const MAX_TEXT_ONLY_CONTINUATIONS = 3;
|
|
22
|
-
/**
|
|
23
|
-
* 不完整响应自动恢复的最大次数。
|
|
24
|
-
*
|
|
25
|
-
* 关键点(中文)
|
|
26
|
-
* - 仅针对 provider 流异常结束这类“本该继续、但响应被截断”的情况。
|
|
27
|
-
* - 只补一次,避免在 provider 异常持续时进入长时间空转。
|
|
28
|
-
*/
|
|
8
|
+
/** 不完整响应自动恢复的最大次数。 */
|
|
29
9
|
export const MAX_INCOMPLETE_RESPONSE_RECOVERIES = 1;
|
|
30
|
-
/**
|
|
31
|
-
* 调试日志中的文本预览最大长度。
|
|
32
|
-
*/
|
|
10
|
+
/** 调试日志中的文本预览最大长度。 */
|
|
33
11
|
const DEBUG_TEXT_PREVIEW_MAX_CHARS = 180;
|
|
34
|
-
/**
|
|
35
|
-
* UI tool part 中表示“尚未完成”的状态集合。
|
|
36
|
-
*/
|
|
37
|
-
const INCOMPLETE_TOOL_PART_STATES = new Set([
|
|
38
|
-
"input-streaming",
|
|
39
|
-
"input-available",
|
|
40
|
-
"output-streaming",
|
|
41
|
-
]);
|
|
42
|
-
/**
|
|
43
|
-
* 可能表示“只是描述下一步、还没真正执行”的文本模式。
|
|
44
|
-
*
|
|
45
|
-
* 关键点(中文)
|
|
46
|
-
* - 这里故意只匹配非常明显的“我现在开始/接下来我会”类表达。
|
|
47
|
-
* - 不做泛化判断,避免把正常最终答案误判为继续执行。
|
|
48
|
-
*/
|
|
49
|
-
const TEXT_ONLY_CONTINUATION_PATTERNS = [
|
|
50
|
-
{ name: "zh_start_now", pattern: /我现在开始/ },
|
|
51
|
-
{ name: "zh_next_will", pattern: /接下来我会/ },
|
|
52
|
-
{ name: "zh_will_do", pattern: /我会(?:先|继续|开始|基于|按)/ },
|
|
53
|
-
{ name: "zh_after_finish", pattern: /写完.*发你|完成后.*发你/ },
|
|
54
|
-
{ name: "zh_fill_write", pattern: /开始(?:填充|写|补全)/ },
|
|
55
|
-
{ name: "zh_one_by_one", pattern: /先把.+写完整/ },
|
|
56
|
-
{
|
|
57
|
-
name: "en_start_now",
|
|
58
|
-
pattern: /\bi(?:'m| am)?\s+(?:now\s+)?(?:starting|going to start)\b/i,
|
|
59
|
-
},
|
|
60
|
-
{ name: "en_next_will", pattern: /\bnext,\s*i(?:'ll| will)\b/i },
|
|
61
|
-
{
|
|
62
|
-
name: "en_will_do",
|
|
63
|
-
pattern: /\bi(?:'ll| will)\s+(?:start|continue|write|fill|complete)\b/i,
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
name: "en_after_finish",
|
|
67
|
-
pattern: /\bafter (?:that|this),?\s*i(?:'ll| will)\b/i,
|
|
68
|
-
},
|
|
69
|
-
];
|
|
70
|
-
function toJsonObject(value) {
|
|
71
|
-
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
72
|
-
return null;
|
|
73
|
-
return value;
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* 生成日志友好的单行预览文本。
|
|
77
|
-
*/
|
|
12
|
+
/** 生成日志友好的单行预览文本。 */
|
|
78
13
|
export function to_inline_preview(value) {
|
|
79
|
-
const normalized = String(value ?? "").replace(/\s+/
|
|
14
|
+
const normalized = String(value ?? "").replace(/\s+/gu, " ").trim();
|
|
80
15
|
if (!normalized)
|
|
81
16
|
return "";
|
|
82
17
|
return normalized.length > DEBUG_TEXT_PREVIEW_MAX_CHARS
|
|
83
18
|
? `${normalized.slice(0, DEBUG_TEXT_PREVIEW_MAX_CHARS)}...`
|
|
84
19
|
: normalized;
|
|
85
20
|
}
|
|
86
|
-
|
|
87
|
-
if (!Array.isArray(value))
|
|
88
|
-
return [];
|
|
89
|
-
return value
|
|
90
|
-
.map((item) => {
|
|
91
|
-
const record = toJsonObject(item);
|
|
92
|
-
return typeof record?.toolName === "string" ? record.toolName : "";
|
|
93
|
-
})
|
|
94
|
-
.filter((name) => Boolean(name))
|
|
95
|
-
.slice(0, 8);
|
|
96
|
-
}
|
|
97
|
-
function pickResponseMessageRoles(value) {
|
|
98
|
-
if (!Array.isArray(value))
|
|
99
|
-
return [];
|
|
100
|
-
return value
|
|
101
|
-
.map((item) => {
|
|
102
|
-
const record = toJsonObject(item);
|
|
103
|
-
return typeof record?.role === "string" ? record.role : "";
|
|
104
|
-
})
|
|
105
|
-
.filter((role) => Boolean(role))
|
|
106
|
-
.slice(0, 8);
|
|
107
|
-
}
|
|
108
|
-
function summarizeResponseBodyForDebug(body) {
|
|
109
|
-
const bodyRecord = toJsonObject(body);
|
|
110
|
-
if (!bodyRecord)
|
|
111
|
-
return {};
|
|
112
|
-
const outputItems = Array.isArray(bodyRecord.output) ? bodyRecord.output : [];
|
|
113
|
-
const outputTypes = outputItems
|
|
114
|
-
.map((item) => {
|
|
115
|
-
const record = toJsonObject(item);
|
|
116
|
-
return typeof record?.type === "string" ? record.type : "";
|
|
117
|
-
})
|
|
118
|
-
.filter((type) => Boolean(type))
|
|
119
|
-
.slice(0, 12);
|
|
120
|
-
const functionCallNames = outputItems
|
|
121
|
-
.map((item) => {
|
|
122
|
-
const record = toJsonObject(item);
|
|
123
|
-
if (record?.type !== "function_call")
|
|
124
|
-
return "";
|
|
125
|
-
return typeof record.name === "string" ? record.name : "";
|
|
126
|
-
})
|
|
127
|
-
.filter((name) => Boolean(name))
|
|
128
|
-
.slice(0, 8);
|
|
129
|
-
return {
|
|
130
|
-
responseBodyKeys: Object.keys(bodyRecord).slice(0, 12),
|
|
131
|
-
responseOutputCount: outputItems.length,
|
|
132
|
-
responseOutputTypes: outputTypes,
|
|
133
|
-
responseHasFunctionCall: functionCallNames.length > 0,
|
|
134
|
-
responseFunctionCallNames: functionCallNames,
|
|
135
|
-
};
|
|
136
|
-
}
|
|
137
|
-
/**
|
|
138
|
-
* 汇总单个 step 的关键信号,便于定位“为什么没有继续下一轮”。
|
|
139
|
-
*/
|
|
21
|
+
/** 汇总单个 Step 的关键信号。 */
|
|
140
22
|
export function summarize_step_for_debug(step_result) {
|
|
141
|
-
const record =
|
|
142
|
-
const usage =
|
|
143
|
-
const response =
|
|
144
|
-
const
|
|
145
|
-
const
|
|
146
|
-
const
|
|
23
|
+
const record = to_json_object(step_result) ?? {};
|
|
24
|
+
const usage = to_json_object(record.usage);
|
|
25
|
+
const response = to_json_object(record.response);
|
|
26
|
+
const tool_calls = Array.isArray(record.tool_calls) ? record.tool_calls : [];
|
|
27
|
+
const tool_results = Array.isArray(record.tool_results) ? record.tool_results : [];
|
|
28
|
+
const response_messages = Array.isArray(response?.messages)
|
|
147
29
|
? response.messages
|
|
148
30
|
: [];
|
|
149
31
|
return {
|
|
150
|
-
finishReason: typeof record.
|
|
151
|
-
rawFinishReason: typeof record.rawFinishReason === "string" ? record.rawFinishReason : null,
|
|
32
|
+
finishReason: typeof record.finish_reason === "string" ? record.finish_reason : null,
|
|
152
33
|
textLength: typeof record.text === "string" ? record.text.length : 0,
|
|
153
34
|
textPreview: to_inline_preview(record.text),
|
|
154
|
-
toolCallCount:
|
|
155
|
-
toolCallNames:
|
|
156
|
-
toolResultCount:
|
|
157
|
-
toolResultNames:
|
|
158
|
-
responseMessageCount:
|
|
159
|
-
responseMessageRoles:
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
35
|
+
toolCallCount: tool_calls.length,
|
|
36
|
+
toolCallNames: pick_tool_names(tool_calls),
|
|
37
|
+
toolResultCount: tool_results.length,
|
|
38
|
+
toolResultNames: pick_tool_names(tool_results),
|
|
39
|
+
responseMessageCount: response_messages.length,
|
|
40
|
+
responseMessageRoles: response_messages
|
|
41
|
+
.map((item) => to_json_object(item)?.role)
|
|
42
|
+
.filter((role) => typeof role === "string")
|
|
43
|
+
.slice(0, 8),
|
|
44
|
+
inputTokens: typeof usage?.input_tokens === "number" ? usage.input_tokens : null,
|
|
45
|
+
outputTokens: typeof usage?.output_tokens === "number" ? usage.output_tokens : null,
|
|
46
|
+
totalTokens: typeof usage?.total_tokens === "number" ? usage.total_tokens : null,
|
|
164
47
|
};
|
|
165
48
|
}
|
|
166
|
-
/**
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
.filter(isTextUIPart)
|
|
173
|
-
.map((part) => String(part.text ?? ""))
|
|
174
|
-
.join("\n")
|
|
175
|
-
.trim();
|
|
176
|
-
const toolNames = parts
|
|
177
|
-
.filter(isToolUIPart)
|
|
178
|
-
.map((part) => String(getToolName(part) || ""))
|
|
179
|
-
.filter((name) => Boolean(name))
|
|
49
|
+
/** 汇总最终 canonical Assistant Parts。 */
|
|
50
|
+
export function summarize_assistant_parts_for_debug(parts) {
|
|
51
|
+
const text = extract_assistant_text(parts);
|
|
52
|
+
const tool_names = parts
|
|
53
|
+
.filter((part) => part.type === "tool")
|
|
54
|
+
.map((part) => part.tool_name)
|
|
180
55
|
.slice(0, 8);
|
|
181
|
-
const partTypes = parts
|
|
182
|
-
.map((part) => {
|
|
183
|
-
const record = toJsonObject(part);
|
|
184
|
-
return typeof record?.type === "string" ? record.type : "unknown";
|
|
185
|
-
})
|
|
186
|
-
.slice(0, 12);
|
|
187
56
|
return {
|
|
188
|
-
role: typeof message?.role === "string" ? message.role : null,
|
|
189
57
|
partCount: parts.length,
|
|
190
|
-
partTypes,
|
|
58
|
+
partTypes: parts.map((part) => part.type).slice(0, 12),
|
|
191
59
|
textLength: text.length,
|
|
192
60
|
textPreview: to_inline_preview(text),
|
|
193
|
-
toolPartCount:
|
|
194
|
-
toolNames,
|
|
61
|
+
toolPartCount: tool_names.length,
|
|
62
|
+
toolNames: tool_names,
|
|
195
63
|
};
|
|
196
64
|
}
|
|
197
|
-
/**
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
export function merge_assistant_ui_messages(base, incoming) {
|
|
204
|
-
if (!base)
|
|
205
|
-
return incoming;
|
|
206
|
-
const baseMetadata = base.metadata;
|
|
207
|
-
const incomingMetadata = incoming.metadata;
|
|
208
|
-
// 原生审批恢复会把上一条 assistant message 作为 originalMessages 传入,
|
|
209
|
-
// SDK 返回的是同一条消息的完整快照,此时应整体替换而不是重复拼接。
|
|
210
|
-
const merged_parts = base.id === incoming.id
|
|
211
|
-
? incoming.parts
|
|
212
|
-
: [
|
|
213
|
-
...(Array.isArray(base.parts) ? base.parts : []),
|
|
214
|
-
...(Array.isArray(incoming.parts) ? incoming.parts : []),
|
|
215
|
-
];
|
|
216
|
-
return {
|
|
217
|
-
...base,
|
|
218
|
-
metadata: {
|
|
219
|
-
v: incomingMetadata?.v ?? baseMetadata?.v ?? 1,
|
|
220
|
-
ts: incomingMetadata?.ts ?? baseMetadata?.ts ?? Date.now(),
|
|
221
|
-
session_id: incomingMetadata?.session_id ?? baseMetadata?.session_id ?? "",
|
|
222
|
-
...(baseMetadata || {}),
|
|
223
|
-
...(incomingMetadata || {}),
|
|
224
|
-
},
|
|
225
|
-
parts: merged_parts,
|
|
226
|
-
};
|
|
65
|
+
/** 按 Step 顺序合并 canonical Assistant Parts。 */
|
|
66
|
+
export function merge_assistant_parts(base, incoming) {
|
|
67
|
+
return [...base, ...incoming].map((part, index) => ({
|
|
68
|
+
...part,
|
|
69
|
+
sequence: index + 1,
|
|
70
|
+
}));
|
|
227
71
|
}
|
|
228
|
-
|
|
229
|
-
|
|
72
|
+
/** 从 canonical Assistant Parts 提取用户可见文本。 */
|
|
73
|
+
export function extract_assistant_text(parts) {
|
|
74
|
+
const chat_send = [...parts].reverse().find((part) => part.type === "tool" && part.tool_name === "chat_send");
|
|
75
|
+
if (chat_send?.type === "tool" && chat_send.input) {
|
|
76
|
+
const input = to_json_object(chat_send.input);
|
|
77
|
+
const text = typeof input?.text === "string" ? input.text.trim() : "";
|
|
78
|
+
if (text && chat_send.state === "completed")
|
|
79
|
+
return text;
|
|
80
|
+
}
|
|
230
81
|
return parts
|
|
231
|
-
.
|
|
232
|
-
.
|
|
233
|
-
|
|
234
|
-
state: typeof toJsonObject(part)?.state === "string"
|
|
235
|
-
? String(toJsonObject(part)?.state)
|
|
236
|
-
: "",
|
|
237
|
-
}))
|
|
238
|
-
.filter((item) => INCOMPLETE_TOOL_PART_STATES.has(item.state))
|
|
239
|
-
.slice(0, 8);
|
|
240
|
-
}
|
|
241
|
-
function looksLikeIncompleteText(text) {
|
|
242
|
-
const normalized = String(text || "").trim();
|
|
243
|
-
if (!normalized)
|
|
244
|
-
return false;
|
|
245
|
-
if (normalized.endsWith("```"))
|
|
246
|
-
return false;
|
|
247
|
-
if (/[。!?.!?]$/.test(normalized))
|
|
248
|
-
return false;
|
|
249
|
-
if (/[::\-((`]$/.test(normalized))
|
|
250
|
-
return true;
|
|
251
|
-
if (/#{1,6}\s*$/.test(normalized))
|
|
252
|
-
return true;
|
|
253
|
-
if (/^- [^\n]*$/m.test(normalized.split("\n").slice(-1)[0] || ""))
|
|
254
|
-
return true;
|
|
255
|
-
return true;
|
|
82
|
+
.flatMap((part) => part.type === "text" ? [part.text] : [])
|
|
83
|
+
.join("\n")
|
|
84
|
+
.trim();
|
|
256
85
|
}
|
|
257
|
-
/**
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
export function build_incomplete_response_recovery_nudge(recoveryIndex) {
|
|
261
|
-
const round = Math.max(1, recoveryIndex);
|
|
86
|
+
/** 构造不完整响应恢复提示。 */
|
|
87
|
+
export function build_incomplete_response_recovery_nudge(recovery_index) {
|
|
88
|
+
const round = Math.max(1, recovery_index);
|
|
262
89
|
return [
|
|
263
90
|
`系统恢复提醒(第 ${round} 次):上一轮响应在流式阶段异常中断。`,
|
|
264
91
|
"不要复述已完成内容。",
|
|
@@ -266,97 +93,50 @@ export function build_incomplete_response_recovery_nudge(recoveryIndex) {
|
|
|
266
93
|
"只有在答案完整结束、任务真正完成、或明确受阻时才停止。",
|
|
267
94
|
].join("\n");
|
|
268
95
|
}
|
|
269
|
-
/**
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
const rawFinishReason = typeof record.rawFinishReason === "string" ? record.rawFinishReason : "";
|
|
96
|
+
/** 检测模型报告未知完成原因或存在未完成 Tool Part 的情况。 */
|
|
97
|
+
export function detect_incomplete_response(input) {
|
|
98
|
+
const record = to_json_object(input.step_result) ?? {};
|
|
99
|
+
const finish_reason = typeof record.finish_reason === "string"
|
|
100
|
+
? record.finish_reason
|
|
101
|
+
: "";
|
|
276
102
|
const text = typeof record.text === "string" ? record.text.trim() : "";
|
|
277
|
-
const
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
103
|
+
const incomplete_tools = input.assistant_parts
|
|
104
|
+
.filter((part) => part.type === "tool" &&
|
|
105
|
+
part.state !== "completed" &&
|
|
106
|
+
part.state !== "failed")
|
|
107
|
+
.map((part) => ({ tool_name: part.tool_name, state: part.state }));
|
|
108
|
+
if (incomplete_tools.length > 0) {
|
|
282
109
|
return {
|
|
283
110
|
reason: "incomplete_tool_part",
|
|
284
111
|
details: {
|
|
285
|
-
finishReason:
|
|
286
|
-
|
|
287
|
-
incompleteToolParts,
|
|
112
|
+
finishReason: finish_reason || null,
|
|
113
|
+
incompleteToolParts: incomplete_tools,
|
|
288
114
|
textPreview: to_inline_preview(text),
|
|
289
115
|
},
|
|
290
116
|
};
|
|
291
117
|
}
|
|
292
|
-
if (
|
|
118
|
+
if (finish_reason !== "unknown")
|
|
293
119
|
return null;
|
|
294
|
-
if (!text) {
|
|
295
|
-
return {
|
|
296
|
-
reason: "finish_reason_other_empty",
|
|
297
|
-
details: {
|
|
298
|
-
finishReason,
|
|
299
|
-
rawFinishReason: rawFinishReason || null,
|
|
300
|
-
toolCallCount: toolCalls.length,
|
|
301
|
-
toolResultCount: toolResults.length,
|
|
302
|
-
},
|
|
303
|
-
};
|
|
304
|
-
}
|
|
305
|
-
if (looksLikeIncompleteText(text)) {
|
|
306
|
-
return {
|
|
307
|
-
reason: "finish_reason_other_truncated_text",
|
|
308
|
-
details: {
|
|
309
|
-
finishReason,
|
|
310
|
-
rawFinishReason: rawFinishReason || null,
|
|
311
|
-
textLength: text.length,
|
|
312
|
-
textPreview: to_inline_preview(text),
|
|
313
|
-
toolCallCount: toolCalls.length,
|
|
314
|
-
toolResultCount: toolResults.length,
|
|
315
|
-
inputTokens: typeof usage?.inputTokens === "number" ? usage.inputTokens : null,
|
|
316
|
-
outputTokens: typeof usage?.outputTokens === "number" ? usage.outputTokens : null,
|
|
317
|
-
totalTokens: typeof usage?.totalTokens === "number" ? usage.totalTokens : null,
|
|
318
|
-
},
|
|
319
|
-
};
|
|
320
|
-
}
|
|
321
120
|
return {
|
|
322
|
-
reason: "
|
|
121
|
+
reason: text ? "finish_reason_unknown" : "finish_reason_unknown_empty",
|
|
323
122
|
details: {
|
|
324
|
-
finishReason,
|
|
325
|
-
rawFinishReason: rawFinishReason || null,
|
|
123
|
+
finishReason: finish_reason,
|
|
326
124
|
textLength: text.length,
|
|
327
125
|
textPreview: to_inline_preview(text),
|
|
328
126
|
},
|
|
329
127
|
};
|
|
330
128
|
}
|
|
331
|
-
/**
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
export function detect_text_only_continuation_reason(step_result) {
|
|
335
|
-
const record = toJsonObject(step_result) || {};
|
|
336
|
-
const finishReason = typeof record.finishReason === "string" ? record.finishReason : "";
|
|
337
|
-
const text = typeof record.text === "string" ? record.text.trim() : "";
|
|
338
|
-
const toolCalls = Array.isArray(record.toolCalls) ? record.toolCalls : [];
|
|
339
|
-
if (!text || toolCalls.length > 0)
|
|
340
|
-
return null;
|
|
341
|
-
if (finishReason && finishReason !== "stop")
|
|
129
|
+
/** 从未知值读取 JSON 对象。 */
|
|
130
|
+
function to_json_object(value) {
|
|
131
|
+
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
342
132
|
return null;
|
|
343
|
-
|
|
344
|
-
if (candidate.pattern.test(text)) {
|
|
345
|
-
return candidate.name;
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
return null;
|
|
133
|
+
return value;
|
|
349
134
|
}
|
|
350
|
-
/**
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
`系统续跑提醒(第 ${round} 次):继续执行当前任务。`,
|
|
357
|
-
"不要只描述计划、下一步或“我接下来会做什么”。",
|
|
358
|
-
"如果需要工具,请直接调用工具并产出实际结果。",
|
|
359
|
-
"只有在任务真正完成、明确受阻、或必须等待用户提供信息时才停止。",
|
|
360
|
-
].join("\n");
|
|
135
|
+
/** 从 Tool 事实数组提取名称。 */
|
|
136
|
+
function pick_tool_names(value) {
|
|
137
|
+
return value
|
|
138
|
+
.map((item) => to_json_object(item)?.tool_name)
|
|
139
|
+
.filter((name) => typeof name === "string")
|
|
140
|
+
.slice(0, 8);
|
|
361
141
|
}
|
|
362
142
|
//# sourceMappingURL=CoreEngineSignals.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CoreEngineSignals.js","sourceRoot":"","sources":["../../../src/executor/core-engine/CoreEngineSignals.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACL,WAAW,EACX,YAAY,EACZ,YAAY,GACb,MAAM,IAAI,CAAC;AAIZ;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,EAAE,CAAC;AAEtC;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,CAAC;AAE7C;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,kCAAkC,GAAG,CAAC,CAAC;AAEpD;;GAEG;AACH,MAAM,4BAA4B,GAAG,GAAG,CAAC;AAEzC;;GAEG;AACH,MAAM,2BAA2B,GAAG,IAAI,GAAG,CAAC;IAC1C,iBAAiB;IACjB,iBAAiB;IACjB,kBAAkB;CACnB,CAAC,CAAC;AAEH;;;;;;GAMG;AACH,MAAM,+BAA+B,GAGhC;IACH,EAAE,IAAI,EAAE,cAAc,EAAE,OAAO,EAAE,OAAO,EAAE;IAC1C,EAAE,IAAI,EAAE,cAAc,EAAE,OAAO,EAAE,OAAO,EAAE;IAC1C,EAAE,IAAI,EAAE,YAAY,EAAE,OAAO,EAAE,oBAAoB,EAAE;IACrD,EAAE,IAAI,EAAE,iBAAiB,EAAE,OAAO,EAAE,gBAAgB,EAAE;IACtD,EAAE,IAAI,EAAE,eAAe,EAAE,OAAO,EAAE,eAAe,EAAE;IACnD,EAAE,IAAI,EAAE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,aAAa;YAC3B,UAAU,EAAE,IAAI,CAAC,MAAM;YACvB,WAAW,EAAE,iBAAiB,CAAC,IAAI,CAAC;SACrC;KACF,CAAC;AACJ,CAAC;AAED,sBAAsB;AACtB,SAAS,cAAc,CAAC,KAAc;IACpC,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAC7E,OAAO,KAAmB,CAAC;AAC7B,CAAC;AAED,uBAAuB;AACvB,SAAS,eAAe,CAAC,KAAgB;IACvC,OAAO,KAAK;SACT,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,SAAS,CAAC;SAC9C,MAAM,CAAC,CAAC,IAAI,EAAkB,EAAE,CAAC,OAAO,IAAI,KAAK,QAAQ,CAAC;SAC1D,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AACjB,CAAC"}
|
|
@@ -1,42 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Session 附件持久化模块。
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* - Data URL 附件先由 Session Attachment Store 落盘,Message 只保存文件路径。
|
|
7
|
-
* - 模型执行阶段再读取本地文件,并转换为模型可消费的数据格式。
|
|
8
|
-
* - 历史中的相对路径与旧版 `file://` 会在喂给模型前临时 hydrate。
|
|
9
|
-
*
|
|
10
|
-
* 输入到输出(中文):
|
|
11
|
-
* `file.url = data:<media-type>;base64,...`
|
|
12
|
-
* → Session Attachment Store 解码并写入附件文件
|
|
13
|
-
* → `file.url = .downcity/.../attachments/att_<id>.<ext>`
|
|
14
|
-
* → Message 持久化路径引用
|
|
15
|
-
* → 模型执行前读取文件并恢复为 Data URL
|
|
16
|
-
* → `convertToModelMessages()` 生成最终 ModelMessage。
|
|
4
|
+
* 本模块只负责在 User Message 入库前把 Data URL 写入 Session Attachment Store。
|
|
5
|
+
* 模型执行阶段的文件读取与 `ModelFileContent` 转换由 `SessionModelMessages` 负责。
|
|
17
6
|
*/
|
|
18
|
-
import type {
|
|
7
|
+
import type { SessionPromptPart } from "../../types/session/SessionContent.js";
|
|
19
8
|
import type { SessionAttachmentStore } from "../../types/store/SessionAttachmentStore.js";
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
* 在用户 prompt 入库前,将 Data URL file part 保存为 Session 附件路径。
|
|
23
|
-
*
|
|
24
|
-
* 关键点(中文)
|
|
25
|
-
* - 只有 Data URL 会在此处落盘;远程 URL 和本地路径保持引用不变。
|
|
26
|
-
* - 附件成功落盘后才把 URL 替换为相对 Workspace 根目录的路径。
|
|
27
|
-
* - canonical filename 保留调用侧传入的用户可见文件名;真实落盘路径只写入 url。
|
|
28
|
-
*/
|
|
29
|
-
export declare function persist_user_prompt_file_parts(parts: SessionUserMessagePart[], attachment_store: SessionAttachmentStore): Promise<SessionUserMessagePart[]>;
|
|
30
|
-
/**
|
|
31
|
-
* 将历史中的本地 file part 临时转换为模型可消费的 data URL。
|
|
32
|
-
*
|
|
33
|
-
* 关键点(中文)
|
|
34
|
-
* - 该函数只修改本轮内存消息,不回写历史。
|
|
35
|
-
* - 新历史保留 Agent 根目录相对路径,旧历史的 `file://` 仍继续兼容。
|
|
36
|
-
*/
|
|
37
|
-
export declare function hydrate_file_url_parts_for_model(messages: SessionMessageRecordV1[], project_root?: string): Promise<SessionMessageRecordV1[]>;
|
|
38
|
-
/**
|
|
39
|
-
* 在 user 消息上注入 FileUIPart,以便多模态模型直接消费本地附件。
|
|
40
|
-
*/
|
|
41
|
-
export declare function inject_file_parts_from_attachments(messages: SessionMessageRecordV1[], project_root?: string): Promise<SessionMessageRecordV1[]>;
|
|
9
|
+
/** 在用户 prompt 入库前持久化 Data URL 文件。 */
|
|
10
|
+
export declare function persist_user_prompt_file_parts(parts: SessionPromptPart[], attachment_store: SessionAttachmentStore): Promise<SessionPromptPart[]>;
|
|
42
11
|
//# sourceMappingURL=SessionAttachmentMapper.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SessionAttachmentMapper.d.ts","sourceRoot":"","sources":["../../../src/executor/messages/SessionAttachmentMapper.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"SessionAttachmentMapper.d.ts","sourceRoot":"","sources":["../../../src/executor/messages/SessionAttachmentMapper.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAC3E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,yCAAyC,CAAC;AAEtF,qCAAqC;AACrC,wBAAsB,8BAA8B,CAClD,KAAK,EAAE,iBAAiB,EAAE,EAC1B,gBAAgB,EAAE,sBAAsB,GACvC,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAe9B"}
|