Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Adrian pre-commit hooks. Run on every `git commit` once `pre-commit
# install` has been run from this repo's root (see CONTRIBUTING.md).
# Scoped to Python files under `sdk/python/` and `scripts/`.
# Formatting/lint hooks are scoped to Python files under `sdk/python/`
# and `scripts/`; the licence-header hook covers Go, Python, TypeScript,
# JavaScript, proto and shell sources repo-wide.

default_install_hook_types: [pre-commit]
default_language_version:
Expand Down Expand Up @@ -34,6 +36,14 @@ repos:

- repo: local
hooks:
- id: license-header
name: licence header
entry: python3 scripts/add_license_header.py
language: system
files: \.(go|py|pyi|ts|tsx|js|mjs|cjs|proto|sh)$
# Vendored code keeps its own licence; generated proto bindings
# would lose the header on regeneration.
exclude: (^|/)vendor/|(^|/)node_modules/|\.pb\.go$|_pb2(_grpc)?\.pyi?$
- id: basedpyright
name: basedpyright
entry: basedpyright
Expand Down
12 changes: 8 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,12 @@ See [`sdk/typescript/README.md`](sdk/typescript/README.md) for usage examples.

After `pre-commit install`, every `git commit` runs the configured hooks on
staged files: `ruff format`, `ruff check --fix`, `basedpyright` on
`sdk/python/adrian/`, plus the standard whitespace / YAML / TOML checks. Hooks that
modify files (formatter, autofix) leave the commit aborted; re-stage the files
and commit again.
`sdk/python/adrian/`, plus the standard whitespace / YAML / TOML checks. A
licence-header hook prepends the Apache-2.0 SPDX header to any staged Go,
Python, TypeScript, JavaScript, proto or shell file that lacks one (vendored
code and generated proto bindings excluded). Hooks that
modify files (formatter, autofix, header) leave the commit aborted; re-stage
the files and commit again.

To run the hooks across the whole tree on demand without committing:

Expand All @@ -53,7 +56,8 @@ pre-commit run --all-files
```

The config lives at [`.pre-commit-config.yaml`](.pre-commit-config.yaml).
Only Python files under `sdk/python/` and `scripts/` are in scope.
Formatting and lint hooks cover Python under `sdk/python/` and `scripts/`;
the licence-header hook covers source files repo-wide.

## Style

Expand Down
3 changes: 3 additions & 0 deletions backend/proto/event.proto
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (c) 2026 SecureAgentics

syntax = "proto3";

package adrian.core_api.v1;
Expand Down
3 changes: 3 additions & 0 deletions examples/python/create_agent.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) 2026 SecureAgentics

"""Adrian with a LangChain agent (``create_agent``).

The current LangChain agent constructor
Expand Down
3 changes: 3 additions & 0 deletions examples/python/hitl_credential_leak.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) 2026 SecureAgentics

"""Adrian Human Review example: human-in-the-loop tool gating.

Builds a small LangGraph agent (gpt-4o-mini + a ``send_email`` tool)
Expand Down
3 changes: 3 additions & 0 deletions examples/python/manual_instrumentation.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) 2026 SecureAgentics

"""Adrian with manual instrumentation (``auto_instrument=False``).

Mirrors :mod:`quickstart` but opts out of the SDK's import-time
Expand Down
3 changes: 3 additions & 0 deletions examples/python/quickstart.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) 2026 SecureAgentics

"""Adrian quickstart: a single async LLM call captured by the SDK.

The simplest possible agent code Adrian can monitor: a bare
Expand Down
3 changes: 3 additions & 0 deletions examples/python/react_agent.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) 2026 SecureAgentics

"""Adrian with a LangGraph ReAct agent (``create_react_agent``).

``langgraph.prebuilt.create_react_agent`` is the long-standing prebuilt
Expand Down
3 changes: 3 additions & 0 deletions examples/typescript/hitl_credential_leak.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (c) 2026 SecureAgentics

/**
* Adrian Human Review example (TypeScript): human-in-the-loop tool gating.
*
Expand Down
3 changes: 3 additions & 0 deletions frontend/app/(dashboard)/agents/[agent_id]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (c) 2026 SecureAgentics

'use client'

import { useEffect, useState } from 'react'
Expand Down
3 changes: 3 additions & 0 deletions frontend/app/(dashboard)/agents/page.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (c) 2026 SecureAgentics

'use client'

import { useEffect, useState } from 'react'
Expand Down
3 changes: 3 additions & 0 deletions frontend/app/(dashboard)/events/page.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (c) 2026 SecureAgentics

'use client'

import { useEffect, useMemo, useState } from 'react'
Expand Down
3 changes: 3 additions & 0 deletions frontend/app/(dashboard)/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (c) 2026 SecureAgentics

'use client'

import { useState } from 'react'
Expand Down
3 changes: 3 additions & 0 deletions frontend/app/(dashboard)/mcp/page.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (c) 2026 SecureAgentics

'use client'

import { useEffect, useState } from 'react'
Expand Down
3 changes: 3 additions & 0 deletions frontend/app/(dashboard)/page.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (c) 2026 SecureAgentics

'use client'

import { useEffect, useMemo, useState } from 'react'
Expand Down
3 changes: 3 additions & 0 deletions frontend/app/(dashboard)/reviews/page.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (c) 2026 SecureAgentics

'use client'

import { useEffect, useState } from 'react'
Expand Down
3 changes: 3 additions & 0 deletions frontend/app/(dashboard)/sessions/[session_id]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (c) 2026 SecureAgentics

'use client'

import { useEffect, useState } from 'react'
Expand Down
3 changes: 3 additions & 0 deletions frontend/app/(dashboard)/settings/page.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (c) 2026 SecureAgentics

'use client'

import { useEffect, useState } from 'react'
Expand Down
3 changes: 3 additions & 0 deletions frontend/app/change-password/page.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (c) 2026 SecureAgentics

'use client'

import { useState } from 'react'
Expand Down
3 changes: 3 additions & 0 deletions frontend/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (c) 2026 SecureAgentics

import type { Metadata } from 'next'
import './globals.css'
import { ThemeProvider, themeInitScript } from '@/components/theme-provider'
Expand Down
3 changes: 3 additions & 0 deletions frontend/app/login/page.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (c) 2026 SecureAgentics

'use client'

import { useState } from 'react'
Expand Down
3 changes: 3 additions & 0 deletions frontend/components/alert-explanation.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (c) 2026 SecureAgentics

'use client'

import { resolveAlert, useMadAlerts, type MadAlert } from '@/lib/mad-alerts'
Expand Down
3 changes: 3 additions & 0 deletions frontend/components/badge.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (c) 2026 SecureAgentics

export function Badge({ label, className }: { label: string; className: string }) {
return (
<span className={`inline-block px-2 py-0.5 text-[13px] font-medium rounded ${className}`}>
Expand Down
3 changes: 3 additions & 0 deletions frontend/components/icons/brands/clickup.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (c) 2026 SecureAgentics

// ClickUp uses a three-color gradient mark. Inline SVG keeps the gradient
// IDs scoped via a stable unique suffix to avoid clashes when the icon is
// rendered multiple times on the same page.
Expand Down
3 changes: 3 additions & 0 deletions frontend/components/icons/brands/discord.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (c) 2026 SecureAgentics

export function DiscordIcon({ size = 28 }: { size?: number }) {
return (
<svg xmlns="http://www.w3.org/2000/svg" width={size} height={size} viewBox="0 0 24 24" aria-hidden>
Expand Down
3 changes: 3 additions & 0 deletions frontend/components/icons/brands/telegram.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (c) 2026 SecureAgentics

export function TelegramIcon({ size = 28 }: { size?: number }) {
return (
<svg xmlns="http://www.w3.org/2000/svg" width={size} height={size} viewBox="0 0 24 24" aria-hidden>
Expand Down
3 changes: 3 additions & 0 deletions frontend/components/json-block.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (c) 2026 SecureAgentics

// JsonBlock renders a value as a pretty-printed, syntax-highlighted
// <pre>. Tokenises the JSON.stringify output with a single regex
// pass and wraps each token in a span with a Tailwind colour class:
Expand Down
3 changes: 3 additions & 0 deletions frontend/components/pagination.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (c) 2026 SecureAgentics

'use client'

export function Pagination({
Expand Down
3 changes: 3 additions & 0 deletions frontend/components/sidebar.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (c) 2026 SecureAgentics

'use client'

import { useEffect, useState } from 'react'
Expand Down
3 changes: 3 additions & 0 deletions frontend/components/theme-provider.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (c) 2026 SecureAgentics

'use client'

// Minimal theme provider — no deps. Persists choice to localStorage and
Expand Down
3 changes: 3 additions & 0 deletions frontend/components/theme-toggle.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (c) 2026 SecureAgentics

'use client'

// Three-way segmented toggle: light / system / dark.
Expand Down
3 changes: 3 additions & 0 deletions frontend/components/time-range.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (c) 2026 SecureAgentics

'use client'

export type TimeRange = '1h' | '24h' | '7d' | '30d' | 'custom'
Expand Down
3 changes: 3 additions & 0 deletions frontend/components/topbar.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (c) 2026 SecureAgentics

'use client'

import { useRouter } from 'next/navigation'
Expand Down
3 changes: 3 additions & 0 deletions frontend/components/ui/dialog.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (c) 2026 SecureAgentics

'use client'

// Minimal accessible-ish modal primitive. We intentionally skip Radix - the
Expand Down
3 changes: 3 additions & 0 deletions frontend/lib/agent-profile-templates.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (c) 2026 SecureAgentics

/**
* Starter templates for the Agent Profile editor.
*
Expand Down
3 changes: 3 additions & 0 deletions frontend/lib/utils.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (c) 2026 SecureAgentics

export function timeAgo(date: string | Date): string {
const seconds = Math.floor((Date.now() - new Date(date).getTime()) / 1000)
if (seconds < 60) return `${seconds}s ago`
Expand Down
3 changes: 3 additions & 0 deletions frontend/next.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (c) 2026 SecureAgentics

/** @type {import('next').NextConfig} */
const nextConfig = {
output: 'standalone',
Expand Down
1 change: 1 addition & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "adrian-dashboard",
"version": "1.0.0",
"private": true,
"license": "Apache-2.0",
"scripts": {
"dev": "next dev --port 3000",
"build": "next build",
Expand Down
3 changes: 3 additions & 0 deletions frontend/postcss.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (c) 2026 SecureAgentics

module.exports = {
plugins: {
tailwindcss: {},
Expand Down
3 changes: 3 additions & 0 deletions frontend/tailwind.config.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (c) 2026 SecureAgentics

import type { Config } from 'tailwindcss'

const config: Config = {
Expand Down
3 changes: 3 additions & 0 deletions integrations/claude-code/adrian_cc/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) 2026 SecureAgentics

"""Adrian for Claude Code - runtime security monitoring via hooks.

Intercepts Claude Code tool calls through the native hooks system,
Expand Down
3 changes: 3 additions & 0 deletions integrations/claude-code/adrian_cc/agent.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#!/usr/bin/env python3
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) 2026 SecureAgentics

"""Adrian CC Plugin - Claude Code hook handler.

Each hook invocation:
Expand Down
2 changes: 2 additions & 0 deletions integrations/claude-code/adrian_cc/proto/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) 2026 SecureAgentics
3 changes: 3 additions & 0 deletions integrations/claude-code/adrian_cc/proto/buf/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) 2026 SecureAgentics

"""Vendored buf.validate protobuf stubs."""
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) 2026 SecureAgentics

"""Vendored buf.validate protobuf validation stubs."""
3 changes: 3 additions & 0 deletions integrations/claude-code/adrian_cc/tracker.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) 2026 SecureAgentics

"""Stateful tracker for Claude Code sessions.

Maintains three pieces of state across hook calls within a daemon:
Expand Down
3 changes: 3 additions & 0 deletions integrations/claude-code/adrian_cc/transcript.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) 2026 SecureAgentics

"""Transcript parser - extracts reasoning, user prompts, and invocation context.

Claude Code's transcript is a JSONL file where each line is a
Expand Down
2 changes: 2 additions & 0 deletions integrations/claude-code/bin/adrian-python
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/usr/bin/env sh
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) 2026 SecureAgentics
# Cross-platform launcher for the Adrian Claude Code plugin.
# Linux/macOS run this directly. On Windows, Claude Code's default hook shell
# is Git Bash, which runs this too (the adrian-python.cmd sibling covers
Expand Down
2 changes: 2 additions & 0 deletions integrations/claude-code/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) 2026 SecureAgentics
3 changes: 3 additions & 0 deletions integrations/claude-code/tests/test_agent.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) 2026 SecureAgentics

# pyright: reportPrivateUsage=false
"""Tests for the hook agent - event building, verdict handling, mode logic."""

Expand Down
3 changes: 3 additions & 0 deletions integrations/claude-code/tests/test_integration.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) 2026 SecureAgentics

"""Integration tests - full hook flow against the live Adrian backend.

These tests require the Adrian backend running on localhost:8080 with
Expand Down
3 changes: 3 additions & 0 deletions integrations/claude-code/tests/test_multi_agent.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) 2026 SecureAgentics

"""Multi-agent integration tests - nested sub-agents, parallel agents, full DB verification.

Tests the complete flow: Claude Code → Plugin → Adrian Backend with
Expand Down
3 changes: 3 additions & 0 deletions integrations/claude-code/tests/test_state_and_subagent.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) 2026 SecureAgentics

# pyright: reportPrivateUsage=false
"""Tests for the state locking/atomic-write machinery, the sub-agent hierarchy
stack helpers, and the deterministic transcript-by-agent_id prompt recovery."""
Expand Down
Loading
Loading