directlx-claude-config/plans/floofy-chasing-origami.md

181 lines
5.7 KiB
Markdown

# HiveOps Browser: Agent Download & Properties File Features
## Summary
Add two new menu items to the File menu:
1. **Download Agent** - Downloads hiveops-agent binary from API endpoint
2. **Create Agent Properties** - Opens popup to create hiveops.properties and ext/ej.properties files
---
## Files to Modify
| File | Changes |
|------|---------|
| `src/main/main.js` | Add menu items, window handlers, IPC handlers |
| `src/main/preload.js` | Add IPC bridge methods |
| `src/main/api-client.js` | Add `downloadAgent()` method |
## New Files to Create
| File | Purpose |
|------|---------|
| `src/renderer/agent-properties.html` | Properties form dialog UI (tabbed) |
| `src/renderer/agent-properties.js` | Properties form logic |
| `src/renderer/download-progress.html` | Download progress dialog |
---
## Feature 1: Download Agent
### Menu Item
- Location: File menu, after "License Management"
- Label: "Download Agent"
### Behavior
1. Auto-detect platform (Windows/Linux/macOS)
2. Show native save dialog with default filename
3. Download from API: `GET /api/v1/agent/download?platform={platform}`
4. Show progress dialog during download
5. Set executable permissions on Linux/macOS
6. Show success/error message
---
## Feature 2: Create Agent Properties
### Menu Item
- Location: File menu, after "Download Agent"
- Label: "Create Agent Properties"
### UI Design: Tabbed Dialog
Two tabs: **Main Config** and **Journal Extension**
---
### Tab 1: Main Config (hiveops.properties)
#### Section: HiveOps Management Server
| Field | Default | Description |
|-------|---------|-------------|
| `mgmt.endpoint` | `https://mgmt.directlx.dev/` | HiveOps management server URL |
| `mgmt.api.key` | (empty) | API key for management server |
#### Section: SmartJournal Server (Journal Upload)
| Field | Default | Description |
|-------|---------|-------------|
| `server.endpoint` | (required) | SmartJournal server URL |
| `server.host` | (empty) | Override HTTP host header |
| `server.to.connect` | `10000` | Connection timeout (ms) |
| `server.to.read` | `10000` | Read timeout (ms) |
| `heartbeat.interval` | `5` | Heartbeat interval (minutes) |
#### Section: ATM Identification
| Field | Default | Description |
|-------|---------|-------------|
| `atm.id` | (required) | ATM identifier (4-40 chars) |
| `atm.transit` | (empty) | ATM transit code |
| `country` | `US` | ISO 3166-1 country code (2 chars) |
#### Section: Windows Registry (collapsible, optional)
| Field | Default | Description |
|-------|---------|-------------|
| `atm.idRegistryKey` | (empty) | Registry key for ATM ID |
| `atm.idRegistryValue` | (empty) | Registry value for ATM ID |
| `atm.transitRegistryKey` | (empty) | Registry key for transit |
| `atm.transitRegistryValue` | (empty) | Registry value for transit |
#### Section: Incident Integration
| Field | Default | Description |
|-------|---------|-------------|
| `incident.endpoint` | `http://localhost:8080` | Incident server URL |
| `incident.events.enabled` | `true` | Enable event reporting |
| `incident.events.recheck.delay.msec` | `5000` | Recheck delay (ms) |
| `incident.events.batch.size` | `100` | Event batch size |
| `incident.to.connect` | `10000` | Incident connect timeout |
| `incident.to.read` | `30000` | Incident read timeout |
#### Section: Task Settings
| Field | Default | Description |
|-------|---------|-------------|
| `task.network.cap` | `0.5` | Network utilization cap (0-1) |
| `task.network.retries` | `5` | Upload retry attempts |
#### Section: Directories
| Field | Default | Description |
|-------|---------|-------------|
| `ext.directory` | `ext` | Extensions directory |
| `script.directory` | (empty) | Scripts directory |
| `modules.disabled` | (empty) | Comma-separated disabled modules |
---
### Tab 2: Journal Extension (ext/ej.properties)
#### Section: Journal Location
| Field | Default | Description |
|-------|---------|-------------|
| `journal.dir` | `/opt/hiveops/journal` | Journal directory path |
| `type` | `MAINJOURNAL` | Journal type identifier |
#### Section: Journal Format
| Field | Default | Description |
|-------|---------|-------------|
| `journal.jrntype` | (dropdown) | Journal parser type |
| `filename.format` | `{YYYY}{MM}{DD}.jrn` | Filename pattern |
| `file.format` | `UTF8` | File encoding (UTF8/UTF16LE) |
**journal.jrntype options:**
- PT
- SCOTIABANK_CB
- SCOTIABANK
- HYOSUNG_HIP
- HYOSUNG_FIS
#### Section: Upload Settings
| Field | Default | Description |
|-------|---------|-------------|
| `chunk.max` | `100000` | Max chunk size (bytes) |
| `chunk.delay.msec` | `0` | Delay between chunks (ms) |
| `update.delay.msec` | `300000` | Verification delay (ms) |
---
### Save Behavior
1. User clicks "Save Properties"
2. Show folder picker dialog
3. Create selected folder structure:
```
chosen-folder/
├── hiveops.properties
└── ext/
└── ej.properties
```
4. Show success message with path
---
## Implementation Order
1. **api-client.js** - Add `downloadAgent()` method
2. **preload.js** - Add IPC bridge methods
3. **main.js** - Add menu items, windows, IPC handlers
4. **download-progress.html** - Progress bar UI
5. **agent-properties.html** - Tabbed form with all fields
6. **agent-properties.js** - Form handling, validation, save logic
---
## Verification
1. Launch app: `npm start`
2. File menu should show "Download Agent" and "Create Agent Properties"
3. Test Download Agent:
- Verify save dialog appears
- Verify progress bar during download
- Verify executable permissions set (Linux/macOS)
4. Test Create Agent Properties:
- Verify tabbed dialog opens
- Fill required fields (atm.id, server.endpoint, mgmt.endpoint)
- Click Save, choose folder
- Verify `hiveops.properties` and `ext/ej.properties` created with correct content