@downcity/agent 1.1.438 → 1.1.446

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 (702) hide show
  1. package/README.md +25 -18
  2. package/bin/agent/Agent.d.ts +44 -20
  3. package/bin/agent/Agent.d.ts.map +1 -1
  4. package/bin/agent/Agent.js +114 -69
  5. package/bin/agent/Agent.js.map +1 -1
  6. package/bin/agent/AgentInstructions.d.ts +18 -4
  7. package/bin/agent/AgentInstructions.d.ts.map +1 -1
  8. package/bin/agent/AgentInstructions.js +33 -14
  9. package/bin/agent/AgentInstructions.js.map +1 -1
  10. package/bin/agent/AgentMemoryStorage.d.ts +1 -1
  11. package/bin/agent/AgentMemoryStorage.d.ts.map +1 -1
  12. package/bin/agent/AgentMemoryStorage.js.map +1 -1
  13. package/bin/agent/AgentSessions.d.ts +29 -16
  14. package/bin/agent/AgentSessions.d.ts.map +1 -1
  15. package/bin/agent/AgentSessions.js +42 -22
  16. package/bin/agent/AgentSessions.js.map +1 -1
  17. package/bin/group/Group.d.ts +13 -12
  18. package/bin/group/Group.d.ts.map +1 -1
  19. package/bin/group/Group.js +24 -23
  20. package/bin/group/Group.js.map +1 -1
  21. package/bin/group/GroupSession.d.ts.map +1 -1
  22. package/bin/group/GroupSession.js +13 -9
  23. package/bin/group/GroupSession.js.map +1 -1
  24. package/bin/group/GroupSessions.d.ts +27 -2
  25. package/bin/group/GroupSessions.d.ts.map +1 -1
  26. package/bin/group/GroupSessions.js +68 -21
  27. package/bin/group/GroupSessions.js.map +1 -1
  28. package/bin/group/storage/LocalGroupSessionDataStore.d.ts +8 -0
  29. package/bin/group/storage/LocalGroupSessionDataStore.d.ts.map +1 -1
  30. package/bin/group/storage/LocalGroupSessionDataStore.js +1 -1
  31. package/bin/group/storage/LocalGroupSessionDataStore.js.map +1 -1
  32. package/bin/group/storage/LocalGroupSessionStore.d.ts +64 -5
  33. package/bin/group/storage/LocalGroupSessionStore.d.ts.map +1 -1
  34. package/bin/group/storage/LocalGroupSessionStore.js +114 -23
  35. package/bin/group/storage/LocalGroupSessionStore.js.map +1 -1
  36. package/bin/index.d.ts +25 -30
  37. package/bin/index.d.ts.map +1 -1
  38. package/bin/index.js +14 -14
  39. package/bin/index.js.map +1 -1
  40. package/bin/{executor/model → model}/ModelGenerate.d.ts +1 -1
  41. package/bin/model/ModelGenerate.d.ts.map +1 -0
  42. package/bin/model/ModelGenerate.js.map +1 -0
  43. package/bin/{executor/model → model}/ModelRequestRunner.d.ts +1 -1
  44. package/bin/model/ModelRequestRunner.d.ts.map +1 -0
  45. package/bin/model/ModelRequestRunner.js.map +1 -0
  46. package/bin/{executor/model → model}/ModelStepRunner.d.ts +6 -7
  47. package/bin/model/ModelStepRunner.d.ts.map +1 -0
  48. package/bin/{executor/model → model}/ModelStepRunner.js +16 -10
  49. package/bin/model/ModelStepRunner.js.map +1 -0
  50. package/bin/model/ModelStreamConsumer.d.ts.map +1 -0
  51. package/bin/model/ModelStreamConsumer.js.map +1 -0
  52. package/bin/model/ModelStreamFailure.d.ts.map +1 -0
  53. package/bin/model/ModelStreamFailure.js.map +1 -0
  54. package/bin/model/ToolInputValidation.d.ts +28 -0
  55. package/bin/model/ToolInputValidation.d.ts.map +1 -0
  56. package/bin/model/ToolInputValidation.js +37 -0
  57. package/bin/model/ToolInputValidation.js.map +1 -0
  58. package/bin/model/messages/ChatMessageMarkup.d.ts.map +1 -0
  59. package/bin/model/messages/ChatMessageMarkup.js.map +1 -0
  60. package/bin/{executor → model}/messages/ChatMessageMarkupTypes.d.ts +1 -1
  61. package/bin/model/messages/ChatMessageMarkupTypes.d.ts.map +1 -0
  62. package/bin/{executor → model}/messages/ChatMessageMarkupTypes.js +1 -1
  63. package/bin/model/messages/ChatMessageMarkupTypes.js.map +1 -0
  64. package/bin/model/messages/SessionAttachmentMapper.d.ts.map +1 -0
  65. package/bin/model/messages/SessionAttachmentMapper.js.map +1 -0
  66. package/bin/model/messages/SessionMessageLog.d.ts.map +1 -0
  67. package/bin/model/messages/SessionMessageLog.js.map +1 -0
  68. package/bin/model/messages/SessionModelMessages.d.ts.map +1 -0
  69. package/bin/{executor → model}/messages/SessionModelMessages.js +0 -1
  70. package/bin/model/messages/SessionModelMessages.js.map +1 -0
  71. package/bin/model/prompts/SystemPromptAssets.d.ts.map +1 -0
  72. package/bin/{executor/composer/system/default → model/prompts}/SystemPromptAssets.js +1 -1
  73. package/bin/model/prompts/SystemPromptAssets.js.map +1 -0
  74. package/bin/model/prompts/assets/core.prompt.d.ts +7 -0
  75. package/bin/model/prompts/assets/core.prompt.d.ts.map +1 -0
  76. package/bin/model/prompts/assets/core.prompt.js +8 -0
  77. package/bin/model/prompts/assets/core.prompt.js.map +1 -0
  78. package/bin/session/Session.d.ts +29 -17
  79. package/bin/session/Session.d.ts.map +1 -1
  80. package/bin/session/Session.js +161 -134
  81. package/bin/session/Session.js.map +1 -1
  82. package/bin/session/input/SessionHookRunner.d.ts +52 -0
  83. package/bin/session/input/SessionHookRunner.d.ts.map +1 -0
  84. package/bin/session/input/SessionHookRunner.js +51 -0
  85. package/bin/session/input/SessionHookRunner.js.map +1 -0
  86. package/bin/session/input/SessionSystem.d.ts +26 -0
  87. package/bin/session/input/SessionSystem.d.ts.map +1 -0
  88. package/bin/session/{SessionSystem.js → input/SessionSystem.js} +27 -23
  89. package/bin/session/input/SessionSystem.js.map +1 -0
  90. package/bin/session/input/StepInput.d.ts +77 -0
  91. package/bin/session/input/StepInput.d.ts.map +1 -0
  92. package/bin/session/input/StepInput.js +429 -0
  93. package/bin/session/input/StepInput.js.map +1 -0
  94. package/bin/session/input/composer/AdaptiveContextCheckpoint.d.ts +33 -0
  95. package/bin/session/input/composer/AdaptiveContextCheckpoint.d.ts.map +1 -0
  96. package/bin/session/input/composer/AdaptiveContextCheckpoint.js +83 -0
  97. package/bin/session/input/composer/AdaptiveContextCheckpoint.js.map +1 -0
  98. package/bin/session/input/composer/AdaptiveContextParts.d.ts +26 -0
  99. package/bin/session/input/composer/AdaptiveContextParts.d.ts.map +1 -0
  100. package/bin/session/input/composer/AdaptiveContextParts.js +124 -0
  101. package/bin/session/input/composer/AdaptiveContextParts.js.map +1 -0
  102. package/bin/session/input/composer/ComposerAssembly.d.ts +21 -0
  103. package/bin/session/input/composer/ComposerAssembly.d.ts.map +1 -0
  104. package/bin/session/input/composer/ComposerAssembly.js +64 -0
  105. package/bin/session/input/composer/ComposerAssembly.js.map +1 -0
  106. package/bin/session/{composer/policies/SessionSummaryPrompts.d.ts → input/composer/ContextSummaryPrompts.d.ts} +5 -3
  107. package/bin/session/input/composer/ContextSummaryPrompts.d.ts.map +1 -0
  108. package/bin/session/{composer/policies/SessionSummaryPrompts.js → input/composer/ContextSummaryPrompts.js} +5 -3
  109. package/bin/session/input/composer/ContextSummaryPrompts.js.map +1 -0
  110. package/bin/session/input/composer/DefaultSessionComposer.d.ts +24 -0
  111. package/bin/session/input/composer/DefaultSessionComposer.d.ts.map +1 -0
  112. package/bin/session/input/composer/DefaultSessionComposer.js +108 -0
  113. package/bin/session/input/composer/DefaultSessionComposer.js.map +1 -0
  114. package/bin/session/input/composer/FullHistorySessionComposer.d.ts +19 -0
  115. package/bin/session/input/composer/FullHistorySessionComposer.d.ts.map +1 -0
  116. package/bin/session/input/composer/FullHistorySessionComposer.js +36 -0
  117. package/bin/session/input/composer/FullHistorySessionComposer.js.map +1 -0
  118. package/bin/session/{SessionLoop.d.ts → loop/SessionLoop.d.ts} +34 -7
  119. package/bin/session/loop/SessionLoop.d.ts.map +1 -0
  120. package/bin/session/{SessionLoop.js → loop/SessionLoop.js} +79 -16
  121. package/bin/session/loop/SessionLoop.js.map +1 -0
  122. package/bin/session/{SessionQueue.d.ts → loop/SessionQueue.d.ts} +9 -1
  123. package/bin/session/loop/SessionQueue.d.ts.map +1 -0
  124. package/bin/session/{SessionQueue.js → loop/SessionQueue.js} +19 -0
  125. package/bin/session/loop/SessionQueue.js.map +1 -0
  126. package/bin/session/{SessionState.d.ts → loop/SessionState.d.ts} +4 -5
  127. package/bin/session/loop/SessionState.d.ts.map +1 -0
  128. package/bin/session/{SessionState.js → loop/SessionState.js} +6 -25
  129. package/bin/session/loop/SessionState.js.map +1 -0
  130. package/bin/session/{SessionTitle.d.ts → loop/SessionTitle.d.ts} +4 -4
  131. package/bin/session/loop/SessionTitle.d.ts.map +1 -0
  132. package/bin/session/{SessionTitle.js → loop/SessionTitle.js} +3 -3
  133. package/bin/session/loop/SessionTitle.js.map +1 -0
  134. package/bin/session/loop/SessionTitleTask.d.ts.map +1 -0
  135. package/bin/session/loop/SessionTitleTask.js.map +1 -0
  136. package/bin/session/{runtime → loop}/SessionTurnCompletion.d.ts +7 -0
  137. package/bin/session/loop/SessionTurnCompletion.d.ts.map +1 -0
  138. package/bin/session/{runtime → loop}/SessionTurnCompletion.js +25 -6
  139. package/bin/session/loop/SessionTurnCompletion.js.map +1 -0
  140. package/bin/session/loop/SessionTurnContext.d.ts +12 -0
  141. package/bin/session/loop/SessionTurnContext.d.ts.map +1 -0
  142. package/bin/session/{runtime → loop}/SessionTurnContext.js +14 -67
  143. package/bin/session/loop/SessionTurnContext.js.map +1 -0
  144. package/bin/session/loop/SessionTurnFileDiff.d.ts.map +1 -0
  145. package/bin/session/{runtime → loop}/SessionTurnFileDiff.js +1 -1
  146. package/bin/session/loop/SessionTurnFileDiff.js.map +1 -0
  147. package/bin/session/{messages → loop}/SessionTurnFileDiffBuilder.d.ts +3 -3
  148. package/bin/session/loop/SessionTurnFileDiffBuilder.d.ts.map +1 -0
  149. package/bin/session/loop/SessionTurnFileDiffBuilder.js.map +1 -0
  150. package/bin/session/messages/ApprovalInteraction.d.ts +30 -0
  151. package/bin/session/messages/ApprovalInteraction.d.ts.map +1 -0
  152. package/bin/session/messages/ApprovalInteraction.js +61 -0
  153. package/bin/session/messages/ApprovalInteraction.js.map +1 -0
  154. package/bin/session/messages/SessionAgentMessageState.d.ts +47 -18
  155. package/bin/session/messages/SessionAgentMessageState.d.ts.map +1 -1
  156. package/bin/session/messages/SessionAgentMessageState.js +224 -86
  157. package/bin/session/messages/SessionAgentMessageState.js.map +1 -1
  158. package/bin/session/messages/SessionAgentMessageWriter.d.ts +15 -4
  159. package/bin/session/messages/SessionAgentMessageWriter.d.ts.map +1 -1
  160. package/bin/session/messages/SessionAgentMessageWriter.js +57 -37
  161. package/bin/session/messages/SessionAgentMessageWriter.js.map +1 -1
  162. package/bin/session/messages/SessionAgentParts.d.ts +14 -0
  163. package/bin/session/messages/SessionAgentParts.d.ts.map +1 -0
  164. package/bin/session/messages/SessionAgentParts.js +20 -0
  165. package/bin/session/messages/SessionAgentParts.js.map +1 -0
  166. package/bin/session/{execution → messages}/SessionAssistantOutputAdapter.d.ts +2 -2
  167. package/bin/session/messages/SessionAssistantOutputAdapter.d.ts.map +1 -0
  168. package/bin/session/messages/SessionAssistantOutputAdapter.js.map +1 -0
  169. package/bin/session/messages/SessionEventHub.d.ts.map +1 -0
  170. package/bin/session/messages/SessionEventHub.js.map +1 -0
  171. package/bin/session/messages/SessionInteractions.d.ts +57 -0
  172. package/bin/session/messages/SessionInteractions.d.ts.map +1 -0
  173. package/bin/session/messages/SessionInteractions.js +178 -0
  174. package/bin/session/messages/SessionInteractions.js.map +1 -0
  175. package/bin/session/messages/SessionJsonValue.d.ts +1 -3
  176. package/bin/session/messages/SessionJsonValue.d.ts.map +1 -1
  177. package/bin/session/messages/SessionJsonValue.js +0 -19
  178. package/bin/session/messages/SessionJsonValue.js.map +1 -1
  179. package/bin/session/messages/SessionMessageCache.d.ts +55 -0
  180. package/bin/session/messages/SessionMessageCache.d.ts.map +1 -0
  181. package/bin/session/messages/SessionMessageCache.js +133 -0
  182. package/bin/session/messages/SessionMessageCache.js.map +1 -0
  183. package/bin/session/messages/SessionMessageState.d.ts +17 -0
  184. package/bin/session/messages/SessionMessageState.d.ts.map +1 -0
  185. package/bin/session/messages/SessionMessageState.js +34 -0
  186. package/bin/session/messages/SessionMessageState.js.map +1 -0
  187. package/bin/session/messages/SessionMessageTimeline.d.ts.map +1 -0
  188. package/bin/session/{browse → messages}/SessionMessageTimeline.js +0 -1
  189. package/bin/session/messages/SessionMessageTimeline.js.map +1 -0
  190. package/bin/session/{SessionMessages.d.ts → messages/SessionMessages.d.ts} +35 -43
  191. package/bin/session/messages/SessionMessages.d.ts.map +1 -0
  192. package/bin/session/{SessionMessages.js → messages/SessionMessages.js} +178 -196
  193. package/bin/session/messages/SessionMessages.js.map +1 -0
  194. package/bin/session/messages/SessionModelRequestWarning.d.ts.map +1 -0
  195. package/bin/session/messages/SessionModelRequestWarning.js.map +1 -0
  196. package/bin/session/messages/SessionMutationFactory.d.ts +26 -0
  197. package/bin/session/messages/SessionMutationFactory.d.ts.map +1 -0
  198. package/bin/session/messages/SessionMutationFactory.js +38 -0
  199. package/bin/session/messages/SessionMutationFactory.js.map +1 -0
  200. package/bin/session/messages/SessionUserMessage.d.ts +5 -7
  201. package/bin/session/messages/SessionUserMessage.d.ts.map +1 -1
  202. package/bin/session/messages/SessionUserMessage.js +5 -28
  203. package/bin/session/messages/SessionUserMessage.js.map +1 -1
  204. package/bin/{executor/core-engine/CoreEngineSignals.d.ts → session/runner/AssistantParts.d.ts} +4 -9
  205. package/bin/session/runner/AssistantParts.d.ts.map +1 -0
  206. package/bin/{executor/core-engine/CoreEngineSignals.js → session/runner/AssistantParts.js} +4 -17
  207. package/bin/session/runner/AssistantParts.js.map +1 -0
  208. package/bin/session/runner/ContextPressure.d.ts +15 -0
  209. package/bin/session/runner/ContextPressure.d.ts.map +1 -0
  210. package/bin/{executor/core-engine/CoreEngineContextCompaction.js → session/runner/ContextPressure.js} +11 -11
  211. package/bin/session/runner/ContextPressure.js.map +1 -0
  212. package/bin/session/runner/ContextRetry.d.ts +39 -0
  213. package/bin/session/runner/ContextRetry.d.ts.map +1 -0
  214. package/bin/{executor/services/ExecutorRecoveryPolicy.js → session/runner/ContextRetry.js} +19 -19
  215. package/bin/session/runner/ContextRetry.js.map +1 -0
  216. package/bin/{executor/core-engine/CoreEngineError.d.ts → session/runner/ModelFailure.d.ts} +4 -4
  217. package/bin/session/runner/ModelFailure.d.ts.map +1 -0
  218. package/bin/{executor/core-engine/CoreEngineError.js → session/runner/ModelFailure.js} +4 -4
  219. package/bin/session/runner/ModelFailure.js.map +1 -0
  220. package/bin/session/runner/SessionExecutor.d.ts +108 -0
  221. package/bin/session/runner/SessionExecutor.d.ts.map +1 -0
  222. package/bin/session/runner/SessionExecutor.js +430 -0
  223. package/bin/session/runner/SessionExecutor.js.map +1 -0
  224. package/bin/session/runner/ToolLoopDecision.d.ts +60 -0
  225. package/bin/session/runner/ToolLoopDecision.d.ts.map +1 -0
  226. package/bin/{executor/core-engine/CoreEngineLoopDecision.js → session/runner/ToolLoopDecision.js} +5 -5
  227. package/bin/session/runner/ToolLoopDecision.js.map +1 -0
  228. package/bin/session/runner/ToolLoopLimits.d.ts +30 -0
  229. package/bin/session/runner/ToolLoopLimits.d.ts.map +1 -0
  230. package/bin/session/runner/ToolLoopLimits.js +46 -0
  231. package/bin/session/runner/ToolLoopLimits.js.map +1 -0
  232. package/bin/session/{browse → storage}/Browse.d.ts +1 -1
  233. package/bin/session/storage/Browse.d.ts.map +1 -0
  234. package/bin/session/{browse → storage}/Browse.js +1 -1
  235. package/bin/session/storage/Browse.js.map +1 -0
  236. package/bin/session/storage/LocalSessionStore.js +1 -1
  237. package/bin/session/storage/LocalSessionStore.js.map +1 -1
  238. package/bin/session/storage/LocalStorePaths.d.ts +0 -2
  239. package/bin/session/storage/LocalStorePaths.d.ts.map +1 -1
  240. package/bin/session/storage/LocalStorePaths.js +1 -1
  241. package/bin/session/storage/LocalStorePaths.js.map +1 -1
  242. package/bin/session/storage/Metadata.d.ts +1 -23
  243. package/bin/session/storage/Metadata.d.ts.map +1 -1
  244. package/bin/session/storage/Metadata.js +0 -18
  245. package/bin/session/storage/Metadata.js.map +1 -1
  246. package/bin/session/storage/RuntimeSessionPort.d.ts +0 -4
  247. package/bin/session/storage/RuntimeSessionPort.d.ts.map +1 -1
  248. package/bin/session/storage/RuntimeSessionPort.js +0 -1
  249. package/bin/session/storage/RuntimeSessionPort.js.map +1 -1
  250. package/bin/session/{preview → storage}/SessionMessagePreview.d.ts.map +1 -1
  251. package/bin/session/{preview → storage}/SessionMessagePreview.js +0 -1
  252. package/bin/session/{preview → storage}/SessionMessagePreview.js.map +1 -1
  253. package/bin/session/storage/SessionStorageCodec.d.ts.map +1 -1
  254. package/bin/session/storage/SessionStorageCodec.js +36 -18
  255. package/bin/session/storage/SessionStorageCodec.js.map +1 -1
  256. package/bin/session/storage/SessionStorageSchema.d.ts +1 -1
  257. package/bin/session/storage/SessionStorageSchema.js +1 -1
  258. package/bin/session/storage/SqliteSessionStorage.d.ts +6 -4
  259. package/bin/session/storage/SqliteSessionStorage.d.ts.map +1 -1
  260. package/bin/session/storage/SqliteSessionStorage.js +21 -18
  261. package/bin/session/storage/SqliteSessionStorage.js.map +1 -1
  262. package/bin/tools/ask/AskQuestionAnswers.d.ts +20 -0
  263. package/bin/tools/ask/AskQuestionAnswers.d.ts.map +1 -0
  264. package/bin/tools/ask/AskQuestionAnswers.js +99 -0
  265. package/bin/tools/ask/AskQuestionAnswers.js.map +1 -0
  266. package/bin/tools/ask/AskQuestionsTool.d.ts +5 -2
  267. package/bin/tools/ask/AskQuestionsTool.d.ts.map +1 -1
  268. package/bin/tools/ask/AskQuestionsTool.js +23 -31
  269. package/bin/tools/ask/AskQuestionsTool.js.map +1 -1
  270. package/bin/tools/ask/AskQuestionsToolSchemas.d.ts +1 -1
  271. package/bin/types/agent/AgentOptions.d.ts +16 -8
  272. package/bin/types/agent/AgentOptions.d.ts.map +1 -1
  273. package/bin/types/agent/AgentSessionCollection.d.ts +8 -0
  274. package/bin/types/agent/AgentSessionCollection.d.ts.map +1 -1
  275. package/bin/types/agent/SessionActor.d.ts +3 -3
  276. package/bin/types/agent/SessionActor.d.ts.map +1 -1
  277. package/bin/types/group/DispatchStrategy.js +1 -1
  278. package/bin/types/group/DispatchStrategy.js.map +1 -1
  279. package/bin/types/group/GroupSession.d.ts +41 -1
  280. package/bin/types/group/GroupSession.d.ts.map +1 -1
  281. package/bin/types/group/GroupSessionStore.d.ts +30 -3
  282. package/bin/types/group/GroupSessionStore.d.ts.map +1 -1
  283. package/bin/types/model/ModelRequest.d.ts.map +1 -0
  284. package/bin/types/model/ModelRequest.js.map +1 -0
  285. package/bin/types/sdk/AgentSessionAction.d.ts +1 -9
  286. package/bin/types/sdk/AgentSessionAction.d.ts.map +1 -1
  287. package/bin/types/session/{AdaptivePartContextPolicy.d.ts → ContextCheckpoint.d.ts} +10 -9
  288. package/bin/types/session/ContextCheckpoint.d.ts.map +1 -0
  289. package/bin/types/session/ContextCheckpoint.js +8 -0
  290. package/bin/types/session/ContextCheckpoint.js.map +1 -0
  291. package/bin/types/session/SessionAgentMessageState.d.ts +6 -10
  292. package/bin/types/session/SessionAgentMessageState.d.ts.map +1 -1
  293. package/bin/types/session/SessionAgentMessageState.js +3 -2
  294. package/bin/types/session/SessionAgentMessageState.js.map +1 -1
  295. package/bin/types/session/SessionComposer.d.ts +65 -36
  296. package/bin/types/session/SessionComposer.d.ts.map +1 -1
  297. package/bin/types/session/SessionComposer.js +7 -2
  298. package/bin/types/session/SessionComposer.js.map +1 -1
  299. package/bin/types/session/SessionExecution.d.ts +15 -11
  300. package/bin/types/session/SessionExecution.d.ts.map +1 -1
  301. package/bin/types/session/SessionExecution.js +1 -1
  302. package/bin/types/session/SessionInteractions.d.ts +0 -2
  303. package/bin/types/session/SessionInteractions.d.ts.map +1 -1
  304. package/bin/types/session/SessionLocalState.d.ts +0 -4
  305. package/bin/types/session/SessionLocalState.d.ts.map +1 -1
  306. package/bin/types/session/SessionLoop.d.ts +33 -12
  307. package/bin/types/session/SessionLoop.d.ts.map +1 -1
  308. package/bin/types/session/SessionMessages.d.ts +3 -29
  309. package/bin/types/session/SessionMessages.d.ts.map +1 -1
  310. package/bin/types/session/SessionOptions.d.ts +16 -13
  311. package/bin/types/session/SessionOptions.d.ts.map +1 -1
  312. package/bin/types/session/SessionPort.d.ts +0 -3
  313. package/bin/types/session/SessionPort.d.ts.map +1 -1
  314. package/bin/types/session/SessionState.d.ts +0 -1
  315. package/bin/types/session/SessionState.d.ts.map +1 -1
  316. package/bin/types/session/SessionSystem.d.ts +10 -12
  317. package/bin/types/session/SessionSystem.d.ts.map +1 -1
  318. package/bin/types/session/SessionTool.d.ts +2 -2
  319. package/bin/types/session/SessionTool.d.ts.map +1 -1
  320. package/bin/types/session/SessionTurnCompletion.d.ts +12 -2
  321. package/bin/types/session/SessionTurnCompletion.d.ts.map +1 -1
  322. package/bin/types/session/SessionTurnFileDiff.d.ts +4 -4
  323. package/bin/types/session/SessionTurnFileDiff.d.ts.map +1 -1
  324. package/bin/types/session/{SessionComposition.d.ts → StepInput.d.ts} +17 -15
  325. package/bin/types/session/StepInput.d.ts.map +1 -0
  326. package/bin/types/session/StepInput.js +8 -0
  327. package/bin/types/session/StepInput.js.map +1 -0
  328. package/bin/types/store/SessionHistoryMeta.d.ts.map +1 -0
  329. package/bin/types/store/SessionHistoryMeta.js.map +1 -0
  330. package/bin/types/store/SessionStorage.d.ts +17 -12
  331. package/bin/types/store/SessionStorage.d.ts.map +1 -1
  332. package/bin/types/tool/BoundAgentTool.d.ts +36 -0
  333. package/bin/types/tool/BoundAgentTool.d.ts.map +1 -0
  334. package/bin/types/tool/BoundAgentTool.js +13 -0
  335. package/bin/types/tool/BoundAgentTool.js.map +1 -0
  336. package/bin/types/tools/ask/AskQuestionsTool.d.ts +9 -13
  337. package/bin/types/tools/ask/AskQuestionsTool.d.ts.map +1 -1
  338. package/bin/types/tools/ask/AskQuestionsTool.js +3 -2
  339. package/bin/types/tools/ask/AskQuestionsTool.js.map +1 -1
  340. package/bin/types/turn/SessionAssistantOutput.d.ts.map +1 -0
  341. package/bin/types/turn/SessionAssistantOutput.js.map +1 -0
  342. package/bin/types/{executor → turn}/SessionTurnContext.d.ts +10 -28
  343. package/bin/types/turn/SessionTurnContext.d.ts.map +1 -0
  344. package/bin/types/turn/SessionTurnContext.js.map +1 -0
  345. package/bin/{executor/ids/resolveSessionId.d.ts → utils/ResolveSessionId.d.ts} +1 -1
  346. package/bin/utils/ResolveSessionId.d.ts.map +1 -0
  347. package/bin/{executor/ids/resolveSessionId.js → utils/ResolveSessionId.js} +1 -1
  348. package/bin/utils/ResolveSessionId.js.map +1 -0
  349. package/bin/utils/Time.d.ts +5 -8
  350. package/bin/utils/Time.d.ts.map +1 -1
  351. package/bin/utils/Time.js +5 -54
  352. package/bin/utils/Time.js.map +1 -1
  353. package/package.json +2 -2
  354. package/scripts/ask-question-answers.test.mjs +132 -0
  355. package/scripts/group-session-archive.test.mjs +193 -0
  356. package/scripts/{core-engine-model-stream.test.mjs → model-step-runner.test.mjs} +97 -4
  357. package/scripts/rewrite-build-aliases.mjs +3 -4
  358. package/scripts/session-action-part.test.mjs +172 -0
  359. package/scripts/session-agent-message-part-order.test.mjs +13 -7
  360. package/scripts/{core-engine-context-compaction.test.mjs → session-executor-context-pressure.test.mjs} +40 -32
  361. package/scripts/{executor-failure-result.test.mjs → session-executor-failure-result.test.mjs} +17 -14
  362. package/scripts/session-executor-max-steps.test.mjs +143 -0
  363. package/scripts/session-initialization.test.mjs +3 -4
  364. package/scripts/session-interaction-migration.test.mjs +145 -0
  365. package/scripts/session-interaction-mutation.test.mjs +202 -0
  366. package/scripts/session-messages-error-part.test.mjs +1 -1
  367. package/scripts/session-messages-error.test.mjs +1 -1
  368. package/scripts/session-prompt-idempotency.test.mjs +4 -2
  369. package/scripts/session-queue.test.mjs +21 -1
  370. package/scripts/session-storage-sqlite.test.mjs +3 -3
  371. package/scripts/session-system-blocks.test.mjs +61 -39
  372. package/scripts/session-turn-context.test.mjs +37 -40
  373. package/scripts/verify-build-aliases.mjs +1 -1
  374. package/src/agent/Agent.ts +137 -80
  375. package/src/agent/AgentInstructions.ts +48 -15
  376. package/src/agent/AgentMemoryStorage.ts +1 -1
  377. package/src/agent/AgentSessions.ts +60 -38
  378. package/src/group/Group.ts +27 -24
  379. package/src/group/GroupSession.ts +12 -8
  380. package/src/group/GroupSessions.ts +79 -20
  381. package/src/group/storage/LocalGroupSessionDataStore.ts +9 -1
  382. package/src/group/storage/LocalGroupSessionStore.ts +138 -28
  383. package/src/index.ts +35 -52
  384. package/src/{executor/model → model}/ModelGenerate.ts +3 -3
  385. package/src/{executor/model → model}/ModelRequestRunner.ts +2 -2
  386. package/src/{executor/model → model}/ModelStepRunner.ts +22 -19
  387. package/src/{executor/model → model}/ModelStreamConsumer.ts +1 -1
  388. package/src/model/README.md +117 -0
  389. package/src/model/ToolInputValidation.ts +58 -0
  390. package/src/{executor → model}/messages/ChatMessageMarkupTypes.ts +1 -1
  391. package/src/{executor → model}/messages/SessionModelMessages.ts +0 -1
  392. package/src/{executor/composer/system/default → model/prompts}/SystemPromptAssets.ts +1 -1
  393. package/src/model/prompts/assets/core.prompt.ts +9 -0
  394. package/src/{executor/composer/system/default → model/prompts}/assets/core.prompt.ts.txt +26 -25
  395. package/src/session/Session.ts +185 -151
  396. package/src/session/input/SessionHookRunner.ts +100 -0
  397. package/src/session/{SessionSystem.ts → input/SessionSystem.ts} +31 -29
  398. package/src/session/input/StepInput.ts +507 -0
  399. package/src/session/input/composer/AdaptiveContextCheckpoint.ts +115 -0
  400. package/src/session/input/composer/AdaptiveContextParts.ts +166 -0
  401. package/src/session/input/composer/ComposerAssembly.ts +81 -0
  402. package/src/session/{composer/policies/SessionSummaryPrompts.ts → input/composer/ContextSummaryPrompts.ts} +5 -2
  403. package/src/session/input/composer/DefaultSessionComposer.ts +147 -0
  404. package/src/session/input/composer/FullHistorySessionComposer.ts +55 -0
  405. package/src/session/loop/README.md +28 -0
  406. package/src/session/{SessionLoop.ts → loop/SessionLoop.ts} +100 -24
  407. package/src/session/{SessionQueue.ts → loop/SessionQueue.ts} +18 -0
  408. package/src/session/{SessionState.ts → loop/SessionState.ts} +4 -21
  409. package/src/session/{SessionTitle.ts → loop/SessionTitle.ts} +3 -3
  410. package/src/session/{runtime → loop}/SessionTurnCompletion.ts +27 -8
  411. package/src/session/{runtime → loop}/SessionTurnContext.ts +19 -93
  412. package/src/session/{runtime → loop}/SessionTurnFileDiff.ts +1 -1
  413. package/src/session/{messages → loop}/SessionTurnFileDiffBuilder.ts +4 -4
  414. package/src/session/messages/ApprovalInteraction.ts +77 -0
  415. package/src/session/messages/README.md +27 -0
  416. package/src/session/messages/SessionAgentMessageState.ts +324 -113
  417. package/src/session/messages/SessionAgentMessageWriter.ts +82 -45
  418. package/src/session/messages/SessionAgentParts.ts +39 -0
  419. package/src/session/{execution → messages}/SessionAssistantOutputAdapter.ts +2 -2
  420. package/src/session/messages/SessionInteractions.ts +227 -0
  421. package/src/session/messages/SessionJsonValue.ts +1 -18
  422. package/src/session/messages/SessionMessageCache.ts +171 -0
  423. package/src/session/messages/SessionMessageState.ts +42 -0
  424. package/src/session/{browse → messages}/SessionMessageTimeline.ts +0 -1
  425. package/src/session/{SessionMessages.ts → messages/SessionMessages.ts} +225 -284
  426. package/src/session/messages/SessionMutationFactory.ts +58 -0
  427. package/src/session/messages/SessionUserMessage.ts +7 -32
  428. package/src/{executor/core-engine/CoreEngineSignals.ts → session/runner/AssistantParts.ts} +3 -21
  429. package/src/{executor/core-engine/CoreEngineContextCompaction.ts → session/runner/ContextPressure.ts} +10 -10
  430. package/src/{executor/services/ExecutorRecoveryPolicy.ts → session/runner/ContextRetry.ts} +25 -25
  431. package/src/{executor/core-engine/CoreEngineError.ts → session/runner/ModelFailure.ts} +3 -3
  432. package/src/session/runner/SessionExecutor.ts +633 -0
  433. package/src/session/runner/ToolLoopDecision.ts +98 -0
  434. package/src/session/runner/ToolLoopLimits.ts +53 -0
  435. package/src/session/{browse → storage}/Browse.ts +2 -2
  436. package/src/session/storage/LocalSessionStore.ts +1 -1
  437. package/src/session/storage/LocalStorePaths.ts +1 -1
  438. package/src/session/storage/Metadata.ts +1 -44
  439. package/src/session/storage/RuntimeSessionPort.ts +0 -5
  440. package/src/session/{preview → storage}/SessionMessagePreview.ts +0 -1
  441. package/src/session/storage/SessionStorageCodec.ts +54 -28
  442. package/src/session/storage/SessionStorageSchema.ts +1 -1
  443. package/src/session/storage/SqliteSessionStorage.ts +29 -22
  444. package/src/tools/ask/AskQuestionAnswers.ts +125 -0
  445. package/src/tools/ask/AskQuestionsTool.ts +32 -37
  446. package/src/types/agent/AgentOptions.ts +17 -8
  447. package/src/types/agent/AgentSessionCollection.ts +9 -0
  448. package/src/types/agent/SessionActor.ts +3 -4
  449. package/src/types/group/DispatchStrategy.ts +1 -1
  450. package/src/types/group/GroupSession.ts +44 -1
  451. package/src/types/group/GroupSessionStore.ts +30 -3
  452. package/src/types/sdk/AgentSessionAction.ts +1 -14
  453. package/src/types/session/{AdaptivePartContextPolicy.ts → ContextCheckpoint.ts} +9 -8
  454. package/src/types/session/SessionAgentMessageState.ts +6 -16
  455. package/src/types/session/SessionComposer.ts +67 -39
  456. package/src/types/session/SessionExecution.ts +15 -13
  457. package/src/types/session/SessionInteractions.ts +0 -2
  458. package/src/types/session/SessionLocalState.ts +0 -5
  459. package/src/types/session/SessionLoop.ts +37 -12
  460. package/src/types/session/SessionMessages.ts +3 -34
  461. package/src/types/session/SessionOptions.ts +18 -13
  462. package/src/types/session/SessionPort.ts +0 -4
  463. package/src/types/session/SessionState.ts +0 -1
  464. package/src/types/session/SessionSystem.ts +10 -16
  465. package/src/types/session/SessionTool.ts +2 -2
  466. package/src/types/session/SessionTurnCompletion.ts +12 -2
  467. package/src/types/session/SessionTurnFileDiff.ts +4 -4
  468. package/src/types/session/{SessionComposition.ts → StepInput.ts} +22 -14
  469. package/src/types/store/SessionStorage.ts +17 -12
  470. package/src/types/tool/BoundAgentTool.ts +38 -0
  471. package/src/types/tools/ask/AskQuestionsTool.ts +11 -13
  472. package/src/types/{executor → turn}/SessionTurnContext.ts +8 -34
  473. package/src/utils/Time.ts +12 -64
  474. package/tsconfig.json +1 -2
  475. package/tsconfig.tsbuildinfo +1 -1
  476. package/bin/executor/Executor.d.ts +0 -92
  477. package/bin/executor/Executor.d.ts.map +0 -1
  478. package/bin/executor/Executor.js +0 -232
  479. package/bin/executor/Executor.js.map +0 -1
  480. package/bin/executor/composer/system/default/SystemPromptAssets.d.ts.map +0 -1
  481. package/bin/executor/composer/system/default/SystemPromptAssets.js.map +0 -1
  482. package/bin/executor/composer/system/default/assets/core.prompt.d.ts +0 -7
  483. package/bin/executor/composer/system/default/assets/core.prompt.d.ts.map +0 -1
  484. package/bin/executor/composer/system/default/assets/core.prompt.js +0 -8
  485. package/bin/executor/composer/system/default/assets/core.prompt.js.map +0 -1
  486. package/bin/executor/core-engine/CoreEngineContextCompaction.d.ts +0 -15
  487. package/bin/executor/core-engine/CoreEngineContextCompaction.d.ts.map +0 -1
  488. package/bin/executor/core-engine/CoreEngineContextCompaction.js.map +0 -1
  489. package/bin/executor/core-engine/CoreEngineError.d.ts.map +0 -1
  490. package/bin/executor/core-engine/CoreEngineError.js.map +0 -1
  491. package/bin/executor/core-engine/CoreEngineLoopDecision.d.ts +0 -26
  492. package/bin/executor/core-engine/CoreEngineLoopDecision.d.ts.map +0 -1
  493. package/bin/executor/core-engine/CoreEngineLoopDecision.js.map +0 -1
  494. package/bin/executor/core-engine/CoreEngineRunner.d.ts +0 -48
  495. package/bin/executor/core-engine/CoreEngineRunner.d.ts.map +0 -1
  496. package/bin/executor/core-engine/CoreEngineRunner.js +0 -343
  497. package/bin/executor/core-engine/CoreEngineRunner.js.map +0 -1
  498. package/bin/executor/core-engine/CoreEngineSignals.d.ts.map +0 -1
  499. package/bin/executor/core-engine/CoreEngineSignals.js.map +0 -1
  500. package/bin/executor/ids/resolveSessionId.d.ts.map +0 -1
  501. package/bin/executor/ids/resolveSessionId.js.map +0 -1
  502. package/bin/executor/messages/ChatMessageMarkup.d.ts.map +0 -1
  503. package/bin/executor/messages/ChatMessageMarkup.js.map +0 -1
  504. package/bin/executor/messages/ChatMessageMarkupTypes.d.ts.map +0 -1
  505. package/bin/executor/messages/ChatMessageMarkupTypes.js.map +0 -1
  506. package/bin/executor/messages/SessionAttachmentMapper.d.ts.map +0 -1
  507. package/bin/executor/messages/SessionAttachmentMapper.js.map +0 -1
  508. package/bin/executor/messages/SessionMessageLog.d.ts.map +0 -1
  509. package/bin/executor/messages/SessionMessageLog.js.map +0 -1
  510. package/bin/executor/messages/SessionModelMessages.d.ts.map +0 -1
  511. package/bin/executor/messages/SessionModelMessages.js.map +0 -1
  512. package/bin/executor/model/ModelGenerate.d.ts.map +0 -1
  513. package/bin/executor/model/ModelGenerate.js.map +0 -1
  514. package/bin/executor/model/ModelRequestRunner.d.ts.map +0 -1
  515. package/bin/executor/model/ModelRequestRunner.js.map +0 -1
  516. package/bin/executor/model/ModelStepRunner.d.ts.map +0 -1
  517. package/bin/executor/model/ModelStepRunner.js.map +0 -1
  518. package/bin/executor/model/ModelStreamConsumer.d.ts.map +0 -1
  519. package/bin/executor/model/ModelStreamConsumer.js.map +0 -1
  520. package/bin/executor/model/ModelStreamFailure.d.ts.map +0 -1
  521. package/bin/executor/model/ModelStreamFailure.js.map +0 -1
  522. package/bin/executor/services/ExecutorRecoveryPolicy.d.ts +0 -39
  523. package/bin/executor/services/ExecutorRecoveryPolicy.d.ts.map +0 -1
  524. package/bin/executor/services/ExecutorRecoveryPolicy.js.map +0 -1
  525. package/bin/executor/types/SessionHistoryMeta.d.ts.map +0 -1
  526. package/bin/executor/types/SessionHistoryMeta.js.map +0 -1
  527. package/bin/executor/types/SessionLoop.d.ts +0 -59
  528. package/bin/executor/types/SessionLoop.d.ts.map +0 -1
  529. package/bin/executor/types/SessionLoop.js +0 -9
  530. package/bin/executor/types/SessionLoop.js.map +0 -1
  531. package/bin/executor/types/SessionPrompts.d.ts +0 -14
  532. package/bin/executor/types/SessionPrompts.d.ts.map +0 -1
  533. package/bin/executor/types/SessionPrompts.js +0 -8
  534. package/bin/executor/types/SessionPrompts.js.map +0 -1
  535. package/bin/session/DefaultSessionComposer.d.ts +0 -24
  536. package/bin/session/DefaultSessionComposer.d.ts.map +0 -1
  537. package/bin/session/DefaultSessionComposer.js +0 -99
  538. package/bin/session/DefaultSessionComposer.js.map +0 -1
  539. package/bin/session/SessionComposition.d.ts +0 -49
  540. package/bin/session/SessionComposition.d.ts.map +0 -1
  541. package/bin/session/SessionComposition.js +0 -309
  542. package/bin/session/SessionComposition.js.map +0 -1
  543. package/bin/session/SessionHookPoints.d.ts +0 -15
  544. package/bin/session/SessionHookPoints.d.ts.map +0 -1
  545. package/bin/session/SessionHookPoints.js +0 -15
  546. package/bin/session/SessionHookPoints.js.map +0 -1
  547. package/bin/session/SessionHooks.d.ts +0 -38
  548. package/bin/session/SessionHooks.d.ts.map +0 -1
  549. package/bin/session/SessionHooks.js +0 -71
  550. package/bin/session/SessionHooks.js.map +0 -1
  551. package/bin/session/SessionLoop.d.ts.map +0 -1
  552. package/bin/session/SessionLoop.js.map +0 -1
  553. package/bin/session/SessionMessages.d.ts.map +0 -1
  554. package/bin/session/SessionMessages.js.map +0 -1
  555. package/bin/session/SessionQueue.d.ts.map +0 -1
  556. package/bin/session/SessionQueue.js.map +0 -1
  557. package/bin/session/SessionState.d.ts.map +0 -1
  558. package/bin/session/SessionState.js.map +0 -1
  559. package/bin/session/SessionSystem.d.ts +0 -19
  560. package/bin/session/SessionSystem.d.ts.map +0 -1
  561. package/bin/session/SessionSystem.js.map +0 -1
  562. package/bin/session/SessionTitle.d.ts.map +0 -1
  563. package/bin/session/SessionTitle.js.map +0 -1
  564. package/bin/session/browse/Browse.d.ts.map +0 -1
  565. package/bin/session/browse/Browse.js.map +0 -1
  566. package/bin/session/browse/SessionMessageTimeline.d.ts.map +0 -1
  567. package/bin/session/browse/SessionMessageTimeline.js.map +0 -1
  568. package/bin/session/composer/policies/AdaptivePartContextPolicy.d.ts +0 -35
  569. package/bin/session/composer/policies/AdaptivePartContextPolicy.d.ts.map +0 -1
  570. package/bin/session/composer/policies/AdaptivePartContextPolicy.js +0 -256
  571. package/bin/session/composer/policies/AdaptivePartContextPolicy.js.map +0 -1
  572. package/bin/session/composer/policies/FullHistoryContextPolicy.d.ts +0 -24
  573. package/bin/session/composer/policies/FullHistoryContextPolicy.d.ts.map +0 -1
  574. package/bin/session/composer/policies/FullHistoryContextPolicy.js +0 -31
  575. package/bin/session/composer/policies/FullHistoryContextPolicy.js.map +0 -1
  576. package/bin/session/composer/policies/SessionSummaryPrompts.d.ts.map +0 -1
  577. package/bin/session/composer/policies/SessionSummaryPrompts.js.map +0 -1
  578. package/bin/session/control/SessionInteractions.d.ts +0 -39
  579. package/bin/session/control/SessionInteractions.d.ts.map +0 -1
  580. package/bin/session/control/SessionInteractions.js +0 -255
  581. package/bin/session/control/SessionInteractions.js.map +0 -1
  582. package/bin/session/execution/SessionAssistantOutputAdapter.d.ts.map +0 -1
  583. package/bin/session/execution/SessionAssistantOutputAdapter.js.map +0 -1
  584. package/bin/session/execution/tools/SessionShellApprovalAdapter.d.ts +0 -28
  585. package/bin/session/execution/tools/SessionShellApprovalAdapter.d.ts.map +0 -1
  586. package/bin/session/execution/tools/SessionShellApprovalAdapter.js +0 -87
  587. package/bin/session/execution/tools/SessionShellApprovalAdapter.js.map +0 -1
  588. package/bin/session/messages/SessionAgentActionPartWriter.d.ts +0 -22
  589. package/bin/session/messages/SessionAgentActionPartWriter.d.ts.map +0 -1
  590. package/bin/session/messages/SessionAgentActionPartWriter.js +0 -36
  591. package/bin/session/messages/SessionAgentActionPartWriter.js.map +0 -1
  592. package/bin/session/messages/SessionMessageInteractionWriter.d.ts +0 -46
  593. package/bin/session/messages/SessionMessageInteractionWriter.d.ts.map +0 -1
  594. package/bin/session/messages/SessionMessageInteractionWriter.js +0 -183
  595. package/bin/session/messages/SessionMessageInteractionWriter.js.map +0 -1
  596. package/bin/session/messages/SessionTurnFileDiffBuilder.d.ts.map +0 -1
  597. package/bin/session/messages/SessionTurnFileDiffBuilder.js.map +0 -1
  598. package/bin/session/runtime/SessionEventHub.d.ts.map +0 -1
  599. package/bin/session/runtime/SessionEventHub.js.map +0 -1
  600. package/bin/session/runtime/SessionModelRequestWarning.d.ts.map +0 -1
  601. package/bin/session/runtime/SessionModelRequestWarning.js.map +0 -1
  602. package/bin/session/runtime/SessionTitleTask.d.ts.map +0 -1
  603. package/bin/session/runtime/SessionTitleTask.js.map +0 -1
  604. package/bin/session/runtime/SessionTurnCompletion.d.ts.map +0 -1
  605. package/bin/session/runtime/SessionTurnCompletion.js.map +0 -1
  606. package/bin/session/runtime/SessionTurnContext.d.ts +0 -29
  607. package/bin/session/runtime/SessionTurnContext.d.ts.map +0 -1
  608. package/bin/session/runtime/SessionTurnContext.js.map +0 -1
  609. package/bin/session/runtime/SessionTurnFileDiff.d.ts.map +0 -1
  610. package/bin/session/runtime/SessionTurnFileDiff.js.map +0 -1
  611. package/bin/types/action/ActionResult.d.ts +0 -35
  612. package/bin/types/action/ActionResult.d.ts.map +0 -1
  613. package/bin/types/action/ActionResult.js +0 -18
  614. package/bin/types/action/ActionResult.js.map +0 -1
  615. package/bin/types/executor/ModelRequest.d.ts.map +0 -1
  616. package/bin/types/executor/ModelRequest.js.map +0 -1
  617. package/bin/types/executor/SessionAssistantOutput.d.ts.map +0 -1
  618. package/bin/types/executor/SessionAssistantOutput.js.map +0 -1
  619. package/bin/types/executor/SessionToolExecutionContext.d.ts +0 -23
  620. package/bin/types/executor/SessionToolExecutionContext.d.ts.map +0 -1
  621. package/bin/types/executor/SessionToolExecutionContext.js +0 -10
  622. package/bin/types/executor/SessionToolExecutionContext.js.map +0 -1
  623. package/bin/types/executor/SessionTurnContext.d.ts.map +0 -1
  624. package/bin/types/executor/SessionTurnContext.js.map +0 -1
  625. package/bin/types/session/AdaptivePartContextPolicy.d.ts.map +0 -1
  626. package/bin/types/session/AdaptivePartContextPolicy.js +0 -7
  627. package/bin/types/session/AdaptivePartContextPolicy.js.map +0 -1
  628. package/bin/types/session/SessionComposition.d.ts.map +0 -1
  629. package/bin/types/session/SessionComposition.js +0 -8
  630. package/bin/types/session/SessionComposition.js.map +0 -1
  631. package/bin/types/session/SessionContextPolicy.d.ts +0 -70
  632. package/bin/types/session/SessionContextPolicy.d.ts.map +0 -1
  633. package/bin/types/session/SessionContextPolicy.js +0 -8
  634. package/bin/types/session/SessionContextPolicy.js.map +0 -1
  635. package/bin/types/tools/ToolActionExecutionContext.d.ts +0 -30
  636. package/bin/types/tools/ToolActionExecutionContext.d.ts.map +0 -1
  637. package/bin/types/tools/ToolActionExecutionContext.js +0 -8
  638. package/bin/types/tools/ToolActionExecutionContext.js.map +0 -1
  639. package/src/executor/Executor.ts +0 -319
  640. package/src/executor/README.md +0 -92
  641. package/src/executor/composer/system/default/assets/core.prompt.ts +0 -9
  642. package/src/executor/core-engine/CoreEngineLoopDecision.ts +0 -63
  643. package/src/executor/core-engine/CoreEngineRunner.ts +0 -458
  644. package/src/executor/types/SessionLoop.ts +0 -69
  645. package/src/executor/types/SessionPrompts.ts +0 -14
  646. package/src/session/DefaultSessionComposer.ts +0 -123
  647. package/src/session/SessionComposition.ts +0 -370
  648. package/src/session/SessionHookPoints.ts +0 -17
  649. package/src/session/SessionHooks.ts +0 -85
  650. package/src/session/composer/policies/AdaptivePartContextPolicy.ts +0 -307
  651. package/src/session/composer/policies/FullHistoryContextPolicy.ts +0 -36
  652. package/src/session/control/SessionInteractions.ts +0 -311
  653. package/src/session/execution/tools/SessionShellApprovalAdapter.ts +0 -105
  654. package/src/session/messages/SessionAgentActionPartWriter.ts +0 -54
  655. package/src/session/messages/SessionMessageInteractionWriter.ts +0 -279
  656. package/src/types/action/ActionResult.ts +0 -50
  657. package/src/types/executor/SessionToolExecutionContext.ts +0 -26
  658. package/src/types/session/SessionContextPolicy.ts +0 -77
  659. package/src/types/tools/ToolActionExecutionContext.ts +0 -32
  660. /package/bin/{executor/model → model}/ModelGenerate.js +0 -0
  661. /package/bin/{executor/model → model}/ModelRequestRunner.js +0 -0
  662. /package/bin/{executor/model → model}/ModelStreamConsumer.d.ts +0 -0
  663. /package/bin/{executor/model → model}/ModelStreamConsumer.js +0 -0
  664. /package/bin/{executor/model → model}/ModelStreamFailure.d.ts +0 -0
  665. /package/bin/{executor/model → model}/ModelStreamFailure.js +0 -0
  666. /package/bin/{executor → model}/messages/ChatMessageMarkup.d.ts +0 -0
  667. /package/bin/{executor → model}/messages/ChatMessageMarkup.js +0 -0
  668. /package/bin/{executor → model}/messages/SessionAttachmentMapper.d.ts +0 -0
  669. /package/bin/{executor → model}/messages/SessionAttachmentMapper.js +0 -0
  670. /package/bin/{executor → model}/messages/SessionMessageLog.d.ts +0 -0
  671. /package/bin/{executor → model}/messages/SessionMessageLog.js +0 -0
  672. /package/bin/{executor → model}/messages/SessionModelMessages.d.ts +0 -0
  673. /package/bin/{executor/composer/system/default → model/prompts}/SystemPromptAssets.d.ts +0 -0
  674. /package/bin/session/{runtime → loop}/SessionTitleTask.d.ts +0 -0
  675. /package/bin/session/{runtime → loop}/SessionTitleTask.js +0 -0
  676. /package/bin/session/{runtime → loop}/SessionTurnFileDiff.d.ts +0 -0
  677. /package/bin/session/{messages → loop}/SessionTurnFileDiffBuilder.js +0 -0
  678. /package/bin/session/{execution → messages}/SessionAssistantOutputAdapter.js +0 -0
  679. /package/bin/session/{runtime → messages}/SessionEventHub.d.ts +0 -0
  680. /package/bin/session/{runtime → messages}/SessionEventHub.js +0 -0
  681. /package/bin/session/{browse → messages}/SessionMessageTimeline.d.ts +0 -0
  682. /package/bin/session/{runtime → messages}/SessionModelRequestWarning.d.ts +0 -0
  683. /package/bin/session/{runtime → messages}/SessionModelRequestWarning.js +0 -0
  684. /package/bin/session/{preview → storage}/SessionMessagePreview.d.ts +0 -0
  685. /package/bin/types/{executor → model}/ModelRequest.d.ts +0 -0
  686. /package/bin/types/{executor → model}/ModelRequest.js +0 -0
  687. /package/bin/{executor/types → types/store}/SessionHistoryMeta.d.ts +0 -0
  688. /package/bin/{executor/types → types/store}/SessionHistoryMeta.js +0 -0
  689. /package/bin/types/{executor → turn}/SessionAssistantOutput.d.ts +0 -0
  690. /package/bin/types/{executor → turn}/SessionAssistantOutput.js +0 -0
  691. /package/bin/types/{executor → turn}/SessionTurnContext.js +0 -0
  692. /package/src/{executor/model → model}/ModelStreamFailure.ts +0 -0
  693. /package/src/{executor → model}/messages/ChatMessageMarkup.ts +0 -0
  694. /package/src/{executor → model}/messages/SessionAttachmentMapper.ts +0 -0
  695. /package/src/{executor → model}/messages/SessionMessageLog.ts +0 -0
  696. /package/src/session/{runtime → loop}/SessionTitleTask.ts +0 -0
  697. /package/src/session/{runtime → messages}/SessionEventHub.ts +0 -0
  698. /package/src/session/{runtime → messages}/SessionModelRequestWarning.ts +0 -0
  699. /package/src/types/{executor → model}/ModelRequest.ts +0 -0
  700. /package/src/{executor/types → types/store}/SessionHistoryMeta.ts +0 -0
  701. /package/src/types/{executor → turn}/SessionAssistantOutput.ts +0 -0
  702. /package/src/{executor/ids/resolveSessionId.ts → utils/ResolveSessionId.ts} +0 -0
@@ -1,92 +0,0 @@
1
- /**
2
- * Executor:单个 session 的执行编排器。
3
- *
4
- * 关键点(中文)
5
- * - SDK 对外对象叫 `Session`,这里是内部执行层。
6
- * - 一个 Executor 只对应一个固定的 `session_id`。
7
- * - 负责显式 Turn 上下文消费、executing 状态、Composer 编排与 Tool Loop 执行。
8
- */
9
- import type { SessionHookRuntime } from "@downcity/type";
10
- import type { Logger } from "../utils/logger/Logger.js";
11
- import type { SessionExecutor } from "../types/session/SessionExecution.js";
12
- import type { SessionTurnContext } from "../types/executor/SessionTurnContext.js";
13
- import type { SessionTurnExecutionResult } from "../types/session/SessionExecution.js";
14
- import type { SessionComposer, SessionComposeInput, SessionStepInput } from "../types/session/SessionComposer.js";
15
- import type { SessionContextRecoveryReason } from "../types/session/SessionContextPolicy.js";
16
- type ExecutorOptions = {
17
- /**
18
- * 当前会话 ID。
19
- */
20
- session_id: string;
21
- /** 当前 Session 使用的统一 Composer。 */
22
- composer: SessionComposer;
23
- /** 为 Composer 创建当前 Step 的只读输入快照。 */
24
- get_compose_input: (turn_context: SessionTurnContext, retry_count: number) => Promise<SessionComposeInput>;
25
- /** 请求当前 Composer 推进派生上下文状态。 */
26
- recover_context: (reason: SessionContextRecoveryReason) => Promise<boolean>;
27
- /** 应用 Session 级固定 system snapshot。 */
28
- apply_system_snapshot?: (input: SessionStepInput) => SessionStepInput;
29
- /**
30
- * 统一日志器。
31
- */
32
- logger: Logger;
33
- /** 创建当前 Session effective City 扩展执行视图。 */
34
- get_hooks?: () => SessionHookRuntime;
35
- };
36
- /**
37
- * Executor 单实例实现。
38
- */
39
- export declare class Executor implements SessionExecutor {
40
- /**
41
- * 当前 session 标识。
42
- */
43
- readonly session_id: string;
44
- private readonly composer;
45
- private readonly get_compose_input;
46
- private readonly recover_context;
47
- private readonly apply_system_snapshot?;
48
- private readonly get_hooks;
49
- private readonly logger;
50
- private readonly recovery_policy;
51
- private readonly core_engine_runner;
52
- private executing;
53
- constructor(options: ExecutorOptions);
54
- /**
55
- * 返回当前 session 是否正在执行。
56
- */
57
- is_executing(): boolean;
58
- /**
59
- * 执行当前 Session 的一次 Turn。
60
- *
61
- * 关键点(中文)
62
- * - 这里直接承接单个 Session 实例的一次 Turn 执行编排。
63
- * - scope 绑定、assistant step 持久化、executing 状态都收在实例内部。
64
- */
65
- execute(params: {
66
- turn_context: SessionTurnContext;
67
- }): Promise<SessionTurnExecutionResult>;
68
- /**
69
- * 为下一 Provider Step 生成唯一一份完整输入。
70
- *
71
- * 关键点(中文)
72
- * - 调用方必须先提交 Session 统一输入队列,再调用本方法。
73
- * - 每次调用只读取一次 model、system 与 tools,并把它们传给同一个模型 step。
74
- */
75
- private resolve_step_input;
76
- /** 读取只读 Session 快照并交给统一 Composer。 */
77
- private compose_step;
78
- /**
79
- * 刷新当前 Session step 的 effective Agent 运行视图。
80
- */
81
- private refresh_step_runtime;
82
- /**
83
- * 为所有 tool execute callback 绑定显式 Session 运行上下文。
84
- *
85
- * 关键点(中文)
86
- * - 每个 step 使用独立包装工具,不会在并行 Session 间共享可变指针。
87
- * - Agent 与 Shell 工具通过 RuntimeToolExecutionOptions.context 读取显式快照。
88
- */
89
- private bind_turn_context_to_tools;
90
- }
91
- export {};
92
- //# sourceMappingURL=Executor.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Executor.d.ts","sourceRoot":"","sources":["../../src/executor/Executor.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAIV,kBAAkB,EACnB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAGjF,OAAO,KAAK,EAEV,0BAA0B,EAC3B,MAAM,qCAAqC,CAAC;AAC7C,OAAO,KAAK,EACV,eAAe,EACf,mBAAmB,EACnB,gBAAgB,EACjB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,yCAAyC,CAAC;AAE5F,KAAK,eAAe,GAAG;IACrB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB,iCAAiC;IACjC,QAAQ,EAAE,eAAe,CAAC;IAE1B,oCAAoC;IACpC,iBAAiB,EAAE,CACjB,YAAY,EAAE,kBAAkB,EAChC,WAAW,EAAE,MAAM,KAChB,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAElC,+BAA+B;IAC/B,eAAe,EAAE,CAAC,MAAM,EAAE,4BAA4B,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAE5E,sCAAsC;IACtC,qBAAqB,CAAC,EAAE,CAAC,KAAK,EAAE,gBAAgB,KAAK,gBAAgB,CAAC;IAEtE;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf,0CAA0C;IAC1C,SAAS,CAAC,EAAE,MAAM,kBAAkB,CAAC;CACtC,CAAC;AAEF;;GAEG;AACH,qBAAa,QAAS,YAAW,eAAe;IAC9C;;OAEG;IACH,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAE5B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAkB;IAC3C,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAuC;IACzE,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAqC;IACrE,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAAC,CAA2C;IAClF,OAAO,CAAC,QAAQ,CAAC,SAAS,CAA+B;IACzD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAyB;IACzD,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAmB;IAEtD,OAAO,CAAC,SAAS,CAAS;gBAEd,OAAO,EAAE,eAAe;IA6BpC;;OAEG;IACH,YAAY,IAAI,OAAO;IAIvB;;;;;;OAMG;IACG,OAAO,CAAC,MAAM,EAAE;QACpB,YAAY,EAAE,kBAAkB,CAAC;KAClC,GAAG,OAAO,CAAC,0BAA0B,CAAC;IAuBvC;;;;;;OAMG;YACW,kBAAkB;IAqBhC,qCAAqC;YACvB,YAAY;IA+B1B;;OAEG;YACW,oBAAoB;IAOlC;;;;;;OAMG;IACH,OAAO,CAAC,0BAA0B;CAiFnC"}
@@ -1,232 +0,0 @@
1
- /**
2
- * Executor:单个 session 的执行编排器。
3
- *
4
- * 关键点(中文)
5
- * - SDK 对外对象叫 `Session`,这里是内部执行层。
6
- * - 一个 Executor 只对应一个固定的 `session_id`。
7
- * - 负责显式 Turn 上下文消费、executing 状态、Composer 编排与 Tool Loop 执行。
8
- */
9
- import { CoreEngineRunner } from "./core-engine/CoreEngineRunner.js";
10
- import { ExecutorRecoveryPolicy } from "./services/ExecutorRecoveryPolicy.js";
11
- import { is_action_result } from "../types/action/ActionResult.js";
12
- /**
13
- * Executor 单实例实现。
14
- */
15
- export class Executor {
16
- /**
17
- * 当前 session 标识。
18
- */
19
- session_id;
20
- composer;
21
- get_compose_input;
22
- recover_context;
23
- apply_system_snapshot;
24
- get_hooks;
25
- logger;
26
- recovery_policy;
27
- core_engine_runner;
28
- executing = false;
29
- constructor(options) {
30
- const session_id = String(options.session_id || "").trim();
31
- if (!session_id) {
32
- throw new Error("Executor requires a non-empty session_id");
33
- }
34
- this.session_id = session_id;
35
- this.composer = options.composer;
36
- this.get_compose_input = options.get_compose_input;
37
- this.recover_context = options.recover_context;
38
- this.apply_system_snapshot = options.apply_system_snapshot;
39
- this.get_hooks = options.get_hooks;
40
- this.logger = options.logger;
41
- this.recovery_policy = new ExecutorRecoveryPolicy({
42
- session_id: this.session_id,
43
- recover_context: async (error) => is_provider_context_limit_error(error)
44
- ? await this.recover_context("provider_context_limit")
45
- : false,
46
- logger: this.logger,
47
- });
48
- this.core_engine_runner = new CoreEngineRunner({
49
- session_id: this.session_id,
50
- logger: this.logger,
51
- should_compact_on_error: (error) => is_provider_context_limit_error(error),
52
- });
53
- }
54
- /**
55
- * 返回当前 session 是否正在执行。
56
- */
57
- is_executing() {
58
- return this.executing;
59
- }
60
- /**
61
- * 执行当前 Session 的一次 Turn。
62
- *
63
- * 关键点(中文)
64
- * - 这里直接承接单个 Session 实例的一次 Turn 执行编排。
65
- * - scope 绑定、assistant step 持久化、executing 状态都收在实例内部。
66
- */
67
- async execute(params) {
68
- if (this.executing) {
69
- // 关键点(中文):同一个 Session 实例只允许一个活跃 Turn 执行,
70
- // 否则 step 回调、scope 与执行器状态都会互相污染。
71
- throw new Error("Executor.execute does not support concurrent execution");
72
- }
73
- const turn_context = params.turn_context;
74
- this.executing = true;
75
- try {
76
- const result = await this.recovery_policy.execute_with_retry({
77
- execute_turn: async (retry_count) => await this.core_engine_runner.execute({
78
- turn_context,
79
- resolve_step_input: async () => await this.resolve_step_input(turn_context, retry_count),
80
- }),
81
- });
82
- return result;
83
- }
84
- finally {
85
- this.executing = false;
86
- }
87
- }
88
- /**
89
- * 为下一 Provider Step 生成唯一一份完整输入。
90
- *
91
- * 关键点(中文)
92
- * - 调用方必须先提交 Session 统一输入队列,再调用本方法。
93
- * - 每次调用只读取一次 model、system 与 tools,并把它们传给同一个模型 step。
94
- */
95
- async resolve_step_input(turn_context, retry_count) {
96
- const composed = await this.compose_step(turn_context, retry_count);
97
- return {
98
- model: composed.model,
99
- system: composed.input.system,
100
- messages: composed.input.messages,
101
- tools: this.bind_turn_context_to_tools(composed.input.tools, turn_context),
102
- ...(composed.context_window !== undefined
103
- ? {
104
- context_window: composed.context_window,
105
- }
106
- : {}),
107
- };
108
- }
109
- /** 读取只读 Session 快照并交给统一 Composer。 */
110
- async compose_step(turn_context, retry_count) {
111
- await this.refresh_step_runtime(turn_context);
112
- const compose_input = await this.get_compose_input(turn_context, retry_count);
113
- const model = compose_input.state.model;
114
- if (!model)
115
- throw new Error("requires a configured model.");
116
- turn_context.step.commit({
117
- workspace_env: compose_input.state.env,
118
- agent_systems: compose_input.state.systems,
119
- });
120
- const raw_input = await this.composer.compose(compose_input);
121
- return {
122
- input: this.apply_system_snapshot
123
- ? this.apply_system_snapshot(raw_input)
124
- : raw_input,
125
- model,
126
- ...(compose_input.state.model_context_window !== undefined
127
- ? { context_window: compose_input.state.model_context_window }
128
- : {}),
129
- };
130
- }
131
- /**
132
- * 刷新当前 Session step 的 effective Agent 运行视图。
133
- */
134
- async refresh_step_runtime(turn_context) {
135
- const hooks = await this.get_hooks?.().open();
136
- await turn_context.step.replace_hooks(hooks);
137
- }
138
- /**
139
- * 为所有 tool execute callback 绑定显式 Session 运行上下文。
140
- *
141
- * 关键点(中文)
142
- * - 每个 step 使用独立包装工具,不会在并行 Session 间共享可变指针。
143
- * - Agent 与 Shell 工具通过 RuntimeToolExecutionOptions.context 读取显式快照。
144
- */
145
- bind_turn_context_to_tools(tools, turn_context) {
146
- const wrapped = {};
147
- for (const [name, tool] of Object.entries(tools)) {
148
- const original_execute = tool.execute;
149
- if (typeof original_execute !== "function") {
150
- wrapped[name] = tool;
151
- continue;
152
- }
153
- wrapped[name] = {
154
- ...tool,
155
- execute: async (args, options) => {
156
- const tool_call_id = String(options.tool_call_id || "").trim();
157
- if (!tool_call_id) {
158
- throw new Error(`Tool execution requires toolCallId: ${name}`);
159
- }
160
- if (tool_call_id && turn_context.output.assistant) {
161
- await turn_context.output.assistant.prepare_tool_input({
162
- tool_call_id,
163
- tool_name: name,
164
- input: args,
165
- });
166
- }
167
- const abort_signal = options.abort_signal ||
168
- turn_context.lifecycle.abort_signal;
169
- const execution_context = {
170
- session_turn_context: turn_context,
171
- action_execution_context: {
172
- call_id: tool_call_id,
173
- abort_signal,
174
- session: {
175
- session_id: turn_context.session.session_id,
176
- turn_id: turn_context.session.turn_id,
177
- interactions: turn_context.interactions,
178
- },
179
- ...(turn_context.session.project_root
180
- ? { workspace_path: turn_context.session.project_root }
181
- : {}),
182
- ...(turn_context.step.workspace_env
183
- ? { workspace_env: turn_context.step.workspace_env }
184
- : {}),
185
- },
186
- shell_execution_context: {
187
- session: {
188
- session_id: turn_context.session.session_id,
189
- turn_id: turn_context.session.turn_id,
190
- },
191
- call_id: tool_call_id,
192
- abort_signal,
193
- ...(turn_context.step.workspace_env
194
- ? { workspace_env: turn_context.step.workspace_env }
195
- : {}),
196
- ...(turn_context.shell.approval_gateway
197
- ? { approval_gateway: turn_context.shell.approval_gateway }
198
- : {}),
199
- },
200
- };
201
- const output = await original_execute(args, {
202
- ...options,
203
- context: execution_context,
204
- });
205
- if (!is_action_result(output))
206
- return output;
207
- if (Array.isArray(output.effects)) {
208
- turn_context.effects.append(output.effects);
209
- }
210
- for (const message of output.messages) {
211
- if (message.role === "agent") {
212
- turn_context.output.enqueue_assistant_parts(message.parts);
213
- continue;
214
- }
215
- await turn_context.input.append_internal(message.parts);
216
- }
217
- return output.output;
218
- },
219
- };
220
- }
221
- return wrapped;
222
- }
223
- }
224
- /** Core Engine 的单 Step 内恢复仍需同步识别 Provider 上下文错误。 */
225
- function is_provider_context_limit_error(error) {
226
- const message = String(error ?? "").toLowerCase();
227
- return message.includes("context_length") ||
228
- message.includes("too long") ||
229
- message.includes("maximum context") ||
230
- message.includes("context window");
231
- }
232
- //# sourceMappingURL=Executor.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Executor.js","sourceRoot":"","sources":["../../src/executor/Executor.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAQH,OAAO,EAAE,gBAAgB,EAAE,MAAM,2CAA2C,CAAC;AAC7E,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AAKtF,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AA0ClE;;GAEG;AACH,MAAM,OAAO,QAAQ;IACnB;;OAEG;IACM,UAAU,CAAS;IAEX,QAAQ,CAAkB;IAC1B,iBAAiB,CAAuC;IACxD,eAAe,CAAqC;IACpD,qBAAqB,CAA4C;IACjE,SAAS,CAA+B;IACxC,MAAM,CAAS;IACf,eAAe,CAAyB;IACxC,kBAAkB,CAAmB;IAE9C,SAAS,GAAG,KAAK,CAAC;IAE1B,YAAY,OAAwB;QAClC,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC,UAAU,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;QAC3D,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;QAC9D,CAAC;QAED,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;QACjC,IAAI,CAAC,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAC;QACnD,IAAI,CAAC,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC;QAC/C,IAAI,CAAC,qBAAqB,GAAG,OAAO,CAAC,qBAAqB,CAAC;QAC3D,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;QACnC,IAAI,CAAC,M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ACvC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC;QAC5B,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAC;QACnC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC;AACvC,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"SystemPromptAssets.d.ts","sourceRoot":"","sources":["../../../../../src/executor/composer/system/default/SystemPromptAssets.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH;;GAEG;AACH,eAAO,MAAM,kBAAkB,QAA8B,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"SystemPromptAssets.js","sourceRoot":"","sources":["../../../../../src/executor/composer/system/default/SystemPromptAssets.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,oBAAoB,MAAM,yDAAyD,CAAC;AAE3F;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,oBAAoB,CAAC,IAAI,EAAE,CAAC"}
@@ -1,7 +0,0 @@
1
- /**
2
- * 自动生成文件,请勿手改。
3
- * 源文件:由同路径 `*.ts.txt` 生成。
4
- */
5
- declare const TEXT_MODULE_CONTENT = "# Harness Design\n\nYou are a Downcity Agent. is a harness around an existing human-owned workspace, not a replacement platform or a detached autonomous worker.\n\n- The harness lets the Agent enter the user's existing project instead of forcing the user to migrate work into a new AI platform.\n- The project structure is the control surface. Files, directories, scripts, docs, configuration, and existing workflows define the practical business boundary.\n- The Agent inherits the workspace's knowledge topology. Read and follow the existing structure before creating new abstractions, stores, or process layers.\n- The harness keeps the human in control. The user owns intent, boundaries, approvals, and final judgment; the Agent supplies high-density execution inside those boundaries.\n- Agent state should remain observable and handoff-friendly. Prefer outputs, changes, and explanations that a human can inspect, resume, or correct through normal project artifacts.\n- Autonomy should be progressive. Execute low-risk, reversible work directly; pause for clarification or approval when the boundary, consequence, or owner is unclear.\n- Tools and plugins are harness surfaces. Use them to act precisely in the current execution context without treating any tool as a reason to ignore the user's native workflow.\n- Prefer project-native, maintainable changes over clever platform-shaped abstractions. The best result should feel like it naturally belongs in the existing workspace.\n\n# Shell Commands\n\nCommand execution tools:\n- Prefer `shell_exec` for short, one-off commands.\n- Use `shell_session` for long-running tasks, tasks that need status checks, or processes that need stdin interaction.\n- For long-running tasks, use `wait_ms` with `shell_session` to wait for output or state changes and avoid frequent polling overhead.\n- Start a long-running command with `shell_session({ action: \"start\", cmd })` and keep the returned `shell_id`.\n- `shell_id` identifies a shell session; it is not a chat `session_id`.\n- During long-running tasks, read new output with `shell_session({ action: \"read\", shell_id })`. Do not implement your own high-frequency empty polling loop.\n- When a process needs stdin, use `shell_session({ action: \"send\", shell_id, input })`.\n- When sending stdin to a host shell session, every `send` call must include a clear `reason`. Invoke the tool directly; the runtime pauses the call and requests user approval before writing. Approval for `start` only authorizes starting the process; it does not authorize later stdin writes.\n- When a command session is complete and no longer needed, release it with `shell_session({ action: \"stop\", shell_id })`.\n- Do not forward very long raw shell output directly to the user. Summarize it first.\n- Shell commands use the Workspace's persistent isolated Sandbox by default. The project is mounted at `/workspace`; HOME, installed tools, and caches persist across chat sessions that use the same Workspace. Different Workspaces do not share writable Sandbox state.\n- When installing Python dependencies, prefer a project-local `.venv`; do not use `pip install --user`.\n- If a task requires host-directory writes or host-level capabilities, invoke the appropriate shell tool directly with `target: \"host\"` and a clear `reason`. The runtime pauses before execution and presents the approval request to the user.\n- Do not ask for a separate chat confirmation before issuing a host tool call when the command and reason are already clear. Do not claim that an approval request was sent unless you actually emitted the tool call.\n- Do not attempt `sudo`, Xcode Command Line Tools installation, SSH/keychain/shell profile modification, or obviously destructive commands. These requests are rejected even for host execution.\n- If the user rejects a host execution request, do not keep asking for the same command. Explain the impact and provide a Sandbox alternative when possible.\n- Downloads, tool caches, global package installs, and temporary state should normally live in the current Workspace Sandbox HOME. Do not assume access to the real user's HOME or cache.\n\n# File Operations\n\nStructured file tools:\n- Use `grep` to search project file contents instead of running `rg` through the shell.\n- Use `find` to discover project files by glob pattern instead of running shell `find`.\n- Use `read` to examine project files instead of `cat`, `head`, `tail`, or `sed`. Continue with the returned `next_offset` when `truncated` is true.\n- Use `write` for new files or complete rewrites. Existing files are not overwritten unless `overwrite: true` is explicit.\n- Use `edit` for precise changes. Every `edits[].old_text` must match exactly once in the original file.\n- When changing multiple separate locations in one file, use one `edit` call with multiple non-overlapping entries.\n- Pass the SHA-256 returned by `read` as `edit.expected_sha256` when the file may be changed concurrently.\n- File and search tools only operate inside the current project root and never support host access. Use the approved host shell workflow only when the user explicitly authorizes a broader action.\n\n# Plugin System\n\nYou are working in a plugin-based execution environment.\n\nPlugin call rules:\n- When you need plugin capabilities, prefer invoking the plugin action through the available tools.\n- If `plugin_read` is available, call `plugin_read({})` to list the plugins actually registered in the current Agent before choosing one. Use `plugin_read({ plugin, action? })` to inspect its action schema and examples.\n- If `plugin_call` is available, call the action with `plugin_call({ plugin, action, payload })`.\n- `plugin_call.plugin` must be a plugin name returned by `plugin_read({})`.\n- `plugin_call.action` must be an action name returned by `plugin_read({ plugin })`.\n- `plugin_call.payload` is a structured JSON payload. Pass `{}` when there are no parameters. If the action metadata declares an input schema, the payload must conform to that schema.\n- `ActionSchedule` is an internal Agent capability for delayed plugin actions. It is not a standalone plugin.\n\nSpecific plugin capabilities are defined by the action metadata returned by `plugin_read` and by each plugin's system prompt.\n\n# Default Decisions And Clarification\n\n- Execute first and communicate second by default: for low-risk, reversible requests where the user's intent is clear enough, use the current date, timezone, chat context, and common defaults to proceed. Do not repeatedly ask about obvious event titles, default platforms, or clear time expressions.\n- Ask a clarification only when missing information would materially change the outcome, such as the date, target object, amount, account, recipient, or when an action is irreversible, high-risk, or privacy-sensitive.\n- When handling relative time expressions, prefer the runtime-provided `current_date`, `current_time`, and `timezone`. If inbound `<info>` explicitly provides `user_timezone`, use that first; otherwise use the runtime clock timezone. For expressions such as \"today\", \"tomorrow\", \"2 PM\", or \"two hours earlier\", resolve them to absolute times before acting, and state the absolute date and time in your reply.\n- When a task depends on external permissions, system capabilities, or third-party connections such as calendars, reminders, chat channels, or system authorization, probe availability first before promising to create, send, or write anything.\n- If probing shows a blocker caused by system permissions, host environment, or connection state, state the real blocker and next step directly. Do not first promise that you can do it and then spend multiple turns asking follow-up questions.\n- If you have enough information to complete several low-risk default actions in one pass, complete them and briefly state which assumptions you used.\n\n# Very Important\n\nSafety and boundaries:\n- Do not run destructive commands such as `rm -rf` or `git reset --hard` unless the user explicitly asks for them.\n- For API keys, tokens, secrets, environment variables, bot credentials, and similar sensitive configuration, prefer guiding the user to maintain them in `Global / Env` or the owning Plugin's Mainview. Do not ask the user to paste secret values directly into the current chat.\n- Secret-listing capabilities can return only configured key names and descriptions. They never return secret values. Do not ask the user to \"send the secret to you\" or keep trying to retrieve plaintext secrets.\n";
6
- export default TEXT_MODULE_CONTENT;
7
- //# sourceMappingURL=core.prompt.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"core.prompt.d.ts","sourceRoot":"","sources":["../../../../../../src/executor/composer/system/default/assets/core.prompt.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,QAAA,MAAM,mBAAmB,s4QAAs4Q,CAAC;AAEh6Q,eAAe,mBAAmB,CAAC"}
@@ -1,8 +0,0 @@
1
- /**
2
- * 自动生成文件,请勿手改。
3
- * 源文件:由同路径 `*.ts.txt` 生成。
4
- */
5
- // Source: src/executor/composer/system/default/assets/core.prompt.ts.txt
6
- const TEXT_MODULE_CONTENT = "# Harness Design\n\nYou are a Downcity Agent. is a harness around an existing human-owned workspace, not a replacement platform or a detached autonomous worker.\n\n- The harness lets the Agent enter the user's existing project instead of forcing the user to migrate work into a new AI platform.\n- The project structure is the control surface. Files, directories, scripts, docs, configuration, and existing workflows define the practical business boundary.\n- The Agent inherits the workspace's knowledge topology. Read and follow the existing structure before creating new abstractions, stores, or process layers.\n- The harness keeps the human in control. The user owns intent, boundaries, approvals, and final judgment; the Agent supplies high-density execution inside those boundaries.\n- Agent state should remain observable and handoff-friendly. Prefer outputs, changes, and explanations that a human can inspect, resume, or correct through normal project artifacts.\n- Autonomy should be progressive. Execute low-risk, reversible work directly; pause for clarification or approval when the boundary, consequence, or owner is unclear.\n- Tools and plugins are harness surfaces. Use them to act precisely in the current execution context without treating any tool as a reason to ignore the user's native workflow.\n- Prefer project-native, maintainable changes over clever platform-shaped abstractions. The best result should feel like it naturally belongs in the existing workspace.\n\n# Shell Commands\n\nCommand execution tools:\n- Prefer `shell_exec` for short, one-off commands.\n- Use `shell_session` for long-running tasks, tasks that need status checks, or processes that need stdin interaction.\n- For long-running tasks, use `wait_ms` with `shell_session` to wait for output or state changes and avoid frequent polling overhead.\n- Start a long-running command with `shell_session({ action: \"start\", cmd })` and keep the returned `shell_id`.\n- `shell_id` identifies a shell session; it is not a chat `session_id`.\n- During long-running tasks, read new output with `shell_session({ action: \"read\", shell_id })`. Do not implement your own high-frequency empty polling loop.\n- When a process needs stdin, use `shell_session({ action: \"send\", shell_id, input })`.\n- When sending stdin to a host shell session, every `send` call must include a clear `reason`. Invoke the tool directly; the runtime pauses the call and requests user approval before writing. Approval for `start` only authorizes starting the process; it does not authorize later stdin writes.\n- When a command session is complete and no longer needed, release it with `shell_session({ action: \"stop\", shell_id })`.\n- Do not forward very long raw shell output directly to the user. Summarize it first.\n- Shell commands use the Workspace's persistent isolated Sandbox by default. The project is mounted at `/workspace`; HOME, installed tools, and caches persist across chat sessions that use the same Workspace. Different Workspaces do not share writable Sandbox state.\n- When installing Python dependencies, prefer a project-local `.venv`; do not use `pip install --user`.\n- If a task requires host-directory writes or host-level capabilities, invoke the appropriate shell tool directly with `target: \"host\"` and a clear `reason`. The runtime pauses before execution and presents the approval request to the user.\n- Do not ask for a separate chat confirmation before issuing a host tool call when the command and reason are already clear. Do not claim that an approval request was sent unless you actually emitted the tool call.\n- Do not attempt `sudo`, Xcode Command Line Tools installation, SSH/keychain/shell profile modification, or obviously destructive commands. These requests are rejected even for host execution.\n- If the user rejects a host execution request, do not keep asking for the same command. Explain the impact and provide a Sandbox alternative when possible.\n- Downloads, tool caches, global package installs, and temporary state should normally live in the current Workspace Sandbox HOME. Do not assume access to the real user's HOME or cache.\n\n# File Operations\n\nStructured file tools:\n- Use `grep` to search project file contents instead of running `rg` through the shell.\n- Use `find` to discover project files by glob pattern instead of running shell `find`.\n- Use `read` to examine project files instead of `cat`, `head`, `tail`, or `sed`. Continue with the returned `next_offset` when `truncated` is true.\n- Use `write` for new files or complete rewrites. Existing files are not overwritten unless `overwrite: true` is explicit.\n- Use `edit` for precise changes. Every `edits[].old_text` must match exactly once in the original file.\n- When changing multiple separate locations in one file, use one `edit` call with multiple non-overlapping entries.\n- Pass the SHA-256 returned by `read` as `edit.expected_sha256` when the file may be changed concurrently.\n- File and search tools only operate inside the current project root and never support host access. Use the approved host shell workflow only when the user explicitly authorizes a broader action.\n\n# Plugin System\n\nYou are working in a plugin-based execution environment.\n\nPlugin call rules:\n- When you need plugin capabilities, prefer invoking the plugin action through the available tools.\n- If `plugin_read` is available, call `plugin_read({})` to list the plugins actually registered in the current Agent before choosing one. Use `plugin_read({ plugin, action? })` to inspect its action schema and examples.\n- If `plugin_call` is available, call the action with `plugin_call({ plugin, action, payload })`.\n- `plugin_call.plugin` must be a plugin name returned by `plugin_read({})`.\n- `plugin_call.action` must be an action name returned by `plugin_read({ plugin })`.\n- `plugin_call.payload` is a structured JSON payload. Pass `{}` when there are no parameters. If the action metadata declares an input schema, the payload must conform to that schema.\n- `ActionSchedule` is an internal Agent capability for delayed plugin actions. It is not a standalone plugin.\n\nSpecific plugin capabilities are defined by the action metadata returned by `plugin_read` and by each plugin's system prompt.\n\n# Default Decisions And Clarification\n\n- Execute first and communicate second by default: for low-risk, reversible requests where the user's intent is clear enough, use the current date, timezone, chat context, and common defaults to proceed. Do not repeatedly ask about obvious event titles, default platforms, or clear time expressions.\n- Ask a clarification only when missing information would materially change the outcome, such as the date, target object, amount, account, recipient, or when an action is irreversible, high-risk, or privacy-sensitive.\n- When handling relative time expressions, prefer the runtime-provided `current_date`, `current_time`, and `timezone`. If inbound `<info>` explicitly provides `user_timezone`, use that first; otherwise use the runtime clock timezone. For expressions such as \"today\", \"tomorrow\", \"2 PM\", or \"two hours earlier\", resolve them to absolute times before acting, and state the absolute date and time in your reply.\n- When a task depends on external permissions, system capabilities, or third-party connections such as calendars, reminders, chat channels, or system authorization, probe availability first before promising to create, send, or write anything.\n- If probing shows a blocker caused by system permissions, host environment, or connection state, state the real blocker and next step directly. Do not first promise that you can do it and then spend multiple turns asking follow-up questions.\n- If you have enough information to complete several low-risk default actions in one pass, complete them and briefly state which assumptions you used.\n\n# Very Important\n\nSafety and boundaries:\n- Do not run destructive commands such as `rm -rf` or `git reset --hard` unless the user explicitly asks for them.\n- For API keys, tokens, secrets, environment variables, bot credentials, and similar sensitive configuration, prefer guiding the user to maintain them in `Global / Env` or the owning Plugin's Mainview. Do not ask the user to paste secret values directly into the current chat.\n- Secret-listing capabilities can return only configured key names and descriptions. They never return secret values. Do not ask the user to \"send the secret to you\" or keep trying to retrieve plaintext secrets.\n";
7
- export default TEXT_MODULE_CONTENT;
8
- //# sourceMappingURL=core.prompt.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"core.prompt.js","sourceRoot":"","sources":["../../../../../../src/executor/composer/system/default/assets/core.prompt.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,yEAAyE;AACzE,MAAM,mBAAmB,GAAG,m4QAAm4Q,CAAC;AAEh6Q,eAAe,mBAAmB,CAAC"}
@@ -1,15 +0,0 @@
1
- /**
2
- * CoreEngine Downcity 模型上下文压缩模块。
3
- *
4
- * 本模块只判断真实 Provider usage 是否达到恢复阈值;具体选择、摘要和持久化全部
5
- * 归属于 SessionComposer 的 Context Policy。
6
- */
7
- /** usage 达到模型上下文窗口 95% 时安排下一 step 压缩。 */
8
- export declare const MODEL_CONTEXT_COMPACTION_TRIGGER_RATIO = 0.95;
9
- /** 读取 Provider usage 中的实际总 token。 */
10
- export declare function resolve_model_usage_tokens(usage: unknown): number | null;
11
- /** 计算真实 usage 占当前模型上下文窗口的比例。 */
12
- export declare function resolve_model_usage_ratio(usage: unknown, context_window: number | undefined): number | null;
13
- /** 判断一次真实 usage 是否要求下一 step 继续压缩。 */
14
- export declare function should_compact_after_usage(usage_ratio: number | null): boolean;
15
- //# sourceMappingURL=CoreEngineContextCompaction.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CoreEngineContextCompaction.d.ts","sourceRoot":"","sources":["../../../src/executor/core-engine/CoreEngineContextCompaction.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,yCAAyC;AACzC,eAAO,MAAM,sCAAsC,OAAO,CAAC;AAE3D,qCAAqC;AACrC,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CASxE;AAED,gCAAgC;AAChC,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,OAAO,EACd,cAAc,EAAE,MAAM,GAAG,SAAS,GACjC,MAAM,GAAG,IAAI,CAIf;AAED,qCAAqC;AACrC,wBAAgB,0BAA0B,CACxC,WAAW,EAAE,MAAM,GAAG,IAAI,GACzB,OAAO,CAGT"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"CoreEngineContextCompaction.js","sourceRoot":"","sources":["../../../src/executor/core-engine/CoreEngineContextCompaction.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,yCAAyC;AACzC,MAAM,CAAC,MAAM,sCAAsC,GAAG,IAAI,CAAC;AAE3D,qCAAqC;AACrC,MAAM,UAAU,0BAA0B,CAAC,KAAc;IACvD,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC;IACrD,MAAM,MAAM,GAAG,KAAgC,CAAC;IAChD,MAAM,YAAY,GAAG,wBAAwB,CAAC,MAAM,CAAC,YAAY,IAAI,MAAM,CAAC,WAAW,CAAC,CAAC;IACzF,IAAI,YAAY,KAAK,IAAI;QAAE,OAAO,YAAY,CAAC;IAC/C,MAAM,YAAY,GAAG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],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEjD;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,GAAG,UAAU,CAYjE;AAED;;GAEG;AACH,wBAAgB,mCAAmC,CAAC,MAAM,EAAE;IAC1D;;OAEG;IACH,KAAK,EAAE,OAAO,CAAC;IACf;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,GAAG,MAAM,CAOT"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"CoreEngineError.js","sourceRoot":"","sources":["../../../src/executor/core-engine/CoreEngineError.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH;;GAEG;AACH,MAAM,UAAU,sBAAsB,CAAC,KAAc;IACnD,MAAM,MAAM,GACV,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QACzD,CAAC,CAAE,KAAiC;QACpC,CAAC,CAAC,EAAE,CAAC;IACT,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;IAC3B,OAAO;QACL,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC;QACpB,IAAI,EAAE,OAAO,MAAM,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI;QAC1D,OAAO,EAAE,OAAO,MAAM,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI;QACnE,KAAK,EAAE,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;KAClD,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,mCAAmC,CAAC,MASnD;IACC,MAAM,UAAU,GAAG,kBAAkB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACpD,MAAM,UAAU,GAAG,kBAAkB,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;IAC1D,IAAI,gDAAgD,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,UAAU,EAAE,CAAC;QACpF,OAAO,UAAU,CAAC;IACpB,CAAC;IACD,OAAO,UAAU,IAAI,UAAU,IAAI,yBAAyB,CAAC;AAC/D,CAAC;AAED,4CAA4C;AAC5C,SAAS,kBAAkB,CAAC,KAAc;IACxC,IAAI,KAAK,YAAY,KAAK;QAAE,OAAO,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;IACxD,OAAO,MAAM,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;AACpC,CAAC"}
@@ -1,26 +0,0 @@
1
- /**
2
- * CoreEngineLoopDecision:模型/tool-loop 核心循环的纯决策模块。
3
- *
4
- * 关键点(中文)
5
- * - 把 “是否继续下一轮” 的分支优先级从 CoreEngine 主流程中拆出。
6
- * - 保持纯函数,不依赖模型、持久化或 logger,便于直接测试。
7
- */
8
- import type { SessionLoopDecision, SessionLoopDecisionInput, SessionTailMergeContinuationInput } from "../../executor/types/SessionLoop.js";
9
- /**
10
- * 评估当前 step 完成后,tool-loop 是否应继续下一轮。
11
- *
12
- * 优先级(中文)
13
- * 1. 不完整响应恢复
14
- * 2. 已发生的工具调用
15
- * 3. 停止
16
- */
17
- export declare function evaluate_core_engine_loop_decision(input: SessionLoopDecisionInput): SessionLoopDecision;
18
- /**
19
- * 评估 stop 前的尾部合并是否应该继续下一轮。
20
- *
21
- * 关键点(中文)
22
- * - 只要最后一次 tail merge 真正并入了新的 user 消息,就必须续跑。
23
- * - 这样可以覆盖“最后一个 step 结束后,新消息才到达”的收尾窗口。
24
- */
25
- export declare function should_continue_for_tail_merged_user_messages(input: SessionTailMergeContinuationInput): boolean;
26
- //# sourceMappingURL=CoreEngineLoopDecision.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CoreEngineLoopDecision.d.ts","sourceRoot":"","sources":["../../../src/executor/core-engine/CoreEngineLoopDecision.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EACV,mBAAmB,EACnB,wBAAwB,EACxB,iCAAiC,EAClC,MAAM,iCAAiC,CAAC;AAEzC;;;;;;;GAOG;AACH,wBAAgB,kCAAkC,CAChD,KAAK,EAAE,wBAAwB,GAC9B,mBAAmB,CAyBrB;AAED;;;;;;GAMG;AACH,wBAAgB,6CAA6C,CAC3D,KAAK,EAAE,iCAAiC,GACvC,OAAO,CAET"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"CoreEngineLoopDecision.js","sourceRoot":"","sources":["../../../src/executor/core-engine/CoreEngineLoopDecision.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAQH;;;;;;;GAOG;AACH,MAAM,UAAU,kCAAkC,CAChD,KAA+B;IAE/B,IACE,KAAK,CAAC,qBAAqB;QAC3B,KAAK,CAAC,uBAAuB,GAAG,KAAK,CAAC,uBAAuB,EAC7D,CAAC;QACD,OAAO;YACL,IAAI,EAAE,oBAAoB;YAC1B,oBAAoB,EAAE,KAAK;YAC3B,6BAA6B,EAAE,IAAI;SACpC,CAAC;IACJ,CAAC;IAED,IAAI,KAAK,CAAC,aAAa,GAAG,CAAC,EAAE,CAAC;QAC5B,OAAO;YACL,IAAI,EAAE,yBAAyB;YAC/B,oBAAoB,EAAE,IAAI;YAC1B,6BAA6B,EAAE,KAAK;SACrC,CAAC;IACJ,CAAC;IAED,OAAO;QACL,IAAI,EAAE,MAAM;QACZ,oBAAoB,EAAE,KAAK;QAC3B,6BAA6B,EAAE,KAAK;KACrC,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,6CAA6C,CAC3D,KAAwC;IAExC,OAAO,KAAK,CAAC,sBAAsB,GAAG,CAAC,CAAC;AAC1C,CAAC"}
@@ -1,48 +0,0 @@
1
- /**
2
- * CoreEngineRunner:模型与 tool-loop 主循环执行器。
3
- *
4
- * 关键点(中文)
5
- * - 每个 Provider Step 都通过回调取得 Composer 生成的完整输入。
6
- * - 只负责 step 循环、续写恢复与最终 assistant 汇总,不持有历史副本。
7
- * - 保持失败返回结构稳定,避免对外 Session 行为变化。
8
- */
9
- import type { Logger } from "../../utils/logger/Logger.js";
10
- import type { SessionTurnContext } from "../../types/executor/SessionTurnContext.js";
11
- import type { SessionStepExecutionInput, SessionTurnExecutionResult } from "../../types/session/SessionExecution.js";
12
- interface CoreEngineRunnerOptions {
13
- /** 当前 Session 稳定标识。 */
14
- session_id: string;
15
- /**
16
- * 当前 session 统一日志器。
17
- */
18
- logger: Logger;
19
- /**
20
- * 判断某次执行错误是否应该上抛给外层压缩重试。
21
- */
22
- should_compact_on_error: (error: unknown) => boolean;
23
- }
24
- interface CoreEngineTurnInput {
25
- /**
26
- * 当前显式运行上下文。
27
- */
28
- turn_context: SessionTurnContext;
29
- /**
30
- * 在统一输入队列提交后解析当前 Session step 的 effective 配置。
31
- */
32
- resolve_step_input: () => Promise<SessionStepExecutionInput>;
33
- }
34
- /**
35
- * 模型与 tool-loop 主循环执行器。
36
- */
37
- export declare class CoreEngineRunner {
38
- private readonly session_id;
39
- private readonly logger;
40
- private readonly should_compact_on_error;
41
- constructor(options: CoreEngineRunnerOptions);
42
- /**
43
- * 执行一次已装配完成的模型/tool-loop 运行。
44
- */
45
- execute(input: CoreEngineTurnInput): Promise<SessionTurnExecutionResult>;
46
- }
47
- export {};
48
- //# sourceMappingURL=CoreEngineRunner.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CoreEngineRunner.d.ts","sourceRoot":"","sources":["../../../src/executor/core-engine/CoreEngineRunner.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAgCH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAEjF,OAAO,KAAK,EACV,yBAAyB,EACzB,0BAA0B,EAC3B,MAAM,qCAAqC,CAAC;AAO7C,UAAU,uBAAuB;IAC/B,uBAAuB;IACvB,UAAU,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,uBAAuB,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC;CACtD;AAED,UAAU,mBAAmB;IAC3B;;OAEG;IACH,YAAY,EAAE,kBAAkB,CAAC;IAEjC;;OAEG;IACH,kBAAkB,EAAE,MAAM,OAAO,CAAC,yBAAyB,CAAC,CAAC;CAC9D;AAED;;GAEG;AACH,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;IACpC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,uBAAuB,CAAqD;gBAEjF,OAAO,EAAE,uBAAuB;IAS5C;;OAEG;IACG,OAAO,CAAC,KAAK,EAAE,mBAAmB,GAAG,OAAO,CAAC,0BAA0B,CAAC;CA4S/E"}