downcity 1.1.471 → 1.1.481
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +183 -0
- package/README.md +1 -1
- package/bin/city/agent/AgentChatRemote.d.ts.map +1 -1
- package/bin/city/agent/AgentChatRemote.js +24 -4
- package/bin/city/agent/AgentChatRemote.js.map +1 -1
- package/bin/city/agent/AgentConfiguration.d.ts.map +1 -1
- package/bin/city/agent/AgentConfiguration.js +0 -8
- package/bin/city/agent/AgentConfiguration.js.map +1 -1
- package/bin/city/agent/AgentManager.js +2 -2
- package/bin/city/agent/AgentManager.js.map +1 -1
- package/bin/city/agent/CityLifecycle.js +1 -1
- package/bin/city/agent/CityLifecycle.js.map +1 -1
- package/bin/city/agent/CliAgentContext.d.ts +9 -5
- package/bin/city/agent/CliAgentContext.d.ts.map +1 -1
- package/bin/city/agent/CliCityRuntime.d.ts +1 -1
- package/bin/city/agent/CliCityRuntime.d.ts.map +1 -1
- package/bin/city/agent/CliCityRuntime.js +45 -16
- package/bin/city/agent/CliCityRuntime.js.map +1 -1
- package/bin/city/agent/Init.d.ts +1 -1
- package/bin/city/agent/Init.d.ts.map +1 -1
- package/bin/city/agent/Init.js +3 -1
- package/bin/city/agent/Init.js.map +1 -1
- package/bin/city/agent/control/ExecuteBySession.js +1 -1
- package/bin/city/agent/control/ExecuteBySession.js.map +1 -1
- package/bin/city/agent/http/execute/execute.js +1 -1
- package/bin/city/agent/http/execute/execute.js.map +1 -1
- package/bin/city/agent/tui/dialogs/ApprovalDialog.d.ts +1 -1
- package/bin/city/agent/tui/dialogs/ApprovalDialog.js +2 -2
- package/bin/city/agent/tui/dialogs/ApprovalDialog.js.map +1 -1
- package/bin/city/agent/tui/dialogs/SecurityPolicyDialog.js +2 -2
- package/bin/city/agent/tui/dialogs/SecurityPolicyDialog.js.map +1 -1
- package/bin/city/command/CityResetCommand.js +1 -1
- package/bin/city/command/CityResetCommand.js.map +1 -1
- package/bin/city/command/PluginCommand.d.ts +1 -2
- package/bin/city/command/PluginCommand.d.ts.map +1 -1
- package/bin/city/command/PluginCommand.js +21 -100
- package/bin/city/command/PluginCommand.js.map +1 -1
- package/bin/city/process/plugin/InteractivePluginManager.d.ts +1 -3
- package/bin/city/process/plugin/InteractivePluginManager.d.ts.map +1 -1
- package/bin/city/process/plugin/InteractivePluginManager.js +11 -131
- package/bin/city/process/plugin/InteractivePluginManager.js.map +1 -1
- package/bin/city/process/plugin/PluginCatalog.d.ts.map +1 -1
- package/bin/city/process/plugin/PluginCatalog.js +12 -14
- package/bin/city/process/plugin/PluginCatalog.js.map +1 -1
- package/bin/city/process/plugin/PluginInstaller.d.ts.map +1 -1
- package/bin/city/process/plugin/PluginInstaller.js +32 -11
- package/bin/city/process/plugin/PluginInstaller.js.map +1 -1
- package/bin/city/process/registry/AgentConfigRepository.d.ts.map +1 -1
- package/bin/city/process/registry/AgentConfigRepository.js +9 -3
- package/bin/city/process/registry/AgentConfigRepository.js.map +1 -1
- package/bin/city/process/registry/CityPaths.d.ts +1 -1
- package/bin/city/process/registry/CityPaths.js +1 -1
- package/bin/city/process/registry/PluginRepository.d.ts +8 -22
- package/bin/city/process/registry/PluginRepository.d.ts.map +1 -1
- package/bin/city/process/registry/PluginRepository.js +12 -90
- package/bin/city/process/registry/PluginRepository.js.map +1 -1
- package/bin/city/process/registry/WorkspaceRepository.d.ts +1 -1
- package/bin/city/process/registry/WorkspaceRepository.d.ts.map +1 -1
- package/bin/city/runtime/AgentAssembly.d.ts +8 -9
- package/bin/city/runtime/AgentAssembly.d.ts.map +1 -1
- package/bin/city/runtime/AgentAssembly.js +20 -24
- package/bin/city/runtime/AgentAssembly.js.map +1 -1
- package/bin/city/runtime/CityReset.js +1 -1
- package/bin/city/runtime/CityReset.js.map +1 -1
- package/bin/city/runtime/LocalCliSchema.d.ts +2 -2
- package/bin/city/runtime/LocalCliSchema.d.ts.map +1 -1
- package/bin/city/runtime/LocalCliSchema.js +1 -1
- package/bin/city/runtime/LocalData.d.ts +2 -2
- package/bin/city/runtime/LocalData.d.ts.map +1 -1
- package/bin/city/runtime/LocalData.js +2 -2
- package/bin/city/runtime/LocalData.js.map +1 -1
- package/bin/city/runtime/auth/AgentTokenRepository.d.ts +1 -1
- package/bin/city/runtime/auth/AgentTokenRepository.d.ts.map +1 -1
- package/bin/city/runtime/city-model/CityAiServiceBinding.d.ts +3 -4
- package/bin/city/runtime/city-model/CityAiServiceBinding.d.ts.map +1 -1
- package/bin/city/runtime/city-model/CityAiServiceBinding.js +1 -1
- package/bin/city/runtime/city-model/CityAiServiceBinding.js.map +1 -1
- package/bin/city/sandbox/PlatformSandbox.d.ts +6 -11
- package/bin/city/sandbox/PlatformSandbox.d.ts.map +1 -1
- package/bin/city/sandbox/PlatformSandbox.js +7 -30
- package/bin/city/sandbox/PlatformSandbox.js.map +1 -1
- package/bin/city/shared/PluginTargetSupport.js +2 -2
- package/bin/city/shared/PluginTargetSupport.js.map +1 -1
- package/bin/city/types/agent/AgentConfig.d.ts +12 -0
- package/bin/city/types/agent/AgentConfig.d.ts.map +1 -1
- package/bin/city/types/plugin/PluginCatalog.d.ts +8 -8
- package/bin/city/types/plugin/PluginCatalog.d.ts.map +1 -1
- package/bin/city/types/plugin/PluginDefinition.d.ts +5 -7
- package/bin/city/types/plugin/PluginDefinition.d.ts.map +1 -1
- package/bin/federation/core/update.js +1 -1
- package/bin/federation/core/update.js.map +1 -1
- package/bin/federation/tui/FederationDashboard.js +2 -2
- package/bin/federation/tui/FederationDashboard.js.map +1 -1
- package/package.json +20 -29
- package/bin/city/types/plugin/AgentPluginReference.d.ts +0 -20
- package/bin/city/types/plugin/AgentPluginReference.d.ts.map +0 -1
- package/bin/city/types/plugin/AgentPluginReference.js +0 -3
- package/bin/city/types/plugin/AgentPluginReference.js.map +0 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
https://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction, and
|
|
10
|
+
distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by the copyright
|
|
13
|
+
owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all other entities
|
|
16
|
+
that control, are controlled by, or are under common control with that entity.
|
|
17
|
+
For the purposes of this definition, "control" means (i) the power, direct or
|
|
18
|
+
indirect, to cause the direction or management of such entity, whether by
|
|
19
|
+
contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
20
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
21
|
+
|
|
22
|
+
"You" (or "Your") shall mean an individual or Legal Entity exercising
|
|
23
|
+
permissions granted by this License.
|
|
24
|
+
|
|
25
|
+
"Source" form shall mean the preferred form for making modifications, including
|
|
26
|
+
but not limited to software source code, documentation source, and configuration
|
|
27
|
+
files.
|
|
28
|
+
|
|
29
|
+
"Object" form shall mean any form resulting from mechanical transformation or
|
|
30
|
+
translation of a Source form, including but not limited to compiled object code,
|
|
31
|
+
generated documentation, and conversions to other media types.
|
|
32
|
+
|
|
33
|
+
"Work" shall mean the work of authorship, whether in Source or Object form,
|
|
34
|
+
made available under the License, as indicated by a copyright notice that is
|
|
35
|
+
included in or attached to the work (an example is provided in the Appendix
|
|
36
|
+
below).
|
|
37
|
+
|
|
38
|
+
"Derivative Works" shall mean any work, whether in Source or Object form, that
|
|
39
|
+
is based on (or derived from) the Work and for which the editorial revisions,
|
|
40
|
+
annotations, elaborations, or other modifications represent, as a whole, an
|
|
41
|
+
original work of authorship. For the purposes of this License, Derivative Works
|
|
42
|
+
shall not include works that remain separable from, or merely link (or bind by
|
|
43
|
+
name) to the interfaces of, the Work and Derivative Works thereof.
|
|
44
|
+
|
|
45
|
+
"Contribution" shall mean any work of authorship, including the original version
|
|
46
|
+
of the Work and any modifications or additions to that Work or Derivative Works
|
|
47
|
+
thereof, that is intentionally submitted to Licensor for inclusion in the Work
|
|
48
|
+
by the copyright owner or by an individual or Legal Entity authorized to submit
|
|
49
|
+
on behalf of the copyright owner. For the purposes of this definition,
|
|
50
|
+
"submitted" means any form of electronic, verbal, or written communication sent
|
|
51
|
+
to the Licensor or its representatives, including but not limited to
|
|
52
|
+
communication on electronic mailing lists, source code control systems, and
|
|
53
|
+
issue tracking systems that are managed by, or on behalf of, the Licensor for
|
|
54
|
+
the purpose of discussing and improving the Work, but excluding communication
|
|
55
|
+
that is conspicuously marked or otherwise designated in writing by the copyright
|
|
56
|
+
owner as "Not a Contribution."
|
|
57
|
+
|
|
58
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf
|
|
59
|
+
of whom a Contribution has been received by Licensor and subsequently
|
|
60
|
+
incorporated within the Work.
|
|
61
|
+
|
|
62
|
+
2. Grant of Copyright License. Subject to the terms and conditions of this
|
|
63
|
+
License, each Contributor hereby grants to You a perpetual, worldwide,
|
|
64
|
+
non-exclusive, no-charge, royalty-free, irrevocable copyright license to
|
|
65
|
+
reproduce, prepare Derivative Works of, publicly display, publicly perform,
|
|
66
|
+
sublicense, and distribute the Work and such Derivative Works in Source or
|
|
67
|
+
Object form.
|
|
68
|
+
|
|
69
|
+
3. Grant of Patent License. Subject to the terms and conditions of this License,
|
|
70
|
+
each Contributor hereby grants to You a perpetual, worldwide, non-exclusive,
|
|
71
|
+
no-charge, royalty-free, irrevocable (except as stated in this section) patent
|
|
72
|
+
license to make, have made, use, offer to sell, sell, import, and otherwise
|
|
73
|
+
transfer the Work, where such license applies only to those patent claims
|
|
74
|
+
licensable by such Contributor that are necessarily infringed by their
|
|
75
|
+
Contribution(s) alone or by combination of their Contribution(s) with the Work
|
|
76
|
+
to which such Contribution(s) was submitted. If You institute patent litigation
|
|
77
|
+
against any entity (including a cross-claim or counterclaim in a lawsuit)
|
|
78
|
+
alleging that the Work or a Contribution incorporated within the Work
|
|
79
|
+
constitutes direct or contributory patent infringement, then any patent licenses
|
|
80
|
+
granted to You under this License for that Work shall terminate as of the date
|
|
81
|
+
such litigation is filed.
|
|
82
|
+
|
|
83
|
+
4. Redistribution. You may reproduce and distribute copies of the Work or
|
|
84
|
+
Derivative Works thereof in any medium, with or without modifications, and in
|
|
85
|
+
Source or Object form, provided that You meet the following conditions:
|
|
86
|
+
|
|
87
|
+
(a) You must give any other recipients of the Work or Derivative Works a copy of
|
|
88
|
+
this License; and
|
|
89
|
+
|
|
90
|
+
(b) You must cause any modified files to carry prominent notices stating that
|
|
91
|
+
You changed the files; and
|
|
92
|
+
|
|
93
|
+
(c) You must retain, in the Source form of any Derivative Works that You
|
|
94
|
+
distribute, all copyright, patent, trademark, and attribution notices from the
|
|
95
|
+
Source form of the Work, excluding those notices that do not pertain to any part
|
|
96
|
+
of the Derivative Works; and
|
|
97
|
+
|
|
98
|
+
(d) If the Work includes a "NOTICE" text file as part of its distribution, then
|
|
99
|
+
any Derivative Works that You distribute must include a readable copy of the
|
|
100
|
+
attribution notices contained within such NOTICE file, excluding those notices
|
|
101
|
+
that do not pertain to any part of the Derivative Works, in at least one of the
|
|
102
|
+
following places: within a NOTICE text file distributed as part of the
|
|
103
|
+
Derivative Works; within the Source form or documentation, if provided along
|
|
104
|
+
with the Derivative Works; or, within a display generated by the Derivative
|
|
105
|
+
Works, if and wherever such third-party notices normally appear. The contents of
|
|
106
|
+
the NOTICE file are for informational purposes only and do not modify the
|
|
107
|
+
License. You may add Your own attribution notices within Derivative Works that
|
|
108
|
+
You distribute, alongside or as an addendum to the NOTICE text from the Work,
|
|
109
|
+
provided that such additional attribution notices cannot be construed as
|
|
110
|
+
modifying the License.
|
|
111
|
+
|
|
112
|
+
You may add Your own copyright statement to Your modifications and may provide
|
|
113
|
+
additional or different license terms and conditions for use, reproduction, or
|
|
114
|
+
distribution of Your modifications, or for any such Derivative Works as a whole,
|
|
115
|
+
provided Your use, reproduction, and distribution of the Work otherwise complies
|
|
116
|
+
with the conditions stated in this License.
|
|
117
|
+
|
|
118
|
+
5. Submission of Contributions. Unless You explicitly state otherwise, any
|
|
119
|
+
Contribution intentionally submitted for inclusion in the Work by You to the
|
|
120
|
+
Licensor shall be under the terms and conditions of this License, without any
|
|
121
|
+
additional terms or conditions. Notwithstanding the above, nothing herein shall
|
|
122
|
+
supersede or modify the terms of any separate license agreement you may have
|
|
123
|
+
executed with Licensor regarding such Contributions.
|
|
124
|
+
|
|
125
|
+
6. Trademarks. This License does not grant permission to use the trade names,
|
|
126
|
+
trademarks, service marks, or product names of the Licensor, except as required
|
|
127
|
+
for reasonable and customary use in describing the origin of the Work and
|
|
128
|
+
reproducing the content of the NOTICE file.
|
|
129
|
+
|
|
130
|
+
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in
|
|
131
|
+
writing, Licensor provides the Work (and each Contributor provides its
|
|
132
|
+
Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
133
|
+
KIND, either express or implied, including, without limitation, any warranties or
|
|
134
|
+
conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
135
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
136
|
+
appropriateness of using or redistributing the Work and assume any risks
|
|
137
|
+
associated with Your exercise of permissions under this License.
|
|
138
|
+
|
|
139
|
+
8. Limitation of Liability. In no event and under no legal theory, whether in
|
|
140
|
+
tort (including negligence), contract, or otherwise, unless required by
|
|
141
|
+
applicable law (such as deliberate and grossly negligent acts) or agreed to in
|
|
142
|
+
writing, shall any Contributor be liable to You for damages, including any
|
|
143
|
+
direct, indirect, special, incidental, or consequential damages of any character
|
|
144
|
+
arising as a result of this License or out of the use or inability to use the
|
|
145
|
+
Work (including but not limited to damages for loss of goodwill, work stoppage,
|
|
146
|
+
computer failure or malfunction, or any and all other commercial damages or
|
|
147
|
+
losses), even if such Contributor has been advised of the possibility of such
|
|
148
|
+
damages.
|
|
149
|
+
|
|
150
|
+
9. Accepting Warranty or Additional Liability. While redistributing the Work or
|
|
151
|
+
Derivative Works thereof, You may choose to offer, and charge a fee for,
|
|
152
|
+
acceptance of support, warranty, indemnity, or other liability obligations
|
|
153
|
+
and/or rights consistent with this License. However, in accepting such
|
|
154
|
+
obligations, You may act only on Your own behalf and on Your sole
|
|
155
|
+
responsibility, not on behalf of any other Contributor, and only if You agree to
|
|
156
|
+
indemnify, defend, and hold each Contributor harmless for any liability incurred
|
|
157
|
+
by, or claims asserted against, such Contributor by reason of your accepting any
|
|
158
|
+
such warranty or additional liability.
|
|
159
|
+
|
|
160
|
+
END OF TERMS AND CONDITIONS
|
|
161
|
+
|
|
162
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
163
|
+
|
|
164
|
+
To apply the Apache License to your work, attach the following boilerplate
|
|
165
|
+
notice, with the fields enclosed by brackets "[]" replaced with your own
|
|
166
|
+
identifying information. (Do not include the brackets!) The text should be
|
|
167
|
+
enclosed in the appropriate comment syntax for the file format. We also
|
|
168
|
+
recommend that a file or class name and description of purpose be included on
|
|
169
|
+
the same "printed page" as the copyright notice for easier identification within
|
|
170
|
+
third-party archives.
|
|
171
|
+
|
|
172
|
+
Copyright [yyyy] [name of copyright owner]
|
|
173
|
+
|
|
174
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
175
|
+
you may not use this file except in compliance with the License.
|
|
176
|
+
You may obtain a copy of the License at
|
|
177
|
+
|
|
178
|
+
https://www.apache.org/licenses/LICENSE-2.0
|
|
179
|
+
|
|
180
|
+
Unless required by applicable law or agreed to in writing, software distributed
|
|
181
|
+
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
182
|
+
CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
|
183
|
+
specific language governing permissions and limitations under the License.
|
package/README.md
CHANGED
|
@@ -38,7 +38,7 @@ CLI 从本地产品配置装配的 Agent 默认启用 `ask_question` Tool。使
|
|
|
38
38
|
`city agent chat <agent_id>` 交互时,模型可以在缺少关键信息时显示文本、单选或多选问题;
|
|
39
39
|
回答会通过 Session Interaction 提交,并在同一轮模型执行中继续处理。
|
|
40
40
|
|
|
41
|
-
Agent 定义保存在 `~/.downcity/agents/<agent_id>/agent.json`,主体指令保存在同目录的 `SOUL.md`。Plugin 以稳定 ID 使用 `~/.downcity/plugins/<plugin_id
|
|
41
|
+
Agent 定义保存在 `~/.downcity/agents/<agent_id>/agent.json`,主体指令保存在同目录的 `SOUL.md`。Plugin 以稳定 ID 使用 `~/.downcity/plugins/<plugin_id>/`,每个 Plugin 的唯一明文配置位于自己的 `config.toml`。第三方 Plugin 的安装目录只保留唯一 `plugin.json`、建立 ESM 边界的 `package.json` 与自包含入口,不保留源码和构建配置。Plugin 运行时状态和缓存由宿主放入 `~/.downcity/agents/<agent_id>/plugins/<plugin_id>/`,不写入 Plugin 配置目录,也不按 Workspace 复制。`downcity.db` 只保存 Workspace 索引、Token 与平台状态。Agent 与 Workspace 不绑定,同一个 Agent 可以进入多个 Workspace;Agent 不保存 Plugin 引用,City 自动把全部已注册 Plugin 和同一份配置提供给所有 Agent。CLI daemon 和 Desktop 各自创建独立的 City 实例,加入 City 后,Agent 的 Session 状态统一保存在 `~/.downcity/agents/<agent_id>/sessions/<session_id>/`;未加入 City 时只保存在当前 Agent 实例内存中。Workspace 只在 Session 的 `meta.json` 中作为可选 `workspace_id` 记录,项目目录不创建 `.downcity`。
|
|
42
42
|
|
|
43
43
|
CLI City 只维护一个 daemon,并分别监听一个 HTTP 端口和一个原生 TCP RPC 端口。两种协议都按 `agent_id` 路由,不为每个 Agent 分配独立端口。
|
|
44
44
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentChatRemote.d.ts","sourceRoot":"","sources":["../../../src/city/agent/AgentChatRemote.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;A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AsB,CAAC,MAAM,EAAE;IACnD,YAAY,EAAE,eAAe,CAAC;CAC/B,GAAG,OAAO,CAAC,2BAA2B,EAAE,CAAC,CAGzC;AAED;;GAEG;AACH,wBAAsB,uBAAuB,CAAC,MAAM,EAAE;IACpD,YAAY,EAAE,eAAe,CAAC;IAC9B,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,GAAG,OAAO,CAAC;IAAE,UAAU,EAAE,MAAM,CAAA;CAAE,CAAC,CAMlC;AAED;;GAEG;AACH,wBAAsB,wBAAwB,CAAC,MAAM,EAAE;IACrD,YAAY,EAAE,eAAe,CAAC;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAW9B;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,mBAAmB,GAC3B,2BAA2B,CAS7B;AAED;;GAEG;AACH,wBAAgB,6BAA6B,CAAC,OAAO,EAAE,2BAA2B,GAAG,MAAM,CAO1F;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAKhE"}
|
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
* - City daemon 在线时通过 RPC 访问宿主;离线时保留本地装配路径供一次性 CLI 调用。
|
|
7
7
|
* - 不处理命令行交互,只负责选择远程或本地访问路径。
|
|
8
8
|
*/
|
|
9
|
-
import { generate_id,
|
|
9
|
+
import { generate_id, } from "@downcity/agent";
|
|
10
|
+
import { City, LocalStorageProvider, RemoteAgent } from "@downcity/city";
|
|
10
11
|
import { resolveDaemonRpcEndpoint } from "../process/daemon/Client.js";
|
|
11
12
|
import { is_process_alive, read_daemon_meta, read_daemon_pid, } from "../process/daemon/Manager.js";
|
|
12
13
|
import { AGENT_CHAT_NEW_SESSION_ID_PREFIX, } from "./AgentChatTypes.js";
|
|
@@ -58,13 +59,30 @@ export async function createRemoteAgent(params) {
|
|
|
58
59
|
throw new Error(`Workspace not found: ${target_config.workspace_id}`);
|
|
59
60
|
agent = await create_cli_agent({
|
|
60
61
|
config,
|
|
61
|
-
plugin_loader,
|
|
62
62
|
});
|
|
63
63
|
const workspace = await create_cli_workspace(workspace_config, data.root_path);
|
|
64
|
+
const city = new City({
|
|
65
|
+
storage: new LocalStorageProvider(data.root_path),
|
|
66
|
+
workspaces: [workspace],
|
|
67
|
+
plugins: await plugin_loader.list_registrations(),
|
|
68
|
+
plugin_host: {
|
|
69
|
+
config: (plugin_id) => ({
|
|
70
|
+
get: () => structuredClone(data.plugins.get_config(plugin_id)),
|
|
71
|
+
set: async (config) => {
|
|
72
|
+
data.plugins.set_config(plugin_id, structuredClone(config));
|
|
73
|
+
},
|
|
74
|
+
}),
|
|
75
|
+
notifications: () => ({
|
|
76
|
+
publish: async () => { },
|
|
77
|
+
dismiss: async () => { },
|
|
78
|
+
}),
|
|
79
|
+
},
|
|
80
|
+
});
|
|
81
|
+
city.agents.add(agent);
|
|
64
82
|
return {
|
|
65
83
|
sessions: create_local_chat_sessions(agent.sessions, workspace, async (model_id) => await resolve_cli_agent_model(model_id, workspace.get_env())),
|
|
66
84
|
close: async () => {
|
|
67
|
-
await
|
|
85
|
+
await city.close();
|
|
68
86
|
data.database.close();
|
|
69
87
|
},
|
|
70
88
|
};
|
|
@@ -87,6 +105,8 @@ export async function createRemoteAgent(params) {
|
|
|
87
105
|
function create_local_chat_sessions(sessions, workspace, resolve_model) {
|
|
88
106
|
const wrap = (session) => ({
|
|
89
107
|
id: session.id,
|
|
108
|
+
workspace_id: session.workspace_id,
|
|
109
|
+
origin: session.origin,
|
|
90
110
|
get_info: async () => await session.get_info(),
|
|
91
111
|
prompt: async (input) => await session.prompt(input),
|
|
92
112
|
stop: async () => await session.stop(),
|
|
@@ -107,7 +127,7 @@ function create_local_chat_sessions(sessions, workspace, resolve_model) {
|
|
|
107
127
|
});
|
|
108
128
|
return {
|
|
109
129
|
create: async () => wrap(await sessions.create({ workspace })),
|
|
110
|
-
get: async (session_id) => wrap(await sessions.get(session_id, { workspace })),
|
|
130
|
+
get: async (session_id, origin_type) => wrap(await sessions.get(session_id, origin_type, { workspace })),
|
|
111
131
|
list: async (input) => await sessions.list(input),
|
|
112
132
|
archive: async (input) => await sessions.archive(input),
|
|
113
133
|
archived: async (input) => await sessions.archived(input),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentChatRemote.js","sourceRoot":"","sources":["../../../src/city/agent/AgentChatRemote.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAEL,WAAW,
|
|
1
|
+
{"version":3,"file":"AgentChatRemote.js","sourceRoot":"","sources":["../../../src/city/agent/AgentChatRemote.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAEL,WAAW,GAQZ,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,IAAI,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAGzE,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAC3E,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,GAChB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACL,gCAAgC,GAGjC,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,wBAAwB,EAAE,MAAM,oDAAoD,CAAC;AAE9F,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,wBAAwB,EACxB,uBAAuB,GACxB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAkB1E;;GAEG;AACH,MAAM,UAAU,wBAAwB;IACtC,OAAO;QACL,gCAAgC;QAChC,IAAI,CAAC,GAAG,EAAE;QACV,WAAW,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;KAC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AAC,aAAa;QACpC,GAAG,CAAC,OAAO,OAAO,CAAC,UAAU,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACrF,GAAG,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAClD,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,6BAA6B,CAAC,OAAoC;IAChF,MAAM,KAAK,GAAG;QACZ,GAAG,OAAO,CAAC,aAAa,WAAW;QACnC,OAAO,CAAC,YAAY,IAAI,EAAE;QAC1B,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE;KACnC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAClB,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAC3B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,yBAAyB,CAAC,KAAc;IACtD,OAAO,CACL,MAAM,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE;QAC1B,6DAA6D,CAC9D,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentConfiguration.d.ts","sourceRoot":"","sources":["../../../src/city/agent/AgentConfiguration.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;
|
|
1
|
+
{"version":3,"file":"AgentConfiguration.d.ts","sourceRoot":"","sources":["../../../src/city/agent/AgentConfiguration.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAQH,mCAAmC;AACnC,wBAAsB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAmC7E"}
|
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
import { formatAgentConfigPanelDescription, loadAgentSummaries } from "./AgentManagerHelpers.js";
|
|
9
9
|
import { configure_agent_model } from "./AgentModel.js";
|
|
10
10
|
import { run_interactive_env_manager } from "../env/InteractiveEnvManager.js";
|
|
11
|
-
import { run_interactive_agent_plugin_manager } from "../process/plugin/InteractivePluginManager.js";
|
|
12
11
|
import { t } from "../../shared/CliLocale.js";
|
|
13
12
|
import { ManagedTuiRuntime } from "../../shared/tui/ManagedTuiRuntime.js";
|
|
14
13
|
/** 打开指定 Agent 的配置页,直到用户返回 Chat。 */
|
|
@@ -30,11 +29,6 @@ export async function run_agent_configuration(agent_id) {
|
|
|
30
29
|
value: "configure_model",
|
|
31
30
|
hint: t({ zh: "选择 Agent 的默认对话模型", en: "Choose the Agent default chat model" }),
|
|
32
31
|
},
|
|
33
|
-
{
|
|
34
|
-
label: "Plugins",
|
|
35
|
-
value: "configure_plugins",
|
|
36
|
-
hint: t({ zh: "启用、禁用和配置 Agent Plugin", en: "Enable, disable, and configure Agent Plugins" }),
|
|
37
|
-
},
|
|
38
32
|
{
|
|
39
33
|
label: "Workspace Env",
|
|
40
34
|
value: "configure_env",
|
|
@@ -52,8 +46,6 @@ export async function run_agent_configuration(agent_id) {
|
|
|
52
46
|
return;
|
|
53
47
|
if (action === "configure_model")
|
|
54
48
|
await configure_agent_model(agent_id);
|
|
55
|
-
if (action === "configure_plugins")
|
|
56
|
-
await run_interactive_agent_plugin_manager(agent_id);
|
|
57
49
|
if (action === "configure_env")
|
|
58
50
|
await run_interactive_env_manager(agent_id);
|
|
59
51
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentConfiguration.js","sourceRoot":"","sources":["../../../src/city/agent/AgentConfiguration.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,iCAAiC,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAC5G,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,2BAA2B,EAAE,MAAM,qCAAqC,CAAC;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AC,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,eAAe,EAAE,CAAC;wBAC7C,KAAK,EAAE,iBAAiB;wBACxB,IAAI,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,kBAAkB,EAAE,EAAE,EAAE,qCAAqC,EAAE,CAAC;qBAC/E;oBACD;wBACE,KAAK,EAAE,eAAe;wBACtB,KAAK,EAAE,eAAe;wBACtB,IAAI,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,sBAAsB,EAAE,EAAE,EAAE,+CAA+C,EAAE,CAAC;qBAC7F;oBACD,EAAE,KAAK,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,cAAc,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE;iBAChE;gBACD,WAAW,EAAE,IAAI;aAClB,CAAC,CAAC;QACL,CAAC;gBAAS,CAAC;YACT,OAAO,CAAC,KAAK,EAAE,CAAC;QAClB,CAAC;QAED,IAAI,CAAC,MAAM,IAAI,MAAM,KAAK,MAAM;YAAE,OAAO;QACzC,IAAI,MAAM,KAAK,iBAAiB;YAAE,MAAM,qBAAqB,CAAC,QAAQ,CAAC,CAAC;QACxE,IAAI,MAAM,KAAK,eAAe;YAAE,MAAM,2BAA2B,CAAC,QAAQ,CAAC,CAAC;IAC9E,CAAC;AACH,CAAC"}
|
|
@@ -101,8 +101,8 @@ async function build_agent_options(include_settings) {
|
|
|
101
101
|
label: "Plugins",
|
|
102
102
|
value: "plugins",
|
|
103
103
|
hint: t({
|
|
104
|
-
zh: "安装、更新和管理全局 Plugin
|
|
105
|
-
en: "Install, update, and manage global Plugins and configuration
|
|
104
|
+
zh: "安装、更新和管理全局 Plugin 与唯一配置",
|
|
105
|
+
en: "Install, update, and manage global Plugins and unique configuration",
|
|
106
106
|
}),
|
|
107
107
|
},
|
|
108
108
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentManager.js","sourceRoot":"","sources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AAE,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE;KACtD,CAAC;AACJ,CAAC;AAED,SAAS,cAAc,CAAC,KAAa;IACnC,OAAO,KAAK,KAAK,YAAY;WACxB,KAAK,KAAK,SAAS;WACnB,KAAK,KAAK,UAAU;WACpB,KAAK,KAAK,MAAM,CAAC;AACxB,CAAC;AAED,KAAK,UAAU,WAAW,CAAC,KAK1B;IACC,MAAM,OAAO,GAAG,IAAI,iBAAiB,CAAC,EAAE,KAAK,EAAE,cAAc,KAAK,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IAC9E,IAAI,CAAC;QACH,OAAO,MAAM,OAAO,CAAC,MAAM,CAAC;YAC1B,KAAK,EAAE,KAAK,CAAC,KAAK;YAClB,QAAQ,EAAE,KAAK,CAAC,QAAQ;YACxB,MAAM,EAAE,KAAK,CAAC,MAAM;YACpB,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,WAAW,EAAE,IAAI;SAClB,CAAC,CAAC;IACL,CAAC;YAAS,CAAC;QACT,OAAO,CAAC,KAAK,EAAE,CAAC;IAClB,CAAC;AACH,CAAC;AAED,KAAK,UAAU,YAAY,CAAC,IAAkC,EAAE,OAAe;IAC7E,MAAM,OAAO,GAAG,IAAI,iBAAiB,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,CAAC;IAC7D,IAAI,CAAC;QACH,MAAM,OAAO,CAAC,YAAY,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC5C,CAAC;YAAS,CAAC;QACT,OAAO,CAAC,KAAK,EAAE,CAAC;IAClB,CAAC;AACH,CAAC"}
|
|
@@ -12,7 +12,7 @@ import { list_agent_configs } from "../process/registry/AgentConfigRepository.js
|
|
|
12
12
|
import { emitCliBlock } from "../../shared/CliReporter.js";
|
|
13
13
|
import { CliError } from "../../shared/CliError.js";
|
|
14
14
|
import { run_city_foreground } from "./Run.js";
|
|
15
|
-
import { read_city_host_state, request_city_host_shutdown } from "@downcity/
|
|
15
|
+
import { read_city_host_state, request_city_host_shutdown } from "@downcity/city";
|
|
16
16
|
import prompts from "../tui/Prompts.js";
|
|
17
17
|
/** 启动 City;foreground=true 时由当前进程直接持有。 */
|
|
18
18
|
export async function city_on(options) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CityLifecycle.js","sourceRoot":"","sources":["../../../src/city/agent/CityLifecycle.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,EACL,0BAA0B,EAC1B,6BAA6B,EAC7B,mBAAmB,EACnB,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,kCAAkC,CAAC;AAE1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,kDAAkD,CAAC;AACtF,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,0BAA0B,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"CityLifecycle.js","sourceRoot":"","sources":["../../../src/city/agent/CityLifecycle.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,EACL,0BAA0B,EAC1B,6BAA6B,EAC7B,mBAAmB,EACnB,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,oBAAoB,EACpB,mBAAm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B;iBACpF,CAAC;YACF,GAAG,CAAC,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,+CAA+C,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACpF,CAAC,CAAC;QACH,OAAO;IACT,CAAC;IACD,YAAY,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC,CAAC;AAC3E,CAAC"}
|
|
@@ -4,14 +4,17 @@
|
|
|
4
4
|
* 该类型只描述 CLI 路由实际需要的字段,不把 Agent 内部装配对象
|
|
5
5
|
* 暴露为 CLI 的统一领域模型。
|
|
6
6
|
*/
|
|
7
|
-
import type { Agent,
|
|
8
|
-
import type {
|
|
7
|
+
import type { Agent, AgentSessionCollection, SessionSystemMessage } from "@downcity/agent";
|
|
8
|
+
import type { City } from "@downcity/city";
|
|
9
|
+
import type { WorkspaceRuntime } from "@downcity/type/workspace";
|
|
10
|
+
/** City 为一个 Agent/Workspace 投影的 Plugin 调用面。 */
|
|
11
|
+
type CityPluginScope = ReturnType<City["plugins"]["scope"]>;
|
|
9
12
|
/** CLI 单 Agent 控制面所需的最小执行能力。 */
|
|
10
13
|
export interface CliAgentContext {
|
|
11
14
|
/** 当前 Agent 实例。 */
|
|
12
15
|
agent: Agent;
|
|
13
16
|
/** 当前请求绑定的 Workspace。 */
|
|
14
|
-
workspace:
|
|
17
|
+
workspace: WorkspaceRuntime;
|
|
15
18
|
/** 当前 Workspace 稳定标识。 */
|
|
16
19
|
workspace_id: string;
|
|
17
20
|
/** 当前 Agent 私有数据根目录。 */
|
|
@@ -19,11 +22,11 @@ export interface CliAgentContext {
|
|
|
19
22
|
/** 当前 Agent 的唯一 Session 集合。 */
|
|
20
23
|
sessions: AgentSessionCollection;
|
|
21
24
|
/** 当前 Workspace 下的 Plugin 调用面。 */
|
|
22
|
-
plugins:
|
|
25
|
+
plugins: CityPluginScope;
|
|
23
26
|
/** Agent 稳定标识。 */
|
|
24
27
|
id: string;
|
|
25
28
|
/** 读取当前 Plugin 状态。 */
|
|
26
|
-
list_plugin_states: () => ReturnType<
|
|
29
|
+
list_plugin_states: () => ReturnType<CityPluginScope["snapshots"]>;
|
|
27
30
|
/** 解析指定 Session 的 system messages。 */
|
|
28
31
|
resolve_system_messages: (input: {
|
|
29
32
|
/** 目标 Session ID。 */
|
|
@@ -34,4 +37,5 @@ export interface CliAgentContext {
|
|
|
34
37
|
/** 注册当前 Workspace 下的 Plugin HTTP 路由。 */
|
|
35
38
|
register_plugin_http_routes: (app: import("hono").Hono) => void;
|
|
36
39
|
}
|
|
40
|
+
export {};
|
|
37
41
|
//# sourceMappingURL=CliAgentContext.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CliAgentContext.d.ts","sourceRoot":"","sources":["../../../src/city/agent/CliAgentContext.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,KAAK,EACL,
|
|
1
|
+
{"version":3,"file":"CliAgentContext.d.ts","sourceRoot":"","sources":["../../../src/city/agent/CliAgentContext.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,KAAK,EACL,sBAAsB,EACtB,oBAAoB,EACrB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAEjE,+CAA+C;AAC/C,KAAK,eAAe,GAAG,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;AAE5D,gCAAgC;AAChC,MAAM,WAAW,eAAe;IAC9B,mBAAmB;IACnB,KAAK,EAAE,KAAK,CAAC;IACb,yBAAyB;IACzB,SAAS,EAAE,gBAAgB,CAAC;IAC5B,yBAAyB;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,wBAAwB;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,+BAA+B;IAC/B,QAAQ,EAAE,sBAAsB,CAAC;IACjC,kCAAkC;IAClC,OAAO,EAAE,eAAe,CAAC;IACzB,kBAAkB;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,sBAAsB;IACtB,kBAAkB,EAAE,MAAM,UAAU,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC,CAAC;IACnE,sCAAsC;IACtC,uBAAuB,EAAE,CAAC,KAAK,EAAE;QAC/B,qBAAqB;QACrB,UAAU,EAAE,MAAM,CAAC;QACnB,8BAA8B;QAC9B,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;KAC3B,KAAK,OAAO,CAAC,oBAAoB,EAAE,CAAC,CAAC;IACtC,wCAAwC;IACxC,2BAA2B,EAAE,CAAC,GAAG,EAAE,OAAO,MAAM,EAAE,IAAI,KAAK,IAAI,CAAC;CACjE"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* CLI 显式读取本地配置并创建 Agent;City 只索引这些实例并提供一个 HTTP Server
|
|
5
5
|
* 与一个 RPC Server。Agent 不拥有独立端口。
|
|
6
6
|
*/
|
|
7
|
-
import { City } from "@downcity/
|
|
7
|
+
import { City } from "@downcity/city";
|
|
8
8
|
import type { CityDaemonOptions } from "../process/daemon/Types.js";
|
|
9
9
|
/** 已启动的 CLI City Runtime。 */
|
|
10
10
|
export declare class CliCityRuntime {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CliCityRuntime.d.ts","sourceRoot":"","sources":["../../../src/city/agent/CliCityRuntime.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"CliCityRuntime.d.ts","sourceRoot":"","sources":["../../../src/city/agent/CliCityRuntime.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAQtC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAYxE,6BAA6B;AAC7B,qBAAa,cAAc;IACzB,oBAAoB;IACpB,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IACpB,uBAAuB;IACvB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,sBAAsB;IACtB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAE1B,kCAAkC;IAClC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAe;IACpC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAS;IAE1C,OAAO,CAAC,OAAO,CAAS;IAExB,OAAO;IAkBP,uBAAuB;IACjB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAe3B,uCAAuC;WAC1B,KAAK,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,cAAc,CAAC;CAoIxE"}
|
|
@@ -4,10 +4,9 @@
|
|
|
4
4
|
* CLI 显式读取本地配置并创建 Agent;City 只索引这些实例并提供一个 HTTP Server
|
|
5
5
|
* 与一个 RPC Server。Agent 不拥有独立端口。
|
|
6
6
|
*/
|
|
7
|
-
import { City } from "@downcity/
|
|
8
|
-
import { LocalStorageProvider } from "@downcity/
|
|
9
|
-
import {
|
|
10
|
-
import { create_city_host_instance_id, register_city_host, unregister_city_host, } from "@downcity/agent/city";
|
|
7
|
+
import { City } from "@downcity/city";
|
|
8
|
+
import { LocalStorageProvider } from "@downcity/city";
|
|
9
|
+
import { create_city_host_instance_id, register_city_host, unregister_city_host, } from "@downcity/city";
|
|
11
10
|
import { EmbassySessionResolver } from "../shared/EmbassySessionResolver.js";
|
|
12
11
|
import { create_agent_http_gateway_app } from "./AgentHttpGateway.js";
|
|
13
12
|
import { AuthService } from "../runtime/auth/AuthService.js";
|
|
@@ -58,10 +57,24 @@ export class CliCityRuntime {
|
|
|
58
57
|
const plugin_loader = create_cli_plugin_loader({
|
|
59
58
|
plugin_repository: data.plugins,
|
|
60
59
|
});
|
|
60
|
+
const plugin_registrations = await plugin_loader.list_registrations();
|
|
61
61
|
const { embassy } = await new EmbassySessionResolver().create_user_client();
|
|
62
62
|
const city = new City({
|
|
63
63
|
storage: new LocalStorageProvider(data.root_path),
|
|
64
64
|
embassy,
|
|
65
|
+
plugins: plugin_registrations,
|
|
66
|
+
plugin_host: {
|
|
67
|
+
config: (plugin_id) => ({
|
|
68
|
+
get: () => structuredClone(data.plugins.get_config(plugin_id)),
|
|
69
|
+
set: async (config) => {
|
|
70
|
+
data.plugins.set_config(plugin_id, structuredClone(config));
|
|
71
|
+
},
|
|
72
|
+
}),
|
|
73
|
+
notifications: () => ({
|
|
74
|
+
publish: async () => { },
|
|
75
|
+
dismiss: async () => { },
|
|
76
|
+
}),
|
|
77
|
+
},
|
|
65
78
|
runtime: {
|
|
66
79
|
resolve_workspace: async (_agent, workspace_id) => {
|
|
67
80
|
const workspace_config = data.workspaces.get(workspace_id);
|
|
@@ -70,15 +83,32 @@ export class CliCityRuntime {
|
|
|
70
83
|
return await create_cli_workspace(workspace_config, data.root_path);
|
|
71
84
|
},
|
|
72
85
|
http: {
|
|
73
|
-
resolve_session_model: async (
|
|
74
|
-
create_agent_extension: ({ agent, workspace, sdk_router }) => {
|
|
86
|
+
resolve_session_model: async ({ workspace, model_id }) => await resolve_cli_agent_model(model_id, workspace.get_env()),
|
|
87
|
+
create_agent_extension: ({ agent, workspace, plugins, sdk_router }) => {
|
|
75
88
|
const auth_service = new AuthService({
|
|
76
89
|
agent_id: agent.id,
|
|
77
90
|
repository: data.agent_tokens,
|
|
78
91
|
});
|
|
92
|
+
const data_path = city.storage.open_scope(["agents", agent.id]).root_path;
|
|
79
93
|
return {
|
|
80
94
|
router: create_agent_http_gateway_app({
|
|
81
|
-
get_context: () =>
|
|
95
|
+
get_context: () => ({
|
|
96
|
+
agent,
|
|
97
|
+
workspace,
|
|
98
|
+
workspace_id: workspace.id,
|
|
99
|
+
data_path,
|
|
100
|
+
sessions: agent.sessions,
|
|
101
|
+
plugins,
|
|
102
|
+
id: agent.id,
|
|
103
|
+
list_plugin_states: () => city.plugins.snapshots(),
|
|
104
|
+
resolve_system_messages: (input) => agent.resolve_system_messages(workspace, input),
|
|
105
|
+
register_plugin_http_routes: (app) => {
|
|
106
|
+
city.plugins.register_http_routes(app, {
|
|
107
|
+
agent_id: agent.id,
|
|
108
|
+
workspace_id: workspace.id,
|
|
109
|
+
});
|
|
110
|
+
},
|
|
111
|
+
}),
|
|
82
112
|
sdk_router,
|
|
83
113
|
auth_service,
|
|
84
114
|
}),
|
|
@@ -88,11 +118,10 @@ export class CliCityRuntime {
|
|
|
88
118
|
},
|
|
89
119
|
rpc: {
|
|
90
120
|
shutdown: () => { process.kill(process.pid, "SIGTERM"); },
|
|
91
|
-
resolve_session_model: async (
|
|
92
|
-
reload_workspace_env: async (
|
|
93
|
-
const
|
|
94
|
-
|
|
95
|
-
entry.workspace.set_env(env);
|
|
121
|
+
resolve_session_model: async ({ workspace, model_id }) => await resolve_cli_agent_model(model_id, workspace.get_env()),
|
|
122
|
+
reload_workspace_env: async ({ workspace }) => {
|
|
123
|
+
const env = reload_cli_workspace_env(workspace.path, data.root_path);
|
|
124
|
+
workspace.set_env(env);
|
|
96
125
|
return env;
|
|
97
126
|
},
|
|
98
127
|
},
|
|
@@ -101,11 +130,11 @@ export class CliCityRuntime {
|
|
|
101
130
|
const agents = [];
|
|
102
131
|
try {
|
|
103
132
|
for (const config of data.agents.list()) {
|
|
104
|
-
|
|
133
|
+
const agent = await create_cli_agent({
|
|
105
134
|
config,
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
city.agents.add(
|
|
135
|
+
});
|
|
136
|
+
agents.push(agent);
|
|
137
|
+
city.agents.add(agent);
|
|
109
138
|
}
|
|
110
139
|
}
|
|
111
140
|
catch (error) {
|