@kenhkl/agent-moss 0.12.9 → 0.14.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.
@@ -0,0 +1,25 @@
1
+ {
2
+ "_comment": "Tool Registry — 工具名/命令 → 数据流属性(单一事实源,双端共用)。对齐站点 registry.ts:actionClass(read/write/compute/network_egress/message_egress/unknown)+ requireHighIntegrity(该工具是否要求高完整性输入)。驱动 Rule 5/9/10/11 的按动作类分流 block/observe 与低完整性判定。",
3
+ "tools": {
4
+ "bash": { "actionClass": "compute", "requireHighIntegrity": true },
5
+ "shell": { "actionClass": "compute", "requireHighIntegrity": true },
6
+ "terminal": { "actionClass": "compute", "requireHighIntegrity": true },
7
+ "cmd": { "actionClass": "compute", "requireHighIntegrity": true },
8
+ "python": { "actionClass": "compute", "requireHighIntegrity": true },
9
+ "node": { "actionClass": "compute", "requireHighIntegrity": true },
10
+ "exec": { "actionClass": "compute", "requireHighIntegrity": true },
11
+ "curl": { "actionClass": "network_egress", "requireHighIntegrity": false },
12
+ "wget": { "actionClass": "network_egress", "requireHighIntegrity": false },
13
+ "scp": { "actionClass": "network_egress", "requireHighIntegrity": false },
14
+ "rsync": { "actionClass": "network_egress", "requireHighIntegrity": false },
15
+ "nc": { "actionClass": "network_egress", "requireHighIntegrity": false },
16
+ "file.read": { "actionClass": "read", "requireHighIntegrity": false },
17
+ "file_read": { "actionClass": "read", "requireHighIntegrity": false },
18
+ "read_file": { "actionClass": "read", "requireHighIntegrity": false },
19
+ "cat": { "actionClass": "read", "requireHighIntegrity": false },
20
+ "file.write": { "actionClass": "write", "requireHighIntegrity": false },
21
+ "file_write": { "actionClass": "write", "requireHighIntegrity": false },
22
+ "write_file": { "actionClass": "write", "requireHighIntegrity": false },
23
+ "echo": { "actionClass": "write", "requireHighIntegrity": false }
24
+ }
25
+ }
@@ -109,11 +109,40 @@ def clear_scenario_extensions_cache() -> None:
109
109
  _cache.clear()
110
110
 
111
111
 
112
+ def get_scenario_extensions_multi(scenario_spec: str | None) -> AgentExtensions | None:
113
+ """按逗号分隔的场景列表加载并合并扩展(AGENT_MOSS_SCENARIO 支持多场景)。
114
+
115
+ 引擎层兜底 env 时使用:`AGENT_MOSS_SCENARIO=bank,meow` 会被拆成多个场景 id,
116
+ 逐个加载后合并成一个 AgentExtensions(append 语义,与 console 的
117
+ _enabled_scenario_ids 逗号分隔口径一致)。
118
+
119
+ Args:
120
+ scenario_spec: 逗号分隔的场景 id 字符串(可为空)。
121
+
122
+ Returns:
123
+ 合并后的 AgentExtensions,或 None(无任何场景可加载)。
124
+ """
125
+ if not scenario_spec:
126
+ return None
127
+ ids = [s.strip() for s in scenario_spec.split(",") if s.strip()]
128
+ if not ids:
129
+ return None
130
+ exts = [get_scenario_extensions(sid) for sid in ids]
131
+ non_null = [e for e in exts if e is not None]
132
+ if not non_null:
133
+ return None
134
+ merged: AgentExtensions | None = non_null[0]
135
+ for e in non_null[1:]:
136
+ merged = AgentExtensions.merge(merged, e)
137
+ return merged
138
+
139
+
112
140
  __all__ = [
113
141
  "AgentExtensions",
114
142
  "InjectionKeyword",
115
143
  "CommandPattern",
116
144
  "SensitivePath",
117
145
  "get_scenario_extensions",
146
+ "get_scenario_extensions_multi",
118
147
  "clear_scenario_extensions_cache",
119
148
  ]