@actiondock/core 2.8.0 → 2.9.0

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.
@@ -18,6 +18,40 @@ export interface ServerTlsOptions {
18
18
  /** 私钥密码口令(若私钥被密码加密) */
19
19
  passphrase?: string;
20
20
  }
21
+ /**
22
+ * 单个虚拟投影视图(Virtual View)的配置选项。
23
+ */
24
+ export interface ServerViewOptions {
25
+ /** 视图唯一标识名称(若在 views 对象中配置则键名作为默认名称) */
26
+ name?: string;
27
+ /** 该视图独立的 Bearer Token 鉴权令牌 */
28
+ token?: string;
29
+ /** 该视图允许访问执行的 Package ID 白名单列表(为空允许全部) */
30
+ packageAllowlist?: string[];
31
+ /** 该视图允许访问执行的 Action 标识白名单列表(为空允许全部,支持短名或 packageId/actionId) */
32
+ actionAllowlist?: string[];
33
+ /** 该视图是否开启配置与状态管理路由能力(默认关闭) */
34
+ enableManagement?: boolean;
35
+ /** 该视图是否启用一体化 MCP 协议支持(默认开启) */
36
+ enableMcp?: boolean;
37
+ /** 该视图自定义的 MCP 请求处理器钩子(可选,支持请求处理函数或接收视图策略的工厂函数) */
38
+ mcpHandler?: ((req: Request, view?: EffectiveServerPolicy) => Promise<Response | null | undefined> | Response | null | undefined) | ((view: EffectiveServerPolicy) => ((req: Request) => Promise<Response | null | undefined> | Response | null | undefined));
39
+ }
40
+ /**
41
+ * 当前请求上下文生效的统一服务端安全策略。
42
+ */
43
+ export interface EffectiveServerPolicy {
44
+ /** 当前生效的视图名称(默认视图为 "default") */
45
+ viewName?: string;
46
+ /** 当前生效的 Bearer Token 鉴权令牌 */
47
+ token?: string;
48
+ /** 当前生效的 Package ID 白名单列表 */
49
+ packageAllowlist?: string[];
50
+ /** 当前生效的 Action 标识白名单列表 */
51
+ actionAllowlist?: string[];
52
+ /** 当前生效的管理能力开关 */
53
+ enableManagement?: boolean;
54
+ }
21
55
  /**
22
56
  * 启动 ActionDock HTTP Runner 服务端的配置选项。
23
57
  */
@@ -48,14 +82,18 @@ export interface ServerOptions {
48
82
  corsOrigins?: string[];
49
83
  /** 允许访问执行的 Package ID 白名单列表(为空允许全部) */
50
84
  packageAllowlist?: string[];
85
+ /** 允许访问执行的 Action 标识白名单列表(为空允许全部,支持短名或 packageId/actionId) */
86
+ actionAllowlist?: string[];
51
87
  /** 最大允许的请求体字节限制(默认 1MB,防 DoS) */
52
88
  maxBodyBytes?: number;
53
89
  /** 是否在 health 和 info 接口中透传本地 projectRoot 等调试路径 */
54
90
  exposeDebugInfo?: boolean;
55
91
  /** 是否启用一体化 MCP 协议支持(默认开启) */
56
92
  enableMcp?: boolean;
57
- /** 自定义 MCP 请求处理器钩子(若挂载则 /mcp 路由交由其处理) */
58
- mcpHandler?: (req: Request) => Promise<Response | null | undefined> | Response | null | undefined;
93
+ /** 自定义 MCP 请求处理器钩子(若挂载则 /mcp 路由交由其处理,支持处理函数或接收视图策略的工厂函数) */
94
+ mcpHandler?: ((req: Request, view?: EffectiveServerPolicy) => Promise<Response | null | undefined> | Response | null | undefined) | ((view: EffectiveServerPolicy) => ((req: Request) => Promise<Response | null | undefined> | Response | null | undefined));
95
+ /** 自定义 MCP 处理器工厂函数(可选,为每个视图创建独立处理器) */
96
+ mcpHandlerFactory?: (view: EffectiveServerPolicy) => ((req: Request) => Promise<Response | null | undefined> | Response | null | undefined);
59
97
  /** 可选注入的统一运行时底层平台 */
60
98
  platform?: import("../platform/types.js").RuntimePlatform;
61
99
  /** 是否显式开启配置与状态管理路由能力(默认关闭,关闭时返回 403) */
@@ -64,6 +102,26 @@ export interface ServerOptions {
64
102
  scanLinkedPackages?: boolean;
65
103
  /** 服务端 TLS/HTTPS 安全传输选项 */
66
104
  tls?: ServerTlsOptions;
105
+ /**
106
+ * 虚拟投影视图配置。
107
+ * 支持对象字典形式 Record<string, ServerViewOptions> 或数组形式 ServerViewOptions[]。
108
+ * 单端口上支持多视图独立隔离 Token、白名单与管理权限。
109
+ */
110
+ views?: Record<string, ServerViewOptions> | ServerViewOptions[];
111
+ }
112
+ /**
113
+ * 路由处理统一上下文对象。
114
+ */
115
+ export interface RouteContext {
116
+ req: Request;
117
+ url: URL;
118
+ pathname: string;
119
+ corsHeaders: Record<string, string>;
120
+ projectRoot: string | null;
121
+ customHome?: string;
122
+ service: ActionDockService;
123
+ options: ServerOptions;
124
+ activePolicy: EffectiveServerPolicy;
67
125
  }
68
126
  /**
69
127
  * 已启动的 ActionDock HTTP Runner 实例句柄。
package/dist/version.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  /**
2
2
  * ActionDock 核心版本号单一事实源。
3
3
  */
4
- export declare const ACTIONDOCK_VERSION = "2.8.0";
4
+ export declare const ACTIONDOCK_VERSION = "2.9.0";
package/dist/version.js CHANGED
@@ -1,4 +1,4 @@
1
1
  /**
2
2
  * ActionDock 核心版本号单一事实源。
3
3
  */
4
- export const ACTIONDOCK_VERSION = "2.8.0";
4
+ export const ACTIONDOCK_VERSION = "2.9.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@actiondock/core",
3
- "version": "2.8.0",
3
+ "version": "2.9.0",
4
4
  "description": "ActionDock Core Engine - Project loader, runtime execution, SQLite storage, standalone builder, and skill exporter",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -66,7 +66,7 @@
66
66
  "test": "node ../../scripts/run-tests.ts"
67
67
  },
68
68
  "dependencies": {
69
- "@actiondock/sdk": "^2.8.0",
69
+ "@actiondock/sdk": "^2.9.0",
70
70
  "ajv": "^8.17.1",
71
71
  "ajv-formats": "^3.0.1",
72
72
  "undici": "^7.29.1"