@downcity/agent 1.1.111 → 1.1.118
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/bin/agent/local/Agent.d.ts +22 -0
- package/bin/agent/local/Agent.d.ts.map +1 -1
- package/bin/agent/local/Agent.js +31 -0
- package/bin/agent/local/Agent.js.map +1 -1
- package/bin/agent/local/services/AgentAssemblyService.d.ts +4 -0
- package/bin/agent/local/services/AgentAssemblyService.d.ts.map +1 -1
- package/bin/agent/local/services/AgentAssemblyService.js +18 -2
- package/bin/agent/local/services/AgentAssemblyService.js.map +1 -1
- package/bin/agent/local/services/AgentLifecycleService.d.ts +6 -0
- package/bin/agent/local/services/AgentLifecycleService.d.ts.map +1 -1
- package/bin/agent/local/services/AgentLifecycleService.js +4 -0
- package/bin/agent/local/services/AgentLifecycleService.js.map +1 -1
- package/bin/agent/remote/RemoteAgent.d.ts +26 -1
- package/bin/agent/remote/RemoteAgent.d.ts.map +1 -1
- package/bin/agent/remote/RemoteAgent.js +40 -0
- package/bin/agent/remote/RemoteAgent.js.map +1 -1
- package/bin/agent/remote/RemoteTransport.d.ts +14 -1
- package/bin/agent/remote/RemoteTransport.d.ts.map +1 -1
- package/bin/agent/remote/transports/HttpRemoteAgentTransport.d.ts +11 -1
- package/bin/agent/remote/transports/HttpRemoteAgentTransport.d.ts.map +1 -1
- package/bin/agent/remote/transports/HttpRemoteAgentTransport.js +54 -0
- package/bin/agent/remote/transports/HttpRemoteAgentTransport.js.map +1 -1
- package/bin/agent/remote/transports/RpcRemoteAgentTransport.d.ts +10 -1
- package/bin/agent/remote/transports/RpcRemoteAgentTransport.d.ts.map +1 -1
- package/bin/agent/remote/transports/RpcRemoteAgentTransport.js +16 -0
- package/bin/agent/remote/transports/RpcRemoteAgentTransport.js.map +1 -1
- package/bin/executor/Executor.d.ts.map +1 -1
- package/bin/executor/Executor.js +7 -1
- package/bin/executor/Executor.js.map +1 -1
- package/bin/executor/composer/system/default/assets/core.prompt.d.ts +1 -1
- package/bin/executor/composer/system/default/assets/core.prompt.d.ts.map +1 -1
- package/bin/executor/composer/system/default/assets/core.prompt.js +1 -1
- package/bin/executor/composer/system/default/assets/core.prompt.js.map +1 -1
- package/bin/index.d.ts +1 -2
- package/bin/index.d.ts.map +1 -1
- package/bin/index.js +0 -1
- package/bin/index.js.map +1 -1
- package/bin/rpc/Client.d.ts +13 -0
- package/bin/rpc/Client.d.ts.map +1 -1
- package/bin/rpc/Client.js +31 -0
- package/bin/rpc/Client.js.map +1 -1
- package/bin/rpc/server/InternalHandlers.d.ts.map +1 -1
- package/bin/rpc/server/InternalHandlers.js +30 -0
- package/bin/rpc/server/InternalHandlers.js.map +1 -1
- package/bin/rpc/server/ServerTypes.d.ts +5 -0
- package/bin/rpc/server/ServerTypes.d.ts.map +1 -1
- package/bin/types/agent/AgentOptions.d.ts +9 -0
- package/bin/types/agent/AgentOptions.d.ts.map +1 -1
- package/bin/types/agent/AgentTypes.d.ts +1 -0
- package/bin/types/agent/AgentTypes.d.ts.map +1 -1
- package/bin/types/agent/RemoteAgentPluginAction.d.ts +46 -0
- package/bin/types/agent/RemoteAgentPluginAction.d.ts.map +1 -0
- package/bin/types/agent/RemoteAgentPluginAction.js +9 -0
- package/bin/types/agent/RemoteAgentPluginAction.js.map +1 -0
- package/bin/types/config/DowncityConfig.d.ts +2 -2
- package/bin/types/config/DowncityConfig.d.ts.map +1 -1
- package/bin/types/rpc/RpcProtocol.d.ts +25 -0
- package/bin/types/rpc/RpcProtocol.d.ts.map +1 -1
- package/bin/types/sdk/AgentSessionEvent.d.ts +24 -4
- package/bin/types/sdk/AgentSessionEvent.d.ts.map +1 -1
- package/package.json +4 -3
- package/scripts/linux-bubblewrap-sandbox.test.mjs +1 -1
- package/scripts/shell-sandbox-preflight.test.mjs +1 -1
- package/src/agent/local/Agent.ts +38 -0
- package/src/agent/local/services/AgentAssemblyService.ts +23 -2
- package/src/agent/local/services/AgentLifecycleService.ts +11 -0
- package/src/agent/remote/RemoteAgent.ts +52 -0
- package/src/agent/remote/RemoteTransport.ts +16 -0
- package/src/agent/remote/transports/HttpRemoteAgentTransport.ts +83 -0
- package/src/agent/remote/transports/RpcRemoteAgentTransport.ts +28 -0
- package/src/executor/Executor.ts +12 -2
- package/src/executor/composer/system/default/assets/core.prompt.ts +1 -1
- package/src/executor/composer/system/default/assets/core.prompt.ts.txt +1 -0
- package/src/index.ts +2 -1
- package/src/rpc/Client.ts +38 -0
- package/src/rpc/server/InternalHandlers.ts +31 -0
- package/src/rpc/server/ServerTypes.ts +5 -0
- package/src/types/agent/AgentOptions.ts +10 -0
- package/src/types/agent/AgentTypes.ts +4 -0
- package/src/types/agent/RemoteAgentPluginAction.ts +52 -0
- package/src/types/config/DowncityConfig.ts +2 -2
- package/src/types/rpc/RpcProtocol.ts +28 -0
- package/src/types/sdk/AgentSessionEvent.ts +28 -4
- package/tsconfig.tsbuildinfo +1 -1
- package/bin/executor/tools/shell/ShellToolBridge.d.ts +0 -79
- package/bin/executor/tools/shell/ShellToolBridge.d.ts.map +0 -1
- package/bin/executor/tools/shell/ShellToolBridge.js +0 -320
- package/bin/executor/tools/shell/ShellToolBridge.js.map +0 -1
- package/bin/executor/tools/shell/ShellToolDefinition.d.ts +0 -114
- package/bin/executor/tools/shell/ShellToolDefinition.d.ts.map +0 -1
- package/bin/executor/tools/shell/ShellToolDefinition.js +0 -367
- package/bin/executor/tools/shell/ShellToolDefinition.js.map +0 -1
- package/bin/executor/tools/shell/ShellToolFormatting.d.ts +0 -17
- package/bin/executor/tools/shell/ShellToolFormatting.d.ts.map +0 -1
- package/bin/executor/tools/shell/ShellToolFormatting.js +0 -36
- package/bin/executor/tools/shell/ShellToolFormatting.js.map +0 -1
- package/bin/executor/tools/shell/ShellToolSchemas.d.ts +0 -60
- package/bin/executor/tools/shell/ShellToolSchemas.d.ts.map +0 -1
- package/bin/executor/tools/shell/ShellToolSchemas.js +0 -126
- package/bin/executor/tools/shell/ShellToolSchemas.js.map +0 -1
- package/bin/executor/tools/shell/types/Shell.d.ts +0 -109
- package/bin/executor/tools/shell/types/Shell.d.ts.map +0 -1
- package/bin/executor/tools/shell/types/Shell.js +0 -9
- package/bin/executor/tools/shell/types/Shell.js.map +0 -1
- package/bin/executor/tools/shell/types/ShellPlugin.d.ts +0 -252
- package/bin/executor/tools/shell/types/ShellPlugin.d.ts.map +0 -1
- package/bin/executor/tools/shell/types/ShellPlugin.js +0 -9
- package/bin/executor/tools/shell/types/ShellPlugin.js.map +0 -1
- package/bin/sandbox/LinuxBubblewrapSandbox.d.ts +0 -19
- package/bin/sandbox/LinuxBubblewrapSandbox.d.ts.map +0 -1
- package/bin/sandbox/LinuxBubblewrapSandbox.js +0 -186
- package/bin/sandbox/LinuxBubblewrapSandbox.js.map +0 -1
- package/bin/sandbox/MacOsSeatbeltSandbox.d.ts +0 -16
- package/bin/sandbox/MacOsSeatbeltSandbox.d.ts.map +0 -1
- package/bin/sandbox/MacOsSeatbeltSandbox.js +0 -154
- package/bin/sandbox/MacOsSeatbeltSandbox.js.map +0 -1
- package/bin/sandbox/SandboxConfigResolver.d.ts +0 -37
- package/bin/sandbox/SandboxConfigResolver.d.ts.map +0 -1
- package/bin/sandbox/SandboxConfigResolver.js +0 -130
- package/bin/sandbox/SandboxConfigResolver.js.map +0 -1
- package/bin/sandbox/SandboxPreflight.d.ts +0 -73
- package/bin/sandbox/SandboxPreflight.d.ts.map +0 -1
- package/bin/sandbox/SandboxPreflight.js +0 -122
- package/bin/sandbox/SandboxPreflight.js.map +0 -1
- package/bin/sandbox/SandboxRunner.d.ts +0 -61
- package/bin/sandbox/SandboxRunner.d.ts.map +0 -1
- package/bin/sandbox/SandboxRunner.js +0 -107
- package/bin/sandbox/SandboxRunner.js.map +0 -1
- package/bin/sandbox/UnrestrictedSandbox.d.ts +0 -16
- package/bin/sandbox/UnrestrictedSandbox.d.ts.map +0 -1
- package/bin/sandbox/UnrestrictedSandbox.js +0 -39
- package/bin/sandbox/UnrestrictedSandbox.js.map +0 -1
- package/bin/sandbox/types/Sandbox.d.ts +0 -130
- package/bin/sandbox/types/Sandbox.d.ts.map +0 -1
- package/bin/sandbox/types/Sandbox.js +0 -10
- package/bin/sandbox/types/Sandbox.js.map +0 -1
- package/bin/sandbox/types/SandboxRuntime.d.ts +0 -370
- package/bin/sandbox/types/SandboxRuntime.d.ts.map +0 -1
- package/bin/sandbox/types/SandboxRuntime.js +0 -10
- package/bin/sandbox/types/SandboxRuntime.js.map +0 -1
- package/src/executor/tools/shell/ShellToolBridge.ts +0 -412
- package/src/executor/tools/shell/ShellToolDefinition.ts +0 -521
- package/src/executor/tools/shell/ShellToolFormatting.ts +0 -34
- package/src/executor/tools/shell/ShellToolSchemas.ts +0 -135
- package/src/executor/tools/shell/types/Shell.ts +0 -116
- package/src/executor/tools/shell/types/ShellPlugin.ts +0 -271
- package/src/sandbox/LinuxBubblewrapSandbox.ts +0 -222
- package/src/sandbox/MacOsSeatbeltSandbox.ts +0 -191
- package/src/sandbox/SandboxConfigResolver.ts +0 -152
- package/src/sandbox/SandboxPreflight.ts +0 -205
- package/src/sandbox/SandboxRunner.ts +0 -151
- package/src/sandbox/UnrestrictedSandbox.ts +0 -53
- package/src/sandbox/types/Sandbox.ts +0 -144
- package/src/sandbox/types/SandboxRuntime.ts +0 -440
|
@@ -9,6 +9,7 @@ import type { AgentSessionCollection } from "../../types/agent/AgentTypes.js";
|
|
|
9
9
|
import type { AgentContext } from "../../types/runtime/agent/AgentContext.js";
|
|
10
10
|
import type { AgentRuntime } from "../../types/runtime/agent/AgentRuntime.js";
|
|
11
11
|
import type { RpcEventFrame } from "../../types/rpc/RpcProtocol.js";
|
|
12
|
+
import type { Shell } from "@downcity/shell";
|
|
12
13
|
/**
|
|
13
14
|
* RPC Server 启动参数。
|
|
14
15
|
*/
|
|
@@ -23,6 +24,8 @@ export interface RpcServerStartOptions {
|
|
|
23
24
|
getAgentContext?: () => AgentContext;
|
|
24
25
|
/** Agent 运行态访问口。 */
|
|
25
26
|
getAgentRuntime?: () => AgentRuntime;
|
|
27
|
+
/** Shell 访问口。 */
|
|
28
|
+
getShell?: () => Shell | undefined;
|
|
26
29
|
}
|
|
27
30
|
/**
|
|
28
31
|
* RPC request handler 依赖。
|
|
@@ -34,6 +37,8 @@ export interface RpcRequestHandlerOptions {
|
|
|
34
37
|
getAgentContext?: () => AgentContext;
|
|
35
38
|
/** Agent 运行态访问口。 */
|
|
36
39
|
getAgentRuntime?: () => AgentRuntime;
|
|
40
|
+
/** Shell 访问口。 */
|
|
41
|
+
getShell?: () => Shell | undefined;
|
|
37
42
|
}
|
|
38
43
|
/**
|
|
39
44
|
* 单个 socket 上的 session 订阅。
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ServerTypes.d.ts","sourceRoot":"","sources":["../../../src/rpc/server/ServerTypes.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAC1E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAC1E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAC1E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"ServerTypes.d.ts","sourceRoot":"","sources":["../../../src/rpc/server/ServerTypes.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAC1E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAC1E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAC1E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAE7C;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,kBAAkB;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,kBAAkB;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,qBAAqB;IACrB,iBAAiB,EAAE,sBAAsB,CAAC;IAC1C,oBAAoB;IACpB,eAAe,CAAC,EAAE,MAAM,YAAY,CAAC;IACrC,oBAAoB;IACpB,eAAe,CAAC,EAAE,MAAM,YAAY,CAAC;IACrC,iBAAiB;IACjB,QAAQ,CAAC,EAAE,MAAM,KAAK,GAAG,SAAS,CAAC;CACpC;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,qBAAqB;IACrB,iBAAiB,EAAE,sBAAsB,CAAC;IAC1C,oBAAoB;IACpB,eAAe,CAAC,EAAE,MAAM,YAAY,CAAC;IACrC,oBAAoB;IACpB,eAAe,CAAC,EAAE,MAAM,YAAY,CAAC;IACrC,iBAAiB;IACjB,QAAQ,CAAC,EAAE,MAAM,KAAK,GAAG,SAAS,CAAC;CACpC;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,uBAAuB;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc;IACd,WAAW,EAAE,MAAM,IAAI,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;AAEnE;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;AAEjE;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC"}
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* - RemoteAgent 与 Session 数据结构拆到独立类型文件。
|
|
7
7
|
*/
|
|
8
8
|
import type { Tool } from "ai";
|
|
9
|
+
import type { Shell } from "@downcity/shell";
|
|
9
10
|
import type { BasePlugin } from "../../plugin/core/BasePlugin.js";
|
|
10
11
|
import type { AgentModel } from "../../model/CityModelAdapter.js";
|
|
11
12
|
import type { RpcServerInstance } from "../../rpc/Server.js";
|
|
@@ -40,6 +41,14 @@ export interface AgentOptions {
|
|
|
40
41
|
* - session 运行时会直接复用这份工具集合。
|
|
41
42
|
*/
|
|
42
43
|
tools?: Record<string, Tool>;
|
|
44
|
+
/**
|
|
45
|
+
* 当前 agent 内建 shell 能力。
|
|
46
|
+
*
|
|
47
|
+
* 关键点(中文)
|
|
48
|
+
* - Shell 不是 plugin,而是 agent 直接挂载的内建工具对象。
|
|
49
|
+
* - 未传入时,Agent 不会自动注入 shell tools。
|
|
50
|
+
*/
|
|
51
|
+
shell?: Shell;
|
|
43
52
|
/**
|
|
44
53
|
* 调用方显式传入的静态基础指令。
|
|
45
54
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentOptions.d.ts","sourceRoot":"","sources":["../../../src/types/agent/AgentOptions.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAC/B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,KAAK,EACV,mBAAmB,EACnB,cAAc,EACf,MAAM,mCAAmC,CAAC;AAE3C;;;;;;GAMG;AACH,MAAM,MAAM,uBAAuB,GAAG,KACpC,OAAO,EAAE,cAAc,KACpB,mBAAmB,CAAC;AAEzB;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B;;;;;;OAMG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX,yBAAyB;IACzB,IAAI,EAAE,MAAM,CAAC;IAEb;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI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,OAAO,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,0BAA0B;IAC1B,UAAU,EAAE,OAAO,CAAC;IACpB,yBAAyB;IACzB,cAAc,EAAE,OAAO,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,+BAA+B;IAC/B,GAAG,CAAC,EAAE,eAAe,CAAC;IACtB,8BAA8B;IAC9B,cAAc,EAAE,OAAO,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,gBAAgB;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,gBAAgB;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,cAAc;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,eAAe;IACf,IAAI,EAAE,MAAM,CAAC;IACb,eAAe;IACf,IAAI,EAAE,MAAM,CAAC;IACb,qBAAqB;IACrB,MAAM,EAAE,iBAAiB,CAAC;CAC3B"}
|
|
@@ -11,6 +11,7 @@ export type { SessionComposerFactoryContext, SessionComposerInput, SessionCompos
|
|
|
11
11
|
export type { AgentManagedSession, SessionOptions, } from "../../types/session/SessionOptions.js";
|
|
12
12
|
export type { AgentOptions, AgentRpcBinding, AgentRpcStartOptions, AgentSessionConstructor, AgentStartOptions, AgentStartResult, AgentStopResult, } from "../../types/agent/AgentOptions.js";
|
|
13
13
|
export type { RemoteAgentOptions } from "../../types/agent/RemoteAgentOptions.js";
|
|
14
|
+
export type { RemoteAgentPluginActionInput, RemoteAgentPluginActionResult, } from "../../types/agent/RemoteAgentPluginAction.js";
|
|
14
15
|
export type { AgentCreateSessionInput, AgentListSessionsInput, AgentSessionConfigSnapshot, AgentSessionForkInput, AgentSessionHistoryInput, AgentSessionHistoryPage, AgentSessionHistoryView, AgentSessionInfo, AgentSessionSetInput, AgentSessionSummary, AgentSessionSummaryPage, AgentSessionSystemBlock, AgentSessionSystemBlockSource, AgentSessionSystemSessionInfo, AgentSessionSystemSnapshot, AgentSessionTimelineEvent, } from "../../types/agent/SessionTypes.js";
|
|
15
16
|
export type { AgentSession, AgentSessionActor, AgentSessionCollection, RemoteAgentSession, } from "../../types/agent/SessionActor.js";
|
|
16
17
|
//# sourceMappingURL=AgentTypes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentTypes.d.ts","sourceRoot":"","sources":["../../../src/types/agent/AgentTypes.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,YAAY,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAC9D,YAAY,EACV,6BAA6B,EAC7B,oBAAoB,EACpB,sBAAsB,GACvB,MAAM,2CAA2C,CAAC;AACnD,YAAY,EACV,mBAAmB,EACnB,cAAc,GACf,MAAM,mCAAmC,CAAC;AAC3C,YAAY,EACV,YAAY,EACZ,eAAe,EACf,oBAAoB,EACpB,uBAAuB,EACvB,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,GAChB,MAAM,+BAA+B,CAAC;AACvC,YAAY,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAC9E,YAAY,EACV,uBAAuB,EACvB,sBAAsB,EACtB,0BAA0B,EAC1B,qBAAqB,EACrB,wBAAwB,EACxB,uBAAuB,EACvB,uBAAuB,EACvB,gBAAgB,EAChB,oBAAoB,EACpB,mBAAmB,EACnB,uBAAuB,EACvB,uBAAuB,EACvB,6BAA6B,EAC7B,6BAA6B,EAC7B,0BAA0B,EAC1B,yBAAyB,GAC1B,MAAM,+BAA+B,CAAC;AACvC,YAAY,EACV,YAAY,EACZ,iBAAiB,EACjB,sBAAsB,EACtB,kBAAkB,GACnB,MAAM,+BAA+B,CAAC"}
|
|
1
|
+
{"version":3,"file":"AgentTypes.d.ts","sourceRoot":"","sources":["../../../src/types/agent/AgentTypes.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,YAAY,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAC9D,YAAY,EACV,6BAA6B,EAC7B,oBAAoB,EACpB,sBAAsB,GACvB,MAAM,2CAA2C,CAAC;AACnD,YAAY,EACV,mBAAmB,EACnB,cAAc,GACf,MAAM,mCAAmC,CAAC;AAC3C,YAAY,EACV,YAAY,EACZ,eAAe,EACf,oBAAoB,EACpB,uBAAuB,EACvB,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,GAChB,MAAM,+BAA+B,CAAC;AACvC,YAAY,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAC9E,YAAY,EACV,4BAA4B,EAC5B,6BAA6B,GAC9B,MAAM,0CAA0C,CAAC;AAClD,YAAY,EACV,uBAAuB,EACvB,sBAAsB,EACtB,0BAA0B,EAC1B,qBAAqB,EACrB,wBAAwB,EACxB,uBAAuB,EACvB,uBAAuB,EACvB,gBAAgB,EAChB,oBAAoB,EACpB,mBAAmB,EACnB,uBAAuB,EACvB,uBAAuB,EACvB,6BAA6B,EAC7B,6BAA6B,EAC7B,0BAA0B,EAC1B,yBAAyB,GAC1B,MAAM,+BAA+B,CAAC;AACvC,YAAY,EACV,YAAY,EACZ,iBAAiB,EACjB,sBAAsB,EACtB,kBAAkB,GACnB,MAAM,+BAA+B,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RemoteAgent plugin action 类型。
|
|
3
|
+
*
|
|
4
|
+
* 关键点(中文)
|
|
5
|
+
* - RemoteAgent 是远程 runtime 的瘦客户端,因此这里只描述远程调用协议。
|
|
6
|
+
* - 业务 action 的具体 payload 与 data 由目标 plugin 自己定义。
|
|
7
|
+
*/
|
|
8
|
+
import type { JsonValue } from "../../types/common/Json.js";
|
|
9
|
+
import type { PluginActionResult } from "../../types/plugin/PluginAction.js";
|
|
10
|
+
/**
|
|
11
|
+
* RemoteAgent 远程 plugin action 调用输入。
|
|
12
|
+
*/
|
|
13
|
+
export interface RemoteAgentPluginActionInput {
|
|
14
|
+
/**
|
|
15
|
+
* 目标 plugin 名称。
|
|
16
|
+
*
|
|
17
|
+
* 示例:`shell`、`chat`、`task`。
|
|
18
|
+
*/
|
|
19
|
+
plugin: string;
|
|
20
|
+
/**
|
|
21
|
+
* 目标 action 名称。
|
|
22
|
+
*
|
|
23
|
+
* 示例:`approve`、`deny`、`send`。
|
|
24
|
+
*/
|
|
25
|
+
action: string;
|
|
26
|
+
/**
|
|
27
|
+
* 传给目标 action 的 JSON payload。
|
|
28
|
+
*
|
|
29
|
+
* shell approval 示例:`{ "approvalId": "ap_xxx" }`。
|
|
30
|
+
*/
|
|
31
|
+
payload?: JsonValue;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* RemoteAgent 远程 plugin action 调用结果。
|
|
35
|
+
*/
|
|
36
|
+
export type RemoteAgentPluginActionResult = PluginActionResult<JsonValue> & {
|
|
37
|
+
/**
|
|
38
|
+
* Runtime 回传的 plugin 名称。
|
|
39
|
+
*/
|
|
40
|
+
pluginName?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Runtime 回传的 action 名称。
|
|
43
|
+
*/
|
|
44
|
+
actionName?: string;
|
|
45
|
+
};
|
|
46
|
+
//# sourceMappingURL=RemoteAgentPluginAction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RemoteAgentPluginAction.d.ts","sourceRoot":"","sources":["../../../src/types/agent/RemoteAgentPluginAction.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAEzE;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC3C;;;;OAIG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;;;OAIG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;;;OAIG;IACH,OAAO,CAAC,EAAE,SAAS,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,MAAM,6BAA6B,GACvC,kBAAkB,CAAC,SAAS,CAAC,GAAG;IAC9B;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RemoteAgentPluginAction.js","sourceRoot":"","sources":["../../../src/types/agent/RemoteAgentPluginAction.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import type { LlmConfig } from "../../types/config/LlmConfig.js";
|
|
9
9
|
import type { ExecutionBindingConfig } from "../../types/config/ExecutionBinding.js";
|
|
10
10
|
import type { JsonObject } from "../../types/common/Json.js";
|
|
11
|
-
import type { SandboxProjectConfig } from "
|
|
11
|
+
import type { SandboxProjectConfig } from "@downcity/shell/sandbox/types/Sandbox.js";
|
|
12
12
|
/**
|
|
13
13
|
* 单个聊天渠道配置。
|
|
14
14
|
*/
|
|
@@ -155,7 +155,7 @@ export interface DowncityConfig {
|
|
|
155
155
|
* shell / CLI 执行 sandbox 配置。
|
|
156
156
|
*
|
|
157
157
|
* 关键点(中文)
|
|
158
|
-
* -
|
|
158
|
+
* - 当前只作用于内建 shell 这条命令执行链。
|
|
159
159
|
* - 这里不表达审批、用户授权与复杂策略系统,只表达最小边界。
|
|
160
160
|
*/
|
|
161
161
|
sandbox?: SandboxProjectConfig;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DowncityConfig.d.ts","sourceRoot":"","sources":["../../../src/types/config/DowncityConfig.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AACjF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"DowncityConfig.d.ts","sourceRoot":"","sources":["../../../src/types/config/DowncityConfig.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AACjF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0CAA0C,CAAC;AAErF;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,gCAAgC;IAC/C;;OAEG;IACH,QAAQ,CAAC,EAAE,yBAAyB,CAAC;IACrC;;OAEG;IACH,MAAM,CAAC,EAAE,yBAAyB,CAAC;IACnC;;OAEG;IACH,EAAE,CAAC,EAAE,yBAAyB,CAAC;CAChC;AAED;;GAEG;AACH,MAAM,WAAW,6BAA6B;IAC5C;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;;;;;;;OASG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;;;;;;;OASG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,8BAA8B;IAC7C;;OAEG;IACH,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC;;OAEG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC;;OAEG;IACH,KAAK,CAAC,EAAE,6BAA6B,CAAC;IACtC;;OAEG;IACH,MAAM,CAAC,EAAE,8BAA8B,CAAC;IACxC;;OAEG;IACH,QAAQ,CAAC,EAAE,gCAAgC,CAAC;CAC7C;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC;;OAEG;IACH,IAAI,CAAC,EAAE,wBAAwB,CAAC;IAChC;;OAEG;IACH,CAAC,UAAU,EAAE,MAAM,GACf,UAAU,GACV,wBAAwB,GACxB,SAAS,CAAC;CACf;AAED,MAAM,WAAW,cAAc;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;;;OAMG;IACH,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,KAAK,CAAC,EAAE;QACN,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,CAAC;IACF;;;;;;;;OAQG;IACH,OAAO,CAAC,EAAE,uBAAuB,CAAC;IAClC;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,sBAAsB,CAAC;IACnC;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,oBAAoB,CAAC;IAC/B;;;;;;;OAOG;IACH,GAAG,CAAC,EAAE,SAAS,CAAC;CACjB"}
|
|
@@ -205,6 +205,31 @@ export type RpcRequest = {
|
|
|
205
205
|
/** action payload。 */
|
|
206
206
|
payload?: JsonValue;
|
|
207
207
|
};
|
|
208
|
+
} | {
|
|
209
|
+
/** 请求 id,用于匹配响应。 */
|
|
210
|
+
id: string;
|
|
211
|
+
/** 列出 shell approvals。 */
|
|
212
|
+
method: "internal.shell.approvals";
|
|
213
|
+
} | {
|
|
214
|
+
/** 请求 id,用于匹配响应。 */
|
|
215
|
+
id: string;
|
|
216
|
+
/** 批准 shell approval。 */
|
|
217
|
+
method: "internal.shell.approve";
|
|
218
|
+
/** approval 参数。 */
|
|
219
|
+
params: {
|
|
220
|
+
/** approval id。 */
|
|
221
|
+
approvalId: string;
|
|
222
|
+
};
|
|
223
|
+
} | {
|
|
224
|
+
/** 请求 id,用于匹配响应。 */
|
|
225
|
+
id: string;
|
|
226
|
+
/** 拒绝 shell approval。 */
|
|
227
|
+
method: "internal.shell.deny";
|
|
228
|
+
/** approval 参数。 */
|
|
229
|
+
params: {
|
|
230
|
+
/** approval id。 */
|
|
231
|
+
approvalId: string;
|
|
232
|
+
};
|
|
208
233
|
};
|
|
209
234
|
/**
|
|
210
235
|
* RPC 成功响应帧。
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RpcProtocol.d.ts","sourceRoot":"","sources":["../../../src/types/rpc/RpcProtocol.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACV,uBAAuB,EACvB,sBAAsB,EACtB,wBAAwB,EACxB,0BAA0B,EAC3B,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAC1E,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,mCAAmC,CAAC;AACjF,OAAO,KAAK,EAAc,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACpE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AAEzE;;;;;;GAMG;AACH,MAAM,MAAM,UAAU,GAClB;IACE,oBAAoB;IACpB,EAAE,EAAE,MAAM,CAAC;IACX,kBAAkB;IAClB,MAAM,EAAE,mBAAmB,CAAC;IAC5B,iBAAiB;IACjB,MAAM,CAAC,EAAE,sBAAsB,CAAC;CACjC,GACD;IACE,oBAAoB;IACpB,EAAE,EAAE,MAAM,CAAC;IACX,kBAAkB;IAClB,MAAM,EAAE,qBAAqB,CAAC;IAC9B,YAAY;IACZ,MAAM,CAAC,EAAE,uBAAuB,CAAC;CAClC,GACD;IACE,oBAAoB;IACpB,EAAE,EAAE,MAAM,CAAC;IACX,qBAAqB;IACrB,MAAM,EAAE,kBAAkB,CAAC;IAC3B,qBAAqB;IACrB,MAAM,EAAE;QACN,qBAAqB;QACrB,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;CACH,GACD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IACrC,cAAc;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,qBAAqB;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,yBAAyB;IACzB,aAAa,EAAE,MAAM,CAAC;IACtB,2BAA2B;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,yBAAyB;IACzB,QAAQ,EAAE,sBAAsB,EAAE,CAAC;CACpC;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,uBAAuB;IACvB,MAAM,EAAE,0BAA0B,CAAC;CACpC"}
|
|
@@ -77,7 +77,7 @@ export interface AgentSessionToolCallEvent {
|
|
|
77
77
|
/**
|
|
78
78
|
* 当前工具名称。
|
|
79
79
|
*/
|
|
80
|
-
toolName: string;
|
|
80
|
+
toolName: "shell_exec" | "shell_start" | "shell_write" | string;
|
|
81
81
|
/**
|
|
82
82
|
* 当前工具输入参数。
|
|
83
83
|
*/
|
|
@@ -102,7 +102,7 @@ export interface AgentSessionToolResultEvent {
|
|
|
102
102
|
/**
|
|
103
103
|
* 当前工具名称。
|
|
104
104
|
*/
|
|
105
|
-
toolName: string;
|
|
105
|
+
toolName: "shell_exec" | "shell_start" | "shell_write" | string;
|
|
106
106
|
/**
|
|
107
107
|
* 当前工具输出结果。
|
|
108
108
|
*/
|
|
@@ -127,7 +127,7 @@ export interface AgentSessionToolApprovalRequestEvent {
|
|
|
127
127
|
/**
|
|
128
128
|
* 当前工具名称。
|
|
129
129
|
*/
|
|
130
|
-
toolName: string;
|
|
130
|
+
toolName: "shell_exec" | "shell_start" | "shell_write" | string;
|
|
131
131
|
/**
|
|
132
132
|
* 当前审批请求唯一标识。
|
|
133
133
|
*/
|
|
@@ -138,8 +138,28 @@ export interface AgentSessionToolApprovalRequestEvent {
|
|
|
138
138
|
sandbox: "unrestricted";
|
|
139
139
|
/**
|
|
140
140
|
* 请求执行的命令文本。
|
|
141
|
+
*
|
|
142
|
+
* 说明(中文)
|
|
143
|
+
* - `shell_exec` / `shell_start` 中是命令文本。
|
|
144
|
+
* - `shell_write` 中是 stdin 写入内容,用于兼容旧 UI 展示。
|
|
141
145
|
*/
|
|
142
146
|
cmd: string;
|
|
147
|
+
/**
|
|
148
|
+
* 当前审批动作类型。
|
|
149
|
+
*/
|
|
150
|
+
operation?: "exec" | "start" | "write";
|
|
151
|
+
/**
|
|
152
|
+
* 关联 shell_id;`shell_write` 审批时用于标识目标会话。
|
|
153
|
+
*/
|
|
154
|
+
shellId?: string;
|
|
155
|
+
/**
|
|
156
|
+
* stdin 写入内容预览;仅 `shell_write` 审批存在。
|
|
157
|
+
*/
|
|
158
|
+
inputPreview?: string;
|
|
159
|
+
/**
|
|
160
|
+
* stdin 写入字符数;仅 `shell_write` 审批存在。
|
|
161
|
+
*/
|
|
162
|
+
inputChars?: number;
|
|
143
163
|
/**
|
|
144
164
|
* 命令执行目录。
|
|
145
165
|
*/
|
|
@@ -172,7 +192,7 @@ export interface AgentSessionToolApprovalResultEvent {
|
|
|
172
192
|
/**
|
|
173
193
|
* 当前工具名称。
|
|
174
194
|
*/
|
|
175
|
-
toolName: string;
|
|
195
|
+
toolName: "shell_exec" | "shell_start" | "shell_write" | string;
|
|
176
196
|
/**
|
|
177
197
|
* 当前审批请求唯一标识。
|
|
178
198
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentSessionEvent.d.ts","sourceRoot":"","sources":["../../../src/types/sdk/AgentSessionEvent.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,gCAAgC,CAAC;AAErF;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC;;OAEG;IACH,IAAI,EAAE,YAAY,CAAC;IAEnB;;;;;;OAMG;IACH,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC;;OAEG;IACH,IAAI,EAAE,YAAY,CAAC;IAEnB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,MAAM,WAAW,+BAA+B;IAC9C;;OAEG;IACH,IAAI,EAAE,iBAAiB,CAAC;IAExB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC;;OAEG;IACH,IAAI,EAAE,WAAW,CAAC;IAElB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"AgentSessionEvent.d.ts","sourceRoot":"","sources":["../../../src/types/sdk/AgentSessionEvent.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,gCAAgC,CAAC;AAErF;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC;;OAEG;IACH,IAAI,EAAE,YAAY,CAAC;IAEnB;;;;;;OAMG;IACH,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC;;OAEG;IACH,IAAI,EAAE,YAAY,CAAC;IAEnB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,MAAM,WAAW,+BAA+B;IAC9C;;OAEG;IACH,IAAI,EAAE,iBAAiB,CAAC;IAExB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,MAAM,WAAW,yBAA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,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,MAAM,iBAAiB,GACzB,0BAA0B,GAC1B,0BAA0B,GAC1B,+BAA+B,GAC/B,yBAAyB,GACzB,2BAA2B,GAC3B,oCAAoC,GACpC,mCAAmC,GACnC,8BAA8B,GAC9B,sBAAsB,GACtB,2BAA2B,GAC3B,sBAAsB,CAAC;AAE3B;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG,CAAC,KAAK,EAAE,iBAAiB,KAAK,IAAI,CAAC;AAExE;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG,MAAM,IAAI,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@downcity/agent",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.118",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Downcity Agent 运行时 — 单 Agent 执行壳与本机 RPC 能力",
|
|
6
6
|
"main": "./bin/index.js",
|
|
@@ -17,6 +17,8 @@
|
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@ai-sdk/openai-compatible": "^2.0.48",
|
|
20
|
+
"@downcity/shell": "^0.1.4",
|
|
21
|
+
"@downcity/type": "0.1.43",
|
|
20
22
|
"@larksuiteoapi/node-sdk": "^1.66.0",
|
|
21
23
|
"ai": "^6.0.193",
|
|
22
24
|
"commander": "^15.0.0",
|
|
@@ -28,8 +30,7 @@
|
|
|
28
30
|
"nanoid": "^5.1.11",
|
|
29
31
|
"node-cron": "^4.2.1",
|
|
30
32
|
"ws": "^8.21.0",
|
|
31
|
-
"zod": "^4.4.3"
|
|
32
|
-
"@downcity/type": "0.1.40"
|
|
33
|
+
"zod": "^4.4.3"
|
|
33
34
|
},
|
|
34
35
|
"devDependencies": {
|
|
35
36
|
"@types/fs-extra": "^11.0.4",
|
|
@@ -12,7 +12,7 @@ import fs from "node:fs/promises";
|
|
|
12
12
|
import os from "node:os";
|
|
13
13
|
import path from "node:path";
|
|
14
14
|
|
|
15
|
-
import { buildLinuxBubblewrapArgs } from "
|
|
15
|
+
import { buildLinuxBubblewrapArgs } from "@downcity/shell/sandbox/LinuxBubblewrapSandbox.js";
|
|
16
16
|
|
|
17
17
|
async function createSandboxFixture() {
|
|
18
18
|
const root = await fs.mkdtemp(path.join(os.tmpdir(), "downcity-bwrap-"));
|
|
@@ -11,7 +11,7 @@ import assert from "node:assert/strict";
|
|
|
11
11
|
|
|
12
12
|
import {
|
|
13
13
|
checkShellSandboxPreflightWithProbe,
|
|
14
|
-
} from "
|
|
14
|
+
} from "@downcity/shell/sandbox/SandboxPreflight.js";
|
|
15
15
|
|
|
16
16
|
async function withPlatform(platform, callback) {
|
|
17
17
|
const previous = Object.getOwnPropertyDescriptor(process, "platform");
|
package/src/agent/local/Agent.ts
CHANGED
|
@@ -24,6 +24,11 @@ import type {
|
|
|
24
24
|
AgentStartResult,
|
|
25
25
|
AgentStopResult,
|
|
26
26
|
} from "@/types/agent/AgentTypes.js";
|
|
27
|
+
import type {
|
|
28
|
+
ShellApprovalDecisionResult,
|
|
29
|
+
ShellApprovalView,
|
|
30
|
+
Shell,
|
|
31
|
+
} from "@downcity/shell";
|
|
27
32
|
import { PluginRegistry } from "@/plugin/core/PluginRegistry.js";
|
|
28
33
|
import { Logger } from "@/utils/logger/Logger.js";
|
|
29
34
|
import { normalizeInstructionInput } from "@/agent/local/AgentInstructions.js";
|
|
@@ -53,6 +58,7 @@ export class Agent {
|
|
|
53
58
|
private readonly SessionClass: AgentOptions["Session"];
|
|
54
59
|
private readonly sessionManager: AgentSessionManager;
|
|
55
60
|
private readonly lifecycleService: AgentLifecycleService;
|
|
61
|
+
private readonly shell?: AgentOptions["shell"];
|
|
56
62
|
|
|
57
63
|
private instruction: string[];
|
|
58
64
|
|
|
@@ -88,6 +94,7 @@ export class Agent {
|
|
|
88
94
|
this.config = assembly.config;
|
|
89
95
|
this.env = assembly.env;
|
|
90
96
|
this.instruction = assembly.instruction;
|
|
97
|
+
this.shell = assembly.shell;
|
|
91
98
|
|
|
92
99
|
this.sessionManager = this.create_session_manager(assembly);
|
|
93
100
|
session_manager_ref = this.sessionManager;
|
|
@@ -96,6 +103,7 @@ export class Agent {
|
|
|
96
103
|
agent_context: this.agentContext,
|
|
97
104
|
session_collection: this.sessionManager.get_session_collection(),
|
|
98
105
|
get_runtime: () => this.runtime,
|
|
106
|
+
get_shell: () => this.shell,
|
|
99
107
|
});
|
|
100
108
|
}
|
|
101
109
|
|
|
@@ -136,6 +144,29 @@ export class Agent {
|
|
|
136
144
|
return await this.lifecycleService.stop();
|
|
137
145
|
}
|
|
138
146
|
|
|
147
|
+
/**
|
|
148
|
+
* 列出当前 shell pending approvals。
|
|
149
|
+
*/
|
|
150
|
+
approvals(): ShellApprovalView[] {
|
|
151
|
+
return this.shell?.approvals() || [];
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* 批准当前 shell pending approval。
|
|
156
|
+
*/
|
|
157
|
+
async approve(input: { approval_id: string }): Promise<ShellApprovalDecisionResult> {
|
|
158
|
+
if (!this.shell) throw new Error("Agent shell is not configured");
|
|
159
|
+
return await this.shell.approve(input);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* 拒绝当前 shell pending approval。
|
|
164
|
+
*/
|
|
165
|
+
async deny(input: { approval_id: string }): Promise<ShellApprovalDecisionResult> {
|
|
166
|
+
if (!this.shell) throw new Error("Agent shell is not configured");
|
|
167
|
+
return await this.shell.deny(input);
|
|
168
|
+
}
|
|
169
|
+
|
|
139
170
|
/**
|
|
140
171
|
* 更新当前 SDK Agent 的静态基础指令。
|
|
141
172
|
*/
|
|
@@ -178,6 +209,13 @@ export class Agent {
|
|
|
178
209
|
return this.sessionManager.get_session_collection();
|
|
179
210
|
}
|
|
180
211
|
|
|
212
|
+
/**
|
|
213
|
+
* 返回当前 agent 挂载的 Shell。
|
|
214
|
+
*/
|
|
215
|
+
getShell(): Shell | undefined {
|
|
216
|
+
return this.shell;
|
|
217
|
+
}
|
|
218
|
+
|
|
181
219
|
private create_session_manager(
|
|
182
220
|
assembly: AgentAssemblyResult,
|
|
183
221
|
): AgentSessionManager {
|
|
@@ -28,13 +28,13 @@ import {
|
|
|
28
28
|
createAgentContext,
|
|
29
29
|
createAgentRuntime,
|
|
30
30
|
} from "@/agent/local/AgentRuntimeFactory.js";
|
|
31
|
-
import { setShellToolRuntime } from "@executor/tools/shell/ShellToolDefinition.js";
|
|
32
31
|
import {
|
|
33
32
|
plugin_tools,
|
|
34
33
|
setPluginToolRuntime,
|
|
35
34
|
} from "@executor/tools/plugin/PluginToolDefinition.js";
|
|
36
35
|
import type { AgentManagedSession } from "@/types/agent/AgentTypes.js";
|
|
37
36
|
import type { SessionPort } from "@/types/runtime/agent/AgentContext.js";
|
|
37
|
+
import type { AgentSessionEvent } from "@/types/sdk/AgentSessionEvent.js";
|
|
38
38
|
|
|
39
39
|
type AgentAssemblyServiceOptions = {
|
|
40
40
|
/**
|
|
@@ -123,6 +123,11 @@ export interface AgentAssemblyResult {
|
|
|
123
123
|
* 当前 agent context。
|
|
124
124
|
*/
|
|
125
125
|
agent_context: AgentContext;
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* 当前 agent 挂载的内建 shell。
|
|
129
|
+
*/
|
|
130
|
+
shell?: AgentOptions["shell"];
|
|
126
131
|
}
|
|
127
132
|
|
|
128
133
|
/**
|
|
@@ -201,7 +206,22 @@ export class AgentAssemblyService {
|
|
|
201
206
|
resolve_session_model: async (session_id) =>
|
|
202
207
|
await this.resolve_session_model(session_id),
|
|
203
208
|
});
|
|
204
|
-
|
|
209
|
+
const shell = this.options.shell;
|
|
210
|
+
if (shell) {
|
|
211
|
+
shell.configure({
|
|
212
|
+
root_path: path,
|
|
213
|
+
env,
|
|
214
|
+
agent_id: id,
|
|
215
|
+
sandbox: config.sandbox,
|
|
216
|
+
logger,
|
|
217
|
+
emit_event: (event) => {
|
|
218
|
+
const session_id = String(event.session_id || "").trim();
|
|
219
|
+
if (!session_id) return;
|
|
220
|
+
agent_context.session.get(session_id).publishEvent(event as unknown as AgentSessionEvent);
|
|
221
|
+
},
|
|
222
|
+
});
|
|
223
|
+
Object.assign(tools, shell.tools);
|
|
224
|
+
}
|
|
205
225
|
setPluginToolRuntime(plugins);
|
|
206
226
|
|
|
207
227
|
return {
|
|
@@ -217,6 +237,7 @@ export class AgentAssemblyService {
|
|
|
217
237
|
plugins,
|
|
218
238
|
runtime,
|
|
219
239
|
agent_context,
|
|
240
|
+
...(shell ? { shell } : {}),
|
|
220
241
|
};
|
|
221
242
|
}
|
|
222
243
|
|
|
@@ -22,6 +22,7 @@ import { startActionScheduleRuntime } from "@/plugin/core/ActionScheduleRuntime.
|
|
|
22
22
|
import { startAllPlugins, stopAllPlugins } from "@/plugin/core/Manager.js";
|
|
23
23
|
import { startRpcServer } from "@/rpc/Server.js";
|
|
24
24
|
import type { AgentRuntime } from "@/types/runtime/agent/AgentRuntime.js";
|
|
25
|
+
import type { Shell } from "@downcity/shell";
|
|
25
26
|
|
|
26
27
|
type AgentLifecycleServiceOptions = {
|
|
27
28
|
/**
|
|
@@ -43,6 +44,11 @@ type AgentLifecycleServiceOptions = {
|
|
|
43
44
|
* 读取当前 agent runtime。
|
|
44
45
|
*/
|
|
45
46
|
get_runtime: () => AgentRuntime;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* 读取当前 agent 挂载的 Shell。
|
|
50
|
+
*/
|
|
51
|
+
get_shell?: () => Shell | undefined;
|
|
46
52
|
};
|
|
47
53
|
|
|
48
54
|
/**
|
|
@@ -53,6 +59,7 @@ export class AgentLifecycleService {
|
|
|
53
59
|
private readonly agent_context: AgentContext;
|
|
54
60
|
private readonly session_collection: AgentSessionCollection;
|
|
55
61
|
private readonly get_runtime: AgentLifecycleServiceOptions["get_runtime"];
|
|
62
|
+
private readonly get_shell: AgentLifecycleServiceOptions["get_shell"];
|
|
56
63
|
|
|
57
64
|
private plugins_started = false;
|
|
58
65
|
private action_schedule_runtime: ActionScheduleRuntimeHandle | null = null;
|
|
@@ -64,6 +71,7 @@ export class AgentLifecycleService {
|
|
|
64
71
|
this.agent_context = options.agent_context;
|
|
65
72
|
this.session_collection = options.session_collection;
|
|
66
73
|
this.get_runtime = options.get_runtime;
|
|
74
|
+
this.get_shell = options.get_shell;
|
|
67
75
|
}
|
|
68
76
|
|
|
69
77
|
/**
|
|
@@ -112,6 +120,8 @@ export class AgentLifecycleService {
|
|
|
112
120
|
await this.stop_rpc();
|
|
113
121
|
}
|
|
114
122
|
|
|
123
|
+
await this.get_shell?.()?.dispose();
|
|
124
|
+
|
|
115
125
|
this.start_promise = null;
|
|
116
126
|
|
|
117
127
|
return {
|
|
@@ -168,6 +178,7 @@ export class AgentLifecycleService {
|
|
|
168
178
|
sessionCollection: this.session_collection,
|
|
169
179
|
getAgentContext: () => this.agent_context,
|
|
170
180
|
getAgentRuntime: () => this.get_runtime(),
|
|
181
|
+
getShell: () => this.get_shell?.(),
|
|
171
182
|
});
|
|
172
183
|
this.rpc_binding = {
|
|
173
184
|
url: `rpc://${host}:${port}`,
|
|
@@ -11,9 +11,15 @@ import type {
|
|
|
11
11
|
AgentCreateSessionInput,
|
|
12
12
|
AgentListSessionsInput,
|
|
13
13
|
AgentSessionSummaryPage,
|
|
14
|
+
RemoteAgentPluginActionInput,
|
|
15
|
+
RemoteAgentPluginActionResult,
|
|
14
16
|
RemoteAgentOptions,
|
|
15
17
|
RemoteAgentSession,
|
|
16
18
|
} from "@/types/agent/AgentTypes.js";
|
|
19
|
+
import type {
|
|
20
|
+
ShellApprovalDecisionResult,
|
|
21
|
+
ShellApprovalView,
|
|
22
|
+
} from "@downcity/shell";
|
|
17
23
|
import type { RemoteAgentTransport } from "@/agent/remote/RemoteTransport.js";
|
|
18
24
|
import { RemoteSession } from "@/agent/remote/RemoteSession.js";
|
|
19
25
|
import { create_remote_agent_transport } from "@/agent/remote/TransportFactory.js";
|
|
@@ -63,6 +69,52 @@ export class RemoteAgent {
|
|
|
63
69
|
return await this.transport.list_sessions(input);
|
|
64
70
|
}
|
|
65
71
|
|
|
72
|
+
/**
|
|
73
|
+
* 执行远程 Agent runtime 内的 plugin action。
|
|
74
|
+
*
|
|
75
|
+
* 关键点(中文)
|
|
76
|
+
* - 这是 RemoteAgent 顶层能力,不绑定某个 session。
|
|
77
|
+
* - Shell approval 请使用 `approvals()` / `approve()` / `deny()`。
|
|
78
|
+
*/
|
|
79
|
+
async runPluginAction(
|
|
80
|
+
input: RemoteAgentPluginActionInput,
|
|
81
|
+
): Promise<RemoteAgentPluginActionResult> {
|
|
82
|
+
const plugin = String(input.plugin || "").trim();
|
|
83
|
+
const action = String(input.action || "").trim();
|
|
84
|
+
if (!plugin) {
|
|
85
|
+
throw new Error("runPluginAction requires a non-empty plugin");
|
|
86
|
+
}
|
|
87
|
+
if (!action) {
|
|
88
|
+
throw new Error("runPluginAction requires a non-empty action");
|
|
89
|
+
}
|
|
90
|
+
return await this.transport.run_plugin_action({
|
|
91
|
+
plugin,
|
|
92
|
+
action,
|
|
93
|
+
...(input.payload !== undefined ? { payload: input.payload } : {}),
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* 列出远程 Agent 的 shell pending approvals。
|
|
99
|
+
*/
|
|
100
|
+
async approvals(): Promise<ShellApprovalView[]> {
|
|
101
|
+
return await this.transport.approvals();
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* 批准远程 Agent 的 shell approval。
|
|
106
|
+
*/
|
|
107
|
+
async approve(input: { approval_id: string }): Promise<ShellApprovalDecisionResult> {
|
|
108
|
+
return await this.transport.approve(input);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* 拒绝远程 Agent 的 shell approval。
|
|
113
|
+
*/
|
|
114
|
+
async deny(input: { approval_id: string }): Promise<ShellApprovalDecisionResult> {
|
|
115
|
+
return await this.transport.deny(input);
|
|
116
|
+
}
|
|
117
|
+
|
|
66
118
|
/**
|
|
67
119
|
* 关闭远程 transport。
|
|
68
120
|
*
|