Your team of AI agents, on your Mac, Windows or Linux. Agents that talk in channels, write code, review each other and use your tools, on the Claude Code, Codex, OpenCode or Pi you already have. Anything that touches the real world waits for your yes.
TypeScript agent-teamagentic-aiai-agentsai-assistantclaude-codecodexcursorelectrongrokgrok-bot-alternativelinuxlocal-firstmacosmcpmulti-agentopenclaw-alternativeopencodewindows
// Pure rules of the governance layer: which tools a grant exposes, and how an approval is bound to
// one exact call. How a tool is classified is in shared/classify.ts.
import { createHash } from 'node:crypto'
import type { ConnectorTool, GrantLevel } from '../shared/types'
// The classes themselves live in shared/, so the approval card reads them too.
export { callClass, classify, classifyAction, legacyClassify, permits, runnerAllowed, runnerRules } from '../shared/classify'
// `read` exposes read tools; `read_write` exposes everything (sensitive ones go through approval).
// `perCall`: a runner judged on each call (Composio's), exposed to readers too, for its read-only calls.
export function allowed(tool: ConnectorTool, grant: GrantLevel | undefined, perCall = false): boolean {
if (!tool.enabled) return false
if (grant === 'read') return tool.cls === 'read' || perCall
return grant === 'read_write'
}
// Same JSON for the same arguments regardless of key order.
export function canonical(value: unknown): string {
if (Array.isArray(value)) return `[${value.map(canonical).join(',')}]`
if (value && typeof value === 'object') {
const entries = Object.entries(value as Record<string, unknown>)
.filter(([, v]) => v !== undefined)
.sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0))
return `{${entries.map(([k, v]) => `${JSON.stringify(k)}:${canonical(v)}`).join(',')}}`
}
return JSON.stringify(value) ?? 'null'
}
export function approvalHash(connectorId: string, tool: string, args: Record<string, unknown>): string {
return createHash('sha256').update(`${connectorId}\n${tool}\n${canonical(args)}`).digest('hex')
}