Files
open-multi-agent/packages/core/src/classifiers.ts
T
Jack Chen e6869fdba9 feat(classifiers): add optional classifyBashCommand behind /classifiers subpath (#382)
Ships an opt-in, dependency-free shell risk classifier for the onToolCall gate
(#377). classifyBashCommand(command) returns safe | review | high so users get
the taxonomy from #96 without writing regex tables by hand.

- safe: read-only inspection (ls, cat, grep/rg with a path, git status/log/diff)
- review: context bombs and unknowns (ls -R, find / without -maxdepth,
  grep -r / rg -r without scope, tree, du, unrecognised commands)
- high: destructive/sensitive (rm, sudo, curl | bash, dd, mkfs, chmod 777/-R,
  git push --force, npm publish)

Compound commands are segmented on shell separators and the highest risk wins;
quoted strings are stripped so patterns inside a string do not match. Convenience
heuristic, not a security boundary. Exported only via
@open-multi-agent/core/classifiers so pattern tables never load unless imported.

Closes #379
2026-07-16 16:15:48 +08:00

8 lines
410 B
TypeScript

/**
* Optional risk classifiers, shipped behind the `@open-multi-agent/core/classifiers`
* subpath so their pattern tables never load unless imported. Convenience
* helpers for `onToolCallGate` policies — not part of the core import surface.
*/
export type { BashRiskLevel, BashRiskAssessment } from './tool/classifiers/bash-risk.js'
export { classifyBashCommand } from './tool/classifiers/bash-risk.js'