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.
Files changed (103) hide show
  1. package/.claude/settings.local.json +9 -0
  2. package/.coaia/pde/d77620fc-1cd9-47e2-ba00-c03e114e42e9.jsonl +16 -0
  3. package/.coaia/pde/de44d838-b58b-4e91-b791-dd3b0f940ed1.jsonl +60 -0
  4. package/.gemini/settings.json +8 -0
  5. package/.hch/issue_.env +4 -0
  6. package/.hch/issue_add__2601211715.json +77 -0
  7. package/.hch/issue_add__2601211715.md +4 -0
  8. package/.hch/issue_add__2602242020.json +78 -0
  9. package/.hch/issue_add__2602242020.md +7 -0
  10. package/.hch/issues.json +2312 -0
  11. package/.hch/issues.md +30 -0
  12. package/260123084839.coaia-narrative.autoRevisionOfInitial_NewStructuralTensionChart-to-initiate-HierarchicalThinking.txt +5 -0
  13. package/2602010101.issue.txt +31 -0
  14. package/BUGS.md +242 -0
  15. package/CLAUDE.md +2 -0
  16. package/ENHANCEMENTS.md +129 -0
  17. package/FEATURES_ENDING_SESSIONS.md +21 -0
  18. package/FIXES.md +114 -0
  19. package/GUILLAUME.md +77 -0
  20. package/KINSHIP.md +50 -0
  21. package/LAUNCH__session_id__MiaCodeNextWorkReviewAndCommits_2601312020.sh +7 -0
  22. package/PHASE_2.md +153 -0
  23. package/PHASE_2_IMPLEMENTATION.md +134 -0
  24. package/README.md +203 -0
  25. package/RESUME__issueMaker__540244c2-b096-40d8-8c3f-398408d3e0eb.2602041757.sh +1 -0
  26. package/RUN_COPILOT_with_related_folders__260130.sh +2 -0
  27. package/WS__mia-code__260214__IAIP_PDE.code-workspace +29 -0
  28. package/WS__mia-code__src332__260122.code-workspace +23 -0
  29. package/_env.sh +12 -0
  30. package/dist/cli.d.ts +11 -0
  31. package/dist/cli.js +679 -0
  32. package/dist/commands.d.ts +43 -0
  33. package/dist/commands.js +108 -0
  34. package/dist/config.d.ts +8 -0
  35. package/dist/config.js +57 -0
  36. package/dist/formatting.d.ts +12 -0
  37. package/dist/formatting.js +133 -0
  38. package/dist/geminiHeadless.d.ts +25 -0
  39. package/dist/geminiHeadless.js +246 -0
  40. package/dist/index.d.ts +2 -0
  41. package/dist/index.js +186 -0
  42. package/dist/mcp/config-generator.d.ts +23 -0
  43. package/dist/mcp/config-generator.js +116 -0
  44. package/dist/mcp/index.d.ts +18 -0
  45. package/dist/mcp/index.js +43 -0
  46. package/dist/mcp/miaco-server.d.ts +15 -0
  47. package/dist/mcp/miaco-server.js +161 -0
  48. package/dist/mcp/miatel-server.d.ts +15 -0
  49. package/dist/mcp/miatel-server.js +123 -0
  50. package/dist/mcp/miawa-server.d.ts +15 -0
  51. package/dist/mcp/miawa-server.js +125 -0
  52. package/dist/mcp/utils.d.ts +51 -0
  53. package/dist/mcp/utils.js +76 -0
  54. package/dist/multiline-input.d.ts +98 -0
  55. package/dist/multiline-input.js +630 -0
  56. package/dist/narrative/index.d.ts +9 -0
  57. package/dist/narrative/index.js +11 -0
  58. package/dist/narrative/router.d.ts +89 -0
  59. package/dist/narrative/router.js +186 -0
  60. package/dist/narrative/tracer.d.ts +75 -0
  61. package/dist/narrative/tracer.js +180 -0
  62. package/dist/sessionStore.d.ts +10 -0
  63. package/dist/sessionStore.js +93 -0
  64. package/dist/types.d.ts +44 -0
  65. package/dist/types.js +1 -0
  66. package/dist/unifier.d.ts +6 -0
  67. package/dist/unifier.js +147 -0
  68. package/issue-358--architecture/ARCHITECTURE_OVERVIEW.md +60 -0
  69. package/issue-358--architecture/CLI_INTEGRATION.md +61 -0
  70. package/issue-358--architecture/COVER_ART_BRIEF.md +68 -0
  71. package/issue-358--architecture/MEMORY_SYSTEM.md +89 -0
  72. package/issue-358--architecture/PERSONA_REGISTRY.md +97 -0
  73. package/issue-358--architecture/PODCAST_PRODUCTION_PLAN.md +61 -0
  74. package/issue-358--architecture/PODCAST_SCRIPT_FINAL.md +109 -0
  75. package/issue-358--architecture/PROTOTYPE_CHARACTER_SPEC.md +59 -0
  76. package/issue-358--architecture/RESOURCES.md +41 -0
  77. package/issue-358--architecture/TEAM_LISTENING_GUIDE.md +53 -0
  78. package/llms-gemini-cli.txt +145 -0
  79. package/package.json +39 -0
  80. package/samples/copilot/session-state/be76abaa-a27f-4725-b2a9-22fb45f7e0f7/checkpoints/index.md +6 -0
  81. package/samples/copilot/session-state/be76abaa-a27f-4725-b2a9-22fb45f7e0f7/events.jsonl +213 -0
  82. package/samples/copilot/session-state/be76abaa-a27f-4725-b2a9-22fb45f7e0f7/plan.md +243 -0
  83. package/samples/copilot/session-state/be76abaa-a27f-4725-b2a9-22fb45f7e0f7/workspace.yaml +5 -0
  84. package/src/cli.ts +742 -0
  85. package/src/commands.ts +127 -0
  86. package/src/config.ts +67 -0
  87. package/src/formatting.ts +157 -0
  88. package/src/geminiHeadless.ts +300 -0
  89. package/src/index.ts +194 -0
  90. package/src/mcp/config-generator.ts +141 -0
  91. package/src/mcp/index.ts +55 -0
  92. package/src/mcp/miaco-server.ts +199 -0
  93. package/src/mcp/miatel-server.ts +138 -0
  94. package/src/mcp/miawa-server.ts +158 -0
  95. package/src/mcp/utils.ts +121 -0
  96. package/src/multiline-input.ts +739 -0
  97. package/src/narrative/index.ts +33 -0
  98. package/src/narrative/router.ts +260 -0
  99. package/src/narrative/tracer.ts +249 -0
  100. package/src/sessionStore.ts +111 -0
  101. package/src/types.ts +49 -0
  102. package/src/unifier.ts +171 -0
  103. 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
@@ -0,0 +1,5 @@
1
+ id: be76abaa-a27f-4725-b2a9-22fb45f7e0f7
2
+ summary_count: 0
3
+ created_at: 2026-01-23T12:45:07.084Z
4
+ updated_at: 2026-01-23T12:49:44.989Z
5
+ summary: we will want our whole layer that deals with updating prices, indicators and signals (most likely @j...