@downcity/agent 1.1.175 → 1.1.178
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/AgentPluginFactory.d.ts +4 -2
- package/bin/agent/local/AgentPluginFactory.d.ts.map +1 -1
- package/bin/agent/local/AgentPluginFactory.js +4 -6
- package/bin/agent/local/AgentPluginFactory.js.map +1 -1
- package/bin/agent/local/AgentRuntimeAssembly.d.ts.map +1 -1
- package/bin/agent/local/AgentRuntimeAssembly.js +3 -8
- package/bin/agent/local/AgentRuntimeAssembly.js.map +1 -1
- package/bin/agent/local/ProjectSetup.d.ts +1 -1
- package/bin/agent/local/ProjectSetup.d.ts.map +1 -1
- package/bin/agent/local/ProjectSetup.js +2 -6
- package/bin/agent/local/ProjectSetup.js.map +1 -1
- package/bin/agent/local/services/AgentAssemblyService.d.ts +2 -3
- package/bin/agent/local/services/AgentAssemblyService.d.ts.map +1 -1
- package/bin/agent/local/services/AgentAssemblyService.js +9 -14
- package/bin/agent/local/services/AgentAssemblyService.js.map +1 -1
- package/bin/agent/local/services/AgentBackgroundService.d.ts.map +1 -1
- package/bin/agent/local/services/AgentBackgroundService.js +5 -6
- package/bin/agent/local/services/AgentBackgroundService.js.map +1 -1
- package/bin/agent/local/services/AgentSessionManager.d.ts +2 -2
- package/bin/agent/local/services/AgentSessionManager.d.ts.map +1 -1
- package/bin/agent/local/services/AgentSessionManager.js +1 -28
- package/bin/agent/local/services/AgentSessionManager.js.map +1 -1
- package/bin/config/AgentInitializer.d.ts +4 -4
- package/bin/config/AgentInitializer.d.ts.map +1 -1
- package/bin/config/AgentInitializer.js +7 -49
- package/bin/config/AgentInitializer.js.map +1 -1
- package/bin/config/DowncitySchema.d.ts +3 -4
- package/bin/config/DowncitySchema.d.ts.map +1 -1
- package/bin/config/DowncitySchema.js +1 -2
- package/bin/config/DowncitySchema.js.map +1 -1
- package/bin/executor/composer/system/default/SystemDomain.d.ts.map +1 -1
- package/bin/executor/composer/system/default/SystemDomain.js +1 -2
- package/bin/executor/composer/system/default/SystemDomain.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 +0 -2
- package/bin/index.d.ts.map +1 -1
- package/bin/index.js +1 -4
- package/bin/index.js.map +1 -1
- package/bin/plugin/core/Activation.d.ts +6 -5
- package/bin/plugin/core/Activation.d.ts.map +1 -1
- package/bin/plugin/core/Activation.js +9 -9
- package/bin/plugin/core/Activation.js.map +1 -1
- package/bin/plugin/core/BasePlugin.d.ts +5 -4
- package/bin/plugin/core/BasePlugin.d.ts.map +1 -1
- package/bin/plugin/core/BasePlugin.js +7 -4
- package/bin/plugin/core/BasePlugin.js.map +1 -1
- package/bin/plugin/core/HookRegistry.d.ts +4 -0
- package/bin/plugin/core/HookRegistry.d.ts.map +1 -1
- package/bin/plugin/core/HookRegistry.js +40 -0
- package/bin/plugin/core/HookRegistry.js.map +1 -1
- package/bin/plugin/core/Manager.d.ts +1 -1
- package/bin/plugin/core/Manager.d.ts.map +1 -1
- package/bin/plugin/core/Manager.js +1 -1
- package/bin/plugin/core/Manager.js.map +1 -1
- package/bin/plugin/core/PluginActionRunner.d.ts +13 -7
- package/bin/plugin/core/PluginActionRunner.d.ts.map +1 -1
- package/bin/plugin/core/PluginActionRunner.js +46 -111
- package/bin/plugin/core/PluginActionRunner.js.map +1 -1
- package/bin/plugin/core/PluginCatalog.d.ts +1 -1
- package/bin/plugin/core/PluginCatalog.d.ts.map +1 -1
- package/bin/plugin/core/PluginCatalog.js +1 -21
- package/bin/plugin/core/PluginCatalog.js.map +1 -1
- package/bin/plugin/core/PluginLocalExecution.d.ts +12 -2
- package/bin/plugin/core/PluginLocalExecution.d.ts.map +1 -1
- package/bin/plugin/core/PluginLocalExecution.js +18 -24
- package/bin/plugin/core/PluginLocalExecution.js.map +1 -1
- package/bin/plugin/core/PluginRegistry.d.ts +60 -7
- package/bin/plugin/core/PluginRegistry.d.ts.map +1 -1
- package/bin/plugin/core/PluginRegistry.js +269 -42
- package/bin/plugin/core/PluginRegistry.js.map +1 -1
- package/bin/plugin/core/PluginStateController.d.ts +11 -36
- package/bin/plugin/core/PluginStateController.d.ts.map +1 -1
- package/bin/plugin/core/PluginStateController.js +45 -190
- package/bin/plugin/core/PluginStateController.js.map +1 -1
- package/bin/plugin/types/Plugin.d.ts +1 -1
- package/bin/plugin/types/Plugin.d.ts.map +1 -1
- package/bin/plugin/types/PluginState.d.ts +1 -1
- package/bin/plugin/types/PluginState.d.ts.map +1 -1
- package/bin/plugin/types/Plugins.d.ts +12 -12
- package/bin/plugin/types/Plugins.d.ts.map +1 -1
- package/bin/types/agent/AgentOptions.d.ts +12 -3
- package/bin/types/agent/AgentOptions.d.ts.map +1 -1
- package/bin/types/agent/AgentRuntimeAssembly.d.ts +1 -1
- package/bin/types/config/AgentProject.d.ts +6 -14
- package/bin/types/config/AgentProject.d.ts.map +1 -1
- package/bin/types/plugin/PluginRuntime.d.ts +23 -2
- package/bin/types/plugin/PluginRuntime.d.ts.map +1 -1
- package/bin/types/plugin/PluginState.d.ts +47 -36
- package/bin/types/plugin/PluginState.d.ts.map +1 -1
- package/bin/types/plugin/PluginState.js +4 -3
- package/bin/types/plugin/PluginState.js.map +1 -1
- package/bin/types/runtime/agent/AgentContext.d.ts +3 -3
- package/bin/types/runtime/agent/AgentContext.d.ts.map +1 -1
- package/bin/types/runtime/agent/AgentContext.js.map +1 -1
- package/package.json +3 -3
- package/src/agent/local/AgentPluginFactory.ts +8 -8
- package/src/agent/local/AgentRuntimeAssembly.ts +3 -9
- package/src/agent/local/ProjectSetup.ts +1 -8
- package/src/agent/local/services/AgentAssemblyService.ts +13 -23
- package/src/agent/local/services/AgentBackgroundService.ts +5 -6
- package/src/agent/local/services/AgentSessionManager.ts +4 -26
- package/src/config/AgentInitializer.ts +7 -57
- package/src/config/DowncitySchema.ts +3 -4
- package/src/executor/composer/system/default/SystemDomain.ts +1 -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 -1
- package/src/index.ts +1 -8
- package/src/plugin/core/Activation.ts +10 -10
- package/src/plugin/core/BasePlugin.ts +9 -6
- package/src/plugin/core/HookRegistry.ts +41 -0
- package/src/plugin/core/Manager.ts +0 -2
- package/src/plugin/core/PluginActionRunner.ts +52 -133
- package/src/plugin/core/PluginCatalog.ts +1 -23
- package/src/plugin/core/PluginLocalExecution.ts +30 -25
- package/src/plugin/core/PluginRegistry.ts +298 -44
- package/src/plugin/core/PluginStateController.ts +45 -235
- package/src/plugin/types/Plugin.ts +2 -1
- package/src/plugin/types/PluginState.ts +2 -1
- package/src/plugin/types/Plugins.ts +12 -12
- package/src/types/agent/AgentOptions.ts +13 -3
- package/src/types/agent/AgentRuntimeAssembly.ts +1 -1
- package/src/types/config/AgentProject.ts +7 -15
- package/src/types/plugin/PluginRuntime.ts +23 -2
- package/src/types/plugin/PluginState.ts +50 -43
- package/src/types/runtime/agent/AgentContext.ts +3 -3
- package/tsconfig.tsbuildinfo +1 -1
- package/bin/config/Defaults.d.ts +0 -21
- package/bin/config/Defaults.d.ts.map +0 -1
- package/bin/config/Defaults.js +0 -47
- package/bin/config/Defaults.js.map +0 -1
- package/bin/plugin/core/ProjectConfigStore.d.ts +0 -84
- package/bin/plugin/core/ProjectConfigStore.d.ts.map +0 -1
- package/bin/plugin/core/ProjectConfigStore.js +0 -89
- package/bin/plugin/core/ProjectConfigStore.js.map +0 -1
- package/src/config/Defaults.ts +0 -49
- package/src/plugin/core/ProjectConfigStore.ts +0 -155
|
@@ -1,82 +1,89 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Plugin
|
|
2
|
+
* Plugin 注册状态类型。
|
|
3
3
|
*
|
|
4
4
|
* 关键点(中文)
|
|
5
|
-
* -
|
|
6
|
-
* -
|
|
5
|
+
* - Plugin 只属于 Agent:注册即生效,卸载即不可见。
|
|
6
|
+
* - 不再暴露 start / stop / restart 这类生命周期状态。
|
|
7
|
+
* - `error` 只表示最近一次注册后运行发生错误,方便开发者诊断。
|
|
7
8
|
*/
|
|
8
9
|
|
|
10
|
+
import type { Plugin } from "@/types/plugin/PluginDefinition.js";
|
|
11
|
+
|
|
9
12
|
/**
|
|
10
|
-
* Plugin
|
|
11
|
-
*
|
|
12
|
-
* 说明(中文)
|
|
13
|
-
* - `starting` / `stopping` 仅用于生命周期过渡态。
|
|
14
|
-
* - `error` 表示最近一次 lifecycle / command / action 执行失败后留下的状态标记。
|
|
13
|
+
* Plugin 当前可观察状态。
|
|
15
14
|
*/
|
|
16
|
-
export type PluginState =
|
|
17
|
-
| "running"
|
|
18
|
-
| "stopped"
|
|
19
|
-
| "starting"
|
|
20
|
-
| "stopping"
|
|
21
|
-
| "error";
|
|
15
|
+
export type PluginState = "ready" | "error";
|
|
22
16
|
|
|
23
17
|
/**
|
|
24
|
-
*
|
|
18
|
+
* 单个已注册 plugin 的运行时记录。
|
|
25
19
|
*/
|
|
26
|
-
export interface
|
|
27
|
-
/**
|
|
20
|
+
export interface PluginRuntimeRecord {
|
|
21
|
+
/** 当前 plugin 实例。 */
|
|
22
|
+
plugin: Plugin;
|
|
23
|
+
/** 当前可观察状态。 */
|
|
28
24
|
state: PluginState;
|
|
25
|
+
/** plugin 注册时间(毫秒时间戳)。 */
|
|
26
|
+
registered_at: number;
|
|
29
27
|
/** 最近一次状态更新时间(毫秒时间戳)。 */
|
|
30
|
-
|
|
28
|
+
updated_at: number;
|
|
31
29
|
/** 最近一次错误信息。 */
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
lastCommand?: string;
|
|
35
|
-
/** 最近一次执行命令的时间(毫秒时间戳)。 */
|
|
36
|
-
lastCommandAt?: number;
|
|
37
|
-
/** 当前串行控制链。 */
|
|
30
|
+
last_error?: string;
|
|
31
|
+
/** 当前串行变更链。 */
|
|
38
32
|
chain: Promise<void>;
|
|
33
|
+
/** lifecycle.start 是否已经执行成功。 */
|
|
34
|
+
lifecycle_started: boolean;
|
|
39
35
|
}
|
|
40
36
|
|
|
41
37
|
/**
|
|
42
|
-
* 单个 plugin
|
|
38
|
+
* 单个 plugin 注册快照。
|
|
43
39
|
*/
|
|
44
|
-
export interface
|
|
40
|
+
export interface PluginSnapshot {
|
|
45
41
|
/** plugin 名称。 */
|
|
46
42
|
name: string;
|
|
47
|
-
/**
|
|
43
|
+
/** plugin 标题。 */
|
|
44
|
+
title: string;
|
|
45
|
+
/** plugin 描述。 */
|
|
46
|
+
description: string;
|
|
47
|
+
/** 当前注册后的可用状态。 */
|
|
48
|
+
status: PluginState;
|
|
49
|
+
/** 兼容旧字段的状态别名。 */
|
|
48
50
|
state: PluginState;
|
|
49
|
-
/**
|
|
51
|
+
/** 注册时间(毫秒时间戳)。 */
|
|
52
|
+
registered_at: number;
|
|
53
|
+
/** 最近更新时间(毫秒时间戳)。 */
|
|
54
|
+
updated_at: number;
|
|
55
|
+
/** 兼容旧字段的最近更新时间。 */
|
|
50
56
|
updatedAt: number;
|
|
51
|
-
/**
|
|
57
|
+
/** 最近错误。 */
|
|
58
|
+
last_error?: string;
|
|
59
|
+
/** 兼容旧字段的最近错误。 */
|
|
52
60
|
lastError?: string;
|
|
53
|
-
/** 最近一次执行的命令名。 */
|
|
54
|
-
lastCommand?: string;
|
|
55
|
-
/** 最近一次执行命令的时间(毫秒时间戳)。 */
|
|
56
|
-
lastCommandAt?: number;
|
|
57
|
-
/** 是否支持主动生命周期。 */
|
|
58
|
-
supportsLifecycle: boolean;
|
|
59
|
-
/** 是否支持 command/action。 */
|
|
60
|
-
supportsCommand: boolean;
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
/**
|
|
64
|
-
* plugin
|
|
64
|
+
* 兼容旧名称的 plugin 快照类型。
|
|
65
|
+
*/
|
|
66
|
+
export type PluginStateSnapshot = PluginSnapshot;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* 兼容旧控制动作类型。
|
|
70
|
+
*
|
|
71
|
+
* 说明(中文)
|
|
72
|
+
* - 控制面只保留状态查询与卸载。
|
|
65
73
|
*/
|
|
66
74
|
export type PluginStateControlAction =
|
|
67
|
-
| "
|
|
68
|
-
| "
|
|
69
|
-
| "restart"
|
|
75
|
+
| "register"
|
|
76
|
+
| "unregister"
|
|
70
77
|
| "status";
|
|
71
78
|
|
|
72
79
|
/**
|
|
73
|
-
* plugin
|
|
80
|
+
* plugin 控制结果。
|
|
74
81
|
*/
|
|
75
82
|
export interface PluginStateControlResult {
|
|
76
83
|
/** 控制动作是否成功。 */
|
|
77
84
|
success: boolean;
|
|
78
85
|
/** 成功或失败后返回的最新 plugin 快照。 */
|
|
79
|
-
plugin?:
|
|
86
|
+
plugin?: PluginSnapshot;
|
|
80
87
|
/** 失败时的错误信息。 */
|
|
81
88
|
error?: string;
|
|
82
89
|
}
|
|
@@ -16,7 +16,7 @@ import type {
|
|
|
16
16
|
import type { DowncityConfig } from "@/types/config/DowncityConfig.js";
|
|
17
17
|
import type { JsonValue } from "@/types/common/Json.js";
|
|
18
18
|
import type { AgentPlugins } from "@/plugin/types/Plugin.js";
|
|
19
|
-
import type {
|
|
19
|
+
import type { Plugin } from "@/types/plugin/PluginDefinition.js";
|
|
20
20
|
import type {
|
|
21
21
|
SessionMetadataV1,
|
|
22
22
|
SessionMessageV1,
|
|
@@ -249,7 +249,7 @@ export interface AgentContextOptions {
|
|
|
249
249
|
/** 当前可见的 plugin 配置持久化能力集合。 */
|
|
250
250
|
pluginConfig: AgentPluginConfigRuntime;
|
|
251
251
|
/** 当前 agent 持有的插件实例集合。 */
|
|
252
|
-
pluginInstances: Map<string,
|
|
252
|
+
pluginInstances: Map<string, Plugin>;
|
|
253
253
|
/** Session 能力入口。 */
|
|
254
254
|
session: SessionCollectionPort;
|
|
255
255
|
/** Plugin 调用入口。 */
|
|
@@ -282,7 +282,7 @@ export class AgentContext {
|
|
|
282
282
|
/** 当前可见的 plugin 配置持久化能力集合。 */
|
|
283
283
|
readonly pluginConfig: AgentPluginConfigRuntime;
|
|
284
284
|
/** 当前 agent 持有的插件实例集合。 */
|
|
285
|
-
readonly pluginInstances: Map<string,
|
|
285
|
+
readonly pluginInstances: Map<string, Plugin>;
|
|
286
286
|
/** Session 能力入口。 */
|
|
287
287
|
readonly session: SessionCollectionPort;
|
|
288
288
|
/** Plugin 调用入口。 */
|