@downcity/agent 1.1.208 → 1.1.212

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 (272) hide show
  1. package/bin/agent/local/Agent.d.ts +3 -3
  2. package/bin/agent/local/Agent.d.ts.map +1 -1
  3. package/bin/agent/local/Agent.js +0 -3
  4. package/bin/agent/local/Agent.js.map +1 -1
  5. package/bin/agent/local/AgentInstructions.d.ts +1 -1
  6. package/bin/agent/local/AgentInstructions.d.ts.map +1 -1
  7. package/bin/agent/local/services/AgentAssemblyService.d.ts +3 -8
  8. package/bin/agent/local/services/AgentAssemblyService.d.ts.map +1 -1
  9. package/bin/agent/local/services/AgentAssemblyService.js +0 -1
  10. package/bin/agent/local/services/AgentAssemblyService.js.map +1 -1
  11. package/bin/agent/local/services/AgentSessions.d.ts +5 -7
  12. package/bin/agent/local/services/AgentSessions.d.ts.map +1 -1
  13. package/bin/agent/local/services/AgentSessions.js +2 -3
  14. package/bin/agent/local/services/AgentSessions.js.map +1 -1
  15. package/bin/agent/remote/RemoteAgent.d.ts +3 -1
  16. package/bin/agent/remote/RemoteAgent.d.ts.map +1 -1
  17. package/bin/agent/remote/RemoteAgent.js.map +1 -1
  18. package/bin/agent/remote/RemoteSession.d.ts +10 -1
  19. package/bin/agent/remote/RemoteSession.d.ts.map +1 -1
  20. package/bin/agent/remote/RemoteSession.js +18 -0
  21. package/bin/agent/remote/RemoteSession.js.map +1 -1
  22. package/bin/agent/remote/RemoteTransport.d.ts +5 -1
  23. package/bin/agent/remote/RemoteTransport.d.ts.map +1 -1
  24. package/bin/agent/remote/transports/HttpRemoteAgentTransport.d.ts +4 -1
  25. package/bin/agent/remote/transports/HttpRemoteAgentTransport.d.ts.map +1 -1
  26. package/bin/agent/remote/transports/HttpRemoteAgentTransport.js +7 -0
  27. package/bin/agent/remote/transports/HttpRemoteAgentTransport.js.map +1 -1
  28. package/bin/agent/remote/transports/RpcRemoteAgentTransport.d.ts +4 -1
  29. package/bin/agent/remote/transports/RpcRemoteAgentTransport.d.ts.map +1 -1
  30. package/bin/agent/remote/transports/RpcRemoteAgentTransport.js +1 -0
  31. package/bin/agent/remote/transports/RpcRemoteAgentTransport.js.map +1 -1
  32. package/bin/executor/Executor.d.ts +0 -16
  33. package/bin/executor/Executor.d.ts.map +1 -1
  34. package/bin/executor/Executor.js +0 -16
  35. package/bin/executor/Executor.js.map +1 -1
  36. package/bin/executor/composer/compaction/jsonl/JsonlSessionCompactionExecutor.d.ts +1 -3
  37. package/bin/executor/composer/compaction/jsonl/JsonlSessionCompactionExecutor.d.ts.map +1 -1
  38. package/bin/executor/composer/compaction/jsonl/JsonlSessionCompactionExecutor.js +1 -5
  39. package/bin/executor/composer/compaction/jsonl/JsonlSessionCompactionExecutor.js.map +1 -1
  40. package/bin/executor/composer/history/SessionHistoryWriter.d.ts +0 -10
  41. package/bin/executor/composer/history/SessionHistoryWriter.d.ts.map +1 -1
  42. package/bin/executor/composer/history/SessionHistoryWriter.js +31 -61
  43. package/bin/executor/composer/history/SessionHistoryWriter.js.map +1 -1
  44. package/bin/executor/messages/AssistantFileResource.d.ts.map +1 -1
  45. package/bin/executor/messages/AssistantFileResource.js +58 -15
  46. package/bin/executor/messages/AssistantFileResource.js.map +1 -1
  47. package/bin/executor/services/ExecutorInflightService.d.ts +0 -5
  48. package/bin/executor/services/ExecutorInflightService.d.ts.map +1 -1
  49. package/bin/executor/services/ExecutorInflightService.js +0 -6
  50. package/bin/executor/services/ExecutorInflightService.js.map +1 -1
  51. package/bin/executor/store/history/jsonl/JsonlSessionHistoryStore.d.ts +4 -0
  52. package/bin/executor/store/history/jsonl/JsonlSessionHistoryStore.d.ts.map +1 -1
  53. package/bin/executor/store/history/jsonl/JsonlSessionHistoryStore.js +115 -3
  54. package/bin/executor/store/history/jsonl/JsonlSessionHistoryStore.js.map +1 -1
  55. package/bin/executor/types/SessionHistoryMeta.d.ts +6 -0
  56. package/bin/executor/types/SessionHistoryMeta.d.ts.map +1 -1
  57. package/bin/index.d.ts +38 -6
  58. package/bin/index.d.ts.map +1 -1
  59. package/bin/index.js +14 -1
  60. package/bin/index.js.map +1 -1
  61. package/bin/plugin/core/ActionScheduleExecutor.js +1 -1
  62. package/bin/plugin/core/ActionScheduleExecutor.js.map +1 -1
  63. package/bin/plugin/core/BasePlugin.d.ts +7 -9
  64. package/bin/plugin/core/BasePlugin.d.ts.map +1 -1
  65. package/bin/plugin/core/BasePlugin.js +1 -14
  66. package/bin/plugin/core/BasePlugin.js.map +1 -1
  67. package/bin/plugin/core/HookRegistry.d.ts +1 -1
  68. package/bin/plugin/core/HookRegistry.d.ts.map +1 -1
  69. package/bin/plugin/core/PluginActionFactory.d.ts +1 -5
  70. package/bin/plugin/core/PluginActionFactory.d.ts.map +1 -1
  71. package/bin/plugin/core/PluginActionFactory.js +0 -3
  72. package/bin/plugin/core/PluginActionFactory.js.map +1 -1
  73. package/bin/plugin/core/PluginActionRunner.d.ts +6 -4
  74. package/bin/plugin/core/PluginActionRunner.d.ts.map +1 -1
  75. package/bin/plugin/core/PluginActionRunner.js +2 -2
  76. package/bin/plugin/core/PluginActionRunner.js.map +1 -1
  77. package/bin/plugin/core/PluginCatalog.d.ts +2 -1
  78. package/bin/plugin/core/PluginCatalog.d.ts.map +1 -1
  79. package/bin/plugin/core/PluginCatalog.js.map +1 -1
  80. package/bin/plugin/core/PluginCommand.d.ts +1 -1
  81. package/bin/plugin/core/PluginCommand.d.ts.map +1 -1
  82. package/bin/plugin/core/PluginCommand.js.map +1 -1
  83. package/bin/plugin/core/PluginHttpRoutes.d.ts +1 -1
  84. package/bin/plugin/core/PluginHttpRoutes.d.ts.map +1 -1
  85. package/bin/plugin/core/PluginLocalExecution.d.ts +4 -1
  86. package/bin/plugin/core/PluginLocalExecution.d.ts.map +1 -1
  87. package/bin/plugin/core/PluginLocalExecution.js +0 -1
  88. package/bin/plugin/core/PluginLocalExecution.js.map +1 -1
  89. package/bin/plugin/core/PluginRegistry.d.ts +4 -2
  90. package/bin/plugin/core/PluginRegistry.d.ts.map +1 -1
  91. package/bin/plugin/core/PluginRegistry.js +7 -6
  92. package/bin/plugin/core/PluginRegistry.js.map +1 -1
  93. package/bin/plugin/core/PluginStateController.d.ts +7 -27
  94. package/bin/plugin/core/PluginStateController.d.ts.map +1 -1
  95. package/bin/plugin/core/PluginStateController.js +5 -39
  96. package/bin/plugin/core/PluginStateController.js.map +1 -1
  97. package/bin/plugin/types/PluginApi.d.ts +3 -79
  98. package/bin/plugin/types/PluginApi.d.ts.map +1 -1
  99. package/bin/rpc/Client.d.ts +11 -6
  100. package/bin/rpc/Client.d.ts.map +1 -1
  101. package/bin/rpc/Client.js +2 -0
  102. package/bin/rpc/Client.js.map +1 -1
  103. package/bin/session/Session.d.ts +2 -5
  104. package/bin/session/Session.d.ts.map +1 -1
  105. package/bin/session/Session.js +3 -16
  106. package/bin/session/Session.js.map +1 -1
  107. package/bin/session/SessionSystemBuilder.d.ts +1 -1
  108. package/bin/session/SessionSystemBuilder.d.ts.map +1 -1
  109. package/bin/session/browse/Browse.d.ts +4 -6
  110. package/bin/session/browse/Browse.d.ts.map +1 -1
  111. package/bin/session/browse/Browse.js +71 -71
  112. package/bin/session/browse/Browse.js.map +1 -1
  113. package/bin/session/preview/SessionMessagePreview.d.ts +13 -0
  114. package/bin/session/preview/SessionMessagePreview.d.ts.map +1 -0
  115. package/bin/session/preview/SessionMessagePreview.js +61 -0
  116. package/bin/session/preview/SessionMessagePreview.js.map +1 -0
  117. package/bin/session/runtime/SessionPromptRuntime.d.ts +14 -0
  118. package/bin/session/runtime/SessionPromptRuntime.d.ts.map +1 -1
  119. package/bin/session/runtime/SessionPromptRuntime.js +11 -0
  120. package/bin/session/runtime/SessionPromptRuntime.js.map +1 -1
  121. package/bin/session/services/SessionStateService.d.ts +1 -1
  122. package/bin/session/services/SessionStateService.d.ts.map +1 -1
  123. package/bin/session/services/SessionStateService.js +2 -2
  124. package/bin/session/services/SessionStateService.js.map +1 -1
  125. package/bin/session/services/SessionTurnService.d.ts.map +1 -1
  126. package/bin/session/services/SessionTurnService.js +9 -0
  127. package/bin/session/services/SessionTurnService.js.map +1 -1
  128. package/bin/session/services/SessionViewService.d.ts +2 -1
  129. package/bin/session/services/SessionViewService.d.ts.map +1 -1
  130. package/bin/session/services/SessionViewService.js +4 -1
  131. package/bin/session/services/SessionViewService.js.map +1 -1
  132. package/bin/session/storage/Metadata.d.ts.map +1 -1
  133. package/bin/session/storage/Metadata.js +23 -0
  134. package/bin/session/storage/Metadata.js.map +1 -1
  135. package/bin/session/storage/Persistence.d.ts +1 -1
  136. package/bin/session/storage/Persistence.d.ts.map +1 -1
  137. package/bin/session/storage/RuntimeSessionPort.d.ts +0 -12
  138. package/bin/session/storage/RuntimeSessionPort.d.ts.map +1 -1
  139. package/bin/session/storage/RuntimeSessionPort.js +0 -8
  140. package/bin/session/storage/RuntimeSessionPort.js.map +1 -1
  141. package/bin/types/plugin/PluginAction.d.ts +0 -10
  142. package/bin/types/plugin/PluginAction.d.ts.map +1 -1
  143. package/bin/types/plugin/PluginCommand.d.ts +2 -3
  144. package/bin/types/plugin/PluginCommand.d.ts.map +1 -1
  145. package/bin/types/plugin/PluginControl.d.ts +74 -0
  146. package/bin/types/plugin/PluginControl.d.ts.map +1 -0
  147. package/bin/types/plugin/PluginControl.js +9 -0
  148. package/bin/types/plugin/PluginControl.js.map +1 -0
  149. package/bin/types/plugin/PluginDefinition.d.ts +1 -1
  150. package/bin/types/plugin/PluginDefinition.d.ts.map +1 -1
  151. package/bin/types/plugin/PluginRuntime.d.ts +1 -3
  152. package/bin/types/plugin/PluginRuntime.d.ts.map +1 -1
  153. package/bin/types/plugin/PluginState.d.ts +3 -16
  154. package/bin/types/plugin/PluginState.d.ts.map +1 -1
  155. package/bin/types/rpc/RpcProtocol.d.ts +3 -3
  156. package/bin/types/rpc/RpcProtocol.d.ts.map +1 -1
  157. package/bin/types/runtime/agent/AgentContext.d.ts +1 -9
  158. package/bin/types/runtime/agent/AgentContext.d.ts.map +1 -1
  159. package/bin/types/runtime/agent/AgentContext.js.map +1 -1
  160. package/bin/types/session/SessionLocalState.d.ts +1 -1
  161. package/bin/types/session/SessionLocalState.d.ts.map +1 -1
  162. package/package.json +4 -7
  163. package/scripts/agent-ready.test.mjs +38 -0
  164. package/scripts/assistant-file-resource.test.mjs +39 -0
  165. package/scripts/city-model-tool-loop.test.mjs +18 -30
  166. package/scripts/image-plugin-job.test.mjs +13 -13
  167. package/scripts/plugin-tool-bridge.test.mjs +2 -3
  168. package/scripts/remote-session-reconnect.test.mjs +67 -0
  169. package/scripts/session-history-writer-error.test.mjs +57 -0
  170. package/scripts/session-list-title.test.mjs +114 -23
  171. package/scripts/session-prompt-runtime.test.mjs +22 -0
  172. package/src/agent/local/Agent.ts +4 -10
  173. package/src/agent/local/AgentInstructions.ts +1 -1
  174. package/src/agent/local/services/AgentAssemblyService.ts +3 -9
  175. package/src/agent/local/services/AgentSessions.ts +8 -15
  176. package/src/agent/remote/RemoteAgent.ts +5 -4
  177. package/src/agent/remote/RemoteSession.ts +21 -2
  178. package/src/agent/remote/RemoteTransport.ts +6 -2
  179. package/src/agent/remote/transports/HttpRemoteAgentTransport.ts +13 -3
  180. package/src/agent/remote/transports/RpcRemoteAgentTransport.ts +6 -2
  181. package/src/executor/Executor.ts +0 -23
  182. package/src/executor/composer/compaction/jsonl/JsonlSessionCompactionExecutor.ts +2 -8
  183. package/src/executor/composer/history/SessionHistoryWriter.ts +33 -64
  184. package/src/executor/messages/AssistantFileResource.ts +61 -17
  185. package/src/executor/services/ExecutorInflightService.ts +0 -10
  186. package/src/executor/store/history/jsonl/JsonlSessionHistoryStore.ts +130 -4
  187. package/src/executor/types/SessionHistoryMeta.ts +6 -0
  188. package/src/index.ts +100 -29
  189. package/src/plugin/core/ActionScheduleExecutor.ts +1 -1
  190. package/src/plugin/core/BasePlugin.ts +8 -22
  191. package/src/plugin/core/HookRegistry.ts +1 -1
  192. package/src/plugin/core/PluginActionFactory.ts +1 -8
  193. package/src/plugin/core/PluginActionRunner.ts +8 -11
  194. package/src/plugin/core/PluginCatalog.ts +2 -5
  195. package/src/plugin/core/PluginCommand.ts +2 -1
  196. package/src/plugin/core/PluginHttpRoutes.ts +1 -1
  197. package/src/plugin/core/PluginLocalExecution.ts +4 -7
  198. package/src/plugin/core/PluginRegistry.ts +10 -10
  199. package/src/plugin/core/PluginStateController.ts +12 -60
  200. package/src/plugin/types/PluginApi.ts +6 -81
  201. package/src/rpc/Client.ts +22 -16
  202. package/src/session/Session.ts +5 -21
  203. package/src/session/SessionSystemBuilder.ts +1 -1
  204. package/src/session/browse/Browse.ts +103 -84
  205. package/src/session/preview/SessionMessagePreview.ts +75 -0
  206. package/src/session/runtime/SessionPromptRuntime.ts +29 -4
  207. package/src/session/services/SessionStateService.ts +3 -4
  208. package/src/session/services/SessionTurnService.ts +9 -0
  209. package/src/session/services/SessionViewService.ts +6 -6
  210. package/src/session/storage/Metadata.ts +26 -0
  211. package/src/session/storage/Persistence.ts +1 -1
  212. package/src/session/storage/RuntimeSessionPort.ts +0 -20
  213. package/src/types/plugin/PluginAction.ts +0 -10
  214. package/src/types/plugin/PluginCommand.ts +2 -3
  215. package/src/types/plugin/PluginControl.ts +80 -0
  216. package/src/types/plugin/PluginDefinition.ts +1 -1
  217. package/src/types/plugin/PluginRuntime.ts +1 -3
  218. package/src/types/plugin/PluginState.ts +3 -20
  219. package/src/types/rpc/RpcProtocol.ts +4 -4
  220. package/src/types/runtime/agent/AgentContext.ts +1 -9
  221. package/src/types/session/SessionLocalState.ts +1 -1
  222. package/tsconfig.tsbuildinfo +1 -1
  223. package/bin/config/DowncitySchema.d.ts +0 -20
  224. package/bin/config/DowncitySchema.d.ts.map +0 -1
  225. package/bin/config/DowncitySchema.js +0 -160
  226. package/bin/config/DowncitySchema.js.map +0 -1
  227. package/bin/plugin/core/Activation.d.ts +0 -18
  228. package/bin/plugin/core/Activation.d.ts.map +0 -1
  229. package/bin/plugin/core/Activation.js +0 -21
  230. package/bin/plugin/core/Activation.js.map +0 -1
  231. package/bin/plugin/core/Manager.d.ts +0 -7
  232. package/bin/plugin/core/Manager.d.ts.map +0 -1
  233. package/bin/plugin/core/Manager.js +0 -6
  234. package/bin/plugin/core/Manager.js.map +0 -1
  235. package/bin/plugin/types/Plugin.d.ts +0 -15
  236. package/bin/plugin/types/Plugin.d.ts.map +0 -1
  237. package/bin/plugin/types/Plugin.js +0 -9
  238. package/bin/plugin/types/Plugin.js.map +0 -1
  239. package/bin/plugin/types/PluginLifecycle.d.ts +0 -34
  240. package/bin/plugin/types/PluginLifecycle.d.ts.map +0 -1
  241. package/bin/plugin/types/PluginLifecycle.js +0 -9
  242. package/bin/plugin/types/PluginLifecycle.js.map +0 -1
  243. package/bin/plugin/types/PluginState.d.ts +0 -5
  244. package/bin/plugin/types/PluginState.d.ts.map +0 -1
  245. package/bin/plugin/types/PluginState.js +0 -5
  246. package/bin/plugin/types/PluginState.js.map +0 -1
  247. package/bin/plugin/types/Plugins.d.ts +0 -61
  248. package/bin/plugin/types/Plugins.d.ts.map +0 -1
  249. package/bin/plugin/types/Plugins.js +0 -5
  250. package/bin/plugin/types/Plugins.js.map +0 -1
  251. package/bin/session/index.d.ts +0 -15
  252. package/bin/session/index.d.ts.map +0 -1
  253. package/bin/session/index.js +0 -15
  254. package/bin/session/index.js.map +0 -1
  255. package/bin/types/agent/AgentTypes.d.ts +0 -18
  256. package/bin/types/agent/AgentTypes.d.ts.map +0 -1
  257. package/bin/types/agent/AgentTypes.js +0 -10
  258. package/bin/types/agent/AgentTypes.js.map +0 -1
  259. package/bin/utils/logger/Format.d.ts +0 -11
  260. package/bin/utils/logger/Format.d.ts.map +0 -1
  261. package/bin/utils/logger/Format.js +0 -10
  262. package/bin/utils/logger/Format.js.map +0 -1
  263. package/src/config/DowncitySchema.ts +0 -175
  264. package/src/plugin/core/Activation.ts +0 -26
  265. package/src/plugin/core/Manager.ts +0 -17
  266. package/src/plugin/types/Plugin.ts +0 -63
  267. package/src/plugin/types/PluginLifecycle.ts +0 -35
  268. package/src/plugin/types/PluginState.ts +0 -12
  269. package/src/plugin/types/Plugins.ts +0 -67
  270. package/src/session/index.ts +0 -57
  271. package/src/types/agent/AgentTypes.ts +0 -58
  272. package/src/utils/logger/Format.ts +0 -15
@@ -1,175 +0,0 @@
1
- /**
2
- * `downcity.json` Schema 定义模块。
3
- *
4
- * 职责说明(中文)
5
- * - 提供旧版 `downcity.json` 的 JSON Schema 常量。
6
- * - 保留给迁移场景与编辑器辅助,不再作为新 Agent 项目的默认配置入口。
7
- *
8
- * 边界说明(中文)
9
- * - 这里是静态 schema 常量,不负责运行时配置装配或业务校验逻辑。
10
- * - 当 schema 与运行时实现存在差异时,应同时更新配置解析与用户文档。
11
- */
12
- import type { JsonObject } from "@/types/common/Json.js";
13
-
14
- /**
15
- * `downcity.json` 的本地 Schema 常量。
16
- *
17
- * 关键点(中文)
18
- * - 该结构主要面向 legacy 文件的 IDE 校验与用户编辑体验,不替代运行时断言。
19
- */
20
- export const DOWNCITY_JSON_SCHEMA: JsonObject = {
21
- $schema: "https://json-schema.org/draft/2020-12/schema",
22
- $id: "https://downcity.ai/schemas/downcity.schema.json",
23
- title: "Downcity downcity.json",
24
- type: "object",
25
- additionalProperties: true,
26
- properties: {
27
- $schema: {
28
- type: "string",
29
- description:
30
- "JSON Schema reference for editor/IDE validation (e.g. ./.downcity/schema/downcity.schema.json).",
31
- },
32
- id: { type: "string" },
33
- version: { type: "string" },
34
- start: {
35
- type: "object",
36
- additionalProperties: true,
37
- properties: {
38
- port: { type: "integer", minimum: 1, maximum: 65535 },
39
- host: { type: "string" },
40
- },
41
- },
42
- execution: {
43
- type: "object",
44
- additionalProperties: true,
45
- properties: {
46
- type: {
47
- type: "string",
48
- enum: ["api"],
49
- },
50
- modelId: {
51
- type: "string",
52
- description:
53
- "API 执行模式下绑定的 City AIService 模型 ID。",
54
- },
55
- },
56
- required: ["type", "modelId"],
57
- },
58
- plugins: {
59
- type: "object",
60
- additionalProperties: true,
61
- properties: {
62
- chat: {
63
- type: "object",
64
- additionalProperties: true,
65
- properties: {
66
- queue: {
67
- type: "object",
68
- additionalProperties: true,
69
- properties: {
70
- maxConcurrency: { type: "integer", minimum: 1, maximum: 32 },
71
- mergeDebounceMs: { type: "integer", minimum: 0, maximum: 60000 },
72
- mergeMaxWaitMs: { type: "integer", minimum: 0, maximum: 120000 },
73
- },
74
- },
75
- egress: {
76
- type: "object",
77
- additionalProperties: true,
78
- properties: {
79
- chatSendMaxCallsPerRun: { type: "integer", minimum: 1, maximum: 500 },
80
- chatSendIdempotency: { type: "boolean" },
81
- },
82
- },
83
- channels: {
84
- type: "object",
85
- additionalProperties: true,
86
- description:
87
- "Chat platform channels (Telegram / Feishu / QQ...).",
88
- properties: {
89
- telegram: {
90
- type: "object",
91
- additionalProperties: true,
92
- properties: {
93
- enabled: { type: "boolean" },
94
- channelAccountId: { type: "string" },
95
- },
96
- },
97
- feishu: {
98
- type: "object",
99
- additionalProperties: true,
100
- properties: {
101
- enabled: { type: "boolean" },
102
- channelAccountId: { type: "string" },
103
- },
104
- },
105
- qq: {
106
- type: "object",
107
- additionalProperties: true,
108
- properties: {
109
- enabled: { type: "boolean" },
110
- channelAccountId: { type: "string" },
111
- },
112
- },
113
- },
114
- },
115
- },
116
- },
117
- },
118
- },
119
- llm: {
120
- type: "object",
121
- additionalProperties: true,
122
- properties: {
123
- providers: {
124
- type: "object",
125
- additionalProperties: {
126
- type: "object",
127
- additionalProperties: true,
128
- properties: {
129
- type: {
130
- type: "string",
131
- enum: [
132
- "anthropic",
133
- "openai",
134
- "deepseek",
135
- "gemini",
136
- "open-compatible",
137
- "open-responses",
138
- "moonshot-cn",
139
- "moonshot-ai",
140
- "kimi-code",
141
- "xai",
142
- "huggingface",
143
- "openrouter",
144
- ],
145
- },
146
- baseUrl: { type: "string" },
147
- apiKey: { type: "string" },
148
- },
149
- required: ["type"],
150
- },
151
- },
152
- models: {
153
- type: "object",
154
- additionalProperties: {
155
- type: "object",
156
- additionalProperties: true,
157
- properties: {
158
- provider: { type: "string" },
159
- name: { type: "string" },
160
- temperature: { type: "number" },
161
- maxTokens: { type: "number" },
162
- topP: { type: "number" },
163
- frequencyPenalty: { type: "number" },
164
- presencePenalty: { type: "number" },
165
- anthropicVersion: { type: "string" },
166
- },
167
- required: ["provider", "name"],
168
- },
169
- },
170
- logMessages: { type: "boolean" },
171
- },
172
- required: ["providers", "models"],
173
- },
174
- },
175
- };
@@ -1,26 +0,0 @@
1
- /**
2
- * Plugin 激活兼容工具。
3
- *
4
- * 关键点(中文)
5
- * - 新模型不再读取 `downcity.json.plugins.<name>.enabled`。
6
- * - 传入 plugin 本身就表示调用方希望它可见;Agent runtime 以注册表作为真实边界。
7
- * - 该函数仅为旧内部集成保留,后续应优先使用 `context.plugins.has/status`。
8
- */
9
-
10
- import type { Plugin } from "@/plugin/types/Plugin.js";
11
- import type { AgentContext } from "@/types/runtime/agent/AgentContext.js";
12
-
13
- /**
14
- * 判断当前 plugin 是否可被视为启用。
15
- */
16
- export function isPluginEnabled(params: {
17
- plugin: Plugin;
18
- context?: Pick<AgentContext, "plugins">;
19
- }): boolean {
20
- const pluginName = String(params.plugin.name || "").trim();
21
- if (!pluginName) return false;
22
- if (params.context?.plugins) {
23
- return params.context.plugins.status(pluginName)?.status === "ready";
24
- }
25
- return true;
26
- }
@@ -1,17 +0,0 @@
1
- /**
2
- * Plugin Manager 门面模块。
3
- */
4
-
5
- export type {
6
- PluginStateControlAction,
7
- PluginStateControlResult,
8
- PluginStateSnapshot,
9
- } from "@/plugin/types/Plugin.js";
10
- export {
11
- controlPluginState,
12
- isPluginRunning,
13
- listPluginStates,
14
- } from "@/plugin/core/PluginStateController.js";
15
- export {
16
- runPluginCommand,
17
- } from "@/plugin/core/PluginActionRunner.js";
@@ -1,63 +0,0 @@
1
- /**
2
- * Plugin 类型 facade。
3
- *
4
- * 关键点(中文)
5
- * - 保留旧的 `@/plugin/types/Plugin.js` 导入路径。
6
- * - 真实类型按职责拆到 `src/types/plugin/*`,避免单文件继续膨胀。
7
- */
8
-
9
- export type {
10
- PluginState,
11
- PluginStateControlAction,
12
- PluginStateControlResult,
13
- PluginRuntimeRecord,
14
- PluginSnapshot,
15
- PluginStateSnapshot,
16
- } from "@/types/plugin/PluginState.js";
17
- export type {
18
- PluginCommandContext,
19
- PluginCommandParams,
20
- PluginCommandResult,
21
- PluginLifecycle,
22
- } from "@/types/plugin/PluginCommand.js";
23
- export type {
24
- PluginAction,
25
- PluginActionApi,
26
- PluginActionCommand,
27
- PluginActionCommandInput,
28
- PluginActionExample,
29
- PluginActionInvokeParams,
30
- PluginActionInvokePort,
31
- PluginActionInvokeResult,
32
- PluginActionInputSchema,
33
- PluginActionMetadata,
34
- PluginActionResult,
35
- PluginActions,
36
- } from "@/types/plugin/PluginAction.js";
37
- export type {
38
- PluginAvailability,
39
- PluginConfigDefinition,
40
- PluginEffectHook,
41
- PluginGuardHook,
42
- PluginHooks,
43
- PluginPipelineHook,
44
- AgentPlugins,
45
- PluginActionReadView,
46
- PluginResolveHook,
47
- PluginResolves,
48
- PluginReadView,
49
- PluginView,
50
- } from "@/types/plugin/PluginRuntime.js";
51
- export type {
52
- PluginSetupDefinition,
53
- PluginSetupField,
54
- PluginSetupFieldOption,
55
- PluginUsageDefinition,
56
- PluginUsageField,
57
- PluginUsageFieldOption,
58
- } from "@/types/plugin/PluginSetup.js";
59
- export type {
60
- PluginHttpDefinition,
61
- PluginHttpRegistration,
62
- } from "@/types/plugin/PluginHttp.js";
63
- export type { Plugin } from "@/types/plugin/PluginDefinition.js";
@@ -1,35 +0,0 @@
1
- /**
2
- * Plugin 生命周期配置类型定义。
3
- *
4
- * 关键点(中文)
5
- * - Plugin 是否启用属于 city 级全局状态,不属于单个 agent 项目。
6
- * - 该文件只描述 city 级 lifecycle 数据,不承载 agent 局部参数。
7
- */
8
-
9
- /**
10
- * 单个 plugin 的 city 级生命周期配置。
11
- */
12
- export interface CityPluginLifecycleItem {
13
- /**
14
- * 当前 plugin 是否在 city 级被启用。
15
- */
16
- enabled: boolean;
17
- /**
18
- * 最近更新时间(ISO 字符串)。
19
- */
20
- updatedAt: string;
21
- }
22
-
23
- /**
24
- * city 级 plugin 生命周期配置映射。
25
- */
26
- export interface CityPluginLifecycleConfig {
27
- /**
28
- * 插件生命周期配置对象映射。
29
- *
30
- * 说明(中文)
31
- * - key 为 plugin 稳定名称。
32
- * - value 为该 plugin 的 city 级启用状态快照。
33
- */
34
- [pluginName: string]: CityPluginLifecycleItem | undefined;
35
- }
@@ -1,12 +0,0 @@
1
- /**
2
- * PluginState:plugin 运行状态相关共享类型导出。
3
- */
4
-
5
- export type {
6
- PluginState,
7
- PluginStateControlAction,
8
- PluginStateControlResult,
9
- PluginRuntimeRecord,
10
- PluginSnapshot,
11
- PluginStateSnapshot,
12
- } from "@/types/plugin/PluginState.js";
@@ -1,67 +0,0 @@
1
- /**
2
- * plugin 管理命令类型。
3
- */
4
-
5
- import type { JsonValue } from "@/types/common/Json.js";
6
-
7
- export type PluginControlAction = "status" | "unregister";
8
-
9
- /**
10
- * 单个 plugin 的对外状态视图。
11
- */
12
- export type PluginStateView = {
13
- /** plugin 稳定名称。 */
14
- name: string;
15
- /** 当前注册状态。 */
16
- state: "ready" | "error";
17
- /** 当前注册状态。 */
18
- status: "ready" | "error";
19
- /** 注册时间(毫秒时间戳)。 */
20
- registered_at: number;
21
- /** 最近更新时间(毫秒时间戳)。 */
22
- updated_at: number;
23
- /** 兼容旧字段的最近一次状态更新时间。 */
24
- updatedAt: number;
25
- /** 最近一次错误信息。 */
26
- lastError?: string;
27
- /** 最近一次错误信息。 */
28
- last_error?: string;
29
- };
30
-
31
- /**
32
- * plugin 状态列表响应。
33
- */
34
- export type PluginStateListResponse = {
35
- success: boolean;
36
- plugins?: PluginStateView[];
37
- error?: string;
38
- };
39
-
40
- /**
41
- * plugin 生命周期控制响应。
42
- */
43
- export type PluginControlResponse = {
44
- success: boolean;
45
- plugin?: PluginStateView;
46
- error?: string;
47
- };
48
-
49
- /**
50
- * plugin command/action 执行响应。
51
- */
52
- export type PluginCommandResponse = {
53
- success: boolean;
54
- plugin?: PluginStateView;
55
- message?: string;
56
- data?: JsonValue;
57
- error?: string;
58
- };
59
-
60
- export type PluginCliBaseOptions = {
61
- path?: string;
62
- agent?: string;
63
- host?: string;
64
- port?: number;
65
- token?: string;
66
- json?: boolean;
67
- };
@@ -1,57 +0,0 @@
1
- /**
2
- * Session 模块聚合入口。
3
- *
4
- * 职责说明(中文)
5
- * - 统一暴露 `session/` 目录下的本地 Session 实现与相关辅助能力。
6
- * - 让 `Session` 相关代码收敛在一个目录树中,避免实现散落在 Agent 入口模块里。
7
- */
8
-
9
- export { Session } from "./Session.js";
10
-
11
- export {
12
- getSdkAgentDirPath,
13
- getSdkAgentArchivedSessionDirPath,
14
- getSdkAgentArchivedSessionMessagesDirPath,
15
- getSdkAgentArchivedSessionMessagesPath,
16
- getSdkAgentArchivedSessionMetaPath,
17
- getSdkAgentArchivedSessionsDirPath,
18
- getSdkAgentSessionArchiveDirPath,
19
- getSdkAgentSessionArchiveFilePath,
20
- getSdkAgentSessionDirPath,
21
- getSdkAgentSessionInflightPath,
22
- getSdkAgentSessionMessagesDirPath,
23
- getSdkAgentSessionMessagesPath,
24
- getSdkAgentSessionMetaPath,
25
- getSdkAgentSessionsRootDirPath,
26
- getSdkAgentsRootDirPath,
27
- getSdkDowncityDirPath,
28
- } from "./storage/Paths.js";
29
- export {
30
- inferModelLabel,
31
- normalizeSessionTitle,
32
- patchSessionModelLabel,
33
- readSessionMetadata,
34
- readSessionMetadataFromPath,
35
- resolveSystemTimezone,
36
- writeSessionMetadata,
37
- } from "./storage/Metadata.js";
38
- export {
39
- ensureSessionTitle,
40
- } from "./SessionTitle.js";
41
- export {
42
- persistSdkAssistantResult,
43
- touchSessionMetadata,
44
- } from "./storage/Persistence.js";
45
- export {
46
- createRuntimeSessionPort,
47
- } from "./storage/RuntimeSessionPort.js";
48
- export {
49
- buildSessionRecordsPage,
50
- buildSessionInfo,
51
- listArchivedAgentSessionSummaryPage,
52
- listAgentSessionSummaryPage,
53
- loadSessionArchiveMessagesFromPath,
54
- loadSessionMessagesFromPath,
55
- resolveSessionMessagePreview,
56
- toSessionTimelineEvents,
57
- } from "./browse/Browse.js";
@@ -1,58 +0,0 @@
1
- /**
2
- * Agent 对外类型 facade。
3
- *
4
- * 关键点(中文)
5
- * - 保留旧的 `@/types/agent/AgentTypes.js` 导入路径。
6
- * - 真实类型按职责拆到 AgentOptions / RemoteAgentOptions / SessionTypes / SessionActor。
7
- * - 这里不承载具体字段定义,避免单文件继续膨胀。
8
- */
9
-
10
- export type { AgentModel } from "@/model/CityModelAdapter.js";
11
- export type {
12
- SessionComposerFactoryContext,
13
- SessionComposerInput,
14
- SessionComposerOptions,
15
- } from "@/types/session/SessionComposerOptions.js";
16
- export type {
17
- AgentManagedSession,
18
- SessionOptions,
19
- } from "@/types/session/SessionOptions.js";
20
- export type {
21
- AgentOptions,
22
- AgentSessionConstructor,
23
- } from "@/types/agent/AgentOptions.js";
24
- export type { RemoteAgentOptions } from "@/types/agent/RemoteAgentOptions.js";
25
- export type {
26
- RemoteAgentPluginActionInput,
27
- RemoteAgentPluginActionResult,
28
- } from "@/types/agent/RemoteAgentPluginAction.js";
29
- export type {
30
- AgentArchiveSessionInput,
31
- AgentArchiveSessionsInput,
32
- AgentArchiveSessionResult,
33
- AgentArchiveSessionsResult,
34
- AgentCleanArchiveResult,
35
- AgentCreateSessionInput,
36
- AgentListSessionsInput,
37
- AgentSessionConfigSnapshot,
38
- AgentSessionForkInput,
39
- AgentSessionRecordsInput,
40
- AgentSessionRecordsPage,
41
- AgentSessionRecordsView,
42
- AgentSessionInfo,
43
- AgentSessionSetInput,
44
- AgentSessionSummary,
45
- AgentSessionSummaryPage,
46
- AgentSessionSystemBlock,
47
- AgentSessionSystemBlockSource,
48
- AgentSessionSystemSessionInfo,
49
- AgentSessionSystemSnapshot,
50
- AgentSessionTimelineEvent,
51
- } from "@/types/agent/SessionTypes.js";
52
- export type { AgentSessionStopResult } from "@/types/sdk/AgentSessionStop.js";
53
- export type {
54
- AgentSession,
55
- AgentSessionActor,
56
- AgentSessions,
57
- RemoteAgentSession,
58
- } from "@/types/agent/SessionActor.js";
@@ -1,15 +0,0 @@
1
- /**
2
- * LLM 请求/响应日志格式化公共入口。
3
- *
4
- * 关键点(中文)
5
- * - 外部模块只从这里导入,内部拆分对调用方透明。
6
- * - `ProviderFetch` 仍然保留在 facade,避免影响 `Fetch.ts` 的类型入口。
7
- */
8
-
9
- export { parseFetchRequestForLog } from "./FormatRequest.js";
10
- export { parseFetchResponseForLog } from "./FormatResponse.js";
11
-
12
- export type ProviderFetch = (
13
- input: string | URL | Request,
14
- init?: RequestInit,
15
- ) => Promise<Response>;