open-index/open-npm huggingface dataset:
npm package: @moshesdk/adapter-generic-tools
Description: MosheSDK generic tool adapter — wrap any tool call through the safety pipeline
Latest version: 0.1.2

# @moshesdk/adapter-generic-tools

`@moshesdk/adapter-generic-tools` provides lightweight wrapper helpers that turn normal tool, command, outbound request, and message-send calls into MosheSDK policy checks. It sits between your agent code and the engine so you can integrate enforcement without manually building `ActionEnvelope` objects.

## Installation

If you already use `@moshesdk/sdk`, this adapter is included through the top-level SDK export surface.

For custom integrations that only need the adapter layer:

```bash
pnpm add @moshesdk/adapter-generic-tools @moshesdk/core @moshesdk/spec
```

## Basic Usage

```typescript
import { GenericAdapter, Moshe } from '@moshesdk/sdk';

const moshe = new Moshe({
  policy: { version: '0.1.0', forbiddenCommands: ['rm\\s+-rf\\s+/'] },
  store: new MemoryStore(),
  onError: 'BLOCK',
  onUnhandledReview: 'BLOCK'
});

const adapter = new GenericAdapter(moshe.withSession('session-1'));

await adapter.wrapCommand({
  command: 'ls -la',
  execute: async () => 'ok'
});

await adapter.wrapToolCall({
  toolName: 'search',
  arguments: { params: { q: 'docs' } },
  execute: async () => ['result']
});

await adapter.wrapOutbound({
  url: 'https://api.example.com/data',
  method: 'POST',
  execute: async () => ({ ok: true })
});

await adapter.wrapMessage({
  recipients: ['a@example.com'],
  subject: 'Hello',
  body: 'World',
  execute: async () => 'sent'
});
```

## Error Handling

```typescript
import { BlockedActionError, ReviewRequiredError } from '@moshesdk/sdk';

try {
  await adapter.wrapCommand({
    command: 'rm -rf /',
    execute: async () => 'never'
  });
} catch (error) {
  if (error instanceof BlockedActionError) {
    console.log(error.decision.reasonCodes);
  }

  if (error instanceof ReviewRequiredError) {
    console.log(error.approvalRequest?.approvalId);
  }
}
```

## SessionEvaluator

Any object with a compatible `evaluate()` method can be used as the adapter backend. In practice this is usually `moshe.withSession(sessionId)`, but the adapter does not require a concrete `Moshe` class instance.
npm package: @moshesdk/adapter-openai
Description: MosheSDK OpenAI tool-call adapter — no openai SDK dependency required
Latest version: 0.1.2

# @moshesdk/adapter-openai

Thin OpenAI tool-call adapter for MosheSDK. It translates OpenAI-style function tool calls into `GenericAdapter` calls without depending on the OpenAI SDK.
npm package: @moshesdk/sdk
Description: TypeScript SDK for MosheSDK — runtime security for AI agents
Latest version: 0.1.2

# @moshesdk/sdk

TypeScript SDK for [MosheSDK](../../README.md) — runtime security for AI agents.

## Installation

```bash
pnpm add @moshesdk/sdk
# or
npm install @moshesdk/sdk
```

Requires Node.js ≥ 18. Zero mandatory runtime dependencies.

## Quick Start

```typescript
import { GenericAdapter, MemoryStore, Moshe } from '@moshesdk/sdk';

const moshe = new Moshe({
  policy: {
    forbiddenCommands: ['rm\\s+-rf'],
    forbiddenFiles: ['.env'],
    sensitiveFiles: ['id_rsa']
  },
  store: new MemoryStore(),
  onError: 'BLOCK',
  onUnhandledReview: 'BLOCK'
});

const session = moshe.withSession('run-001');
const adapter = new GenericAdapter(session, { framework: 'my-agent' });

const result = await adapter.wrapCommand({
  command: 'ls -la',
  toolName: 'shell',
  execute: async () => runShell('ls -la')
});
```

## Adapters

```typescript
import { AnthropicAdapter, OpenAIAdapter } from '@moshesdk/sdk';

// OpenAI tool calls
const oa = new OpenAIAdapter(session);
const result = await oa.wrapToolCall({ toolCall, execute });

// Anthropic tool_use blocks
const aa = new AnthropicAdapter(session);
const result = await aa.wrapToolUse({ toolUse, execute });
```

## Documentation

See the [root README](../../README.md) for the full integration guide, feature
overview, and use cases.
npm package: @moshesdk/store-file
Description: MosheSDK file-backed session, artifact, and approval store
Latest version: 0.1.2

# @moshesdk/store-file

Atomic JSON-backed MosheSDK store for single-process persistence.

## Concurrency Contract

This store supports a single writer only in `v0.1.2`. Multiple processes writing to the same backing file path are unsupported.