@downcity/agent 1.1.238 → 1.1.259

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.
Files changed (578) hide show
  1. package/README.md +38 -45
  2. package/bin/agent/{local/Agent.d.ts → Agent.d.ts} +37 -27
  3. package/bin/agent/Agent.d.ts.map +1 -0
  4. package/bin/agent/Agent.js +211 -0
  5. package/bin/agent/Agent.js.map +1 -0
  6. package/bin/agent/AgentContext.d.ts +64 -0
  7. package/bin/agent/AgentContext.d.ts.map +1 -0
  8. package/bin/agent/AgentContext.js +53 -0
  9. package/bin/agent/AgentContext.js.map +1 -0
  10. package/bin/agent/{local/AgentInstructions.d.ts → AgentInstructions.d.ts} +1 -6
  11. package/bin/agent/AgentInstructions.d.ts.map +1 -0
  12. package/bin/agent/{local/AgentInstructions.js → AgentInstructions.js} +1 -10
  13. package/bin/agent/AgentInstructions.js.map +1 -0
  14. package/bin/{model/CityModelAdapter.d.ts → agent/AgentModel.d.ts} +3 -3
  15. package/bin/agent/AgentModel.d.ts.map +1 -0
  16. package/bin/{model/CityModelAdapter.js → agent/AgentModel.js} +11 -4
  17. package/bin/agent/AgentModel.js.map +1 -0
  18. package/bin/agent/{local/services/AgentSessions.d.ts → AgentSessions.d.ts} +30 -40
  19. package/bin/agent/AgentSessions.d.ts.map +1 -0
  20. package/bin/agent/{local/services/AgentSessions.js → AgentSessions.js} +62 -79
  21. package/bin/agent/AgentSessions.js.map +1 -0
  22. package/bin/agent/AgentState.d.ts +64 -0
  23. package/bin/agent/AgentState.d.ts.map +1 -0
  24. package/bin/agent/AgentState.js +118 -0
  25. package/bin/agent/AgentState.js.map +1 -0
  26. package/bin/config/Paths.d.ts +0 -43
  27. package/bin/config/Paths.d.ts.map +1 -1
  28. package/bin/config/Paths.js +0 -79
  29. package/bin/config/Paths.js.map +1 -1
  30. package/bin/config/ProjectSetup.d.ts.map +1 -0
  31. package/bin/{agent/local → config}/ProjectSetup.js +1 -1
  32. package/bin/config/ProjectSetup.js.map +1 -0
  33. package/bin/executor/Executor.d.ts +20 -86
  34. package/bin/executor/Executor.d.ts.map +1 -1
  35. package/bin/executor/Executor.js +109 -260
  36. package/bin/executor/Executor.js.map +1 -1
  37. package/bin/executor/composer/system/default/DefaultSessionSystemComposer.d.ts +1 -1
  38. package/bin/executor/composer/system/default/DefaultSessionSystemComposer.d.ts.map +1 -1
  39. package/bin/executor/composer/system/default/SystemDomain.d.ts +1 -1
  40. package/bin/executor/composer/system/default/SystemDomain.d.ts.map +1 -1
  41. package/bin/executor/composer/system/default/SystemDomain.js +4 -1
  42. package/bin/executor/composer/system/default/SystemDomain.js.map +1 -1
  43. package/bin/executor/composer/system/default/assets/core.prompt.d.ts +1 -1
  44. package/bin/executor/composer/system/default/assets/core.prompt.d.ts.map +1 -1
  45. package/bin/executor/composer/system/default/assets/core.prompt.js +1 -1
  46. package/bin/executor/composer/system/default/assets/core.prompt.js.map +1 -1
  47. package/bin/executor/core-engine/CoreEngineRunner.d.ts +7 -13
  48. package/bin/executor/core-engine/CoreEngineRunner.d.ts.map +1 -1
  49. package/bin/executor/core-engine/CoreEngineRunner.js +81 -34
  50. package/bin/executor/core-engine/CoreEngineRunner.js.map +1 -1
  51. package/bin/executor/services/ExecutorRecoveryPolicy.d.ts +6 -12
  52. package/bin/executor/services/ExecutorRecoveryPolicy.d.ts.map +1 -1
  53. package/bin/executor/services/ExecutorRecoveryPolicy.js +20 -6
  54. package/bin/executor/services/ExecutorRecoveryPolicy.js.map +1 -1
  55. package/bin/executor/tools/file/ReadImageToolBridge.d.ts +21 -0
  56. package/bin/executor/tools/file/ReadImageToolBridge.d.ts.map +1 -0
  57. package/bin/executor/tools/file/ReadImageToolBridge.js +69 -0
  58. package/bin/executor/tools/file/ReadImageToolBridge.js.map +1 -0
  59. package/bin/executor/tools/plugin/PluginToolBridge.d.ts.map +1 -1
  60. package/bin/executor/tools/plugin/PluginToolBridge.js +6 -5
  61. package/bin/executor/tools/plugin/PluginToolBridge.js.map +1 -1
  62. package/bin/executor/tools/plugin/PluginToolDefinition.d.ts.map +1 -1
  63. package/bin/executor/tools/plugin/PluginToolDefinition.js +15 -2
  64. package/bin/executor/tools/plugin/PluginToolDefinition.js.map +1 -1
  65. package/bin/executor/types/SessionHistoryMeta.d.ts +0 -2
  66. package/bin/executor/types/SessionHistoryMeta.d.ts.map +1 -1
  67. package/bin/index.d.ts +17 -21
  68. package/bin/index.d.ts.map +1 -1
  69. package/bin/index.js +9 -11
  70. package/bin/index.js.map +1 -1
  71. package/bin/plugin/core/ActionScheduleExecutor.d.ts +1 -1
  72. package/bin/plugin/core/ActionScheduleExecutor.d.ts.map +1 -1
  73. package/bin/plugin/core/ActionScheduleRuntime.d.ts +1 -1
  74. package/bin/plugin/core/ActionScheduleRuntime.d.ts.map +1 -1
  75. package/bin/plugin/core/BasePlugin.d.ts +4 -3
  76. package/bin/plugin/core/BasePlugin.d.ts.map +1 -1
  77. package/bin/plugin/core/BasePlugin.js.map +1 -1
  78. package/bin/plugin/core/HookRegistry.d.ts +5 -8
  79. package/bin/plugin/core/HookRegistry.d.ts.map +1 -1
  80. package/bin/plugin/core/HookRegistry.js +12 -12
  81. package/bin/plugin/core/HookRegistry.js.map +1 -1
  82. package/bin/plugin/core/PluginActionFactory.d.ts +6 -3
  83. package/bin/plugin/core/PluginActionFactory.d.ts.map +1 -1
  84. package/bin/plugin/core/PluginActionFactory.js.map +1 -1
  85. package/bin/plugin/core/PluginActionRunner.d.ts +1 -1
  86. package/bin/plugin/core/PluginActionRunner.d.ts.map +1 -1
  87. package/bin/plugin/core/PluginCatalog.d.ts +1 -1
  88. package/bin/plugin/core/PluginCatalog.d.ts.map +1 -1
  89. package/bin/plugin/core/PluginHttpRoutes.d.ts +1 -1
  90. package/bin/plugin/core/PluginHttpRoutes.d.ts.map +1 -1
  91. package/bin/plugin/core/PluginLocalExecution.d.ts +4 -5
  92. package/bin/plugin/core/PluginLocalExecution.d.ts.map +1 -1
  93. package/bin/plugin/core/PluginLocalExecution.js +4 -12
  94. package/bin/plugin/core/PluginLocalExecution.js.map +1 -1
  95. package/bin/plugin/core/PluginRegistry.d.ts +16 -12
  96. package/bin/plugin/core/PluginRegistry.d.ts.map +1 -1
  97. package/bin/plugin/core/PluginRegistry.js +43 -22
  98. package/bin/plugin/core/PluginRegistry.js.map +1 -1
  99. package/bin/plugin/core/PluginStateController.d.ts +1 -1
  100. package/bin/plugin/core/PluginStateController.d.ts.map +1 -1
  101. package/bin/{agent/remote → remote}/RemoteAgent.d.ts +4 -4
  102. package/bin/remote/RemoteAgent.d.ts.map +1 -0
  103. package/bin/{agent/remote → remote}/RemoteAgent.js +3 -3
  104. package/bin/remote/RemoteAgent.js.map +1 -0
  105. package/bin/{agent/remote → remote}/RemoteSession.d.ts +9 -11
  106. package/bin/remote/RemoteSession.d.ts.map +1 -0
  107. package/bin/{agent/remote → remote}/RemoteSession.js +3 -33
  108. package/bin/remote/RemoteSession.js.map +1 -0
  109. package/bin/{agent/remote → remote}/RemoteTransport.d.ts +7 -9
  110. package/bin/remote/RemoteTransport.d.ts.map +1 -0
  111. package/bin/remote/RemoteTransport.js.map +1 -0
  112. package/bin/{agent/remote → remote}/TransportFactory.d.ts +1 -1
  113. package/bin/remote/TransportFactory.d.ts.map +1 -0
  114. package/bin/{agent/remote → remote}/TransportFactory.js +2 -2
  115. package/bin/remote/TransportFactory.js.map +1 -0
  116. package/bin/{agent/remote → remote}/transports/HttpRemoteAgentTransport.d.ts +8 -9
  117. package/bin/remote/transports/HttpRemoteAgentTransport.d.ts.map +1 -0
  118. package/bin/{agent/remote → remote}/transports/HttpRemoteAgentTransport.js +0 -13
  119. package/bin/remote/transports/HttpRemoteAgentTransport.js.map +1 -0
  120. package/bin/{rpc/Client.d.ts → remote/transports/RpcClient.d.ts} +15 -22
  121. package/bin/remote/transports/RpcClient.d.ts.map +1 -0
  122. package/bin/{rpc/Client.js → remote/transports/RpcClient.js} +2 -13
  123. package/bin/remote/transports/RpcClient.js.map +1 -0
  124. package/bin/{agent/remote → remote}/transports/RpcRemoteAgentTransport.d.ts +8 -9
  125. package/bin/remote/transports/RpcRemoteAgentTransport.d.ts.map +1 -0
  126. package/bin/{agent/remote → remote}/transports/RpcRemoteAgentTransport.js +1 -4
  127. package/bin/remote/transports/RpcRemoteAgentTransport.js.map +1 -0
  128. package/bin/session/DefaultSessionComposer.d.ts +18 -0
  129. package/bin/session/DefaultSessionComposer.d.ts.map +1 -0
  130. package/bin/session/DefaultSessionComposer.js +62 -0
  131. package/bin/session/DefaultSessionComposer.js.map +1 -0
  132. package/bin/session/Session.d.ts +44 -33
  133. package/bin/session/Session.d.ts.map +1 -1
  134. package/bin/session/Session.js +440 -274
  135. package/bin/session/Session.js.map +1 -1
  136. package/bin/session/SessionMessages.d.ts +133 -0
  137. package/bin/session/SessionMessages.d.ts.map +1 -0
  138. package/bin/session/{recorder/SessionRecorder.js → SessionMessages.js} +247 -284
  139. package/bin/session/SessionMessages.js.map +1 -0
  140. package/bin/session/SessionQueue.d.ts +34 -0
  141. package/bin/session/SessionQueue.d.ts.map +1 -0
  142. package/bin/session/SessionQueue.js +60 -0
  143. package/bin/session/SessionQueue.js.map +1 -0
  144. package/bin/session/SessionState.d.ts +70 -0
  145. package/bin/session/SessionState.d.ts.map +1 -0
  146. package/bin/session/SessionState.js +267 -0
  147. package/bin/session/SessionState.js.map +1 -0
  148. package/bin/session/SessionSystem.d.ts +15 -0
  149. package/bin/session/SessionSystem.d.ts.map +1 -0
  150. package/bin/session/SessionSystem.js +95 -0
  151. package/bin/session/SessionSystem.js.map +1 -0
  152. package/bin/session/SessionTurn.d.ts +84 -0
  153. package/bin/session/SessionTurn.d.ts.map +1 -0
  154. package/bin/session/SessionTurn.js +588 -0
  155. package/bin/session/SessionTurn.js.map +1 -0
  156. package/bin/session/approval/SessionApprovalBroker.d.ts +48 -0
  157. package/bin/session/approval/SessionApprovalBroker.d.ts.map +1 -0
  158. package/bin/session/approval/SessionApprovalBroker.js +126 -0
  159. package/bin/session/approval/SessionApprovalBroker.js.map +1 -0
  160. package/bin/session/browse/Browse.d.ts.map +1 -1
  161. package/bin/session/browse/Browse.js +1 -4
  162. package/bin/session/browse/Browse.js.map +1 -1
  163. package/bin/session/{recorder → messages}/JsonlSessionMessageStore.d.ts.map +1 -1
  164. package/bin/session/{recorder → messages}/JsonlSessionMessageStore.js.map +1 -1
  165. package/bin/session/messages/SessionAssistantMessageWriter.d.ts +62 -0
  166. package/bin/session/messages/SessionAssistantMessageWriter.d.ts.map +1 -0
  167. package/bin/session/messages/SessionAssistantMessageWriter.js +287 -0
  168. package/bin/session/messages/SessionAssistantMessageWriter.js.map +1 -0
  169. package/bin/session/messages/SessionJsonValue.d.ts +10 -0
  170. package/bin/session/messages/SessionJsonValue.d.ts.map +1 -0
  171. package/bin/session/messages/SessionJsonValue.js +23 -0
  172. package/bin/session/messages/SessionJsonValue.js.map +1 -0
  173. package/bin/session/{recorder → messages}/SessionMessageCodec.d.ts +4 -1
  174. package/bin/session/messages/SessionMessageCodec.d.ts.map +1 -0
  175. package/bin/session/{recorder → messages}/SessionMessageCodec.js +33 -19
  176. package/bin/session/messages/SessionMessageCodec.js.map +1 -0
  177. package/bin/session/messages/SessionMessageCompaction.d.ts +22 -0
  178. package/bin/session/messages/SessionMessageCompaction.d.ts.map +1 -0
  179. package/bin/session/{recorder/SessionRecorderCompaction.js → messages/SessionMessageCompaction.js} +19 -51
  180. package/bin/session/messages/SessionMessageCompaction.js.map +1 -0
  181. package/bin/session/runtime/SessionEventHub.d.ts +1 -8
  182. package/bin/session/runtime/SessionEventHub.d.ts.map +1 -1
  183. package/bin/session/runtime/SessionEventHub.js +1 -6
  184. package/bin/session/runtime/SessionEventHub.js.map +1 -1
  185. package/bin/session/storage/Metadata.d.ts +23 -5
  186. package/bin/session/storage/Metadata.d.ts.map +1 -1
  187. package/bin/session/storage/Metadata.js +32 -29
  188. package/bin/session/storage/Metadata.js.map +1 -1
  189. package/bin/session/storage/RuntimeSessionPort.d.ts +5 -10
  190. package/bin/session/storage/RuntimeSessionPort.d.ts.map +1 -1
  191. package/bin/session/storage/RuntimeSessionPort.js +2 -4
  192. package/bin/session/storage/RuntimeSessionPort.js.map +1 -1
  193. package/bin/types/agent/AgentOptions.d.ts +6 -35
  194. package/bin/types/agent/AgentOptions.d.ts.map +1 -1
  195. package/bin/types/agent/AgentState.d.ts +28 -0
  196. package/bin/types/agent/AgentState.d.ts.map +1 -0
  197. package/bin/types/agent/AgentState.js +9 -0
  198. package/bin/types/agent/AgentState.js.map +1 -0
  199. package/bin/types/agent/SessionActor.d.ts +0 -2
  200. package/bin/types/agent/SessionActor.d.ts.map +1 -1
  201. package/bin/types/agent/SessionTypes.d.ts +5 -18
  202. package/bin/types/agent/SessionTypes.d.ts.map +1 -1
  203. package/bin/types/executor/SessionRunContext.d.ts +8 -2
  204. package/bin/types/executor/SessionRunContext.d.ts.map +1 -1
  205. package/bin/types/executor/SessionRunContext.js +1 -1
  206. package/bin/types/executor/SessionToolExecutionContext.d.ts +20 -0
  207. package/bin/types/executor/SessionToolExecutionContext.d.ts.map +1 -0
  208. package/bin/types/executor/SessionToolExecutionContext.js +10 -0
  209. package/bin/types/executor/SessionToolExecutionContext.js.map +1 -0
  210. package/bin/types/plugin/PluginAction.d.ts +10 -1
  211. package/bin/types/plugin/PluginAction.d.ts.map +1 -1
  212. package/bin/types/plugin/PluginCommand.d.ts +3 -11
  213. package/bin/types/plugin/PluginCommand.d.ts.map +1 -1
  214. package/bin/types/plugin/PluginConfig.d.ts +12 -0
  215. package/bin/types/plugin/PluginConfig.d.ts.map +1 -0
  216. package/bin/types/plugin/PluginConfig.js +5 -0
  217. package/bin/types/plugin/PluginConfig.js.map +1 -0
  218. package/bin/types/plugin/PluginDefinition.d.ts +10 -3
  219. package/bin/types/plugin/PluginDefinition.d.ts.map +1 -1
  220. package/bin/types/plugin/PluginHttp.d.ts +1 -1
  221. package/bin/types/plugin/PluginHttp.d.ts.map +1 -1
  222. package/bin/types/plugin/PluginRunContext.d.ts +26 -0
  223. package/bin/types/plugin/PluginRunContext.d.ts.map +1 -0
  224. package/bin/types/plugin/PluginRunContext.js +10 -0
  225. package/bin/types/plugin/PluginRunContext.js.map +1 -0
  226. package/bin/types/plugin/PluginRuntime.d.ts +9 -3
  227. package/bin/types/plugin/PluginRuntime.d.ts.map +1 -1
  228. package/bin/types/plugin/PluginToolRuntime.d.ts +11 -0
  229. package/bin/types/plugin/PluginToolRuntime.d.ts.map +1 -1
  230. package/bin/types/rpc/RpcProtocol.d.ts +1 -13
  231. package/bin/types/rpc/RpcProtocol.d.ts.map +1 -1
  232. package/bin/types/session/SessionApproval.d.ts +4 -38
  233. package/bin/types/session/SessionApproval.d.ts.map +1 -1
  234. package/bin/types/session/SessionApprovalBroker.d.ts +17 -0
  235. package/bin/types/session/SessionApprovalBroker.d.ts.map +1 -0
  236. package/bin/types/session/SessionApprovalBroker.js +7 -0
  237. package/bin/types/session/SessionApprovalBroker.js.map +1 -0
  238. package/bin/types/session/SessionComposer.d.ts +99 -0
  239. package/bin/types/session/SessionComposer.d.ts.map +1 -0
  240. package/bin/types/session/SessionComposer.js +8 -0
  241. package/bin/types/session/SessionComposer.js.map +1 -0
  242. package/bin/types/session/SessionLocalState.d.ts +6 -6
  243. package/bin/types/session/SessionLocalState.d.ts.map +1 -1
  244. package/bin/types/session/SessionLocalState.js +1 -1
  245. package/bin/types/session/SessionMessage.d.ts +3 -2
  246. package/bin/types/session/SessionMessage.d.ts.map +1 -1
  247. package/bin/types/session/SessionMessages.d.ts +115 -0
  248. package/bin/types/session/SessionMessages.d.ts.map +1 -0
  249. package/bin/types/session/SessionMessages.js +7 -0
  250. package/bin/types/session/SessionMessages.js.map +1 -0
  251. package/bin/types/session/SessionMutation.d.ts +1 -10
  252. package/bin/types/session/SessionMutation.d.ts.map +1 -1
  253. package/bin/types/session/SessionMutation.js.map +1 -1
  254. package/bin/types/session/SessionOptions.d.ts +8 -23
  255. package/bin/types/session/SessionOptions.d.ts.map +1 -1
  256. package/bin/types/session/SessionPort.d.ts +72 -0
  257. package/bin/types/session/SessionPort.d.ts.map +1 -0
  258. package/bin/types/session/SessionPort.js +9 -0
  259. package/bin/types/session/SessionPort.js.map +1 -0
  260. package/bin/types/session/SessionQueue.d.ts +104 -0
  261. package/bin/types/session/SessionQueue.d.ts.map +1 -0
  262. package/bin/types/session/SessionQueue.js +7 -0
  263. package/bin/types/session/SessionQueue.js.map +1 -0
  264. package/bin/types/session/SessionState.d.ts +43 -0
  265. package/bin/types/session/SessionState.d.ts.map +1 -0
  266. package/bin/types/session/SessionState.js +7 -0
  267. package/bin/types/session/SessionState.js.map +1 -0
  268. package/bin/types/session/SessionSystem.d.ts +26 -0
  269. package/bin/types/session/SessionSystem.d.ts.map +1 -0
  270. package/bin/types/session/SessionSystem.js +7 -0
  271. package/bin/types/session/SessionSystem.js.map +1 -0
  272. package/bin/types/session/SessionTool.d.ts +23 -0
  273. package/bin/types/session/SessionTool.d.ts.map +1 -0
  274. package/bin/types/session/SessionTool.js +7 -0
  275. package/bin/types/session/SessionTool.js.map +1 -0
  276. package/bin/types/session/SessionTurn.d.ts +52 -0
  277. package/bin/types/session/SessionTurn.d.ts.map +1 -0
  278. package/bin/types/session/SessionTurn.js +7 -0
  279. package/bin/types/session/SessionTurn.js.map +1 -0
  280. package/package.json +3 -3
  281. package/scripts/agent-env.test.mjs +4 -18
  282. package/scripts/agent-ready.test.mjs +33 -2
  283. package/scripts/agent-session-maintenance.test.mjs +52 -0
  284. package/scripts/city-model-tool-loop.test.mjs +3 -4
  285. package/scripts/core-engine-context-compaction.test.mjs +5 -22
  286. package/scripts/image-plugin-job.test.mjs +4 -6
  287. package/scripts/plugin-tool-bridge.test.mjs +44 -36
  288. package/scripts/read-image-tool-bridge.test.mjs +71 -0
  289. package/scripts/remote-session-reconnect.test.mjs +1 -34
  290. package/scripts/session-compaction-prompts.test.mjs +1 -49
  291. package/scripts/session-composer.test.mjs +163 -0
  292. package/scripts/session-config-turn-boundary.test.mjs +2 -5
  293. package/scripts/session-list-title.test.mjs +3 -2
  294. package/scripts/session-messages-error.test.mjs +57 -0
  295. package/scripts/{session-recorder.test.mjs → session-messages.test.mjs} +245 -93
  296. package/scripts/session-queue.test.mjs +64 -0
  297. package/scripts/session-shell-approval.test.mjs +171 -0
  298. package/scripts/session-system-blocks.test.mjs +10 -10
  299. package/scripts/session-title-event.test.mjs +1 -0
  300. package/src/agent/Agent.ts +241 -0
  301. package/src/agent/AgentContext.ts +92 -0
  302. package/src/agent/{local/AgentInstructions.ts → AgentInstructions.ts} +0 -11
  303. package/src/{model/CityModelAdapter.ts → agent/AgentModel.ts} +10 -3
  304. package/src/agent/{local/services/AgentSessions.ts → AgentSessions.ts} +81 -110
  305. package/src/agent/AgentState.ts +151 -0
  306. package/src/config/Paths.ts +0 -91
  307. package/src/executor/Executor.ts +180 -386
  308. package/src/executor/README.md +62 -86
  309. package/src/executor/composer/system/default/DefaultSessionSystemComposer.ts +1 -1
  310. package/src/executor/composer/system/default/SystemDomain.ts +4 -2
  311. package/src/executor/composer/system/default/assets/core.prompt.ts +1 -1
  312. package/src/executor/composer/system/default/assets/core.prompt.ts.txt +15 -2
  313. package/src/executor/core-engine/CoreEngineRunner.ts +95 -54
  314. package/src/executor/services/ExecutorRecoveryPolicy.ts +24 -19
  315. package/src/executor/tools/file/ReadImageToolBridge.ts +79 -0
  316. package/src/executor/tools/plugin/PluginToolBridge.ts +6 -8
  317. package/src/executor/tools/plugin/PluginToolDefinition.ts +23 -3
  318. package/src/executor/types/SessionHistoryMeta.ts +0 -2
  319. package/src/index.ts +34 -53
  320. package/src/plugin/core/ActionScheduleExecutor.ts +1 -1
  321. package/src/plugin/core/ActionScheduleRuntime.ts +1 -1
  322. package/src/plugin/core/BasePlugin.ts +7 -3
  323. package/src/plugin/core/HookRegistry.ts +15 -18
  324. package/src/plugin/core/PluginActionFactory.ts +9 -3
  325. package/src/plugin/core/PluginActionRunner.ts +1 -1
  326. package/src/plugin/core/PluginCatalog.ts +1 -1
  327. package/src/plugin/core/PluginHttpRoutes.ts +1 -1
  328. package/src/plugin/core/PluginLocalExecution.ts +11 -24
  329. package/src/plugin/core/PluginRegistry.ts +55 -32
  330. package/src/plugin/core/PluginStateController.ts +1 -1
  331. package/src/{agent/remote → remote}/RemoteAgent.ts +4 -4
  332. package/src/{agent/remote → remote}/RemoteSession.ts +2 -35
  333. package/src/{agent/remote → remote}/RemoteTransport.ts +0 -3
  334. package/src/{agent/remote → remote}/TransportFactory.ts +3 -3
  335. package/src/{agent/remote → remote}/transports/HttpRemoteAgentTransport.ts +1 -23
  336. package/src/{rpc/Client.ts → remote/transports/RpcClient.ts} +1 -19
  337. package/src/{agent/remote → remote}/transports/RpcRemoteAgentTransport.ts +2 -10
  338. package/src/session/DefaultSessionComposer.ts +79 -0
  339. package/src/session/Session.ts +496 -332
  340. package/src/session/{recorder/SessionRecorder.ts → SessionMessages.ts} +324 -428
  341. package/src/session/SessionQueue.ts +86 -0
  342. package/src/session/SessionState.ts +322 -0
  343. package/src/session/SessionSystem.ts +117 -0
  344. package/src/session/SessionTurn.ts +684 -0
  345. package/src/session/approval/SessionApprovalBroker.ts +164 -0
  346. package/src/session/browse/Browse.ts +1 -4
  347. package/src/session/messages/SessionAssistantMessageWriter.ts +345 -0
  348. package/src/session/messages/SessionJsonValue.ts +25 -0
  349. package/src/session/{recorder → messages}/SessionMessageCodec.ts +38 -20
  350. package/src/session/{recorder/SessionRecorderCompaction.ts → messages/SessionMessageCompaction.ts} +30 -69
  351. package/src/session/runtime/SessionEventHub.ts +1 -14
  352. package/src/session/storage/Metadata.ts +60 -34
  353. package/src/session/storage/RuntimeSessionPort.ts +7 -14
  354. package/src/types/agent/AgentOptions.ts +6 -38
  355. package/src/types/agent/AgentState.ts +33 -0
  356. package/src/types/agent/SessionActor.ts +0 -3
  357. package/src/types/agent/SessionTypes.ts +5 -18
  358. package/src/types/executor/SessionRunContext.ts +10 -2
  359. package/src/types/executor/SessionToolExecutionContext.ts +21 -0
  360. package/src/types/plugin/PluginAction.ts +10 -1
  361. package/src/types/plugin/PluginCommand.ts +3 -14
  362. package/src/types/plugin/PluginConfig.ts +13 -0
  363. package/src/types/plugin/PluginDefinition.ts +13 -6
  364. package/src/types/plugin/PluginHttp.ts +1 -1
  365. package/src/types/plugin/PluginRunContext.ts +31 -0
  366. package/src/types/plugin/PluginRuntime.ts +13 -6
  367. package/src/types/plugin/PluginToolRuntime.ts +13 -1
  368. package/src/types/rpc/RpcProtocol.ts +0 -14
  369. package/src/types/session/SessionApproval.ts +4 -43
  370. package/src/types/session/SessionApprovalBroker.ts +18 -0
  371. package/src/types/session/SessionComposer.ts +114 -0
  372. package/src/types/session/SessionLocalState.ts +6 -6
  373. package/src/types/session/SessionMessage.ts +3 -2
  374. package/src/types/session/SessionMessages.ts +127 -0
  375. package/src/types/session/SessionMutation.ts +0 -11
  376. package/src/types/session/SessionOptions.ts +8 -40
  377. package/src/types/session/SessionPort.ts +97 -0
  378. package/src/types/session/SessionQueue.ts +122 -0
  379. package/src/types/session/SessionState.ts +47 -0
  380. package/src/types/session/SessionSystem.ts +27 -0
  381. package/src/types/session/SessionTool.ts +25 -0
  382. package/src/types/session/SessionTurn.ts +56 -0
  383. package/tsconfig.tsbuildinfo +1 -1
  384. package/bin/agent/local/Agent.d.ts.map +0 -1
  385. package/bin/agent/local/Agent.js +0 -216
  386. package/bin/agent/local/Agent.js.map +0 -1
  387. package/bin/agent/local/AgentInstructions.d.ts.map +0 -1
  388. package/bin/agent/local/AgentInstructions.js.map +0 -1
  389. package/bin/agent/local/AgentPluginFactory.d.ts +0 -26
  390. package/bin/agent/local/AgentPluginFactory.d.ts.map +0 -1
  391. package/bin/agent/local/AgentPluginFactory.js +0 -33
  392. package/bin/agent/local/AgentPluginFactory.js.map +0 -1
  393. package/bin/agent/local/AgentRuntimeAssembly.d.ts +0 -10
  394. package/bin/agent/local/AgentRuntimeAssembly.d.ts.map +0 -1
  395. package/bin/agent/local/AgentRuntimeAssembly.js +0 -43
  396. package/bin/agent/local/AgentRuntimeAssembly.js.map +0 -1
  397. package/bin/agent/local/ProjectSetup.d.ts.map +0 -1
  398. package/bin/agent/local/ProjectSetup.js.map +0 -1
  399. package/bin/agent/local/services/AgentAssemblyService.d.ts +0 -105
  400. package/bin/agent/local/services/AgentAssemblyService.d.ts.map +0 -1
  401. package/bin/agent/local/services/AgentAssemblyService.js +0 -184
  402. package/bin/agent/local/services/AgentAssemblyService.js.map +0 -1
  403. package/bin/agent/local/services/AgentBackgroundService.d.ts +0 -55
  404. package/bin/agent/local/services/AgentBackgroundService.d.ts.map +0 -1
  405. package/bin/agent/local/services/AgentBackgroundService.js +0 -85
  406. package/bin/agent/local/services/AgentBackgroundService.js.map +0 -1
  407. package/bin/agent/local/services/AgentSessions.d.ts.map +0 -1
  408. package/bin/agent/local/services/AgentSessions.js.map +0 -1
  409. package/bin/agent/remote/RemoteAgent.d.ts.map +0 -1
  410. package/bin/agent/remote/RemoteAgent.js.map +0 -1
  411. package/bin/agent/remote/RemoteSession.d.ts.map +0 -1
  412. package/bin/agent/remote/RemoteSession.js.map +0 -1
  413. package/bin/agent/remote/RemoteTransport.d.ts.map +0 -1
  414. package/bin/agent/remote/RemoteTransport.js.map +0 -1
  415. package/bin/agent/remote/TransportFactory.d.ts.map +0 -1
  416. package/bin/agent/remote/TransportFactory.js.map +0 -1
  417. package/bin/agent/remote/transports/HttpRemoteAgentTransport.d.ts.map +0 -1
  418. package/bin/agent/remote/transports/HttpRemoteAgentTransport.js.map +0 -1
  419. package/bin/agent/remote/transports/RpcRemoteAgentTransport.d.ts.map +0 -1
  420. package/bin/agent/remote/transports/RpcRemoteAgentTransport.js.map +0 -1
  421. package/bin/executor/SessionRunScope.d.ts +0 -68
  422. package/bin/executor/SessionRunScope.d.ts.map +0 -1
  423. package/bin/executor/SessionRunScope.js +0 -96
  424. package/bin/executor/SessionRunScope.js.map +0 -1
  425. package/bin/executor/composer/compaction/SessionCompactionComposer.d.ts +0 -74
  426. package/bin/executor/composer/compaction/SessionCompactionComposer.d.ts.map +0 -1
  427. package/bin/executor/composer/compaction/SessionCompactionComposer.js +0 -9
  428. package/bin/executor/composer/compaction/SessionCompactionComposer.js.map +0 -1
  429. package/bin/executor/composer/compaction/jsonl/JsonlSessionCompactionComposer.d.ts +0 -27
  430. package/bin/executor/composer/compaction/jsonl/JsonlSessionCompactionComposer.d.ts.map +0 -1
  431. package/bin/executor/composer/compaction/jsonl/JsonlSessionCompactionComposer.js +0 -39
  432. package/bin/executor/composer/compaction/jsonl/JsonlSessionCompactionComposer.js.map +0 -1
  433. package/bin/executor/composer/compaction/jsonl/JsonlSessionCompactionExecutor.d.ts +0 -44
  434. package/bin/executor/composer/compaction/jsonl/JsonlSessionCompactionExecutor.d.ts.map +0 -1
  435. package/bin/executor/composer/compaction/jsonl/JsonlSessionCompactionExecutor.js +0 -218
  436. package/bin/executor/composer/compaction/jsonl/JsonlSessionCompactionExecutor.js.map +0 -1
  437. package/bin/executor/composer/compaction/jsonl/JsonlSessionCompactionFileOperations.d.ts +0 -27
  438. package/bin/executor/composer/compaction/jsonl/JsonlSessionCompactionFileOperations.d.ts.map +0 -1
  439. package/bin/executor/composer/compaction/jsonl/JsonlSessionCompactionFileOperations.js +0 -181
  440. package/bin/executor/composer/compaction/jsonl/JsonlSessionCompactionFileOperations.js.map +0 -1
  441. package/bin/executor/composer/context/LocalSessionContextComposer.d.ts +0 -50
  442. package/bin/executor/composer/context/LocalSessionContextComposer.d.ts.map +0 -1
  443. package/bin/executor/composer/context/LocalSessionContextComposer.js +0 -108
  444. package/bin/executor/composer/context/LocalSessionContextComposer.js.map +0 -1
  445. package/bin/executor/composer/context/SessionContextComposer.d.ts +0 -67
  446. package/bin/executor/composer/context/SessionContextComposer.d.ts.map +0 -1
  447. package/bin/executor/composer/context/SessionContextComposer.js +0 -9
  448. package/bin/executor/composer/context/SessionContextComposer.js.map +0 -1
  449. package/bin/executor/composer/history/SessionHistoryComposer.d.ts +0 -54
  450. package/bin/executor/composer/history/SessionHistoryComposer.d.ts.map +0 -1
  451. package/bin/executor/composer/history/SessionHistoryComposer.js +0 -10
  452. package/bin/executor/composer/history/SessionHistoryComposer.js.map +0 -1
  453. package/bin/executor/composer/history/SessionHistoryWriter.d.ts +0 -46
  454. package/bin/executor/composer/history/SessionHistoryWriter.d.ts.map +0 -1
  455. package/bin/executor/composer/history/SessionHistoryWriter.js +0 -65
  456. package/bin/executor/composer/history/SessionHistoryWriter.js.map +0 -1
  457. package/bin/executor/composer/history/jsonl/JsonlSessionHistoryComposer.d.ts +0 -35
  458. package/bin/executor/composer/history/jsonl/JsonlSessionHistoryComposer.d.ts.map +0 -1
  459. package/bin/executor/composer/history/jsonl/JsonlSessionHistoryComposer.js +0 -105
  460. package/bin/executor/composer/history/jsonl/JsonlSessionHistoryComposer.js.map +0 -1
  461. package/bin/executor/messages/AssistantResultPersistence.d.ts +0 -66
  462. package/bin/executor/messages/AssistantResultPersistence.d.ts.map +0 -1
  463. package/bin/executor/messages/AssistantResultPersistence.js +0 -44
  464. package/bin/executor/messages/AssistantResultPersistence.js.map +0 -1
  465. package/bin/executor/services/ExecutorInflightService.d.ts +0 -34
  466. package/bin/executor/services/ExecutorInflightService.d.ts.map +0 -1
  467. package/bin/executor/services/ExecutorInflightService.js +0 -73
  468. package/bin/executor/services/ExecutorInflightService.js.map +0 -1
  469. package/bin/executor/store/history/SessionHistoryStore.d.ts +0 -140
  470. package/bin/executor/store/history/SessionHistoryStore.d.ts.map +0 -1
  471. package/bin/executor/store/history/SessionHistoryStore.js +0 -10
  472. package/bin/executor/store/history/SessionHistoryStore.js.map +0 -1
  473. package/bin/executor/store/history/jsonl/JsonlSessionHistoryStore.d.ts +0 -116
  474. package/bin/executor/store/history/jsonl/JsonlSessionHistoryStore.d.ts.map +0 -1
  475. package/bin/executor/store/history/jsonl/JsonlSessionHistoryStore.js +0 -709
  476. package/bin/executor/store/history/jsonl/JsonlSessionHistoryStore.js.map +0 -1
  477. package/bin/executor/types/SessionHistoryPaths.d.ts +0 -34
  478. package/bin/executor/types/SessionHistoryPaths.d.ts.map +0 -1
  479. package/bin/executor/types/SessionHistoryPaths.js +0 -2
  480. package/bin/executor/types/SessionHistoryPaths.js.map +0 -1
  481. package/bin/model/CityModelAdapter.d.ts.map +0 -1
  482. package/bin/model/CityModelAdapter.js.map +0 -1
  483. package/bin/rpc/Client.d.ts.map +0 -1
  484. package/bin/rpc/Client.js.map +0 -1
  485. package/bin/session/SessionSystemBuilder.d.ts +0 -107
  486. package/bin/session/SessionSystemBuilder.d.ts.map +0 -1
  487. package/bin/session/SessionSystemBuilder.js +0 -148
  488. package/bin/session/SessionSystemBuilder.js.map +0 -1
  489. package/bin/session/recorder/SessionMessageCodec.d.ts.map +0 -1
  490. package/bin/session/recorder/SessionMessageCodec.js.map +0 -1
  491. package/bin/session/recorder/SessionRecorder.d.ts +0 -217
  492. package/bin/session/recorder/SessionRecorder.d.ts.map +0 -1
  493. package/bin/session/recorder/SessionRecorder.js.map +0 -1
  494. package/bin/session/recorder/SessionRecorderCompaction.d.ts +0 -18
  495. package/bin/session/recorder/SessionRecorderCompaction.d.ts.map +0 -1
  496. package/bin/session/recorder/SessionRecorderCompaction.js.map +0 -1
  497. package/bin/session/recorder/SessionRecorderHistoryStore.d.ts +0 -66
  498. package/bin/session/recorder/SessionRecorderHistoryStore.d.ts.map +0 -1
  499. package/bin/session/recorder/SessionRecorderHistoryStore.js +0 -190
  500. package/bin/session/recorder/SessionRecorderHistoryStore.js.map +0 -1
  501. package/bin/session/runtime/SessionPromptRuntime.d.ts +0 -112
  502. package/bin/session/runtime/SessionPromptRuntime.d.ts.map +0 -1
  503. package/bin/session/runtime/SessionPromptRuntime.js +0 -357
  504. package/bin/session/runtime/SessionPromptRuntime.js.map +0 -1
  505. package/bin/session/services/SessionStateService.d.ts +0 -187
  506. package/bin/session/services/SessionStateService.d.ts.map +0 -1
  507. package/bin/session/services/SessionStateService.js +0 -467
  508. package/bin/session/services/SessionStateService.js.map +0 -1
  509. package/bin/session/services/SessionTurnService.d.ts +0 -90
  510. package/bin/session/services/SessionTurnService.d.ts.map +0 -1
  511. package/bin/session/services/SessionTurnService.js +0 -293
  512. package/bin/session/services/SessionTurnService.js.map +0 -1
  513. package/bin/session/services/SessionViewService.d.ts +0 -114
  514. package/bin/session/services/SessionViewService.d.ts.map +0 -1
  515. package/bin/session/services/SessionViewService.js +0 -204
  516. package/bin/session/services/SessionViewService.js.map +0 -1
  517. package/bin/session/storage/Persistence.d.ts +0 -73
  518. package/bin/session/storage/Persistence.d.ts.map +0 -1
  519. package/bin/session/storage/Persistence.js +0 -63
  520. package/bin/session/storage/Persistence.js.map +0 -1
  521. package/bin/types/agent/AgentRuntimeAssembly.d.ts +0 -72
  522. package/bin/types/agent/AgentRuntimeAssembly.d.ts.map +0 -1
  523. package/bin/types/agent/AgentRuntimeAssembly.js +0 -10
  524. package/bin/types/agent/AgentRuntimeAssembly.js.map +0 -1
  525. package/bin/types/runtime/agent/AgentContext.d.ts +0 -306
  526. package/bin/types/runtime/agent/AgentContext.d.ts.map +0 -1
  527. package/bin/types/runtime/agent/AgentContext.js +0 -128
  528. package/bin/types/runtime/agent/AgentContext.js.map +0 -1
  529. package/bin/types/session/SessionComposerOptions.d.ts +0 -90
  530. package/bin/types/session/SessionComposerOptions.d.ts.map +0 -1
  531. package/bin/types/session/SessionComposerOptions.js +0 -10
  532. package/bin/types/session/SessionComposerOptions.js.map +0 -1
  533. package/bin/types/session/SessionQueueCommand.d.ts +0 -68
  534. package/bin/types/session/SessionQueueCommand.d.ts.map +0 -1
  535. package/bin/types/session/SessionQueueCommand.js +0 -10
  536. package/bin/types/session/SessionQueueCommand.js.map +0 -1
  537. package/scripts/session-action-message.test.mjs +0 -410
  538. package/scripts/session-compaction-context-window.test.mjs +0 -96
  539. package/scripts/session-history-inflight.test.mjs +0 -146
  540. package/scripts/session-history-writer-error.test.mjs +0 -57
  541. package/scripts/session-prompt-runtime.test.mjs +0 -390
  542. package/src/agent/local/Agent.ts +0 -250
  543. package/src/agent/local/AgentPluginFactory.ts +0 -51
  544. package/src/agent/local/AgentRuntimeAssembly.ts +0 -65
  545. package/src/agent/local/services/AgentAssemblyService.ts +0 -307
  546. package/src/agent/local/services/AgentBackgroundService.ts +0 -115
  547. package/src/executor/SessionRunScope.ts +0 -122
  548. package/src/executor/composer/compaction/SessionCompactionComposer.ts +0 -84
  549. package/src/executor/composer/compaction/jsonl/JsonlSessionCompactionComposer.ts +0 -51
  550. package/src/executor/composer/compaction/jsonl/JsonlSessionCompactionExecutor.ts +0 -294
  551. package/src/executor/composer/compaction/jsonl/JsonlSessionCompactionFileOperations.ts +0 -197
  552. package/src/executor/composer/context/LocalSessionContextComposer.ts +0 -175
  553. package/src/executor/composer/context/SessionContextComposer.ts +0 -83
  554. package/src/executor/composer/history/SessionHistoryComposer.ts +0 -62
  555. package/src/executor/composer/history/SessionHistoryWriter.ts +0 -100
  556. package/src/executor/composer/history/jsonl/JsonlSessionHistoryComposer.ts +0 -133
  557. package/src/executor/messages/AssistantResultPersistence.ts +0 -106
  558. package/src/executor/services/ExecutorInflightService.ts +0 -95
  559. package/src/executor/store/history/SessionHistoryStore.ts +0 -172
  560. package/src/executor/store/history/jsonl/JsonlSessionHistoryStore.ts +0 -879
  561. package/src/executor/types/SessionHistoryPaths.ts +0 -38
  562. package/src/session/SessionSystemBuilder.ts +0 -262
  563. package/src/session/recorder/SessionRecorderHistoryStore.ts +0 -256
  564. package/src/session/runtime/SessionPromptRuntime.ts +0 -518
  565. package/src/session/services/SessionStateService.ts +0 -628
  566. package/src/session/services/SessionTurnService.ts +0 -368
  567. package/src/session/services/SessionViewService.ts +0 -335
  568. package/src/session/storage/Persistence.ts +0 -137
  569. package/src/types/agent/AgentRuntimeAssembly.ts +0 -74
  570. package/src/types/runtime/agent/AgentContext.ts +0 -387
  571. package/src/types/session/SessionComposerOptions.ts +0 -107
  572. package/src/types/session/SessionQueueCommand.ts +0 -78
  573. /package/bin/{agent/local → config}/ProjectSetup.d.ts +0 -0
  574. /package/bin/{agent/remote → remote}/RemoteTransport.js +0 -0
  575. /package/bin/session/{recorder → messages}/JsonlSessionMessageStore.d.ts +0 -0
  576. /package/bin/session/{recorder → messages}/JsonlSessionMessageStore.js +0 -0
  577. /package/src/{agent/local → config}/ProjectSetup.ts +0 -0
  578. /package/src/session/{recorder → messages}/JsonlSessionMessageStore.ts +0 -0
package/README.md CHANGED
@@ -5,9 +5,9 @@
5
5
  它负责把一个 agent 项目目录装配成可执行运行时,包括:
6
6
 
7
7
  - 本地 SDK:`Agent`、`Session`、`RemoteAgent`
8
- - 内部执行内核:historysystem、tool loop、增量输出
9
- - Plugin 框架:hook、action、内建插件
10
- - 运行时实现:RPC runtime、sandbox、host
8
+ - 内部执行内核:Session ComposerLLM/Tool Loop、增量输出
9
+ - Plugin 框架:registry、action、tool bridge 与执行生命周期
10
+ - 远程访问:`RemoteAgent`、HTTP/RPC transport
11
11
 
12
12
  `downcity` 负责多 Agent 管理、控制面网关、平台 CLI、共享模型目录接入与 daemon 进程管理;`@downcity/agent` 只负责单 Agent 的执行面。
13
13
 
@@ -15,14 +15,13 @@
15
15
 
16
16
  - 面向单个 Agent 项目的执行面
17
17
  - 对外通过 `@downcity/agent` 根入口暴露公共 API
18
- - 负责 session SDK、executor 内核、plugin、sandbox、RPC runtime、SDK 本地 Agent
18
+ - 负责 session SDK、executor 内核、plugin runtime、sandbox、SDK 本地 Agent
19
19
  - 不负责多 Agent registry、control plane daemon、console UI 聚合和平台级编排
20
20
 
21
21
  ## 与其他包的边界
22
22
 
23
23
  - `@downcity/agent`
24
24
  - 单 Agent runtime
25
- - 单 Agent RPC runtime
26
25
  - session SDK、executor 内核、plugin 框架、sandbox
27
26
  - 本地 SDK facade
28
27
  - `downcity`
@@ -49,21 +48,15 @@ packages/agent
49
48
 
50
49
  ```text
51
50
  src/
52
- ├── index.ts # 包公开入口,集中导出外部可依赖的 API 与协议类型
53
- ├── agent/ # Agent SDK 入口,按 local / remote 拆分本地与远程实现
54
- ├── local/ # 本地 Agent facade 与实例装配中心
55
- │ └── remote/ # RemoteAgent facade、RemoteSession 与 HTTP/RPC transport
56
- ├── config/ # 项目环境、运行路径、execution binding 与初始化脚手架
57
- │ └── project/ # Agent 项目初始化与项目初始化类型
58
- ├── executor/ # 内部执行内核,负责历史、systemtool loop、增量输出与消息持久化
59
- ├── plugin/ # 插件系统,负责插件注册、hook、action、内建插件与插件类型
60
- ├── rpc/ # Agent 本机 RPC runtime,对外 HTTP gateway 由 downcity 提供
61
- ├── runtime/ # 运行时实现细节层,统一收纳 host / sandbox / control 等内部能力
62
- │ ├── host/ # 宿主注入能力协议
63
- │ └── sandbox/ # 命令沙箱与沙箱协议
64
- ├── session/ # SDK session actor、metadata、落盘路径、持久化与 runtime 端口适配
65
- ├── types/ # 跨模块共享协议类型,集中放置 common / config / runtime 等稳定契约
66
- └── utils/ # 低层工具,负责 CLI、日志、存储与模板辅助
51
+ ├── index.ts # 包公开入口
52
+ ├── agent/ # Agent facade、AgentState、AgentSessions AgentModel
53
+ ├── config/ # 项目环境、运行路径与初始化能力
54
+ ├── executor/ # LLM/Tool Loop、执行恢复与内存上下文折叠
55
+ ├── plugin/ # Plugin registry、执行视图、工具桥接与生命周期
56
+ ├── remote/ # RemoteAgent、RemoteSession 与 HTTP/RPC transport
57
+ ├── session/ # Session facadeState、Turn、Queue、Messages 与 Composer
58
+ ├── types/ # agent / executor / session / plugin 等共享协议类型
59
+ └── utils/ # 日志、存储、资源和通用辅助能力
67
60
  ```
68
61
 
69
62
  ## 顶层目录职责
@@ -75,32 +68,30 @@ src/
75
68
 
76
69
  - `src/agent/`
77
70
  - SDK facade 层
78
- - `local/Agent.ts` 负责本地 Agent 实例装配、plugin/session/RPC 生命周期
79
- - `remote/RemoteAgent.ts` 负责远程 Agent 客户端入口
80
- - `remote/RemoteSession.ts` 负责远程 session actor 与 turn lifecycle
81
- - `remote/transports/*` 负责 HTTP/RPC transport 适配
71
+ - `Agent.ts` 负责本地 Agent 实例装配
72
+ - `AgentSessions.ts` 负责 Session 集合生命周期
73
+
74
+ - `src/session/`
75
+ - `Session.ts` 是公开 facade 与 Session 对象装配入口
76
+ - `SessionState.ts` 管理配置与 metadata
77
+ - `SessionTurn.ts` 管理输入队列和 Turn 生命周期
78
+ - `SessionMessages.ts` 是 canonical Message 唯一事实源
79
+ - `DefaultSessionComposer.ts` 负责 system/history/tools 与压缩计划定制
80
+ - `messages/` 放 JSONL Store、Assistant writer、Message codec 与 compaction
81
+ - 完整设计见 [`docs/session-runtime-architecture.md`](../../docs/session-runtime-architecture.md)
82
82
 
83
83
  - `src/executor/`
84
84
  - 内部执行内核
85
- - `Session` SDK 用户面对的会话整体,`Executor` 是内部单轮执行引擎
86
- - Store 负责 history 事实源落盘,Composer 是可替换的 session 阶段策略协议,负责定义 system / history / context / compaction 等执行阶段逻辑
87
- - `Executor.prepareExecuteInput()` 串起四类 Composer,`Executor.runCoreEngine()` 负责进入模型 tool loop
88
- - 负责 history、system、context、CoreEngine、增量输出与消息持久化
85
+ - `Executor` 只负责单轮 LLM/Tool Loop、Step 状态和上下文恢复
86
+ - 不持有 History Store,不负责 Message metadata 持久化
89
87
 
90
88
  - `src/plugin/`
91
- - 插件框架与内建插件
92
- - `core/` 负责注册、启用态、hook 调度、本地 action
93
- - `builtins/` 放 `auth`、`chat`、`contact`、`memory`、`shell`、`skill`、`task`、`web`、`asr`、`tts`、`voice`、`workboard` 等内建插件
94
- - `types/` 放插件公共协议类型
95
-
96
- - `src/runtime/`
97
- - 单 Agent 的运行时实现细节层
98
- - `host/` 放宿主注入能力协议
99
- - `sandbox/` 放命令执行隔离与沙箱协议
100
- - `control/` 放 runtime 控制面内部协议与处理器
101
- - `src/rpc/` 放 Agent 本机 RPC runtime;HTTP gateway 由 downcity CLI 基于 RPC 转发提供
102
- - 模型实例解析不在 `agent` 包内完成,而由宿主先创建 `LanguageModel`,再通过 `new Agent({ model })` 或 `session.set({ model })` 注入
103
- - `model` 也可以接收 City City 返回的 `CityModel`,Agent 会在内部适配成 AI SDK `LanguageModel`
89
+ - Agent 侧 Plugin registry、执行视图、生命周期与工具桥接
90
+ - 具体内建 Plugin 实现位于 `@downcity/plugins`
91
+
92
+ - `src/remote/transports/` 放 HTTP、RPC transport 及其内部客户端;RPC Server 与 HTTP gateway 由上游宿主管理
93
+ - Agent 与 Session 都持有宿主传入的 `AgentModel` 实例;`AgentModel` 可以是 AI SDK `LanguageModel` 或 City 返回的 `CityModel`
94
+ - Session 可通过 `session.set({ model })` 覆盖,执行时固定按 Session 模型、Agent 模型的顺序解析,并在 LLM 调用边界转换为 `LanguageModel`
104
95
 
105
96
  - `src/types/`
106
97
  - 跨模块、跨包共享协议类型
@@ -117,13 +108,15 @@ src/
117
108
  `@downcity/agent` 的核心是一条单 Agent 执行链:
118
109
 
119
110
  ```text
120
- 入口协议 -> Agent facade -> AgentContext -> Session / Executor / Plugin -> Runtime 子系统 -> History / Reply
111
+ 入口协议 -> Agent facade -> SessionTurn -> SessionComposer -> Executor -> SessionMessages
121
112
  ```
122
113
 
123
114
  其中:
124
115
 
125
- - `agent/local` `agent/remote` 是用户 API
126
- - `Agent` facade 是实例级装配中心
116
+ - `agent` 承载本地 Agent 核心运行时,`remote` 承载独立的远程 SDK 客户端
117
+ - `config` 承载项目初始化等宿主集成能力,不进入 Agent 核心生命周期
118
+ - `Agent` facade 是实例级装配中心,也是 env、instruction、model、tools、plugins 与 sessions 的唯一状态所有者
119
+ - `AgentContext` 只向 Plugin 与宿主投影受限运行时能力,不保存完整项目 config 或第二份 Agent 状态
127
120
  - `session / executor / plugin` 是三大核心分层
128
- - `runtime` 是 control / sandbox / host 这类实现细节的统一容器
121
+ - `SessionMessages` 是 Message 唯一事实源,Executor 不持有 Store
129
122
  - `types / utils` 提供横向公共支撑
@@ -1,54 +1,69 @@
1
1
  /**
2
- * Agent local:本地入口与 facade。
2
+ * Agent:本地 Agent 核心入口与 facade。
3
3
  *
4
4
  * 职责说明(中文)
5
5
  * - 对外暴露 `Agent` 这一唯一的本地实例类。
6
- * - facade 只保留公开 API 与 service 组合,不再直接承载装配、session 管理与生命周期细节。
7
- * - 单个 agent 的长期对象装配、session 管理、后台能力生命周期分别下沉到独立 service。
6
+ * - Agent 直接持有自身状态与长期运行时对象,避免额外 Assembly 复制同一批字段。
7
+ * - Session 集合由 `AgentSessions` 管理;长期运行状态由 `AgentState` 管理。
8
8
  */
9
9
  import type { Tool } from "ai";
10
- import type { AgentContext } from "../../types/runtime/agent/AgentContext.js";
11
- import type { DowncityConfig } from "../../types/config/DowncityConfig.js";
12
- import type { AgentPlugins } from "../../types/plugin/PluginRuntime.js";
13
- import type { AgentOptions } from "../../types/agent/AgentOptions.js";
14
- import type { AgentSessions as AgentSessionsApi } from "../../types/agent/SessionActor.js";
10
+ import type { AgentModel } from "../agent/AgentModel.js";
11
+ import { AgentContext } from "../agent/AgentContext.js";
12
+ import type { AgentOptions } from "../types/agent/AgentOptions.js";
15
13
  import type { Shell } from "@downcity/shell";
16
- import { Logger } from "../../utils/logger/Logger.js";
14
+ import { Logger } from "../utils/logger/Logger.js";
15
+ import { AgentSessions } from "../agent/AgentSessions.js";
16
+ import { PluginRegistry } from "../plugin/core/PluginRegistry.js";
17
17
  /**
18
18
  * SDK 本地 Agent。
19
19
  */
20
20
  export declare class Agent {
21
+ /** 当前 Agent 的稳定标识,用于区分 Session 存储目录与运行时归属。 */
21
22
  readonly id: string;
23
+ /** 当前 Agent 绑定的项目根目录绝对路径。 */
22
24
  readonly path: string;
25
+ /** 当前 Agent 向所有 Session 提供的工具集合。 */
23
26
  readonly tools: Record<string, Tool>;
24
- readonly plugins: AgentPlugins;
25
- readonly sessions: AgentSessionsApi;
27
+ /** 当前 Agent 已装配的 Plugin 调用与注册入口。 */
28
+ readonly plugins: PluginRegistry;
29
+ /** 当前 Agent 的本地 Session 创建、恢复、查询与归档入口。 */
30
+ readonly sessions: AgentSessions;
31
+ /**
32
+ * 当前 Agent 持有的默认运行时模型实例。
33
+ *
34
+ * 关键点(中文)
35
+ * - Agent 只持有调用方传入的实例,不负责模型选择、持久化或恢复。
36
+ * - Session 未设置自己的模型时,执行会回退使用该实例。
37
+ */
38
+ readonly model?: AgentModel;
39
+ /** 当前 Agent 独享的运行日志器。 */
26
40
  private readonly logger;
27
- private readonly agentContext;
28
- private readonly config;
41
+ /** 提供给 Plugin、Session 与宿主集成层共享的 Agent 执行上下文。 */
42
+ private readonly context;
43
+ /** 当前 Agent configured env 的可变共享对象。 */
29
44
  private readonly env;
30
- private readonly defaultModel?;
31
- private readonly default_model_id?;
32
- private readonly resolve_model?;
45
+ /** 调用方提供的自定义 Session 类;省略时使用 SDK 默认实现。 */
33
46
  private readonly SessionClass;
34
- private readonly backgroundService;
47
+ /** 当前 Agent 的长期运行状态与生命周期。 */
48
+ private readonly state;
49
+ /** 当前 Agent 可选的内建 Shell 实例。 */
35
50
  private readonly shell?;
36
- private readonly local_sessions;
51
+ /** 当前 Agent configured instruction 的可变有序集合。 */
37
52
  private instruction;
38
53
  constructor(options: AgentOptions);
39
54
  /**
40
- * 等待 Agent 后台能力启动完成。
55
+ * 等待 Agent 持有的长期运行时启动完成。
41
56
  *
42
57
  * 关键点(中文)
43
58
  * - Agent 构造完成即开始启动 plugin lifecycle 与 ActionSchedule。
44
- * - 调用方在需要确认后台能力就绪时使用,例如启动后立刻读取 plugin 状态。
59
+ * - 调用方在需要确认运行时就绪时使用,例如启动后立刻读取 plugin 状态。
45
60
  */
46
61
  ready(): Promise<void>;
47
62
  /**
48
- * 释放当前 Agent 的后台能力。
63
+ * 释放当前 Agent 持有的长期运行时对象。
49
64
  *
50
65
  * 关键点(中文)
51
- * - 关闭 plugin lifecycle、ActionSchedule、shell 等后台资源。
66
+ * - 关闭 plugin lifecycle、ActionSchedule、shell 等 Agent 自有资源。
52
67
  * - 不负责任何 transport(RPC / HTTP);transport 由 `@downcity/server` 自行管理。
53
68
  */
54
69
  dispose(): Promise<void>;
@@ -84,10 +99,6 @@ export declare class Agent {
84
99
  * 原地应用一次 env patch,不触发重复广播。
85
100
  */
86
101
  private apply_env_patch;
87
- /**
88
- * 返回当前项目根目录解析后的配置快照。
89
- */
90
- getConfig(): DowncityConfig;
91
102
  /**
92
103
  * 返回当前 agent 绑定的统一日志器。
93
104
  */
@@ -100,6 +111,5 @@ export declare class Agent {
100
111
  * 返回当前 agent 挂载的 Shell。
101
112
  */
102
113
  getShell(): Shell | undefined;
103
- private create_sessions;
104
114
  }
105
115
  //# sourceMappingURL=Agent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Agent.d.ts","sourceRoot":"","sources":["../../src/agent/Agent.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAC/B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAGlD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAGzD,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAEjE;;GAEG;AACH,qBAAa,KAAK;IAChB,8CAA8C;IAC9C,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IAEpB,6BAA6B;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB,oCAAoC;IACpC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAErC,oCAAoC;IACpC,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC;IAEjC,0CAA0C;IAC1C,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC;IAEj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ent 核心入口与 facade。
3
+ *
4
+ * 职责说明(中文)
5
+ * - 对外暴露 `Agent` 这一唯一的本地实例类。
6
+ * - Agent 直接持有自身状态与长期运行时对象,避免额外 Assembly 复制同一批字段。
7
+ * - Session 集合由 `AgentSessions` 管理;长期运行状态由 `AgentState` 管理。
8
+ */
9
+ import { AgentContext } from "../agent/AgentContext.js";
10
+ import { Logger } from "../utils/logger/Logger.js";
11
+ import { resolve_agent_env } from "../config/AgentEnv.js";
12
+ import { normalizeInstructionInput } from "../agent/AgentInstructions.js";
13
+ import { AgentSessions } from "../agent/AgentSessions.js";
14
+ import { AgentState } from "../agent/AgentState.js";
15
+ import { generateId } from "../utils/Id.js";
16
+ import { PluginRegistry } from "../plugin/core/PluginRegistry.js";
17
+ /**
18
+ * SDK 本地 Agent。
19
+ */
20
+ export class Agent {
21
+ /** 当前 Agent 的稳定标识,用于区分 Session 存储目录与运行时归属。 */
22
+ id;
23
+ /** 当前 Agent 绑定的项目根目录绝对路径。 */
24
+ path;
25
+ /** 当前 Agent 向所有 Session 提供的工具集合。 */
26
+ tools;
27
+ /** 当前 Agent 已装配的 Plugin 调用与注册入口。 */
28
+ plugins;
29
+ /** 当前 Agent 的本地 Session 创建、恢复、查询与归档入口。 */
30
+ sessions;
31
+ /**
32
+ * 当前 Agent 持有的默认运行时模型实例。
33
+ *
34
+ * 关键点(中文)
35
+ * - Agent 只持有调用方传入的实例,不负责模型选择、持久化或恢复。
36
+ * - Session 未设置自己的模型时,执行会回退使用该实例。
37
+ */
38
+ model;
39
+ /** 当前 Agent 独享的运行日志器。 */
40
+ logger;
41
+ /** 提供给 Plugin、Session 与宿主集成层共享的 Agent 执行上下文。 */
42
+ context;
43
+ /** 当前 Agent configured env 的可变共享对象。 */
44
+ env;
45
+ /** 调用方提供的自定义 Session 类;省略时使用 SDK 默认实现。 */
46
+ SessionClass;
47
+ /** 当前 Agent 的长期运行状态与生命周期。 */
48
+ state;
49
+ /** 当前 Agent 可选的内建 Shell 实例。 */
50
+ shell;
51
+ /** 当前 Agent configured instruction 的可变有序集合。 */
52
+ instruction;
53
+ constructor(options) {
54
+ this.id = String(options.id || "").trim();
55
+ this.path = String(options.path || "").trim();
56
+ if (!this.id)
57
+ throw new Error("Agent requires a non-empty id");
58
+ if (!this.path)
59
+ throw new Error("Agent requires a non-empty path");
60
+ this.SessionClass = options.Session;
61
+ this.model = options.model;
62
+ this.tools = options.tools && typeof options.tools === "object"
63
+ ? { ...options.tools }
64
+ : {};
65
+ this.logger = new Logger();
66
+ this.logger.bindProjectRoot(this.path);
67
+ this.env = resolve_agent_env(this.path, options.env);
68
+ this.instruction = normalizeInstructionInput(options.instruction);
69
+ this.shell = options.shell;
70
+ this.plugins = new PluginRegistry(options.plugins || []);
71
+ if (this.shell) {
72
+ this.shell.configure({
73
+ root_path: this.path,
74
+ env: this.env,
75
+ agent_id: this.id,
76
+ logger: this.logger,
77
+ });
78
+ Object.assign(this.tools, this.shell.tools);
79
+ }
80
+ this.sessions = new AgentSessions({
81
+ agent_id: this.id,
82
+ project_root: this.path,
83
+ tools: this.tools,
84
+ logger: this.logger,
85
+ get_instruction: () => this.instruction,
86
+ get_agent_env: () => this.getEnv(),
87
+ get_agent_plugins: () => this.plugins.execution_view(),
88
+ ensure_agent_ready: async () => {
89
+ await this.ready();
90
+ },
91
+ get_agent_model: () => this.model,
92
+ SessionClass: this.SessionClass,
93
+ });
94
+ this.context = new AgentContext({
95
+ agent_id: this.id,
96
+ rootPath: this.path,
97
+ logger: this.logger,
98
+ get_env: () => this.env,
99
+ get_systems: () => this.instruction,
100
+ sessions: this.sessions,
101
+ plugins: this.plugins,
102
+ });
103
+ // 关键点(中文):装配完成后创建唯一状态对象,并立即启动长期运行时。
104
+ this.state = new AgentState({
105
+ context: this.context,
106
+ plugins: this.plugins,
107
+ sessions: this.sessions,
108
+ tools: this.tools,
109
+ shell: this.shell,
110
+ });
111
+ }
112
+ /**
113
+ * 等待 Agent 持有的长期运行时启动完成。
114
+ *
115
+ * 关键点(中文)
116
+ * - Agent 构造完成即开始启动 plugin lifecycle 与 ActionSchedule。
117
+ * - 调用方在需要确认运行时就绪时使用,例如启动后立刻读取 plugin 状态。
118
+ */
119
+ async ready() {
120
+ await this.state.ready();
121
+ }
122
+ /**
123
+ * 释放当前 Agent 持有的长期运行时对象。
124
+ *
125
+ * 关键点(中文)
126
+ * - 关闭 plugin lifecycle、ActionSchedule、shell 等 Agent 自有资源。
127
+ * - 不负责任何 transport(RPC / HTTP);transport 由 `@downcity/server` 自行管理。
128
+ */
129
+ async dispose() {
130
+ await this.state.dispose();
131
+ }
132
+ /**
133
+ * 更新当前 SDK Agent 的静态基础指令。
134
+ */
135
+ setInstruction(input) {
136
+ const next_instruction = normalizeInstructionInput(input);
137
+ this.instruction.splice(0, this.instruction.length, ...next_instruction);
138
+ this.sessions.broadcast_instruction(this.instruction, generateId());
139
+ }
140
+ /**
141
+ * 返回当前 agent env 的浅拷贝快照。
142
+ *
143
+ * 关键点(中文)
144
+ * - 返回的是拷贝,调用方修改它不会影响 agent 真实状态。
145
+ * - 想改 env 请使用 `setEnv` / `patchEnv`。
146
+ */
147
+ getEnv() {
148
+ return { ...this.env };
149
+ }
150
+ /**
151
+ * 整体覆盖 agent env。
152
+ *
153
+ * 关键点(中文)
154
+ * - 直接清空当前共享 env 对象,再写入新值,保证 plugin / runtime / shell 看到的是同一引用。
155
+ * - 仅写入字符串值,`null` / `undefined` 表示删除该 key。
156
+ */
157
+ setEnv(next) {
158
+ for (const key of Object.keys(this.env)) {
159
+ delete this.env[key];
160
+ }
161
+ this.apply_env_patch(next);
162
+ this.sessions.broadcast_env(this.env, generateId());
163
+ }
164
+ /**
165
+ * 增量合并 agent env。
166
+ *
167
+ * 关键点(中文)
168
+ * - `null` / `undefined` 表示删除该 key;其他值会强制转字符串后写入。
169
+ * - configured env 原地更新;已有 Session 在下一 step 检查点提交 effective env。
170
+ */
171
+ patchEnv(patch) {
172
+ this.apply_env_patch(patch);
173
+ this.sessions.broadcast_env(this.env, generateId());
174
+ }
175
+ /**
176
+ * 原地应用一次 env patch,不触发重复广播。
177
+ */
178
+ apply_env_patch(patch) {
179
+ if (!patch || typeof patch !== "object")
180
+ return;
181
+ for (const [raw_key, raw_value] of Object.entries(patch)) {
182
+ const key = String(raw_key || "").trim();
183
+ if (!key)
184
+ continue;
185
+ if (raw_value === null || raw_value === undefined) {
186
+ delete this.env[key];
187
+ continue;
188
+ }
189
+ this.env[key] = String(raw_value);
190
+ }
191
+ }
192
+ /**
193
+ * 返回当前 agent 绑定的统一日志器。
194
+ */
195
+ getLogger() {
196
+ return this.logger;
197
+ }
198
+ /**
199
+ * 返回当前 agent context。
200
+ */
201
+ getContext() {
202
+ return this.context;
203
+ }
204
+ /**
205
+ * 返回当前 agent 挂载的 Shell。
206
+ */
207
+ getShell() {
208
+ return this.shell;
209
+ }
210
+ }
211
+ //# sourceMappingURL=Agent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Agent.js","sourceRoot":"","sources":["../../src/agent/Agent.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAGvD,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,yBAAyB,EAAE,MAAM,8BAA8B,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAEjE;;GAEG;AACH,MAAM,OAAO,KAAK;IAChB,8CAA8C;IACrC,EAAE,CAAS;IAEpB,6BAA6B;IACpB,IAAI,CAAS;IAEtB,oCAAoC;IAC3B,KAAK,CAAuB;IAErC,oCAAoC;IA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;;OAEG;IACH,QAAQ;QACN,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;CACF"}
@@ -0,0 +1,64 @@
1
+ /**
2
+ * AgentContext:本地 Agent 的统一执行上下文。
3
+ *
4
+ * 职责说明(中文)
5
+ * - 同一 Agent 实例全程共享同一个 Context。
6
+ * - 向 Plugin、Session 与宿主投影当前 Agent 的稳定运行时能力。
7
+ * - Context 不复制 Agent 状态,env 与 systems 始终从唯一状态源读取。
8
+ */
9
+ import type { AgentSessions } from "../agent/AgentSessions.js";
10
+ import type { AgentPlugins } from "../types/plugin/PluginRuntime.js";
11
+ import type { Logger } from "../utils/logger/Logger.js";
12
+ /**
13
+ * AgentContext 构造参数。
14
+ */
15
+ interface AgentContextOptions {
16
+ /** 当前 Agent 稳定标识。 */
17
+ agent_id: string;
18
+ /** 当前项目根目录。 */
19
+ rootPath: string;
20
+ /** 当前 Agent 统一日志器。 */
21
+ logger: Logger;
22
+ /** 读取当前 Agent configured env。 */
23
+ get_env: () => Readonly<Record<string, string>>;
24
+ /** 读取当前 Agent configured systems。 */
25
+ get_systems: () => readonly string[];
26
+ /** 当前 Agent 直接持有的 Session 集合。 */
27
+ sessions: AgentSessions;
28
+ /** 当前 Agent 唯一的 Plugin 调用入口。 */
29
+ plugins: AgentPlugins;
30
+ }
31
+ /**
32
+ * 本地 Agent 的统一执行上下文。
33
+ */
34
+ export declare class AgentContext {
35
+ /** 当前 Agent 稳定标识。 */
36
+ readonly agent_id: string;
37
+ /** 当前项目根目录。 */
38
+ readonly rootPath: string;
39
+ /** 当前 Agent 统一日志器。 */
40
+ readonly logger: Logger;
41
+ /** 当前 Agent configured env 读取器。 */
42
+ private readonly get_env;
43
+ /** 当前 Agent configured systems 读取器。 */
44
+ private readonly get_systems;
45
+ /** 当前 Agent 直接持有的 Session 集合。 */
46
+ readonly sessions: AgentSessions;
47
+ /** 当前 Agent 唯一的 Plugin 调用入口。 */
48
+ readonly plugins: AgentPlugins;
49
+ constructor(options: AgentContextOptions);
50
+ /**
51
+ * 读取 Agent 已配置的 env。
52
+ *
53
+ * 关键点(中文)
54
+ * - Session step 的 effective env 由 Plugin action 参数 `run_context.agentEnv` 显式提供。
55
+ * - 该 getter 不根据异步调用链隐式切换结果。
56
+ */
57
+ get env(): Readonly<Record<string, string>>;
58
+ /**
59
+ * 读取 Agent 已配置的 instruction。
60
+ */
61
+ get systems(): readonly string[];
62
+ }
63
+ export {};
64
+ //# sourceMappingURL=AgentContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AgentContext.d.ts","sourceRoot":"","sources":["../../src/agent/AgentContext.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAEvD;;GAEG;AACH,UAAU,mBAAmB;IAC3B,qBAAqB;IACrB,QAAQ,EAAE,MAAM,CAAC;IAEjB,eAAe;IACf,QAAQ,EAAE,MAAM,CAAC;IAEjB,sBAAsB;IACtB,MAAM,EAAE,MAAM,CAAC;IAEf,iCAAiC;IACjC,OAAO,EAAE,MAAM,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAEhD,qCAAqC;IACrC,WAAW,EAAE,MAAM,SAAS,MAAM,EAAE,CAAC;IAErC,iCAAiC;IACjC,QAAQ,EAAE,aAAa,CAAC;IAExB,gCAAgC;IAChC,OAAO,EAAE,YAAY,CAAC;CACvB;AAED;;GAEG;AACH,qBAAa,YAAY;IACvB,qBAAqB;IACrB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAE1B,eAAe;IACf,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAE1B,sBAAsB;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAExB,mCAAmC;IACnC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAiC;IAEzD,uCAAuC;IACvC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAqC;IAEjE,iCAAiC;IACjC,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC;IAEjC,gCAAgC;IAChC,QAAQ,CAAC,OAAO,EAAE,YAAY,CAAC;gBAEnB,OAAO,EAAE,mBAAmB;IAUxC;;;;;;OAMG;IACH,IAAI,GAAG,IAAI,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAE1C;IAED;;OAEG;IACH,IAAI,OAAO,IAAI,SAAS,MAAM,EAAE,CAE/B;CACF"}
@@ -0,0 +1,53 @@
1
+ /**
2
+ * AgentContext:本地 Agent 的统一执行上下文。
3
+ *
4
+ * 职责说明(中文)
5
+ * - 同一 Agent 实例全程共享同一个 Context。
6
+ * - 向 Plugin、Session 与宿主投影当前 Agent 的稳定运行时能力。
7
+ * - Context 不复制 Agent 状态,env 与 systems 始终从唯一状态源读取。
8
+ */
9
+ /**
10
+ * 本地 Agent 的统一执行上下文。
11
+ */
12
+ export class AgentContext {
13
+ /** 当前 Agent 稳定标识。 */
14
+ agent_id;
15
+ /** 当前项目根目录。 */
16
+ rootPath;
17
+ /** 当前 Agent 统一日志器。 */
18
+ logger;
19
+ /** 当前 Agent configured env 读取器。 */
20
+ get_env;
21
+ /** 当前 Agent configured systems 读取器。 */
22
+ get_systems;
23
+ /** 当前 Agent 直接持有的 Session 集合。 */
24
+ sessions;
25
+ /** 当前 Agent 唯一的 Plugin 调用入口。 */
26
+ plugins;
27
+ constructor(options) {
28
+ this.agent_id = options.agent_id;
29
+ this.rootPath = options.rootPath;
30
+ this.logger = options.logger;
31
+ this.get_env = options.get_env;
32
+ this.get_systems = options.get_systems;
33
+ this.sessions = options.sessions;
34
+ this.plugins = options.plugins;
35
+ }
36
+ /**
37
+ * 读取 Agent 已配置的 env。
38
+ *
39
+ * 关键点(中文)
40
+ * - Session step 的 effective env 由 Plugin action 参数 `run_context.agentEnv` 显式提供。
41
+ * - 该 getter 不根据异步调用链隐式切换结果。
42
+ */
43
+ get env() {
44
+ return this.get_env();
45
+ }
46
+ /**
47
+ * 读取 Agent 已配置的 instruction。
48
+ */
49
+ get systems() {
50
+ return this.get_systems();
51
+ }
52
+ }
53
+ //# sourceMappingURL=AgentContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AgentContext.js","sourceRoot":"","sources":["../../src/agent/AgentContext.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAgCH;;GAEG;AACH,MAAM,OAAO,YAAY;IACvB,qBAAqB;IACZ,QAAQ,CAAS;IAE1B,eAAe;IACN,QAAQ,CAAS;IAE1B,sBAAsB;IACb,MAAM,CAAS;IAExB,mCAAmC;IAClB,OAAO,CAAiC;IAEzD,uCAAuC;IACtB,WAAW,CAAqC;IAEjE,iCAAiC;IACxB,QAAQ,CAAgB;IAEjC,gCAAgC;IACvB,OAAO,CAAe;IAE/B,YAAY,OAA4B;QACtC,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;QACjC,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;QACjC,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAC7B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;QAC/B,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;QACvC,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;QACjC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IACjC,CAAC;IAED;;;;;;OAMG;IACH,IAAI,GAAG;QACL,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC;IACxB,CAAC;IAED;;OAEG;IACH,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC;IAC5B,CAAC;CACF"}
@@ -6,12 +6,7 @@
6
6
  * - instruction 永远在 core 前面;core 不会被调用方 instruction 替代。
7
7
  * - 不读取 session、plugin 或 runtime 状态,保持为纯函数。
8
8
  */
9
- import type { DowncityConfig } from "../../types/config/DowncityConfig.js";
10
- import type { AgentSessionSystemBlock } from "../../types/agent/SessionTypes.js";
11
- /**
12
- * 创建 SDK 场景的最小 fallback 配置。
13
- */
14
- export declare function createFallbackSdkConfig(agent_id: string): DowncityConfig;
9
+ import type { AgentSessionSystemBlock } from "../types/agent/SessionTypes.js";
15
10
  /**
16
11
  * 归一化调用方传入的静态 instruction。
17
12
  */
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AgentInstructions.d.ts","sourceRoot":"","sources":["../../src/agent/AgentInstructions.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AAG7E;;GAEG;AACH,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,GACnC,MAAM,EAAE,CASV;AAUD;;GAEG;AACH,wBAAgB,6BAA6B,CAC3C,WAAW,EAAE,MAAM,EAAE,EACrB,YAAY,EAAE,MAAM,GACnB,uBAAuB,EAAE,CAc3B"}
@@ -6,16 +6,7 @@
6
6
  * - instruction 永远在 core 前面;core 不会被调用方 instruction 替代。
7
7
  * - 不读取 session、plugin 或 runtime 状态,保持为纯函数。
8
8
  */
9
- import { DEFAULT_SHIP_PROMPTS } from "../../executor/composer/system/default/SystemDomain.js";
10
- /**
11
- * 创建 SDK 场景的最小 fallback 配置。
12
- */
13
- export function createFallbackSdkConfig(agent_id) {
14
- return {
15
- id: agent_id,
16
- version: "0.0.0",
17
- };
18
- }
9
+ import { DEFAULT_SHIP_PROMPTS } from "../executor/composer/system/default/SystemDomain.js";
19
10
  /**
20
11
  * 归一化调用方传入的静态 instruction。
21
12
  */
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AgentInstructions.js","s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