mia-code 0.2.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/.claude/settings.local.json +9 -0
- package/.coaia/pde/d77620fc-1cd9-47e2-ba00-c03e114e42e9.jsonl +16 -0
- package/.coaia/pde/de44d838-b58b-4e91-b791-dd3b0f940ed1.jsonl +60 -0
- package/.gemini/settings.json +8 -0
- package/.hch/issue_.env +4 -0
- package/.hch/issue_add__2601211715.json +77 -0
- package/.hch/issue_add__2601211715.md +4 -0
- package/.hch/issue_add__2602242020.json +78 -0
- package/.hch/issue_add__2602242020.md +7 -0
- package/.hch/issues.json +2312 -0
- package/.hch/issues.md +30 -0
- package/260123084839.coaia-narrative.autoRevisionOfInitial_NewStructuralTensionChart-to-initiate-HierarchicalThinking.txt +5 -0
- package/2602010101.issue.txt +31 -0
- package/BUGS.md +242 -0
- package/CLAUDE.md +2 -0
- package/ENHANCEMENTS.md +129 -0
- package/FEATURES_ENDING_SESSIONS.md +21 -0
- package/FIXES.md +114 -0
- package/GUILLAUME.md +77 -0
- package/KINSHIP.md +50 -0
- package/LAUNCH__session_id__MiaCodeNextWorkReviewAndCommits_2601312020.sh +7 -0
- package/PHASE_2.md +153 -0
- package/PHASE_2_IMPLEMENTATION.md +134 -0
- package/README.md +203 -0
- package/RESUME__issueMaker__540244c2-b096-40d8-8c3f-398408d3e0eb.2602041757.sh +1 -0
- package/RUN_COPILOT_with_related_folders__260130.sh +2 -0
- package/WS__mia-code__260214__IAIP_PDE.code-workspace +29 -0
- package/WS__mia-code__src332__260122.code-workspace +23 -0
- package/_env.sh +12 -0
- package/dist/cli.d.ts +11 -0
- package/dist/cli.js +679 -0
- package/dist/commands.d.ts +43 -0
- package/dist/commands.js +108 -0
- package/dist/config.d.ts +8 -0
- package/dist/config.js +57 -0
- package/dist/formatting.d.ts +12 -0
- package/dist/formatting.js +133 -0
- package/dist/geminiHeadless.d.ts +25 -0
- package/dist/geminiHeadless.js +246 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +186 -0
- package/dist/mcp/config-generator.d.ts +23 -0
- package/dist/mcp/config-generator.js +116 -0
- package/dist/mcp/index.d.ts +18 -0
- package/dist/mcp/index.js +43 -0
- package/dist/mcp/miaco-server.d.ts +15 -0
- package/dist/mcp/miaco-server.js +161 -0
- package/dist/mcp/miatel-server.d.ts +15 -0
- package/dist/mcp/miatel-server.js +123 -0
- package/dist/mcp/miawa-server.d.ts +15 -0
- package/dist/mcp/miawa-server.js +125 -0
- package/dist/mcp/utils.d.ts +51 -0
- package/dist/mcp/utils.js +76 -0
- package/dist/multiline-input.d.ts +98 -0
- package/dist/multiline-input.js +630 -0
- package/dist/narrative/index.d.ts +9 -0
- package/dist/narrative/index.js +11 -0
- package/dist/narrative/router.d.ts +89 -0
- package/dist/narrative/router.js +186 -0
- package/dist/narrative/tracer.d.ts +75 -0
- package/dist/narrative/tracer.js +180 -0
- package/dist/sessionStore.d.ts +10 -0
- package/dist/sessionStore.js +93 -0
- package/dist/types.d.ts +44 -0
- package/dist/types.js +1 -0
- package/dist/unifier.d.ts +6 -0
- package/dist/unifier.js +147 -0
- package/issue-358--architecture/ARCHITECTURE_OVERVIEW.md +60 -0
- package/issue-358--architecture/CLI_INTEGRATION.md +61 -0
- package/issue-358--architecture/COVER_ART_BRIEF.md +68 -0
- package/issue-358--architecture/MEMORY_SYSTEM.md +89 -0
- package/issue-358--architecture/PERSONA_REGISTRY.md +97 -0
- package/issue-358--architecture/PODCAST_PRODUCTION_PLAN.md +61 -0
- package/issue-358--architecture/PODCAST_SCRIPT_FINAL.md +109 -0
- package/issue-358--architecture/PROTOTYPE_CHARACTER_SPEC.md +59 -0
- package/issue-358--architecture/RESOURCES.md +41 -0
- package/issue-358--architecture/TEAM_LISTENING_GUIDE.md +53 -0
- package/llms-gemini-cli.txt +145 -0
- package/package.json +39 -0
- package/samples/copilot/session-state/be76abaa-a27f-4725-b2a9-22fb45f7e0f7/checkpoints/index.md +6 -0
- package/samples/copilot/session-state/be76abaa-a27f-4725-b2a9-22fb45f7e0f7/events.jsonl +213 -0
- package/samples/copilot/session-state/be76abaa-a27f-4725-b2a9-22fb45f7e0f7/plan.md +243 -0
- package/samples/copilot/session-state/be76abaa-a27f-4725-b2a9-22fb45f7e0f7/workspace.yaml +5 -0
- package/src/cli.ts +742 -0
- package/src/commands.ts +127 -0
- package/src/config.ts +67 -0
- package/src/formatting.ts +157 -0
- package/src/geminiHeadless.ts +300 -0
- package/src/index.ts +194 -0
- package/src/mcp/config-generator.ts +141 -0
- package/src/mcp/index.ts +55 -0
- package/src/mcp/miaco-server.ts +199 -0
- package/src/mcp/miatel-server.ts +138 -0
- package/src/mcp/miawa-server.ts +158 -0
- package/src/mcp/utils.ts +121 -0
- package/src/multiline-input.ts +739 -0
- package/src/narrative/index.ts +33 -0
- package/src/narrative/router.ts +260 -0
- package/src/narrative/tracer.ts +249 -0
- package/src/sessionStore.ts +111 -0
- package/src/types.ts +49 -0
- package/src/unifier.ts +171 -0
- package/tsconfig.json +15 -0
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
# JGT Data Service - Docker Container Architecture Plan
|
|
2
|
+
|
|
3
|
+
## 📋 Problem Statement
|
|
4
|
+
|
|
5
|
+
Create a Docker-containerized data service layer that:
|
|
6
|
+
1. Manages market data (PDS/CDS/TTF/MLF) with filesystem persistence
|
|
7
|
+
2. Self-refreshes based on timeframe schedules (H1 at :00, m15 at :15/:30/:45/:00, m5 every 5min)
|
|
8
|
+
3. Exposes a versatile REST API for data distribution
|
|
9
|
+
4. Supports broker configuration
|
|
10
|
+
5. Provides MCP wrapper for jgt-code and agent integration
|
|
11
|
+
6. Remains compatible with future jgtml/FDBScanner container
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## 🎯 Proposed Approach: JGT Data Server (`jgt-data-server`)
|
|
16
|
+
|
|
17
|
+
A single Docker Compose stack with two services:
|
|
18
|
+
1. **jgt-data-server** - Python FastAPI service (data refresh + API)
|
|
19
|
+
2. **jgt-data-mcp** - Node.js MCP server (wraps the API for agent access)
|
|
20
|
+
|
|
21
|
+
### Architecture
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
┌─────────────────────────────────────────────────────────────────────┐
|
|
25
|
+
│ Docker Compose Stack: jgt-data-server │
|
|
26
|
+
├─────────────────────────────────────────────────────────────────────┤
|
|
27
|
+
│ │
|
|
28
|
+
│ ┌─────────────────────────────────┐ ┌───────────────────────────┐ │
|
|
29
|
+
│ │ jgt-data-server (Python) │ │ jgt-data-mcp (Node.js) │ │
|
|
30
|
+
│ │ - FastAPI on :8080 │ │ - MCP Server on :8090 │ │
|
|
31
|
+
│ │ - Scheduler (timeframe-based) │◄─│ - Wraps API for agents │ │
|
|
32
|
+
│ │ - Processor (jgtpy/jgtfxcon) │ │ - jgt-code compatible │ │
|
|
33
|
+
│ └─────────────────────────────────┘ └───────────────────────────┘ │
|
|
34
|
+
│ ▼ │
|
|
35
|
+
│ ┌─────────────────────────────────────────────────────────────────┐│
|
|
36
|
+
│ │ Mounted Volumes ││
|
|
37
|
+
│ │ /data/current → pds/, cds/, ttf/, mlf/ ││
|
|
38
|
+
│ │ /config → config.json, .env ││
|
|
39
|
+
│ └─────────────────────────────────────────────────────────────────┘│
|
|
40
|
+
└─────────────────────────────────────────────────────────────────────┘
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## 📡 API Design
|
|
46
|
+
|
|
47
|
+
### Base Routes
|
|
48
|
+
```
|
|
49
|
+
GET /api/v1/health
|
|
50
|
+
GET /api/v1/status
|
|
51
|
+
GET /api/v1/instruments
|
|
52
|
+
GET /api/v1/timeframes
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Data Access (per instrument/timeframe)
|
|
56
|
+
```
|
|
57
|
+
GET /api/v1/pds/{instrument}/{timeframe} # Price data
|
|
58
|
+
GET /api/v1/cds/{instrument}/{timeframe} # Signals/indicators
|
|
59
|
+
GET /api/v1/ttf/{instrument}/{timeframe} # Cross-timeframe features
|
|
60
|
+
GET /api/v1/mlf/{instrument}/{timeframe} # Meta lag features
|
|
61
|
+
|
|
62
|
+
# Latest record
|
|
63
|
+
GET /api/v1/{type}/{instrument}/{timeframe}/latest
|
|
64
|
+
|
|
65
|
+
# With query params: ?limit=100&format=json|csv
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Perspective Compositions
|
|
69
|
+
```
|
|
70
|
+
GET /api/v1/perspective/{instrument} # Full multi-TF view for charting
|
|
71
|
+
GET /api/v1/perspective/{instrument}/{timeframes} # Specific TF composition
|
|
72
|
+
|
|
73
|
+
# Response includes all data types across requested timeframes
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Service Control
|
|
77
|
+
```
|
|
78
|
+
POST /api/v1/refresh # Trigger manual refresh
|
|
79
|
+
POST /api/v1/refresh/{instrument}/{timeframe} # Specific refresh
|
|
80
|
+
|
|
81
|
+
GET /api/v1/scheduler/status # Scheduler state
|
|
82
|
+
GET /api/v1/scheduler/next # Next scheduled refresh times
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## 📁 Directory Structure
|
|
88
|
+
|
|
89
|
+
```
|
|
90
|
+
jgt-data-server/
|
|
91
|
+
├── docker-compose.yml
|
|
92
|
+
├── .env.example
|
|
93
|
+
├── README.md
|
|
94
|
+
│
|
|
95
|
+
├── server/ # Python FastAPI service
|
|
96
|
+
│ ├── Dockerfile
|
|
97
|
+
│ ├── requirements.txt
|
|
98
|
+
│ ├── pyproject.toml
|
|
99
|
+
│ ├── src/
|
|
100
|
+
│ │ ├── main.py # Entry point
|
|
101
|
+
│ │ ├── config.py # Configuration
|
|
102
|
+
│ │ ├── api/
|
|
103
|
+
│ │ │ ├── __init__.py
|
|
104
|
+
│ │ │ ├── routes.py # API routes
|
|
105
|
+
│ │ │ ├── perspectives.py # Composition endpoints
|
|
106
|
+
│ │ │ └── scheduler_routes.py
|
|
107
|
+
│ │ ├── scheduler/
|
|
108
|
+
│ │ │ ├── __init__.py
|
|
109
|
+
│ │ │ └── timeframe_scheduler.py
|
|
110
|
+
│ │ └── processor/
|
|
111
|
+
│ │ ├── __init__.py
|
|
112
|
+
│ │ └── data_processor.py
|
|
113
|
+
│ └── tests/
|
|
114
|
+
│
|
|
115
|
+
├── mcp/ # Node.js MCP wrapper
|
|
116
|
+
│ ├── Dockerfile
|
|
117
|
+
│ ├── package.json
|
|
118
|
+
│ ├── tsconfig.json
|
|
119
|
+
│ └── src/
|
|
120
|
+
│ ├── index.ts # MCP server
|
|
121
|
+
│ ├── tools.ts # Tool definitions
|
|
122
|
+
│ └── client.ts # API client
|
|
123
|
+
│
|
|
124
|
+
└── config/ # Example configuration
|
|
125
|
+
└── config.example.json
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
## ⏰ Scheduler Logic
|
|
131
|
+
|
|
132
|
+
```python
|
|
133
|
+
TIMEFRAME_REFRESH_TIMES = {
|
|
134
|
+
'm1': every_minute,
|
|
135
|
+
'm5': [0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55],
|
|
136
|
+
'm15': [0, 15, 30, 45],
|
|
137
|
+
'm30': [0, 30],
|
|
138
|
+
'H1': [0], # Every hour at :00
|
|
139
|
+
'H4': [0], # Every 4 hours (0:00, 4:00, 8:00, etc.)
|
|
140
|
+
'D1': [0], # Daily at midnight
|
|
141
|
+
'W1': [0], # Weekly (Sunday midnight)
|
|
142
|
+
'M1': [0], # Monthly (1st at midnight)
|
|
143
|
+
}
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
## 🔧 Configuration
|
|
149
|
+
|
|
150
|
+
### Environment Variables
|
|
151
|
+
```bash
|
|
152
|
+
# Broker
|
|
153
|
+
JGT_CONFIG_JSON_SECRET='{"user_id":"...","password":"...","url":"...","connection":"Demo"}'
|
|
154
|
+
# Or mount config file
|
|
155
|
+
JGT_CONFIG_PATH=/config/config.json
|
|
156
|
+
|
|
157
|
+
# Data paths
|
|
158
|
+
JGTPY_DATA=/data/current
|
|
159
|
+
JGTPY_DATA_FULL=/data/full
|
|
160
|
+
|
|
161
|
+
# Service
|
|
162
|
+
JGTPY_SERVICE_INSTRUMENTS=EUR/USD,XAU/USD,SPX500
|
|
163
|
+
JGTPY_SERVICE_TIMEFRAMES=m5,m15,H1,H4,D1
|
|
164
|
+
JGTPY_SERVICE_PARALLEL_WORKERS=4
|
|
165
|
+
JGTPY_SERVICE_WEB_PORT=8080
|
|
166
|
+
|
|
167
|
+
# Upload (optional)
|
|
168
|
+
JGTPY_DROPBOX_APP_TOKEN=...
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
## 🔌 MCP Integration
|
|
174
|
+
|
|
175
|
+
MCP tools exposed to jgt-code and other agents:
|
|
176
|
+
|
|
177
|
+
```typescript
|
|
178
|
+
// Tools
|
|
179
|
+
get_market_data({ instrument, timeframe, type: 'pds'|'cds'|'ttf'|'mlf', limit? })
|
|
180
|
+
get_perspective({ instrument, timeframes?: string[] })
|
|
181
|
+
trigger_refresh({ instruments?: string[], timeframes?: string[] })
|
|
182
|
+
get_latest_signals({ instrument, timeframe })
|
|
183
|
+
get_scheduler_status()
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
---
|
|
187
|
+
|
|
188
|
+
## 📝 Workplan
|
|
189
|
+
|
|
190
|
+
### Phase 1: Core Infrastructure
|
|
191
|
+
- [ ] Create directory structure at `/b/trading/jgt-data-server/`
|
|
192
|
+
- [ ] Create Docker Compose configuration
|
|
193
|
+
- [ ] Create server Dockerfile (based on existing jgtpy/jgtfxcon patterns)
|
|
194
|
+
- [ ] Create MCP service Dockerfile
|
|
195
|
+
|
|
196
|
+
### Phase 2: Python API Server
|
|
197
|
+
- [ ] Implement main.py entry point
|
|
198
|
+
- [ ] Implement config.py (from JGTServiceConfig patterns)
|
|
199
|
+
- [ ] Implement API routes (extend existing api.py)
|
|
200
|
+
- [ ] Implement perspective composition endpoints
|
|
201
|
+
- [ ] Implement scheduler (from existing scheduler.py patterns)
|
|
202
|
+
- [ ] Implement processor (reuse existing processor.py)
|
|
203
|
+
|
|
204
|
+
### Phase 3: MCP Wrapper
|
|
205
|
+
- [ ] Create MCP package.json and TypeScript config
|
|
206
|
+
- [ ] Implement MCP server with tools
|
|
207
|
+
- [ ] Implement API client for data server
|
|
208
|
+
- [ ] Test integration with jgt-code
|
|
209
|
+
|
|
210
|
+
### Phase 4: Integration & Testing
|
|
211
|
+
- [ ] Create example configuration
|
|
212
|
+
- [ ] Create README with usage instructions
|
|
213
|
+
- [ ] Test full workflow (startup, refresh, API access, MCP)
|
|
214
|
+
- [ ] Validate compatibility with jgt-code patterns
|
|
215
|
+
|
|
216
|
+
---
|
|
217
|
+
|
|
218
|
+
## 🔗 Future Compatibility (jgtml/FDBScanner)
|
|
219
|
+
|
|
220
|
+
The architecture is designed for extension:
|
|
221
|
+
|
|
222
|
+
```yaml
|
|
223
|
+
# Future addition to docker-compose.yml
|
|
224
|
+
jgt-ml-server:
|
|
225
|
+
build: ../jgtml-server
|
|
226
|
+
depends_on:
|
|
227
|
+
- jgt-data-server
|
|
228
|
+
volumes:
|
|
229
|
+
- jgt-data:/data # Shared with data server
|
|
230
|
+
environment:
|
|
231
|
+
- JGT_DATA_API=http://jgt-data-server:8080
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
jgtml will consume data from jgt-data-server's API rather than filesystem directly.
|
|
235
|
+
|
|
236
|
+
---
|
|
237
|
+
|
|
238
|
+
## ✅ Notes
|
|
239
|
+
|
|
240
|
+
1. **Reusing existing code**: Maximum reuse from jgtpy/service/ (api.py, scheduler.py, processor.py, base.py)
|
|
241
|
+
2. **Broker config**: Using established JGT_CONFIG_JSON_SECRET pattern from jgtutils/jgtcommon.py
|
|
242
|
+
3. **jgt-code compatibility**: MCP wrapper follows same patterns as coaia-client.ts
|
|
243
|
+
4. **Volume design**: Data mounted at /data, config at /config - cleanly separable
|