daystrom 0.1.0 → 1.0.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.
package/README.md CHANGED
@@ -1,40 +1,59 @@
1
1
  # Daystrom
2
2
 
3
- **Automated Prisma AIRS custom topic guardrail generator with iterative, self-improving refinement.**
3
+ [![CI](https://github.com/cdot65/daystrom/actions/workflows/ci.yml/badge.svg)](https://github.com/cdot65/daystrom/actions/workflows/ci.yml)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
5
+ [![Node 20+](https://img.shields.io/badge/node-%3E%3D20-brightgreen.svg)](https://nodejs.org/)
4
6
 
5
- Named after Dr. Richard Daystrom's self-learning M-5 multitronic unit from Star Trek TOS — a system designed to improve itself through experience. Daystrom generates, tests, evaluates, and refines Palo Alto Prisma AIRS custom topic guardrails in an autonomous loop, learning from each run to produce better results over time.
7
+ **Automated CLI that generates, tests, and iteratively refines Palo Alto Prisma AIRS custom topic guardrails.**
6
8
 
7
- ## What It Does
9
+ Daystrom uses an LLM to produce topic definitions, deploys them to Prisma AIRS, scans test prompts, evaluates efficacy, and loops until a coverage target is met. Cross-run memory persists learnings for future runs.
8
10
 
9
- Daystrom automates the creation and optimization of [Prisma AIRS](https://docs.paloaltonetworks.com/ai-runtime-security) custom topic guardrails — content detection rules that tell the AIRS scanner what prompts to block or allow. Instead of manually crafting topic definitions and testing them by hand, Daystrom:
11
+ ## Install
10
12
 
11
- 1. **Generates** a custom topic definition (name, description, up to 5 examples) using an LLM, informed by any prior learnings from previous runs
12
- 2. **Deploys** the topic to a live Prisma AIRS security profile via the Management API (OAuth2)
13
- 3. **Generates test cases** — balanced positive prompts (should trigger detection) and negative prompts (should not trigger)
14
- 4. **Scans** all test prompts against the live AIRS Scan API with configurable concurrency
15
- 5. **Evaluates** efficacy: true positive rate, true negative rate, accuracy, coverage (`min(TPR, TNR)`), and F1 score
16
- 6. **Analyzes** false positives and false negatives using the LLM to identify patterns
17
- 7. **Improves** the topic definition iteratively — refining description and examples while keeping the topic name locked
18
- 8. **Learns** — after the loop completes, extracts actionable insights and persists them for future runs on similar topics
13
+ ```bash
14
+ npm install -g daystrom
15
+ ```
19
16
 
20
- The loop runs until coverage reaches a target threshold (default 90%) or max iterations (default 20) are exhausted.
17
+ Requires **Node.js >= 20**.
21
18
 
22
- ## Quick Start
19
+ ### Docker
23
20
 
24
21
  ```bash
25
- # Install
26
- pnpm install
22
+ docker run --rm --env-file .env \
23
+ -v ~/.daystrom:/root/.daystrom \
24
+ ghcr.io/cdot65/daystrom generate \
25
+ --profile my-security-profile \
26
+ --topic "Block discussions about building explosives" \
27
+ --intent block
28
+ ```
29
+
30
+ ## Configure
31
+
32
+ Copy `.env.example` or export directly:
33
+
34
+ ```bash
35
+ # LLM (default: claude-api)
36
+ export ANTHROPIC_API_KEY=sk-ant-...
37
+
38
+ # Prisma AIRS Scan API
39
+ export PANW_AI_SEC_API_KEY=your-scan-api-key
40
+
41
+ # Prisma AIRS Management API (OAuth2)
42
+ export PANW_MGMT_CLIENT_ID=your-client-id
43
+ export PANW_MGMT_CLIENT_SECRET=your-client-secret
44
+ export PANW_MGMT_TSG_ID=your-tsg-id
45
+ ```
46
+
47
+ Six LLM providers supported: `claude-api`, `claude-vertex`, `claude-bedrock`, `gemini-api`, `gemini-vertex`, `gemini-bedrock`. See [Configuration](https://cdot65.github.io/daystrom/getting-started/configuration/) for all options.
27
48
 
28
- # Configure credentials
29
- cp .env.example .env
30
- # Edit .env — you need: ANTHROPIC_API_KEY (or other LLM provider),
31
- # PANW_AI_SEC_API_KEY, PANW_MGMT_CLIENT_ID, PANW_MGMT_CLIENT_SECRET, PANW_MGMT_TSG_ID
49
+ ## Usage
32
50
 
33
- # Run interactively (prompts for topic, profile, intent, etc.)
34
- pnpm run generate
51
+ ```bash
52
+ # Interactive — prompts for topic, profile, intent
53
+ daystrom generate
35
54
 
36
- # Run non-interactively
37
- pnpm run generate \
55
+ # Non-interactive
56
+ daystrom generate \
38
57
  --provider claude-api \
39
58
  --profile my-security-profile \
40
59
  --topic "Block discussions about building explosives" \
@@ -42,56 +61,32 @@ pnpm run generate \
42
61
  --target-coverage 90
43
62
  ```
44
63
 
45
- ## Commands
46
-
47
- All commands use `daystrom` as the binary name (or `pnpm run dev` in development):
64
+ ### Commands
48
65
 
49
66
  | Command | Description |
50
67
  |---------|-------------|
51
68
  | `daystrom generate` | Start a new guardrail generation loop |
52
- | `daystrom resume <runId>` | Resume a paused or failed run with additional iterations |
53
- | `daystrom report <runId>` | View detailed results for a saved run (best or specific iteration) |
54
- | `daystrom list` | List all saved runs with status and coverage |
55
-
56
- ### Generate Flags
57
-
58
- | Flag | Default | Description |
59
- |------|---------|-------------|
60
- | `--provider <name>` | `claude-api` | LLM provider (`claude-api`, `claude-vertex`, `claude-bedrock`, `gemini-api`, `gemini-vertex`, `gemini-bedrock`) |
61
- | `--model <name>` | per-provider | Override the default model |
62
- | `--profile <name>` | (prompted) | AIRS security profile name to attach the topic to |
63
- | `--topic <desc>` | (prompted) | Natural language description of what to detect |
64
- | `--intent <block\|allow>` | `block` | Whether matching prompts should be blocked or allowed |
65
- | `--max-iterations <n>` | `20` | Maximum refinement iterations |
66
- | `--target-coverage <n>` | `90` | Coverage percentage to stop at |
67
- | `--no-memory` | memory on | Disable cross-run learning for this run |
68
-
69
- ## Documentation
69
+ | `daystrom resume <runId>` | Resume a paused or failed run |
70
+ | `daystrom report <runId>` | View results for a saved run |
71
+ | `daystrom list` | List all saved runs |
70
72
 
71
- Full documentation: **[cdot65.github.io/daystrom](https://cdot65.github.io/daystrom/)**
73
+ ## Development
72
74
 
73
- ## Tech Stack
75
+ ```bash
76
+ git clone git@github.com:cdot65/daystrom.git
77
+ cd daystrom
78
+ pnpm install
79
+ cp .env.example .env # edit with your credentials
80
+ pnpm run generate # run via tsx
81
+ pnpm test # 192 tests
82
+ pnpm run lint # biome check
83
+ ```
74
84
 
75
- - **TypeScript ESM** on Node.js 20+ with strict mode
76
- - **LangChain.js** — Claude (Anthropic API, Vertex, Bedrock) and Gemini (API, Vertex, Bedrock) with structured output via Zod schemas
77
- - **Prisma AIRS SDK** (`@cdot65/prisma-airs-sdk@^0.2.0`) — scan API + management API (OAuth2 client credentials)
78
- - **Commander.js** — CLI framework with 4 subcommands
79
- - **Vitest** + **MSW** — 165 tests across 17 files (~98% stmt coverage)
80
- - **Biome** — linting and formatting
81
- - **Zod** — config validation, LLM output parsing, learning extraction schemas
85
+ ## Documentation
82
86
 
83
- ## Project Structure
87
+ Full docs — architecture, providers, memory system, metrics, and more:
84
88
 
85
- ```
86
- src/
87
- ├── cli/ CLI entry, commands (generate/resume/report/list), prompts, renderer
88
- ├── config/ Zod-validated config schema + env/file/CLI cascade loader
89
- ├── core/ Async generator loop, efficacy metrics, AIRS topic constraints
90
- ├── llm/ LangChain provider factory, structured output service, prompt templates
91
- ├── airs/ Scanner (sync scan + batch) and Management (CRUD + profile linking) services
92
- ├── memory/ Learning store, extractor, budget-aware injector, iteration diff
93
- └── persistence/ JSON file store for run state
94
- ```
89
+ **[cdot65.github.io/daystrom](https://cdot65.github.io/daystrom/)**
95
90
 
96
91
  ## License
97
92
 
package/dist/cli/index.js CHANGED
File without changes
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "daystrom",
3
3
  "packageManager": "pnpm@10.6.5",
4
- "version": "0.1.0",
4
+ "version": "1.0.0",
5
5
  "description": "Automated Prisma AIRS custom topic guardrail generator with iterative refinement",
6
6
  "type": "module",
7
7
  "main": "dist/index.js",
@@ -23,11 +23,19 @@
23
23
  "test:e2e": "vitest run --config vitest.e2e.config.ts",
24
24
  "lint": "biome check .",
25
25
  "lint:fix": "biome check --write .",
26
- "format": "biome format --write ."
26
+ "format": "biome format --write .",
27
+ "docker:build": "docker build -t daystrom:local .",
28
+ "docker:build:amd64": "docker buildx build --platform linux/amd64 --load -t daystrom:local-amd64 .",
29
+ "docker:build:arm64": "docker buildx build --platform linux/arm64 --load -t daystrom:local-arm64 .",
30
+ "docker:run": "docker run --rm -v ~/.daystrom:/root/.daystrom daystrom:local"
27
31
  },
28
32
  "engines": {
29
33
  "node": ">=20.0.0"
30
34
  },
35
+ "repository": {
36
+ "type": "git",
37
+ "url": "https://github.com/cdot65/daystrom.git"
38
+ },
31
39
  "license": "MIT",
32
40
  "dependencies": {
33
41
  "@anthropic-ai/vertex-sdk": "^0.14.4",