@kenhkl/agent-moss 0.16.7 → 0.16.12

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/dist/cli.d.ts CHANGED
@@ -1,11 +1,29 @@
1
1
  #!/usr/bin/env node
2
+ import { AnalysisInput } from './engine/coordinator.js';
3
+
2
4
  /**
3
5
  * AgentMoss CLI — TypeScript version.
4
6
  * Supports: init | analyze | server
5
7
  */
8
+
6
9
  /** 命令模式核心:把一条 shell 命令当 a_next 分析,输出 Deny/Allow(--json 时完整
7
10
  * JSON),返回退出码(Allow=0 / Deny=1)。导出供测试直接调用(CLI 分支再 process.exit)。
8
11
  * 零文件读写——镜像 Python cli.py 的 _analyze_command。 */
12
+ /**
13
+ * 把 CLI 输入文件(input.json)映射成引擎入参。
14
+ *
15
+ * 抽成导出函数是为了**可测**:CLI 文件模式的入口字段映射曾经丢字段且无看护
16
+ * (`output` 与 `scenario_id` 都没传),而 CLI 的 main() 里没法单测。Python 侧
17
+ * 对应用 `cli.py::cmd_analyze` 的透传(那边直传原始 dict,天然不丢字段)。
18
+ *
19
+ * 字段口径与 Python CLI(cli.py)逐项对齐:
20
+ * - `output`:工具返回 / 用户对 ask_user_question 的回答 —— L2 授权(consent)
21
+ * 判定看它,丢了会把「已授权」判成「未授权」;
22
+ * - `scenario_id`:场景定制规则(如 bank 沙箱目录白名单)的加载依据,丢了
23
+ * 这些规则整套不生效;
24
+ * - `agent_id` / `cwd`:agent 专属规则与间接文件访问检测依据。
25
+ */
26
+ declare function buildAnalysisInputFromFile(data: any): AnalysisInput;
9
27
  declare function analyzeRawCommand(command: string, useJson?: boolean): Promise<number>;
10
28
 
11
- export { analyzeRawCommand };
29
+ export { analyzeRawCommand, buildAnalysisInputFromFile };