@ftshare-lab/dsh-kline 0.0.0-stage → 0.6.11

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 (211) hide show
  1. package/CHANGELOG.md +611 -0
  2. package/LICENSE +21 -0
  3. package/PROVENANCE.md +13 -0
  4. package/README.en.md +171 -0
  5. package/README.md +170 -2
  6. package/chart_service.py +687 -0
  7. package/config/basic-symbols.json +570 -0
  8. package/config/dsh-kline.patch.yml +4 -0
  9. package/config/dsh-tool-catalog.json +3875 -0
  10. package/cordis.patch.yml +33 -0
  11. package/core/__init__.py +0 -0
  12. package/core/adjustment.py +16 -0
  13. package/core/calc.py +691 -0
  14. package/core/rows.py +228 -0
  15. package/core/ta_engine.py +99 -0
  16. package/docs/anonymous-market-support.md +33 -0
  17. package/docs/automatic-drawing.md +24 -0
  18. package/docs/chart-functions.md +136 -0
  19. package/docs/drawing-examples.en.md +13 -0
  20. package/docs/drawing-examples.md +13 -0
  21. package/docs/embedding.md +77 -0
  22. package/docs/fixtures/price-pattern-real-v1.json +1 -0
  23. package/docs/free-foreign-daily.md +44 -0
  24. package/docs/guide.en.md +232 -0
  25. package/docs/guide.md +248 -0
  26. package/docs/images/abc-drawing-v0.5.0.jpg +0 -0
  27. package/docs/images/channel-drawing-v0.5.0.jpg +0 -0
  28. package/docs/images/drawing-workbench-v0.5.0.jpg +0 -0
  29. package/docs/images/dsh-kline-tab-workspace.png +0 -0
  30. package/docs/images/dsh-market.png +0 -0
  31. package/docs/images/kline-news.png +0 -0
  32. package/docs/images/kline-range-stats.png +0 -0
  33. package/docs/images/kline-support.png +0 -0
  34. package/docs/images/main-chart-comparison-v0.6.9.png +0 -0
  35. package/docs/images/market-overview-v0.6.9.png +0 -0
  36. package/docs/images/natural-language-abc-wolong-2026-10-27.png +0 -0
  37. package/docs/images/natural-language-descending-channel-wolong-2026-10-27.png +0 -0
  38. package/docs/images/platform-breakout-msft-v0.6.9.png +0 -0
  39. package/docs/npm-release.md +33 -0
  40. package/docs/price-pattern-rules-v1.md +40 -0
  41. package/docs/price-pattern-samples-v1.md +42 -0
  42. package/docs/provider-adaptation.md +73 -0
  43. package/docs/release-acceptance-v0.4.0.md +46 -0
  44. package/docs/release-acceptance-v0.4.1.md +43 -0
  45. package/docs/release-acceptance-v0.5.0.md +40 -0
  46. package/docs/release-acceptance-v0.6.0.md +33 -0
  47. package/docs/release-acceptance-v0.6.1.md +19 -0
  48. package/docs/release-acceptance-v0.6.10.md +21 -0
  49. package/docs/release-acceptance-v0.6.11.md +21 -0
  50. package/docs/release-acceptance-v0.6.2.md +31 -0
  51. package/docs/release-acceptance-v0.6.3.md +25 -0
  52. package/docs/release-acceptance-v0.6.4.md +24 -0
  53. package/docs/release-acceptance-v0.6.5.md +21 -0
  54. package/docs/release-acceptance-v0.6.6.md +21 -0
  55. package/docs/release-acceptance-v0.6.7.md +18 -0
  56. package/docs/release-acceptance-v0.6.8.md +18 -0
  57. package/docs/release-acceptance-v0.6.9.md +98 -0
  58. package/docs/release-notes-v0.5.0.md +23 -0
  59. package/docs/release-notes-v0.6.0.md +11 -0
  60. package/docs/release-notes-v0.6.1.md +20 -0
  61. package/docs/release-notes-v0.6.10.md +11 -0
  62. package/docs/release-notes-v0.6.11.md +16 -0
  63. package/docs/release-notes-v0.6.2.md +14 -0
  64. package/docs/release-notes-v0.6.3.md +26 -0
  65. package/docs/release-notes-v0.6.4.md +12 -0
  66. package/docs/release-notes-v0.6.5.md +13 -0
  67. package/docs/release-notes-v0.6.6.md +13 -0
  68. package/docs/release-notes-v0.6.7.md +17 -0
  69. package/docs/release-notes-v0.6.8.md +10 -0
  70. package/docs/release-notes-v0.6.9.md +16 -0
  71. package/lib/candle-sequence.js +15 -0
  72. package/lib/chart-adjustment.js +7 -0
  73. package/lib/chart-annotations.js +33 -0
  74. package/lib/chart-applications.js +171 -0
  75. package/lib/chart-context.js +164 -0
  76. package/lib/chart-observation.js +251 -0
  77. package/lib/chart-service-status.js +82 -0
  78. package/lib/chart-source-status.js +39 -0
  79. package/lib/chart-sources.js +354 -0
  80. package/lib/client/BetterSidebarTab.js +70 -0
  81. package/lib/client/ClassicShell.js +254 -0
  82. package/lib/client/KlineContent.js +155 -0
  83. package/lib/client/PanelHost.js +46 -0
  84. package/lib/client/chart-apply.js +73 -0
  85. package/lib/client/chart-context.js +233 -0
  86. package/lib/client/chart-handoff.js +34 -0
  87. package/lib/client/chart-session-resolver.js +74 -0
  88. package/lib/client/client-context.js +1 -0
  89. package/lib/client/conversation.js +88 -0
  90. package/lib/client/default-tab.js +83 -0
  91. package/lib/client/embed.js +50 -0
  92. package/lib/client/generated-view.js +12983 -0
  93. package/lib/client/horizontal-lines.js +19 -0
  94. package/lib/client/host-options.js +41 -0
  95. package/lib/client/host-panels.js +111 -0
  96. package/lib/client/index.js +77 -0
  97. package/lib/client/mode-preferences.js +48 -0
  98. package/lib/client/native-sidebar-contract.js +45 -0
  99. package/lib/client/native-sidebar-register.js +133 -0
  100. package/lib/client/native-sidebar-services.js +1 -0
  101. package/lib/client/native-sidebar.js +98 -0
  102. package/lib/client/sidebar-integration.js +93 -0
  103. package/lib/client/ui-onboarding.js +48 -0
  104. package/lib/client/version.js +14 -0
  105. package/lib/client.js +17581 -0
  106. package/lib/client.js.map +1 -0
  107. package/lib/drawing-feedback.js +284 -0
  108. package/lib/fibonacci.js +18 -0
  109. package/lib/ftshare-settings-bridge.js +159 -0
  110. package/lib/index.js +279 -0
  111. package/lib/labeled-polyline.js +17 -0
  112. package/lib/pattern-groups.js +91 -0
  113. package/lib/price-bands.js +55 -0
  114. package/lib/price-series.js +47 -0
  115. package/lib/price-sticks.js +32 -0
  116. package/lib/types/candle-sequence.d.ts +2 -0
  117. package/lib/types/chart-adjustment.d.ts +2 -0
  118. package/lib/types/chart-annotations.d.ts +4 -0
  119. package/lib/types/chart-applications.d.ts +26 -0
  120. package/lib/types/chart-context.d.ts +14 -0
  121. package/lib/types/chart-observation.d.ts +8 -0
  122. package/lib/types/chart-service-status.d.ts +22 -0
  123. package/lib/types/chart-source-status.d.ts +47 -0
  124. package/lib/types/chart-sources.d.ts +25 -0
  125. package/lib/types/client/BetterSidebarTab.d.ts +12 -0
  126. package/lib/types/client/ClassicShell.d.ts +4 -0
  127. package/lib/types/client/KlineContent.d.ts +37 -0
  128. package/lib/types/client/PanelHost.d.ts +25 -0
  129. package/lib/types/client/chart-apply.d.ts +13 -0
  130. package/lib/types/client/chart-context.d.ts +23 -0
  131. package/lib/types/client/chart-handoff.d.ts +5 -0
  132. package/lib/types/client/chart-session-resolver.d.ts +2 -0
  133. package/lib/types/client/client-context.d.ts +16 -0
  134. package/lib/types/client/conversation.d.ts +43 -0
  135. package/lib/types/client/default-tab.d.ts +3 -0
  136. package/lib/types/client/embed.d.ts +37 -0
  137. package/lib/types/client/generated-view.d.ts +2 -0
  138. package/lib/types/client/horizontal-lines.d.ts +1 -0
  139. package/lib/types/client/host-options.d.ts +38 -0
  140. package/lib/types/client/host-panels.d.ts +55 -0
  141. package/lib/types/client/index.d.ts +4 -0
  142. package/lib/types/client/mode-preferences.d.ts +25 -0
  143. package/lib/types/client/native-sidebar-contract.d.ts +52 -0
  144. package/lib/types/client/native-sidebar-register.d.ts +46 -0
  145. package/lib/types/client/native-sidebar-services.d.ts +45 -0
  146. package/lib/types/client/native-sidebar.d.ts +47 -0
  147. package/lib/types/client/sidebar-integration.d.ts +12 -0
  148. package/lib/types/client/ui-onboarding.d.ts +7 -0
  149. package/lib/types/client/version.d.ts +1 -0
  150. package/lib/types/drawing-feedback.d.ts +5 -0
  151. package/lib/types/fibonacci.d.ts +5 -0
  152. package/lib/types/ftshare-settings-bridge.d.ts +50 -0
  153. package/lib/types/index.d.ts +26 -0
  154. package/lib/types/labeled-polyline.d.ts +11 -0
  155. package/lib/types/pattern-groups.d.ts +2 -0
  156. package/lib/types/price-bands.d.ts +3 -0
  157. package/lib/types/price-series.d.ts +5 -0
  158. package/lib/types/price-sticks.d.ts +3 -0
  159. package/package.json +155 -4
  160. package/requirements.txt +6 -0
  161. package/screenshots.json +8 -0
  162. package/scripts/bootstrap.sh +5 -0
  163. package/scripts/dsh-bootstrap.mjs +179 -0
  164. package/scripts/dsh-mcp-plugin.mjs +27 -0
  165. package/scripts/run-dsh-kline.mjs +658 -0
  166. package/scripts/run-dsh-kline.sh +5 -0
  167. package/server.py +1755 -0
  168. package/tools/__init__.py +0 -0
  169. package/tools/annotations.py +119 -0
  170. package/tools/automatic_analysis.py +158 -0
  171. package/tools/baostock_source.py +176 -0
  172. package/tools/calc.py +39 -0
  173. package/tools/channel_candidates.py +260 -0
  174. package/tools/channel_preview.py +82 -0
  175. package/tools/channels.py +104 -0
  176. package/tools/chart_applications.py +204 -0
  177. package/tools/chart_context.py +186 -0
  178. package/tools/chart_edits.py +363 -0
  179. package/tools/chart_functions.py +451 -0
  180. package/tools/chart_indicators.py +65 -0
  181. package/tools/chart_measurements.py +84 -0
  182. package/tools/chart_source_status.py +32 -0
  183. package/tools/chart_sources.py +31 -0
  184. package/tools/closed_daily.py +68 -0
  185. package/tools/draw.py +410 -0
  186. package/tools/drawing_feedback.py +45 -0
  187. package/tools/drawing_interaction.py +117 -0
  188. package/tools/drawing_verification.py +141 -0
  189. package/tools/fetch.py +4680 -0
  190. package/tools/fibonacci.py +83 -0
  191. package/tools/foreign_daily.py +185 -0
  192. package/tools/free_sources.py +483 -0
  193. package/tools/lines.py +91 -0
  194. package/tools/nine_count.py +66 -0
  195. package/tools/pattern_groups.py +103 -0
  196. package/tools/pivots.py +60 -0
  197. package/tools/polylines.py +131 -0
  198. package/tools/price_bands.py +165 -0
  199. package/tools/price_patterns.py +311 -0
  200. package/tools/price_series.py +162 -0
  201. package/tools/price_sticks.py +114 -0
  202. package/tools/range_candidates.py +170 -0
  203. package/tools/recent_drawing_candidates.py +123 -0
  204. package/tools/rectangles.py +76 -0
  205. package/tools/regression_channels.py +87 -0
  206. package/tools/ta_functions.py +228 -0
  207. package/tools/trend_lines.py +106 -0
  208. package/tools/watchlist.py +149 -0
  209. package/view/ft-logo.jpg +0 -0
  210. package/view/kline.html +12436 -0
  211. package/view/vendor/klinecharts.min.js +7 -0
package/lib/index.js ADDED
@@ -0,0 +1,279 @@
1
+ import { readFile } from 'node:fs/promises';
2
+ import { homedir } from 'node:os';
3
+ import { join, resolve } from 'node:path';
4
+ import { fileURLToPath } from 'node:url';
5
+ import { ChartServiceUnavailable, readServiceLocator, probeChartService, unavailableService } from "./chart-service-status.js";
6
+ import { ChartContextBroker } from "./chart-context.js";
7
+ import { ChartApplications } from "./chart-applications.js";
8
+ import { startFtshareSettingsBridge } from "./ftshare-settings-bridge.js";
9
+ export const name = 'dsh-kline-sidebar';
10
+ export const inject = ['webServer'];
11
+ const RUNTIME_DIR = runtimeDirectory();
12
+ const RUNTIME_FILE = join(RUNTIME_DIR, 'services', `${process.pid}.json`);
13
+ const STATE_DIR = stateDirectory();
14
+ const SESSION_DIR = join(RUNTIME_DIR, 'sessions');
15
+ const VENDOR_FILE = fileURLToPath(new URL('../view/vendor/klinecharts.min.js', import.meta.url));
16
+ const LOGO_FILE = fileURLToPath(new URL('../view/ft-logo.jpg', import.meta.url));
17
+ const MAX_PROXY_BYTES = 8 * 1024 * 1024;
18
+ const CHART_ACTIONS = new Set([
19
+ 'analyze_kline',
20
+ 'analyze_key_levels',
21
+ 'calc_range',
22
+ 'calculate_chart_indicators',
23
+ 'fetch_candles',
24
+ 'fetch_comparison_candles',
25
+ 'fetch_security_workspace',
26
+ 'fetch_market_pulse',
27
+ 'fetch_market_board_detail',
28
+ 'fetch_security_intelligence',
29
+ 'watchlist_get',
30
+ 'watchlist_save',
31
+ 'market_ticker',
32
+ 'search_symbols',
33
+ 'symbol_directory',
34
+ 'data_source_status',
35
+ 'configure_ftshare',
36
+ 'test_ftshare_connection',
37
+ 'workbench_run_ta',
38
+ 'workbench_run_chart_function',
39
+ 'workbench_prepare_edit',
40
+ 'workbench_apply_edit',
41
+ 'workbench_edit_status',
42
+ ]);
43
+ export function apply(ctx) {
44
+ const contexts = new ChartContextBroker(join(RUNTIME_DIR, 'views', String(process.pid)), () => Date.now(), RUNTIME_DIR);
45
+ ctx.effect(() => ctx.webServer.register({
46
+ kind: 'prefix',
47
+ path: '/dsh-kline',
48
+ handler: (request, response) => serveRuntimeSession(request, response, contexts),
49
+ }), 'dsh-kline: chart session route');
50
+ ctx.inject?.(['systemPrompt'], scoped => {
51
+ if (typeof scoped.systemPrompt?.context !== 'function')
52
+ return;
53
+ scoped.effect(() => scoped.systemPrompt.context({ name: 'dsh-kline:current-view', order: 350,
54
+ text: context => contexts.prompt(context) }), 'dsh-kline: current chart context');
55
+ });
56
+ ctx.inject?.(['ftshareSettings'], scoped => {
57
+ if (!scoped.ftshareSettings?.apiKey)
58
+ return;
59
+ const bridge = startFtshareSettingsBridge({ settings: scoped.ftshareSettings, runtimeDirectory: RUNTIME_DIR });
60
+ scoped.effect(() => () => { void bridge.dispose(); }, 'dsh-kline: FTShare settings credential bridge');
61
+ });
62
+ }
63
+ async function serveRuntimeSession(request, response, contexts) {
64
+ const url = new URL(request.url ?? '/', 'http://localhost');
65
+ const pathname = url.pathname;
66
+ try {
67
+ if (pathname === '/dsh-kline/healthz') {
68
+ if (request.method !== 'GET' && request.method !== 'HEAD') {
69
+ sendJson(response, 405, { ok: false, error: 'method_not_allowed' });
70
+ return;
71
+ }
72
+ const version = JSON.parse(await readFile(new URL('../package.json', import.meta.url), 'utf8')).version;
73
+ const diagnostics = { version, host_process_id: process.pid, locator_path: RUNTIME_FILE,
74
+ log_path: join(STATE_DIR, 'logs', `backend-${process.pid}.log`) };
75
+ try {
76
+ const locator = await readServiceLocator(RUNTIME_FILE, process.pid);
77
+ await probeChartService(locator);
78
+ sendJson(response, 200, { ok: true, ...diagnostics, process_id: locator.process_id,
79
+ service_url: locator.service_url }, request.method === 'HEAD');
80
+ }
81
+ catch (error) {
82
+ let reason = error instanceof ChartServiceUnavailable ? error.reason : 'service_locator_invalid';
83
+ if (reason === 'service_locator_missing') {
84
+ try {
85
+ const status = JSON.parse(await readFile(join(STATE_DIR, 'logs', `backend-${process.pid}.json`), 'utf8'));
86
+ if (status.host_process_id === process.pid && Number.isSafeInteger(status.launcher_process_id)) {
87
+ process.kill(status.launcher_process_id, 0);
88
+ if (status.phase === 'preparing')
89
+ reason = 'runtime_preparing';
90
+ else if (status.phase === 'recovering')
91
+ reason = 'runtime_recovering';
92
+ }
93
+ }
94
+ catch { /* A missing or stale diagnostic cannot prove readiness. */ }
95
+ }
96
+ sendJson(response, 503, { ...unavailableService(reason), ...diagnostics }, request.method === 'HEAD');
97
+ }
98
+ return;
99
+ }
100
+ if (pathname === '/dsh-kline/recovery' && request.method === 'GET') {
101
+ try {
102
+ const recovery = await new ChartApplications(RUNTIME_DIR).recover(url.searchParams.get('conversation') ?? '');
103
+ sendJson(response, 200, recovery);
104
+ }
105
+ catch {
106
+ sendJson(response, 200, { ok: false, error: 'confirmed_chart_recovery_unavailable' });
107
+ }
108
+ return;
109
+ }
110
+ if (pathname === '/dsh-kline/context') {
111
+ if (request.method !== 'POST') {
112
+ sendJson(response, 405, { ok: false, error: 'method_not_allowed' });
113
+ return;
114
+ }
115
+ if (request.headers['content-type']?.split(';')[0] !== 'application/json'
116
+ || request.headers.origin && new URL(request.headers.origin).host !== request.headers.host) {
117
+ sendJson(response, 403, { ok: false, error: 'invalid_context_origin' });
118
+ return;
119
+ }
120
+ try {
121
+ const result = await contexts.publish(JSON.parse((await readRequestBody(request)).toString('utf8')));
122
+ sendJson(response, 200, result);
123
+ }
124
+ catch (error) {
125
+ if (error instanceof Error && error.message === 'context_state_required') {
126
+ sendJson(response, 409, { ok: false, error: 'context_state_required' });
127
+ }
128
+ else {
129
+ sendJson(response, 400, { ok: false, error: 'context_publication_rejected' });
130
+ }
131
+ }
132
+ return;
133
+ }
134
+ // Static browser assets must remain available before the first chart session exists.
135
+ if (pathname === '/dsh-kline/vendor/klinecharts.min.js' && (request.method === 'GET' || request.method === 'HEAD')) {
136
+ const body = await readFile(VENDOR_FILE);
137
+ sendBytes(response, 200, body, 'text/javascript; charset=utf-8', request.method === 'HEAD');
138
+ return;
139
+ }
140
+ if (pathname === '/dsh-kline/logo.jpg' && (request.method === 'GET' || request.method === 'HEAD')) {
141
+ const body = await readFile(LOGO_FILE);
142
+ sendBytes(response, 200, body, 'image/jpeg', request.method === 'HEAD');
143
+ return;
144
+ }
145
+ // Never infer a chart from the global latest publication. The browser
146
+ // obtains this opaque reference from the owning conversation's result.
147
+ if (pathname === '/dsh-kline/session' || pathname === '/dsh-kline/data') {
148
+ if (request.method !== 'GET' && request.method !== 'HEAD') {
149
+ sendJson(response, 405, { ok: false, error: 'method_not_allowed' });
150
+ return;
151
+ }
152
+ const token = url.searchParams.get('session') ?? '';
153
+ if (!/^[A-Za-z0-9_-]{32}$/.test(token)) {
154
+ sendJson(response, 200, { ok: false, error: 'chart_session_required' });
155
+ return;
156
+ }
157
+ const saved = JSON.parse(await readFile(join(SESSION_DIR, `${token}.json`), 'utf8'));
158
+ if (saved.session !== token || saved.ok !== true)
159
+ throw new Error('invalid_chart_snapshot');
160
+ if (pathname === '/dsh-kline/data') {
161
+ sendJson(response, 200, { ok: true, session: token, payload: saved.payload }, request.method === 'HEAD');
162
+ }
163
+ else {
164
+ sendJson(response, 200, { ok: true, session: token, symbol: saved.symbol, name: saved.name, published_at: saved.published_at }, request.method === 'HEAD');
165
+ }
166
+ return;
167
+ }
168
+ // Unknown paths have a stable routing result, independent of backend state.
169
+ if (!pathname.startsWith('/dsh-kline/api/tools/')) {
170
+ sendJson(response, 404, { ok: false, error: 'not_found' }, request.method === 'HEAD');
171
+ return;
172
+ }
173
+ const session = await readLiveSession();
174
+ if (pathname.startsWith('/dsh-kline/api/tools/') && request.method === 'POST') {
175
+ const action = pathname.slice('/dsh-kline/api/tools/'.length).replaceAll('/', '');
176
+ if (!CHART_ACTIONS.has(action)) {
177
+ sendJson(response, 404, { ok: false, error: 'unsupported_chart_action' });
178
+ return;
179
+ }
180
+ if (action.startsWith('workbench_') && (request.headers['content-type']?.split(';')[0] !== 'application/json'
181
+ || request.headers.origin && new URL(request.headers.origin).host !== request.headers.host
182
+ || request.headers['sec-fetch-site'] && !['same-origin', 'none'].includes(String(request.headers['sec-fetch-site'])))) {
183
+ sendJson(response, 403, { ok: false, error: 'invalid_workbench_origin' });
184
+ return;
185
+ }
186
+ const body = await readRequestBody(request);
187
+ await proxyJson(response, `${serviceOrigin(session)}/api/tools/${encodeURIComponent(action)}`, {
188
+ method: 'POST',
189
+ headers: { ...chartServiceHeaders(session), 'Content-Type': 'application/json' },
190
+ body: body.toString('utf8'),
191
+ });
192
+ return;
193
+ }
194
+ if (pathname.startsWith('/dsh-kline/api/tools/')) {
195
+ response.writeHead(405, { Allow: 'POST' });
196
+ response.end();
197
+ return;
198
+ }
199
+ sendJson(response, 404, { ok: false, error: 'not_found' });
200
+ }
201
+ catch (error) {
202
+ if (error instanceof ChartServiceUnavailable) {
203
+ sendJson(response, 200, unavailableService(error.reason), request.method === 'HEAD');
204
+ return;
205
+ }
206
+ const code = error instanceof Error && 'code' in error ? String(error.code) : '';
207
+ sendJson(response, code === 'ENOENT' ? 200 : 500, code === 'ENOENT'
208
+ ? (pathname === '/dsh-kline/data' || pathname === '/dsh-kline/session'
209
+ ? { ok: false, error: 'chart_session_unavailable', message: '这张图表的快照已不可用,请在当前对话重新分析该标的。' }
210
+ : unavailableService())
211
+ : { ok: false, error: 'chart_session_manifest_failed' }, request.method === 'HEAD');
212
+ }
213
+ }
214
+ export function runtimeDirectory(env = process.env) {
215
+ const explicit = String(env.DSH_KLINE_RUNTIME_DIR || '').trim();
216
+ if (explicit)
217
+ return resolve(explicit);
218
+ return join(stateDirectory(env), 'runtime');
219
+ }
220
+ function stateDirectory(env = process.env) {
221
+ const explicit = String(env.DSH_KLINE_CACHE_DIR || '').trim();
222
+ if (explicit)
223
+ return resolve(explicit);
224
+ if (process.platform === 'win32') {
225
+ const local = String(env.LOCALAPPDATA || env.APPDATA || '').trim();
226
+ return join(local || join(homedir(), 'AppData', 'Local'), 'dsh_kline');
227
+ }
228
+ const cache = String(env.XDG_CACHE_HOME || '').trim();
229
+ return join(cache || join(homedir(), '.cache'), 'dsh_kline');
230
+ }
231
+ function chartServiceHeaders(session) {
232
+ return { 'X-DSH-Kline-Token': session.service_token };
233
+ }
234
+ async function readLiveSession() {
235
+ return readServiceLocator(RUNTIME_FILE, process.pid);
236
+ }
237
+ function serviceOrigin(session) {
238
+ return new URL(session.service_url).origin;
239
+ }
240
+ async function proxyJson(response, url, init) {
241
+ let upstream;
242
+ try {
243
+ upstream = await fetch(url, { ...init, signal: AbortSignal.timeout(120000) });
244
+ }
245
+ catch (error) {
246
+ throw new ChartServiceUnavailable(error instanceof Error && error.name === 'TimeoutError' ? 'backend_timeout' : 'backend_unreachable');
247
+ }
248
+ const body = Buffer.from(await upstream.arrayBuffer());
249
+ if (body.length > MAX_PROXY_BYTES) {
250
+ sendJson(response, 502, { ok: false, error: 'chart_response_too_large' });
251
+ return;
252
+ }
253
+ sendBytes(response, upstream.status, body, 'application/json; charset=utf-8');
254
+ }
255
+ async function readRequestBody(request) {
256
+ const chunks = [];
257
+ let size = 0;
258
+ for await (const chunk of request) {
259
+ const buffer = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
260
+ size += buffer.length;
261
+ if (size > MAX_PROXY_BYTES)
262
+ throw new Error('request_too_large');
263
+ chunks.push(buffer);
264
+ }
265
+ return Buffer.concat(chunks);
266
+ }
267
+ function sendJson(response, status, value, head = false) {
268
+ const body = Buffer.from(JSON.stringify(value));
269
+ sendBytes(response, status, body, 'application/json; charset=utf-8', head);
270
+ }
271
+ function sendBytes(response, status, body, contentType, head = false) {
272
+ response.writeHead(status, {
273
+ 'Content-Type': contentType,
274
+ 'Content-Length': String(body.length),
275
+ 'Cache-Control': 'no-store',
276
+ 'X-Content-Type-Options': 'nosniff',
277
+ });
278
+ response.end(head ? undefined : body);
279
+ }
@@ -0,0 +1,17 @@
1
+ export function sanitizePolylinePoints(raw) {
2
+ if (!Array.isArray(raw) || raw.length < 2 || raw.length > 8)
3
+ throw Error('invalid_polyline_points');
4
+ const seen = new Set();
5
+ return raw.map((p, i) => {
6
+ if (typeof p?.label !== 'string' || !p.label.length || [...p.label].length > 16 || p.label !== p.label.trim()
7
+ || /[\x00-\x1f]/.test(p.label) || seen.has(p.label) || !Number.isSafeInteger(p.time) || p.time <= 0
8
+ || typeof p.price !== 'number' || !Number.isFinite(p.price) || p.price <= 0
9
+ || i > 0 && p.time <= raw[i - 1].time)
10
+ throw Error('invalid_polyline_points');
11
+ seen.add(p.label);
12
+ return { label: p.label, time: p.time, price: p.price };
13
+ });
14
+ }
15
+ export function polylineOverlayPoints(command) {
16
+ return sanitizePolylinePoints(command.points).map(p => ({ timestamp: p.time * 1000, value: p.price }));
17
+ }
@@ -0,0 +1,91 @@
1
+ /** Bounded, atomic snapshots produced by the shared Python analyses. */
2
+ const HEX = /^[a-f0-9]{64}$/;
3
+ const COLORS = new Set(['info', 'warning', 'success', 'danger']);
4
+ const TYPES = new Set(['double_top', 'double_bottom', 'head_shoulders_top', 'head_shoulders_bottom', 'platform']);
5
+ const STATUSES = new Set(['candidate', 'pending_confirmation', 'price_confirmed', 'structurally_invalid', 'breakout_failed', 'expired']);
6
+ function time(value) {
7
+ if (!Number.isSafeInteger(value) || value <= 0)
8
+ throw Error('invalid_pattern_time');
9
+ return value;
10
+ }
11
+ function price(value) {
12
+ if (typeof value !== 'number' || !Number.isFinite(value) || value <= 0)
13
+ throw Error('invalid_pattern_price');
14
+ return value;
15
+ }
16
+ function nonnegative(value) {
17
+ if (typeof value !== 'number' || !Number.isFinite(value) || value < 0)
18
+ throw Error('invalid_pattern_ratio');
19
+ return value;
20
+ }
21
+ function label(value, limit) {
22
+ if (typeof value !== 'string' || value.length > limit || /[\x00-\x1f]/.test(value))
23
+ throw Error('invalid_pattern_label');
24
+ return value;
25
+ }
26
+ export function patternGroupObservation(raw) {
27
+ return { geometry_hash: raw.geometry_hash, bar_count: raw.bar_count, rule_version: raw.rule_version, as_of: raw.as_of };
28
+ }
29
+ export function sanitizePatternGroupCommand(raw, interval) {
30
+ const pattern = raw?.type === 'DRAW_AGENT_PRICE_PATTERN';
31
+ const nine = raw?.type === 'DRAW_AGENT_NINE_COUNT';
32
+ if (!pattern && !nine || raw.interval !== interval || !COLORS.has(raw.color)
33
+ || typeof raw.id !== 'string' || !new RegExp(`^${pattern ? 'pattern' : 'nine'}_[a-f0-9]{24}$`).test(raw.id)
34
+ || !HEX.test(raw.geometry_hash) || raw.rule_version !== (pattern ? 'price_patterns_v1' : 'nine_count_v1')
35
+ || !Number.isSafeInteger(raw.bar_count) || raw.bar_count < 0 || raw.bar_count > (pattern ? 5 : 240))
36
+ throw Error('invalid_pattern_group');
37
+ const result = { type: raw.type, id: raw.id, interval, label: label(raw.label ?? '', 48), color: raw.color,
38
+ geometry_hash: raw.geometry_hash, bar_count: raw.bar_count, rule_version: raw.rule_version, as_of: time(raw.as_of) };
39
+ if (raw.create_request_id !== undefined)
40
+ result.create_request_id = label(raw.create_request_id, 160);
41
+ if (pattern) {
42
+ const p = raw.pattern;
43
+ if (!p || !TYPES.has(p.type) || !STATUSES.has(p.status)
44
+ || !Array.isArray(p.anchors) || p.anchors.length !== (p.type === 'platform' ? 0 : p.type.startsWith('double') ? 3 : 5)
45
+ || raw.bar_count !== p.anchors.length || !Array.isArray(p.events) || p.events.length > 128
46
+ || !['up', 'down', null].includes(p.direction) || !['up', 'down', null].includes(p.break_direction))
47
+ throw Error('invalid_pattern_geometry');
48
+ const anchors = p.anchors.map((a) => ({ index: a.index, side: a.side, time: time(a.time), price: price(a.price) }));
49
+ if (anchors.some((a, i) => !Number.isSafeInteger(a.index) || a.index < 0 || !['high', 'low'].includes(a.side)
50
+ || i > 0 && (a.index <= anchors[i - 1].index || a.time <= anchors[i - 1].time)))
51
+ throw Error('invalid_pattern_anchors');
52
+ const events = p.events.map((e) => ({ type: label(e.type, 40), time: time(e.time), index: e.index }));
53
+ if (events.some((e) => !Number.isSafeInteger(e.index) || e.index < 0))
54
+ throw Error('invalid_pattern_events');
55
+ const geometry = { type: p.type, anchors, status: p.status, direction: p.direction, break_direction: p.break_direction,
56
+ atr: price(p.atr), buffer: price(p.buffer), available_at: time(p.available_at), as_of: time(p.as_of),
57
+ confirmed_at: p.confirmed_at == null ? null : time(p.confirmed_at), invalidated_at: p.invalidated_at == null ? null : time(p.invalidated_at),
58
+ outer: p.outer == null ? undefined : price(p.outer), events,
59
+ volume_evidence: p.volume_evidence?.status === 'known' ? { status: 'known', relative_to_preceding_20: nonnegative(p.volume_evidence.relative_to_preceding_20), unit: label(p.volume_evidence.unit, 16) } :
60
+ { status: 'unknown', reason: label(p.volume_evidence?.reason ?? 'unavailable', 80) } };
61
+ if (p.type === 'platform') {
62
+ geometry.box = { start_time: time(p.box?.start_time), end_time: time(p.box?.end_time),
63
+ lower_price: price(p.box?.lower_price), upper_price: price(p.box?.upper_price) };
64
+ if (geometry.box.start_time >= geometry.box.end_time || geometry.box.lower_price >= geometry.box.upper_price)
65
+ throw Error('invalid_pattern_box');
66
+ }
67
+ else if (p.neckline?.type === 'horizontal')
68
+ geometry.neckline = { type: 'horizontal', price: price(p.neckline.price) };
69
+ else if (p.neckline?.type === 'sloped')
70
+ geometry.neckline = { type: 'sloped', from: { index: p.neckline.from?.index, time: time(p.neckline.from?.time), price: price(p.neckline.from?.price) },
71
+ to: { index: p.neckline.to?.index, time: time(p.neckline.to?.time), price: price(p.neckline.to?.price) } };
72
+ else
73
+ throw Error('invalid_pattern_neckline');
74
+ result.pattern = geometry;
75
+ }
76
+ else {
77
+ if (!Array.isArray(raw.marks) || raw.marks.length > 240 || raw.bar_count !== raw.marks.length
78
+ || !Array.isArray(raw.events) || raw.events.length > 30)
79
+ throw Error('invalid_nine_group');
80
+ result.marks = raw.marks.map((m) => ({ time: time(m.time), index: m.index, direction: m.direction, count: m.count,
81
+ label: label(m.label, 2), price: price(m.price) }));
82
+ if (result.marks.some((m, i) => !Number.isSafeInteger(m.index) || m.index < 0 || !['up', 'down'].includes(m.direction)
83
+ || !Number.isSafeInteger(m.count) || m.count < 1 || m.count > 9 || m.label !== String(m.count)
84
+ || i > 0 && m.time <= result.marks[i - 1].time))
85
+ throw Error('invalid_nine_marks');
86
+ result.events = raw.events.map((e) => ({ time: time(e.time), direction: e.direction, label: label(e.label, 20) }));
87
+ if (result.events.some((e) => !['up', 'down'].includes(e.direction)))
88
+ throw Error('invalid_nine_events');
89
+ }
90
+ return result;
91
+ }
@@ -0,0 +1,55 @@
1
+ import { sanitizePriceSource, sanitizePriceCondition } from "./price-series.js";
2
+ const COLORS = new Set(['info', 'warning', 'success', 'danger']);
3
+ const INTERVALS = new Set(['minute', 'day', 'week', 'month', 'quarter', 'year']);
4
+ function bandSource(raw, output) {
5
+ if (raw?.kind !== 'bbands')
6
+ return sanitizePriceSource(raw);
7
+ if (!raw || typeof raw !== 'object' || Array.isArray(raw) || Object.keys(raw).length !== 6
8
+ || raw.output !== output || !Number.isSafeInteger(raw.period) || raw.period < 2 || raw.period > 200
9
+ || typeof raw.deviation_up !== 'number' || !Number.isFinite(raw.deviation_up)
10
+ || raw.deviation_up <= 0 || raw.deviation_up > 5
11
+ || typeof raw.deviation_down !== 'number' || !Number.isFinite(raw.deviation_down)
12
+ || raw.deviation_down <= 0 || raw.deviation_down > 5 || raw.matype !== 0)
13
+ throw Error('invalid_source_band');
14
+ return { kind: 'bbands', output, period: raw.period, deviation_up: raw.deviation_up,
15
+ deviation_down: raw.deviation_down, matype: 0 };
16
+ }
17
+ /** One bounded object; null pairs are explicit gaps and crossed bounds are refused. */
18
+ export function sanitizePriceBandCommand(raw, expectedBars, interval) {
19
+ if (raw?.type !== 'DRAW_AGENT_PRICE_BAND' || typeof raw.id !== 'string' || !/^band_[a-f0-9]{24}$/.test(raw.id)
20
+ || !INTERVALS.has(raw.interval) || !COLORS.has(raw.color) || typeof raw.label !== 'string' || raw.label.length > 48
21
+ || !/^[a-f0-9]{64}$/.test(raw.band_hash) || raw.row_hash != null && !/^[a-f0-9]{16}$/.test(raw.row_hash)
22
+ || !Number.isSafeInteger(raw.bar_count)
23
+ || raw.bar_count < 1 || raw.bar_count > 4000 || raw.interval === interval && raw.bar_count !== expectedBars
24
+ || !Array.isArray(raw.upper_values) || !Array.isArray(raw.lower_values)
25
+ || raw.upper_values.length !== raw.bar_count || raw.lower_values.length !== raw.bar_count)
26
+ throw Error('invalid_source_band');
27
+ const upperSource = bandSource(raw.upper_source, 'upperband');
28
+ const lowerSource = bandSource(raw.lower_source, 'lowerband');
29
+ const boll = upperSource.kind === 'bbands';
30
+ if (boll !== (lowerSource.kind === 'bbands') || boll && (raw.condition != null || JSON.stringify({ ...upperSource, output: null }) !== JSON.stringify({ ...lowerSource, output: null })
31
+ || !Array.isArray(raw.middle_values) || raw.middle_values.length !== raw.bar_count)
32
+ || !boll && raw.middle_values !== undefined)
33
+ throw Error('invalid_source_band');
34
+ let present = 0;
35
+ for (let i = 0; i < raw.bar_count; i++) {
36
+ const upper = raw.upper_values[i], lower = raw.lower_values[i];
37
+ const middle = boll ? raw.middle_values[i] : null;
38
+ if (upper === null && lower === null && middle === null)
39
+ continue;
40
+ if (typeof upper !== 'number' || typeof lower !== 'number' || !Number.isFinite(upper) || !Number.isFinite(lower)
41
+ || lower <= 0 || upper <= lower || boll && (typeof middle !== 'number' || !Number.isFinite(middle)
42
+ || !(lower < middle && middle < upper)))
43
+ throw Error('invalid_source_band');
44
+ present++;
45
+ }
46
+ if (!present)
47
+ throw Error('invalid_source_band');
48
+ return { type: 'DRAW_AGENT_PRICE_BAND', id: raw.id, interval: raw.interval, label: raw.label, color: raw.color,
49
+ bar_count: raw.bar_count, upper_source: upperSource,
50
+ lower_source: lowerSource, condition: sanitizePriceCondition(raw.condition),
51
+ upper_values: [...raw.upper_values], lower_values: [...raw.lower_values], band_hash: raw.band_hash,
52
+ ...(boll ? { middle_values: [...raw.middle_values] } : {}),
53
+ ...(raw.row_hash ? { row_hash: raw.row_hash } : {}) };
54
+ }
55
+ export function bandObservation(raw) { return { band_hash: raw.band_hash, bar_count: raw.bar_count }; }
@@ -0,0 +1,47 @@
1
+ /** Bounded, candle-index-aligned AI price line. No formula source or arbitrary arrays from the host. */
2
+ const COLORS = new Set(['info', 'warning', 'success', 'danger']);
3
+ const FIELDS = new Set(['open', 'high', 'low', 'close']);
4
+ const OPS = new Set(['gt', 'gte', 'lt', 'lte']);
5
+ function source(raw) {
6
+ if (!raw || typeof raw !== 'object' || Array.isArray(raw))
7
+ throw Error('invalid_series_source');
8
+ const keys = Object.keys(raw);
9
+ if (FIELDS.has(raw.kind) && keys.length === 1)
10
+ return { kind: raw.kind };
11
+ if ((raw.kind === 'sma' || raw.kind === 'ema') && keys.length === 2 && Number.isSafeInteger(raw.period) && raw.period >= 2 && raw.period <= 200)
12
+ return { kind: raw.kind, period: raw.period };
13
+ throw Error('invalid_series_source');
14
+ }
15
+ function condition(raw) {
16
+ if (raw == null)
17
+ return null;
18
+ if (!raw || typeof raw !== 'object' || Array.isArray(raw) || Object.keys(raw).length !== 3 || !OPS.has(raw.op))
19
+ throw Error('invalid_series_condition');
20
+ const left = source(raw.left), right = raw.right;
21
+ if (!right || typeof right !== 'object' || Array.isArray(right) || Object.keys(right).length !== 1)
22
+ throw Error('invalid_series_condition');
23
+ if (right.source !== undefined)
24
+ return { left, op: raw.op, right: { source: source(right.source) } };
25
+ if (typeof right.constant === 'number' && Number.isFinite(right.constant) && right.constant > 0)
26
+ return { left, op: raw.op, right: { constant: right.constant } };
27
+ throw Error('invalid_series_condition');
28
+ }
29
+ export { source as sanitizePriceSource, condition as sanitizePriceCondition };
30
+ export function sanitizePriceSeriesCommand(raw, expectedBars, interval) {
31
+ if (raw?.type !== 'DRAW_AGENT_SERIES_LINE' || typeof raw.id !== 'string' || !/^series_[a-f0-9]{24}$/.test(raw.id)
32
+ || !['minute', 'day', 'week', 'month', 'quarter', 'year'].includes(raw.interval)
33
+ || !COLORS.has(raw.color) || typeof raw.label !== 'string' || raw.label.length > 48
34
+ || !/^[a-f0-9]{64}$/.test(raw.series_hash) || raw.row_hash != null && !/^[a-f0-9]{16}$/.test(raw.row_hash)
35
+ || !Number.isSafeInteger(raw.bar_count)
36
+ || raw.bar_count < 1 || raw.bar_count > 4000 || raw.interval === interval && raw.bar_count !== expectedBars
37
+ || !Array.isArray(raw.values) || raw.values.length !== raw.bar_count
38
+ || raw.values.some((value) => value !== null && (typeof value !== 'number' || !Number.isFinite(value) || value <= 0))
39
+ || !raw.values.some((value) => value !== null))
40
+ throw Error('invalid_source_series');
41
+ return { type: 'DRAW_AGENT_SERIES_LINE', id: raw.id, interval: raw.interval, label: raw.label, color: raw.color,
42
+ bar_count: raw.bar_count, source: source(raw.source), condition: condition(raw.condition),
43
+ values: [...raw.values], series_hash: raw.series_hash, ...(raw.row_hash ? { row_hash: raw.row_hash } : {}) };
44
+ }
45
+ export function seriesObservation(raw) {
46
+ return { series_hash: raw.series_hash, bar_count: raw.bar_count };
47
+ }
@@ -0,0 +1,32 @@
1
+ import { sanitizePriceSource, sanitizePriceCondition } from "./price-series.js";
2
+ const COLORS = new Set(['info', 'warning', 'success', 'danger']);
3
+ const INTERVALS = new Set(['minute', 'day', 'week', 'month', 'quarter', 'year']);
4
+ /** A bounded sequence of independent vertical price sticks. */
5
+ export function sanitizePriceSticksCommand(raw, expectedBars, interval) {
6
+ if (raw?.type !== 'DRAW_AGENT_PRICE_STICKS' || typeof raw.id !== 'string' || !/^sticks_[a-f0-9]{24}$/.test(raw.id)
7
+ || !INTERVALS.has(raw.interval) || !COLORS.has(raw.color) || typeof raw.label !== 'string' || raw.label.length > 48
8
+ || !/^[a-f0-9]{64}$/.test(raw.sticks_hash) || raw.row_hash != null && !/^[a-f0-9]{16}$/.test(raw.row_hash)
9
+ || !Number.isSafeInteger(raw.bar_count) || raw.bar_count < 1 || raw.bar_count > 4000
10
+ || raw.interval === interval && raw.bar_count !== expectedBars
11
+ || !Array.isArray(raw.start_values) || !Array.isArray(raw.end_values)
12
+ || raw.start_values.length !== raw.bar_count || raw.end_values.length !== raw.bar_count)
13
+ throw Error('invalid_source_sticks');
14
+ let present = 0;
15
+ for (let i = 0; i < raw.bar_count; i++) {
16
+ const start = raw.start_values[i], end = raw.end_values[i];
17
+ if (start === null && end === null)
18
+ continue;
19
+ if (typeof start !== 'number' || typeof end !== 'number' || !Number.isFinite(start) || !Number.isFinite(end)
20
+ || start <= 0 || end <= 0 || start === end)
21
+ throw Error('invalid_source_sticks');
22
+ present++;
23
+ }
24
+ if (!present)
25
+ throw Error('invalid_source_sticks');
26
+ return { type: 'DRAW_AGENT_PRICE_STICKS', id: raw.id, interval: raw.interval, label: raw.label, color: raw.color,
27
+ bar_count: raw.bar_count, start_source: sanitizePriceSource(raw.start_source),
28
+ end_source: sanitizePriceSource(raw.end_source), condition: sanitizePriceCondition(raw.condition),
29
+ start_values: [...raw.start_values], end_values: [...raw.end_values], sticks_hash: raw.sticks_hash,
30
+ ...(raw.row_hash ? { row_hash: raw.row_hash } : {}) };
31
+ }
32
+ export function sticksObservation(raw) { return { sticks_hash: raw.sticks_hash, bar_count: raw.bar_count }; }
@@ -0,0 +1,2 @@
1
+ /** Non-authorizing row identity for candle-index-aligned drawings. */
2
+ export declare function candleSequenceHash(rows: any[]): string;
@@ -0,0 +1,2 @@
1
+ /** Metadata aliases only; never transform prices or guess missing adjustment. */
2
+ export declare function normalizeAdjustment(value: unknown): string | null;
@@ -0,0 +1,4 @@
1
+ /** Canonical AI-owned text, numeric and icon annotations anchored to exact chart bars. */
2
+ export declare const CHART_ANNOTATION_ICONS: readonly ["arrow_up", "arrow_down", "diamond"];
3
+ export declare function sanitizeChartAnnotation(raw: any): any;
4
+ export declare function chartAnnotationText(command: any): string;
@@ -0,0 +1,26 @@
1
+ export interface ApplicationView {
2
+ ref: string;
3
+ conversation: string;
4
+ view: string;
5
+ revision: number;
6
+ active: boolean;
7
+ ambiguous: boolean;
8
+ applyCapable?: boolean;
9
+ state: any;
10
+ }
11
+ export declare class ChartApplications {
12
+ private runtime;
13
+ private now;
14
+ constructor(runtime: string, now?: () => number);
15
+ private directory;
16
+ private path;
17
+ private read;
18
+ private write;
19
+ private recoveryPath;
20
+ recover(conversation: string): Promise<any>;
21
+ private validate;
22
+ private candidate;
23
+ private publicReceipt;
24
+ acknowledge(view: ApplicationView, receipt: any): Promise<any>;
25
+ dispatch(view: ApplicationView): Promise<any>;
26
+ }
@@ -0,0 +1,14 @@
1
+ export { sanitizeChartContext } from './chart-observation.ts';
2
+ export declare const CONTEXT_TTL_MS = 90000;
3
+ export declare class ChartContextBroker {
4
+ private records;
5
+ private queue;
6
+ private directory;
7
+ private now;
8
+ private applications?;
9
+ private sources?;
10
+ constructor(directory: string, now?: () => number, runtime?: string);
11
+ publish(raw: any): Promise<any>;
12
+ private accept;
13
+ prompt(context: any): string;
14
+ }
@@ -0,0 +1,8 @@
1
+ export declare function text(value: unknown, max?: number): string;
2
+ /** Describes browser input -> display only, never vendor-native history or edit authority. */
3
+ export declare function sanitizeDataProvenance(raw: any): any;
4
+ export declare function sanitizeChartContext(raw: any): any;
5
+ export declare function observationKey(raw: any): string;
6
+ /** Identity required for editing the current source, excluding transient UI state. */
7
+ export declare function drawingSourceKey(raw: any): string;
8
+ export declare function drawingInventory(payload: any): any[];
@@ -0,0 +1,22 @@
1
+ export declare class ChartServiceUnavailable extends Error {
2
+ readonly reason: string;
3
+ constructor(reason: string);
4
+ }
5
+ export interface ServiceLocator extends Record<string, unknown> {
6
+ ok: true;
7
+ process_id: number;
8
+ host_process_id: number;
9
+ session: string;
10
+ service_url: string;
11
+ service_token: string;
12
+ published_at: number;
13
+ instance_id?: string;
14
+ }
15
+ export declare function readServiceLocator(path: string, hostPid: number): Promise<ServiceLocator>;
16
+ export declare function probeChartService(locator: ServiceLocator, timeoutMs?: number): Promise<void>;
17
+ export declare function unavailableService(reason?: string): {
18
+ ok: boolean;
19
+ error: string;
20
+ reason: string;
21
+ message: string;
22
+ };