Package Exports
- @opena2a/shared
- @opena2a/shared/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@opena2a/shared) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
@opena2a/shared
Shared types, config schema, and utilities for the OpenA2A platform.
Install
npm install @opena2a/sharedWhat's Inside
This package provides the common foundation used by opena2a-cli and other OpenA2A tools:
- Project config --
loadProjectConfig()reads and validates.opena2a.yml/opena2a.config.jsonusing Zod schemas - User config --
loadUserConfig()/saveUserConfig()manage per-user preferences stored in~/.opena2a/ - Scan history --
loadScanHistory()/appendScanEntry()track past scan results locally - Shared types --
AdapterType,AdapterResult,Finding, and other interfaces used across adapters
Usage
import {
loadProjectConfig,
loadUserConfig,
saveUserConfig,
isContributeEnabled,
loadScanHistory,
appendScanEntry,
} from '@opena2a/shared';
// Load project config from current directory
const config = loadProjectConfig('./');
// Check user preferences
const userConfig = loadUserConfig();
console.log('Contribute enabled:', isContributeEnabled());
// Track scan history
appendScanEntry({
tool: 'hackmyagent',
target: 'my-project',
score: 85,
timestamp: new Date().toISOString(),
});API
| Export | Description |
|---|---|
loadProjectConfig(dir) |
Load and validate project config from a directory |
projectConfigSchema |
Zod schema for project configuration |
loadUserConfig() |
Load user preferences from ~/.opena2a/ |
saveUserConfig(config) |
Persist user preferences |
isContributeEnabled() |
Check if anonymous data contribution is enabled |
setContributeEnabled(bool) |
Toggle data contribution |
loadScanHistory() |
Load local scan history |
appendScanEntry(entry) |
Add a scan result to history |
getLastScan() |
Get the most recent scan entry |
getRecentScans() |
Get recent scan entries |
Part of OpenA2A
This is an internal package used by opena2a-cli and other OpenA2A tools. For the CLI, see the main repository.
License
Apache-2.0