@azmxailabs/agent-sdk 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Shared provider types — minimal, intentionally close to the union of
3
+ * OpenAI-shape and Anthropic-shape APIs so adapters can translate
4
+ * losslessly in both directions.
5
+ */
6
+ export type Role = "system" | "user" | "assistant";
7
+ export interface ChatMessage {
8
+ role: Role;
9
+ content: string;
10
+ }
11
+ export interface ChatRequest {
12
+ /** Logical model alias registered in the router (NOT the provider's model id). */
13
+ model: string;
14
+ messages: ChatMessage[];
15
+ /** Temperature 0..2. */
16
+ temperature?: number;
17
+ /** Max tokens to generate. */
18
+ maxTokens?: number;
19
+ /** Stop sequences. */
20
+ stop?: string[];
21
+ /** Provider-specific overrides; forwarded as-is. */
22
+ providerOptions?: Record<string, unknown>;
23
+ /** AbortSignal — adapter MUST honor it. */
24
+ signal?: AbortSignal;
25
+ }
26
+ export interface ChatResponse {
27
+ /** Concatenated text content. */
28
+ text: string;
29
+ /** Reason the provider stopped: "stop", "length", "abort", "error" etc. */
30
+ finishReason: string;
31
+ /** Usage if the provider reports it. */
32
+ usage?: TokenUsage;
33
+ /** The raw provider response, for callers that need it. */
34
+ raw?: unknown;
35
+ }
36
+ export interface TokenUsage {
37
+ inputTokens: number;
38
+ outputTokens: number;
39
+ /** Some providers (Anthropic) report cache hits — surface them. */
40
+ cacheReadTokens?: number;
41
+ cacheCreationTokens?: number;
42
+ }
43
+ export interface StreamChunk {
44
+ /** Incremental text — append in order. */
45
+ delta: string;
46
+ /** Set on the final chunk only. */
47
+ done?: boolean;
48
+ /** Usage on the final chunk if provider reports it. */
49
+ usage?: TokenUsage;
50
+ /** Finish reason on the final chunk. */
51
+ finishReason?: string;
52
+ }
53
+ /**
54
+ * Provider — implement this to add a new BYOK backend. The SDK doesn't
55
+ * inspect the body; it just calls .complete or .stream and surfaces
56
+ * whatever you return. Errors should throw with a clear message.
57
+ */
58
+ export interface Provider {
59
+ /** Stable identifier for logs / errors. */
60
+ readonly name: string;
61
+ complete(req: ChatRequest): Promise<ChatResponse>;
62
+ stream(req: ChatRequest): AsyncIterable<StreamChunk>;
63
+ }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Shared provider types — minimal, intentionally close to the union of
3
+ * OpenAI-shape and Anthropic-shape APIs so adapters can translate
4
+ * losslessly in both directions.
5
+ */
6
+ export {};
@@ -0,0 +1,41 @@
1
+ /**
2
+ * DenyList — refuses sensitive file paths by glob.
3
+ *
4
+ * Default list matches AZMX's desktop app defaults: .env, .ssh, common
5
+ * credential files, well-known token paths, and the SDK's own secrets.
6
+ * Extend with .add() / .addAll(); replace with .reset().
7
+ *
8
+ * Globs supported:
9
+ * * any chars except /
10
+ * ** any chars including /
11
+ * ? single char except /
12
+ * [abc] character class
13
+ *
14
+ * Matches are case-sensitive on Linux/macOS and case-insensitive on Windows
15
+ * (caller passes `caseInsensitive: true` to the constructor).
16
+ */
17
+ export declare const DEFAULT_DENY_LIST: readonly string[];
18
+ export interface DenyListOptions {
19
+ caseInsensitive?: boolean;
20
+ }
21
+ export declare class DenyList {
22
+ private patterns;
23
+ private caseInsensitive;
24
+ private sources;
25
+ constructor(initial?: readonly string[], opts?: DenyListOptions);
26
+ add(glob: string): void;
27
+ addAll(globs: readonly string[]): void;
28
+ reset(globs?: readonly string[]): void;
29
+ /** true if the path matches any pattern. */
30
+ matches(path: string): boolean;
31
+ /** Returns every source glob that matched (debug / explainability). */
32
+ matching(path: string): string[];
33
+ /** Snapshot of the current rule set. */
34
+ list(): readonly string[];
35
+ }
36
+ import type { Policy } from "../approval/gate.js";
37
+ /**
38
+ * Convenience: a Policy that denies any file:* or shell action that
39
+ * touches a deny-listed path. Plug into ApprovalGate.use().
40
+ */
41
+ export declare function denyListPolicy(deny?: DenyList): Policy;
Binary file
@@ -0,0 +1 @@
1
+ export * from "./deny-list.js";
@@ -0,0 +1 @@
1
+ export * from "./deny-list.js";
package/package.json ADDED
@@ -0,0 +1,78 @@
1
+ {
2
+ "name": "@azmxailabs/agent-sdk",
3
+ "version": "0.1.0",
4
+ "description": "Build approval-gated AI agents with the same primitives that power AZMX AI — BYOK provider router, approval gate, deny-list, hash-chained audit log. Secure by default, BYOK direct (no proxy), no telemetry.",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "homepage": "https://azmx.ai",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/AzmxAI/azmx.git",
11
+ "directory": "packages/agent-sdk"
12
+ },
13
+ "bugs": {
14
+ "url": "https://github.com/AzmxAI/azmx/issues"
15
+ },
16
+ "keywords": [
17
+ "azmx",
18
+ "azmx-ai",
19
+ "azmxai",
20
+ "azmxailabs",
21
+ "agent",
22
+ "ai-agent",
23
+ "agent-sdk",
24
+ "approval-gate",
25
+ "byok",
26
+ "anthropic",
27
+ "openai",
28
+ "ollama",
29
+ "audit-log",
30
+ "deny-list",
31
+ "sovereign-ai",
32
+ "local-ai"
33
+ ],
34
+ "main": "./dist/index.js",
35
+ "types": "./dist/index.d.ts",
36
+ "exports": {
37
+ ".": {
38
+ "types": "./dist/index.d.ts",
39
+ "import": "./dist/index.js"
40
+ },
41
+ "./approval": {
42
+ "types": "./dist/approval/index.d.ts",
43
+ "import": "./dist/approval/index.js"
44
+ },
45
+ "./security": {
46
+ "types": "./dist/security/index.d.ts",
47
+ "import": "./dist/security/index.js"
48
+ },
49
+ "./audit": {
50
+ "types": "./dist/audit/index.d.ts",
51
+ "import": "./dist/audit/index.js"
52
+ },
53
+ "./providers": {
54
+ "types": "./dist/providers/index.d.ts",
55
+ "import": "./dist/providers/index.js"
56
+ }
57
+ },
58
+ "files": [
59
+ "dist",
60
+ "README.md",
61
+ "LICENSE"
62
+ ],
63
+ "engines": {
64
+ "node": ">=18"
65
+ },
66
+ "scripts": {
67
+ "build": "tsc -p tsconfig.json",
68
+ "dev": "tsc -p tsconfig.json --watch",
69
+ "clean": "rm -rf dist",
70
+ "test": "node --test dist/**/*.test.js",
71
+ "prepublishOnly": "npm run clean && npm run build"
72
+ },
73
+ "dependencies": {},
74
+ "devDependencies": {
75
+ "@types/node": "^20.14.10",
76
+ "typescript": "^5.5.3"
77
+ }
78
+ }