JSPM

@opena2a/shared

0.1.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 165
  • Score
    100M100P100Q92317F
  • License Apache-2.0

Shared types, config schema, and utilities for the OpenA2A platform

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

npm version License: Apache-2.0

Shared types, config schema, and utilities for the OpenA2A platform.

Install

npm install @opena2a/shared

What'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.json using 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