@dsh-ft/dsh-fft-paper-trading 0.7.1 → 0.7.2
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/lib/client.js +1 -1
- package/package.json +1 -4
- package/node_modules/@ftshare-lab/dsh-kline/CHANGELOG.md +0 -611
- package/node_modules/@ftshare-lab/dsh-kline/LICENSE +0 -21
- package/node_modules/@ftshare-lab/dsh-kline/PROVENANCE.md +0 -13
- package/node_modules/@ftshare-lab/dsh-kline/README.en.md +0 -171
- package/node_modules/@ftshare-lab/dsh-kline/README.md +0 -171
- package/node_modules/@ftshare-lab/dsh-kline/chart_service.py +0 -687
- package/node_modules/@ftshare-lab/dsh-kline/config/basic-symbols.json +0 -570
- package/node_modules/@ftshare-lab/dsh-kline/config/dsh-kline.patch.yml +0 -4
- package/node_modules/@ftshare-lab/dsh-kline/config/dsh-tool-catalog.json +0 -3875
- package/node_modules/@ftshare-lab/dsh-kline/cordis.patch.yml +0 -33
- package/node_modules/@ftshare-lab/dsh-kline/core/__init__.py +0 -0
- package/node_modules/@ftshare-lab/dsh-kline/core/adjustment.py +0 -16
- package/node_modules/@ftshare-lab/dsh-kline/core/calc.py +0 -691
- package/node_modules/@ftshare-lab/dsh-kline/core/rows.py +0 -228
- package/node_modules/@ftshare-lab/dsh-kline/core/ta_engine.py +0 -99
- package/node_modules/@ftshare-lab/dsh-kline/lib/candle-sequence.js +0 -15
- package/node_modules/@ftshare-lab/dsh-kline/lib/chart-adjustment.js +0 -7
- package/node_modules/@ftshare-lab/dsh-kline/lib/chart-annotations.js +0 -33
- package/node_modules/@ftshare-lab/dsh-kline/lib/chart-applications.js +0 -171
- package/node_modules/@ftshare-lab/dsh-kline/lib/chart-context.js +0 -164
- package/node_modules/@ftshare-lab/dsh-kline/lib/chart-observation.js +0 -251
- package/node_modules/@ftshare-lab/dsh-kline/lib/chart-service-status.js +0 -82
- package/node_modules/@ftshare-lab/dsh-kline/lib/chart-source-status.js +0 -39
- package/node_modules/@ftshare-lab/dsh-kline/lib/chart-sources.js +0 -354
- package/node_modules/@ftshare-lab/dsh-kline/lib/client.js +0 -17581
- package/node_modules/@ftshare-lab/dsh-kline/lib/drawing-feedback.js +0 -284
- package/node_modules/@ftshare-lab/dsh-kline/lib/fibonacci.js +0 -18
- package/node_modules/@ftshare-lab/dsh-kline/lib/ftshare-settings-bridge.js +0 -159
- package/node_modules/@ftshare-lab/dsh-kline/lib/index.js +0 -279
- package/node_modules/@ftshare-lab/dsh-kline/lib/labeled-polyline.js +0 -17
- package/node_modules/@ftshare-lab/dsh-kline/lib/pattern-groups.js +0 -91
- package/node_modules/@ftshare-lab/dsh-kline/lib/price-bands.js +0 -55
- package/node_modules/@ftshare-lab/dsh-kline/lib/price-series.js +0 -47
- package/node_modules/@ftshare-lab/dsh-kline/lib/price-sticks.js +0 -32
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/candle-sequence.d.ts +0 -2
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/chart-adjustment.d.ts +0 -2
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/chart-annotations.d.ts +0 -4
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/chart-applications.d.ts +0 -26
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/chart-context.d.ts +0 -14
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/chart-observation.d.ts +0 -8
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/chart-service-status.d.ts +0 -22
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/chart-source-status.d.ts +0 -47
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/chart-sources.d.ts +0 -25
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/client/BetterSidebarTab.d.ts +0 -12
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/client/ClassicShell.d.ts +0 -4
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/client/KlineContent.d.ts +0 -37
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/client/PanelHost.d.ts +0 -25
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/client/chart-apply.d.ts +0 -13
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/client/chart-context.d.ts +0 -23
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/client/chart-handoff.d.ts +0 -5
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/client/chart-session-resolver.d.ts +0 -2
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/client/client-context.d.ts +0 -16
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/client/conversation.d.ts +0 -43
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/client/default-tab.d.ts +0 -3
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/client/embed.d.ts +0 -37
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/client/generated-view.d.ts +0 -2
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/client/horizontal-lines.d.ts +0 -1
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/client/host-options.d.ts +0 -38
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/client/host-panels.d.ts +0 -55
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/client/index.d.ts +0 -4
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/client/mode-preferences.d.ts +0 -25
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/client/native-sidebar-contract.d.ts +0 -52
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/client/native-sidebar-register.d.ts +0 -46
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/client/native-sidebar-services.d.ts +0 -45
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/client/native-sidebar.d.ts +0 -47
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/client/sidebar-integration.d.ts +0 -12
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/client/ui-onboarding.d.ts +0 -7
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/client/version.d.ts +0 -1
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/drawing-feedback.d.ts +0 -5
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/fibonacci.d.ts +0 -5
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/ftshare-settings-bridge.d.ts +0 -50
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/index.d.ts +0 -26
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/labeled-polyline.d.ts +0 -11
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/pattern-groups.d.ts +0 -2
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/price-bands.d.ts +0 -3
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/price-series.d.ts +0 -5
- package/node_modules/@ftshare-lab/dsh-kline/lib/types/price-sticks.d.ts +0 -3
- package/node_modules/@ftshare-lab/dsh-kline/package.json +0 -157
- package/node_modules/@ftshare-lab/dsh-kline/requirements.txt +0 -6
- package/node_modules/@ftshare-lab/dsh-kline/scripts/bootstrap.sh +0 -5
- package/node_modules/@ftshare-lab/dsh-kline/scripts/dsh-bootstrap.mjs +0 -179
- package/node_modules/@ftshare-lab/dsh-kline/scripts/dsh-mcp-plugin.mjs +0 -27
- package/node_modules/@ftshare-lab/dsh-kline/scripts/run-dsh-kline.mjs +0 -658
- package/node_modules/@ftshare-lab/dsh-kline/scripts/run-dsh-kline.sh +0 -5
- package/node_modules/@ftshare-lab/dsh-kline/server.py +0 -1755
- package/node_modules/@ftshare-lab/dsh-kline/tools/__init__.py +0 -0
- package/node_modules/@ftshare-lab/dsh-kline/tools/annotations.py +0 -119
- package/node_modules/@ftshare-lab/dsh-kline/tools/automatic_analysis.py +0 -158
- package/node_modules/@ftshare-lab/dsh-kline/tools/baostock_source.py +0 -176
- package/node_modules/@ftshare-lab/dsh-kline/tools/calc.py +0 -39
- package/node_modules/@ftshare-lab/dsh-kline/tools/channel_candidates.py +0 -260
- package/node_modules/@ftshare-lab/dsh-kline/tools/channel_preview.py +0 -82
- package/node_modules/@ftshare-lab/dsh-kline/tools/channels.py +0 -104
- package/node_modules/@ftshare-lab/dsh-kline/tools/chart_applications.py +0 -204
- package/node_modules/@ftshare-lab/dsh-kline/tools/chart_context.py +0 -186
- package/node_modules/@ftshare-lab/dsh-kline/tools/chart_edits.py +0 -363
- package/node_modules/@ftshare-lab/dsh-kline/tools/chart_functions.py +0 -451
- package/node_modules/@ftshare-lab/dsh-kline/tools/chart_indicators.py +0 -65
- package/node_modules/@ftshare-lab/dsh-kline/tools/chart_measurements.py +0 -84
- package/node_modules/@ftshare-lab/dsh-kline/tools/chart_source_status.py +0 -32
- package/node_modules/@ftshare-lab/dsh-kline/tools/chart_sources.py +0 -31
- package/node_modules/@ftshare-lab/dsh-kline/tools/closed_daily.py +0 -68
- package/node_modules/@ftshare-lab/dsh-kline/tools/draw.py +0 -410
- package/node_modules/@ftshare-lab/dsh-kline/tools/drawing_feedback.py +0 -45
- package/node_modules/@ftshare-lab/dsh-kline/tools/drawing_interaction.py +0 -117
- package/node_modules/@ftshare-lab/dsh-kline/tools/drawing_verification.py +0 -141
- package/node_modules/@ftshare-lab/dsh-kline/tools/fetch.py +0 -4680
- package/node_modules/@ftshare-lab/dsh-kline/tools/fibonacci.py +0 -83
- package/node_modules/@ftshare-lab/dsh-kline/tools/foreign_daily.py +0 -185
- package/node_modules/@ftshare-lab/dsh-kline/tools/free_sources.py +0 -483
- package/node_modules/@ftshare-lab/dsh-kline/tools/lines.py +0 -91
- package/node_modules/@ftshare-lab/dsh-kline/tools/nine_count.py +0 -66
- package/node_modules/@ftshare-lab/dsh-kline/tools/pattern_groups.py +0 -103
- package/node_modules/@ftshare-lab/dsh-kline/tools/pivots.py +0 -60
- package/node_modules/@ftshare-lab/dsh-kline/tools/polylines.py +0 -131
- package/node_modules/@ftshare-lab/dsh-kline/tools/price_bands.py +0 -165
- package/node_modules/@ftshare-lab/dsh-kline/tools/price_patterns.py +0 -311
- package/node_modules/@ftshare-lab/dsh-kline/tools/price_series.py +0 -162
- package/node_modules/@ftshare-lab/dsh-kline/tools/price_sticks.py +0 -114
- package/node_modules/@ftshare-lab/dsh-kline/tools/range_candidates.py +0 -170
- package/node_modules/@ftshare-lab/dsh-kline/tools/recent_drawing_candidates.py +0 -123
- package/node_modules/@ftshare-lab/dsh-kline/tools/rectangles.py +0 -76
- package/node_modules/@ftshare-lab/dsh-kline/tools/regression_channels.py +0 -87
- package/node_modules/@ftshare-lab/dsh-kline/tools/ta_functions.py +0 -228
- package/node_modules/@ftshare-lab/dsh-kline/tools/trend_lines.py +0 -106
- package/node_modules/@ftshare-lab/dsh-kline/tools/watchlist.py +0 -149
- package/node_modules/@ftshare-lab/dsh-kline/view/ft-logo.jpg +0 -0
- package/node_modules/@ftshare-lab/dsh-kline/view/vendor/klinecharts.min.js +0 -7
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { BetterSidebarService } from 'dsh-better-sidebar';
|
|
2
|
-
export declare const KLINE_TAB_ID = "ftshare-kline:chart";
|
|
3
|
-
export declare const KLINE_TAB_TITLE_ZH = "\u975E\u51F8 K \u7EBF\u52A9\u624B";
|
|
4
|
-
export declare const KLINE_TAB_TITLE_EN = "FtAI K-Line";
|
|
5
|
-
export declare function klineTabTitle(locale?: string): string;
|
|
6
|
-
export declare function migrateKlineTabTitle(service: BetterSidebarService, tab: {
|
|
7
|
-
id: string;
|
|
8
|
-
type: string;
|
|
9
|
-
title?: string;
|
|
10
|
-
}, sessionId?: string): void;
|
|
11
|
-
export declare function isSidebarUsable(service?: BetterSidebarService): boolean;
|
|
12
|
-
export declare function cleanClassicTabs(service: BetterSidebarService): () => void;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { type KlineHostOptions } from './host-options.ts';
|
|
2
|
-
export declare const ONBOARDING_KEY = "dsh-kline:onboarding-version:v2";
|
|
3
|
-
export declare function hasPreviousUsage(storage: Storage): boolean;
|
|
4
|
-
export declare function captureOnboarding(storage?: Storage): void;
|
|
5
|
-
export declare function onboardingKind(storage?: Storage, host?: KlineHostOptions | undefined): 'upgrade' | 'first' | 'none';
|
|
6
|
-
export declare function classifyOnboarding(storage: Storage, previousUsage: boolean): 'upgrade' | 'first' | 'none';
|
|
7
|
-
export declare function acknowledgeOnboarding(storage?: Storage): void;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function isNewerStableVersion(candidate: string, current: string): boolean;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export declare const FEEDBACK_KINDS: string[];
|
|
2
|
-
export declare const FEEDBACK_STATUSES: string[];
|
|
3
|
-
export declare const FEEDBACK_REASONS: string[];
|
|
4
|
-
export declare function sanitizeDrawingFeedback(raw: any, allowed: any[]): any;
|
|
5
|
-
export declare function collectDrawingFeedback(payload: any, context: any, chart: any, previous?: any[], phase?: string): any;
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
/** Environment variable naming the bridge file for the Python MCP server. */
|
|
2
|
-
export declare const SETTINGS_CREDENTIAL_ENV = "DSH_KLINE_SETTINGS_KEY_FILE";
|
|
3
|
-
/** Directory, relative to the runtime directory, owned by the host bridge. */
|
|
4
|
-
export declare const CREDENTIAL_DIRECTORY = "credentials";
|
|
5
|
-
/**
|
|
6
|
-
* Structural view of the settings service this bridge depends on.
|
|
7
|
-
*
|
|
8
|
-
* Declared here instead of imported from the settings plugin so that a host
|
|
9
|
-
* without that plugin needs no dependency, type, or build edge on it.
|
|
10
|
-
*/
|
|
11
|
-
export interface FtshareApiKeySettings {
|
|
12
|
-
/** Current Key, `undefined` when nothing is configured. */
|
|
13
|
-
resolve(): Promise<string | undefined>;
|
|
14
|
-
/** Credential invalidation notification; returns an unsubscribe function. */
|
|
15
|
-
subscribe(listener: () => void): () => void;
|
|
16
|
-
}
|
|
17
|
-
/** Host service name published by the DSH FTShare settings plugin. */
|
|
18
|
-
export interface FtshareSettingsService {
|
|
19
|
-
readonly apiKey: FtshareApiKeySettings;
|
|
20
|
-
}
|
|
21
|
-
export interface FtshareSettingsBridgeOptions {
|
|
22
|
-
settings: FtshareSettingsService;
|
|
23
|
-
/** Runtime directory shared with the launcher and the MCP server. */
|
|
24
|
-
runtimeDirectory: string;
|
|
25
|
-
/** Owning DSH host process, matching the accompanying service locator. */
|
|
26
|
-
hostPid?: number;
|
|
27
|
-
/** Optional diagnostic sink; the bridge stays silent without one. */
|
|
28
|
-
warn?: (message: string) => void;
|
|
29
|
-
}
|
|
30
|
-
export interface FtshareSettingsBridge {
|
|
31
|
-
/** Stop following the credential and remove the published file. */
|
|
32
|
-
dispose(): Promise<void>;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Path of the credential file published by the DSH host.
|
|
36
|
-
*
|
|
37
|
-
* The launcher mirrors this rule in `scripts/run-dsh-kline.mjs`; keeping the
|
|
38
|
-
* owner pid in the name means a file left behind by an earlier host can never
|
|
39
|
-
* be read by a later one.
|
|
40
|
-
*/
|
|
41
|
-
export declare function settingsCredentialFile(runtimeDirectory: string, hostPid: number): string;
|
|
42
|
-
/**
|
|
43
|
-
* Follow the settings credential until the returned bridge is disposed.
|
|
44
|
-
*
|
|
45
|
-
* The current Key is published immediately and re-published on every
|
|
46
|
-
* invalidation; clearing the Key removes the file. Failures are reported to
|
|
47
|
-
* `warn` and otherwise ignored: a credential convenience must never take the
|
|
48
|
-
* chart down.
|
|
49
|
-
*/
|
|
50
|
-
export declare function startFtshareSettingsBridge(options: FtshareSettingsBridgeOptions): FtshareSettingsBridge;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { IncomingMessage, ServerResponse } from 'node:http';
|
|
2
|
-
import { type FtshareSettingsService } from './ftshare-settings-bridge.ts';
|
|
3
|
-
export declare const name = "dsh-kline-sidebar";
|
|
4
|
-
export declare const inject: string[];
|
|
5
|
-
interface WebServerContext {
|
|
6
|
-
effect(callback: () => () => void, label: string): void;
|
|
7
|
-
inject?(deps: string[], callback: (ctx: WebServerContext) => void): unknown;
|
|
8
|
-
systemPrompt?: {
|
|
9
|
-
context(input: {
|
|
10
|
-
name: string;
|
|
11
|
-
order: number;
|
|
12
|
-
text: (context: any) => string;
|
|
13
|
-
}): () => void;
|
|
14
|
-
};
|
|
15
|
-
ftshareSettings?: FtshareSettingsService;
|
|
16
|
-
webServer: {
|
|
17
|
-
register(route: {
|
|
18
|
-
kind: 'prefix';
|
|
19
|
-
path: string;
|
|
20
|
-
handler: (request: IncomingMessage, response: ServerResponse) => void | Promise<void>;
|
|
21
|
-
}): () => void;
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
export declare function apply(ctx: WebServerContext): void;
|
|
25
|
-
export declare function runtimeDirectory(env?: NodeJS.ProcessEnv): string;
|
|
26
|
-
export {};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/** Canonical explicit labeled paths: no sorting, snapping or automatic waves. */
|
|
2
|
-
export interface LabeledPolylinePoint {
|
|
3
|
-
label: string;
|
|
4
|
-
time: number;
|
|
5
|
-
price: number;
|
|
6
|
-
}
|
|
7
|
-
export declare function sanitizePolylinePoints(raw: any): LabeledPolylinePoint[];
|
|
8
|
-
export declare function polylineOverlayPoints(command: any): {
|
|
9
|
-
timestamp: number;
|
|
10
|
-
value: number;
|
|
11
|
-
}[];
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
declare function source(raw: any): any;
|
|
2
|
-
declare function condition(raw: any): any;
|
|
3
|
-
export { source as sanitizePriceSource, condition as sanitizePriceCondition };
|
|
4
|
-
export declare function sanitizePriceSeriesCommand(raw: any, expectedBars: number, interval: string): any;
|
|
5
|
-
export declare function seriesObservation(raw: any): any;
|
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@ftshare-lab/dsh-kline",
|
|
3
|
-
"version": "0.6.11",
|
|
4
|
-
"description": "DeepSeek Harness K-line plugin for conversational and manual chart drawing, TA-Lib indicators, and FTShare market data.",
|
|
5
|
-
"license": "MIT",
|
|
6
|
-
"type": "module",
|
|
7
|
-
"files": [
|
|
8
|
-
"CHANGELOG.md",
|
|
9
|
-
"LICENSE",
|
|
10
|
-
"PROVENANCE.md",
|
|
11
|
-
"README.en.md",
|
|
12
|
-
"README.md",
|
|
13
|
-
"chart_service.py",
|
|
14
|
-
"config",
|
|
15
|
-
"cordis.patch.yml",
|
|
16
|
-
"core",
|
|
17
|
-
"docs/images",
|
|
18
|
-
"docs/release-acceptance-v0.4.0.md",
|
|
19
|
-
"docs/release-acceptance-v0.4.1.md",
|
|
20
|
-
"docs/release-acceptance-v0.5.0.md",
|
|
21
|
-
"docs/release-notes-v0.5.0.md",
|
|
22
|
-
"docs/release-acceptance-v0.6.0.md",
|
|
23
|
-
"docs/release-notes-v0.6.0.md",
|
|
24
|
-
"docs/chart-functions.md",
|
|
25
|
-
"docs/price-pattern-rules-v1.md",
|
|
26
|
-
"docs/price-pattern-samples-v1.md",
|
|
27
|
-
"docs/automatic-drawing.md",
|
|
28
|
-
"docs/fixtures/price-pattern-real-v1.json",
|
|
29
|
-
"!core/**/__pycache__/**",
|
|
30
|
-
"!core/**/*.py[cod]",
|
|
31
|
-
"lib",
|
|
32
|
-
"requirements.txt",
|
|
33
|
-
"screenshots.json",
|
|
34
|
-
"scripts/bootstrap.sh",
|
|
35
|
-
"scripts/run-dsh-kline.mjs",
|
|
36
|
-
"scripts/run-dsh-kline.sh",
|
|
37
|
-
"server.py",
|
|
38
|
-
"tools",
|
|
39
|
-
"!tools/**/__pycache__/**",
|
|
40
|
-
"!tools/**/*.py[cod]",
|
|
41
|
-
"view",
|
|
42
|
-
"docs/release-notes-v0.6.1.md",
|
|
43
|
-
"docs/release-acceptance-v0.6.1.md",
|
|
44
|
-
"docs/release-notes-v0.6.2.md",
|
|
45
|
-
"docs/release-acceptance-v0.6.2.md",
|
|
46
|
-
"docs/release-notes-v0.6.3.md",
|
|
47
|
-
"docs/release-acceptance-v0.6.3.md",
|
|
48
|
-
"scripts/dsh-mcp-plugin.mjs",
|
|
49
|
-
"docs/release-notes-v0.6.4.md",
|
|
50
|
-
"docs/release-acceptance-v0.6.4.md",
|
|
51
|
-
"docs/embedding.md",
|
|
52
|
-
"docs/anonymous-market-support.md",
|
|
53
|
-
"docs/release-notes-v0.6.5.md",
|
|
54
|
-
"docs/release-acceptance-v0.6.5.md",
|
|
55
|
-
"docs/release-notes-v0.6.6.md",
|
|
56
|
-
"docs/release-acceptance-v0.6.6.md",
|
|
57
|
-
"docs/free-foreign-daily.md",
|
|
58
|
-
"docs/release-notes-v0.6.7.md",
|
|
59
|
-
"docs/release-acceptance-v0.6.7.md",
|
|
60
|
-
"docs/release-notes-v0.6.8.md",
|
|
61
|
-
"docs/release-acceptance-v0.6.8.md",
|
|
62
|
-
"scripts/dsh-bootstrap.mjs",
|
|
63
|
-
"docs/release-notes-v0.6.9.md",
|
|
64
|
-
"docs/release-acceptance-v0.6.9.md",
|
|
65
|
-
"docs/npm-release.md",
|
|
66
|
-
"docs/guide.md",
|
|
67
|
-
"docs/guide.en.md",
|
|
68
|
-
"docs/drawing-examples.md",
|
|
69
|
-
"docs/drawing-examples.en.md",
|
|
70
|
-
"docs/provider-adaptation.md",
|
|
71
|
-
"docs/release-notes-v0.6.10.md",
|
|
72
|
-
"docs/release-acceptance-v0.6.10.md",
|
|
73
|
-
"docs/release-notes-v0.6.11.md",
|
|
74
|
-
"docs/release-acceptance-v0.6.11.md"
|
|
75
|
-
],
|
|
76
|
-
"main": "lib/index.js",
|
|
77
|
-
"types": "lib/types/index.d.ts",
|
|
78
|
-
"exports": {
|
|
79
|
-
".": {
|
|
80
|
-
"types": "./lib/types/index.d.ts",
|
|
81
|
-
"default": "./lib/index.js"
|
|
82
|
-
},
|
|
83
|
-
"./client": {
|
|
84
|
-
"types": "./lib/types/client/index.d.ts",
|
|
85
|
-
"default": "./lib/client.js"
|
|
86
|
-
},
|
|
87
|
-
"./cordis.patch.yml": "./cordis.patch.yml",
|
|
88
|
-
"./package.json": "./package.json"
|
|
89
|
-
},
|
|
90
|
-
"dsh": {
|
|
91
|
-
"bundle": {
|
|
92
|
-
"patch": "./cordis.patch.yml"
|
|
93
|
-
},
|
|
94
|
-
"client": {
|
|
95
|
-
"platform": "web",
|
|
96
|
-
"inject": [
|
|
97
|
-
"@deepseek-ai/dsh-api-session-controller"
|
|
98
|
-
]
|
|
99
|
-
}
|
|
100
|
-
},
|
|
101
|
-
"repository": {
|
|
102
|
-
"type": "git",
|
|
103
|
-
"url": "git+https://github.com/FTShare-Lab/dsh_kline.git"
|
|
104
|
-
},
|
|
105
|
-
"bugs": {
|
|
106
|
-
"url": "https://github.com/FTShare-Lab/dsh_kline/issues"
|
|
107
|
-
},
|
|
108
|
-
"homepage": "https://github.com/FTShare-Lab/dsh_kline#readme",
|
|
109
|
-
"keywords": [
|
|
110
|
-
"deepseek",
|
|
111
|
-
"dsh",
|
|
112
|
-
"mcp",
|
|
113
|
-
"kline",
|
|
114
|
-
"ftshare"
|
|
115
|
-
],
|
|
116
|
-
"packageManager": "pnpm@11.7.0",
|
|
117
|
-
"engines": {
|
|
118
|
-
"node": ">=22.19.0"
|
|
119
|
-
},
|
|
120
|
-
"scripts": {
|
|
121
|
-
"bootstrap": "node ./scripts/run-dsh-kline.mjs --prepare-project",
|
|
122
|
-
"pack:release": "node ./scripts/build-release-package.mjs ./release/dsh-kline-v0.6.11.tgz",
|
|
123
|
-
"pack:codex": "node ./scripts/build-codex-package.mjs ./release/ft-kline-v0.6.11.zip && node ./scripts/verify-codex-package.mjs ./release/ft-kline-v0.6.11.zip",
|
|
124
|
-
"smoke:codex-package": "python ./scripts/smoke-codex-package.py ./release/ft-kline-v0.6.11.zip",
|
|
125
|
-
"generate:client-view": "node ./scripts/generate-client-view.mjs",
|
|
126
|
-
"build:sidebar": "pnpm generate:client-view && tsc -p tsconfig.json && tsdown --config tsdown.config.ts && pnpm verify:package",
|
|
127
|
-
"verify:package": "node ./scripts/verify-package.mjs",
|
|
128
|
-
"verify:packages": "pnpm verify:package && pnpm pack:release && pnpm pack:codex",
|
|
129
|
-
"dsh:web": "bash ./scripts/run-dsh-web.sh",
|
|
130
|
-
"test": "node ./scripts/run-tests.mjs",
|
|
131
|
-
"test:node": "node ./scripts/run-tests.mjs --node",
|
|
132
|
-
"test:python": "node ./scripts/run-tests.mjs --python",
|
|
133
|
-
"test:launcher": "node --test tests/launcher-paths.test.mjs",
|
|
134
|
-
"generate:codex-catalog": "python scripts/generate-codex-catalog.py",
|
|
135
|
-
"verify:codex-catalog": "python scripts/generate-codex-catalog.py --check",
|
|
136
|
-
"sync:codex-marketplace": "node scripts/sync-codex-marketplace.mjs",
|
|
137
|
-
"verify:codex-marketplace": "node scripts/sync-codex-marketplace.mjs --check",
|
|
138
|
-
"generate:dsh-catalog": "python scripts/generate-dsh-catalog.py",
|
|
139
|
-
"verify:dsh-catalog": "python scripts/generate-dsh-catalog.py --check"
|
|
140
|
-
},
|
|
141
|
-
"devDependencies": {
|
|
142
|
-
"@deepseek-ai/dsh": "0.1.5-rc.2",
|
|
143
|
-
"@types/node": "22.20.0",
|
|
144
|
-
"@types/react": "18.3.31",
|
|
145
|
-
"@types/react-dom": "18.3.7",
|
|
146
|
-
"dsh-better-sidebar": "0.19.1",
|
|
147
|
-
"react": "18.3.1",
|
|
148
|
-
"react-dom": "18.3.1",
|
|
149
|
-
"tsdown": "0.22.2",
|
|
150
|
-
"typescript": "6.0.3",
|
|
151
|
-
"unrun": "^0.3.1"
|
|
152
|
-
},
|
|
153
|
-
"publishConfig": {
|
|
154
|
-
"access": "public",
|
|
155
|
-
"registry": "https://registry.npmjs.org/"
|
|
156
|
-
}
|
|
157
|
-
}
|
|
@@ -1,179 +0,0 @@
|
|
|
1
|
-
// Keep the host's MCP connection alive while Python is prepared or restarted.
|
|
2
|
-
// No deferred/expired call or in-flight operation is replayed after a failure.
|
|
3
|
-
import { spawn } from 'node:child_process'
|
|
4
|
-
import { createInterface } from 'node:readline'
|
|
5
|
-
import { readFileSync, mkdirSync, writeFileSync, renameSync, appendFileSync, statSync, rmSync } from 'node:fs'
|
|
6
|
-
import { join } from 'node:path'
|
|
7
|
-
import { defaultStateDirectory } from './run-dsh-kline.mjs'
|
|
8
|
-
|
|
9
|
-
const catalog = JSON.parse(readFileSync(new URL('../config/dsh-tool-catalog.json', import.meta.url), 'utf8'))
|
|
10
|
-
const runtimeTool = { name: 'dsh_kline_runtime_status', description: 'Check Python preparation or recovery. The complete tool catalog is available from startup; retry the requested tool when ready. Never replay an operation with an unknown outcome.',
|
|
11
|
-
inputSchema: { type: 'object', properties: {}, additionalProperties: false }, annotations: { readOnlyHint: true } }
|
|
12
|
-
|
|
13
|
-
export function serve({ input = process.stdin, output = process.stdout, error = process.stderr,
|
|
14
|
-
command = process.execPath, args, env = process.env, spawnServer = spawn,
|
|
15
|
-
preparationWaitMs = 5000, retryDelayMs = 1000, maxRetryDelayMs = 30000, handshakeTimeoutMs = 20 * 60 * 1000 } = {}) {
|
|
16
|
-
const hostPid = /^[1-9]\d*$/.test(env.DSH_KLINE_HOST_PID || '') ? env.DSH_KLINE_HOST_PID : String(process.ppid)
|
|
17
|
-
const directory = join(defaultStateDirectory(env), 'logs')
|
|
18
|
-
const logPath = join(directory, `backend-${hostPid}.log`)
|
|
19
|
-
const statusPath = join(directory, `backend-${hostPid}.json`)
|
|
20
|
-
let child, lines, init, retryTimer, handshakeTimer, closed = false, ready = false, failures = 0, lastError
|
|
21
|
-
const queued = new Map(), inFlight = new Map()
|
|
22
|
-
const send = value => { if (!closed) output.write(`${JSON.stringify(value)}\n`) }
|
|
23
|
-
const reply = (id, result) => send({ jsonrpc: '2.0', id, result })
|
|
24
|
-
const protocolError = (id, code, message) => send({ jsonrpc: '2.0', id, error: { code, message } })
|
|
25
|
-
const status = () => ({ ok: ready, phase: ready ? 'ready' : lastError ? 'recovering' : 'preparing',
|
|
26
|
-
error: ready ? undefined : lastError || 'runtime_preparing', retryable: !closed,
|
|
27
|
-
host_process_id: Number(hostPid), launcher_process_id: process.pid, log_path: logPath })
|
|
28
|
-
const persist = () => {
|
|
29
|
-
try {
|
|
30
|
-
mkdirSync(directory, { recursive: true, mode: 0o700 })
|
|
31
|
-
const temporary = `${statusPath}.${process.pid}.tmp`
|
|
32
|
-
writeFileSync(temporary, JSON.stringify({ ...status(), updated_at: Date.now() }), { mode: 0o600 })
|
|
33
|
-
renameSync(temporary, statusPath)
|
|
34
|
-
} catch { /* A diagnostic failure must not close the protocol connection. */ }
|
|
35
|
-
}
|
|
36
|
-
const log = chunk => {
|
|
37
|
-
error.write(chunk)
|
|
38
|
-
try {
|
|
39
|
-
mkdirSync(directory, { recursive: true, mode: 0o700 })
|
|
40
|
-
try { if (statSync(logPath).size + Buffer.byteLength(chunk) > 1024 * 1024) { rmSync(`${logPath}.previous`, {force:true}); renameSync(logPath, `${logPath}.previous`) } } catch {}
|
|
41
|
-
appendFileSync(logPath, chunk, { mode: 0o600 })
|
|
42
|
-
} catch { /* stderr remains available when the cache is not writable. */ }
|
|
43
|
-
}
|
|
44
|
-
const unavailable = (id, dispatched = false) => reply(id, {
|
|
45
|
-
content: [{ type: 'text', text: dispatched
|
|
46
|
-
? '后端连接中断,操作结果未知。请先核对当前状态,不要自动重放操作。'
|
|
47
|
-
: ready ? '后端已恢复,请重新发起操作。' : 'Python 正在准备或恢复。此操作尚未执行,请就绪后重试。' }],
|
|
48
|
-
structuredContent: { ...status(), ok: false, error: dispatched ? 'runtime_connection_lost' : lastError || 'runtime_preparing',
|
|
49
|
-
operation_dispatched: dispatched, outcome_unknown: dispatched }, isError: true,
|
|
50
|
-
})
|
|
51
|
-
const cancelQueued = id => {
|
|
52
|
-
const item = queued.get(id)
|
|
53
|
-
if (item) { clearTimeout(item.timer); queued.delete(id) }
|
|
54
|
-
}
|
|
55
|
-
const forward = message => {
|
|
56
|
-
if (message.id != null && message.method) inFlight.set(message.id, message)
|
|
57
|
-
child.stdin.write(`${JSON.stringify(message)}\n`)
|
|
58
|
-
}
|
|
59
|
-
const terminate = generation => {
|
|
60
|
-
generation.stdin.destroy()
|
|
61
|
-
if (!generation.pid) { generation.kill(); return }
|
|
62
|
-
if (process.platform === 'win32') {
|
|
63
|
-
// Terminate the owned install/backend tree, including pip children. A
|
|
64
|
-
// parent-only kill can leave an installer racing the next activation.
|
|
65
|
-
const killer = spawn('taskkill', ['/pid', String(generation.pid), '/T', '/F'], {stdio:'ignore', windowsHide:true})
|
|
66
|
-
killer.on('error', () => generation.kill())
|
|
67
|
-
} else {
|
|
68
|
-
// spawn(detached) below gives this generation its own process group.
|
|
69
|
-
try { process.kill(-generation.pid, 'SIGTERM') } catch { generation.kill() }
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
const down = (generation, reason) => {
|
|
73
|
-
if (closed || child !== generation) return
|
|
74
|
-
ready = false; child = undefined; lastError = reason
|
|
75
|
-
clearTimeout(handshakeTimer)
|
|
76
|
-
lines?.close()
|
|
77
|
-
terminate(generation)
|
|
78
|
-
for (const [id, message] of inFlight) {
|
|
79
|
-
if (message.method === 'tools/call') unavailable(id, true)
|
|
80
|
-
else protocolError(id, -32603, 'Backend connection lost; request was not replayed')
|
|
81
|
-
}
|
|
82
|
-
inFlight.clear()
|
|
83
|
-
for (const id of queued.keys()) { cancelQueued(id); unavailable(id) }
|
|
84
|
-
failures += 1
|
|
85
|
-
const wait = Math.min(maxRetryDelayMs, retryDelayMs * 2 ** Math.min(failures - 1, 10))
|
|
86
|
-
log(`[dsh_kline] ${reason}; retrying backend in ${wait}ms; MCP connection retained.\n`)
|
|
87
|
-
persist()
|
|
88
|
-
// Wait for this generation to exit before starting another Python owner.
|
|
89
|
-
const schedule = () => {
|
|
90
|
-
if (!closed && !retryTimer) retryTimer = setTimeout(() => { retryTimer = undefined; start() }, wait)
|
|
91
|
-
}
|
|
92
|
-
if (generation.exitCode != null || generation.signalCode != null || !generation.pid) schedule()
|
|
93
|
-
else generation.once('exit', schedule)
|
|
94
|
-
}
|
|
95
|
-
const start = () => {
|
|
96
|
-
if (closed || child) return
|
|
97
|
-
let generation
|
|
98
|
-
try { generation = spawnServer(command, args, { env: { ...env, DSH_KLINE_DEFER_BOOTSTRAP: '0' }, stdio: ['pipe', 'pipe', 'pipe'], detached:process.platform !== 'win32', windowsHide: true }) }
|
|
99
|
-
catch {
|
|
100
|
-
lastError = 'backend_spawn_failed'; failures += 1; log('[dsh_kline] backend_spawn_failed; MCP connection retained.\n'); persist()
|
|
101
|
-
retryTimer = setTimeout(() => { retryTimer = undefined; start() }, Math.min(maxRetryDelayMs, retryDelayMs * 2 ** Math.min(failures - 1, 10)))
|
|
102
|
-
return
|
|
103
|
-
}
|
|
104
|
-
child = generation; persist()
|
|
105
|
-
generation.stderr.on('data', log)
|
|
106
|
-
generation.stdin.on('error', () => down(generation, 'backend_pipe_failed'))
|
|
107
|
-
generation.on('error', () => down(generation, 'backend_spawn_failed'))
|
|
108
|
-
generation.on('exit', (code, signal) => {
|
|
109
|
-
if (child === generation && !closed) log(`[dsh_kline] Backend exited code=${code} signal=${signal || 'none'}.\n`)
|
|
110
|
-
down(generation, 'backend_exited')
|
|
111
|
-
})
|
|
112
|
-
lines = createInterface({ input: generation.stdout })
|
|
113
|
-
lines.on('line', line => {
|
|
114
|
-
if (child !== generation || closed) return
|
|
115
|
-
let value
|
|
116
|
-
try { value = JSON.parse(line) } catch { log('[dsh_kline] Ignored non-protocol backend stdout.\n'); return }
|
|
117
|
-
if (!value || typeof value !== 'object' || Array.isArray(value) || value.jsonrpc !== '2.0') {
|
|
118
|
-
log('[dsh_kline] Ignored invalid backend protocol frame.\n'); return
|
|
119
|
-
}
|
|
120
|
-
if (!ready && value.id === 'dsh-kline-bootstrap-initialize') {
|
|
121
|
-
if (value.error || !value.result) { down(generation, 'backend_initialize_failed'); return }
|
|
122
|
-
clearTimeout(handshakeTimer)
|
|
123
|
-
forward({ jsonrpc: '2.0', method: 'notifications/initialized' })
|
|
124
|
-
ready = true; lastError = undefined; failures = 0; persist()
|
|
125
|
-
for (const [id, request] of queued) { cancelQueued(id); forward(request.message) }
|
|
126
|
-
} else if (!['notifications/tools/list_changed', 'notifications/resources/list_changed'].includes(value.method)) {
|
|
127
|
-
if (!value.method) inFlight.delete(value.id)
|
|
128
|
-
send(value)
|
|
129
|
-
}
|
|
130
|
-
})
|
|
131
|
-
handshakeTimer = setTimeout(() => down(generation, 'backend_initialize_timeout'), handshakeTimeoutMs)
|
|
132
|
-
forward({ ...init, id: 'dsh-kline-bootstrap-initialize' })
|
|
133
|
-
inFlight.delete('dsh-kline-bootstrap-initialize')
|
|
134
|
-
}
|
|
135
|
-
const shutdown = () => {
|
|
136
|
-
if (closed) return
|
|
137
|
-
closed = true; ready = false
|
|
138
|
-
clearTimeout(retryTimer); clearTimeout(handshakeTimer)
|
|
139
|
-
for (const id of queued.keys()) cancelQueued(id)
|
|
140
|
-
inFlight.clear()
|
|
141
|
-
if (child) terminate(child)
|
|
142
|
-
lines?.close(); inputLines.close()
|
|
143
|
-
process.removeListener('SIGTERM', shutdown); process.removeListener('SIGINT', shutdown)
|
|
144
|
-
}
|
|
145
|
-
const inputLines = createInterface({ input })
|
|
146
|
-
inputLines.on('line', line => {
|
|
147
|
-
let message
|
|
148
|
-
try { message = JSON.parse(line) } catch { protocolError(null, -32700, 'Invalid JSON'); return }
|
|
149
|
-
if (!message || typeof message !== 'object' || Array.isArray(message) || message.jsonrpc !== '2.0') { protocolError(null, -32600, 'Invalid JSON-RPC message'); return }
|
|
150
|
-
if (message.method === 'initialize' && !init) {
|
|
151
|
-
init = message
|
|
152
|
-
reply(message.id, { protocolVersion: message.params?.protocolVersion || '2024-11-05',
|
|
153
|
-
capabilities: { tools: { listChanged: false } }, serverInfo: { name: 'dsh_kline', version: catalog.version },
|
|
154
|
-
instructions: `${catalog.instructions}\nThe complete tool catalog is available during preparation. Retry calls reporting runtime_preparing only after readiness; never replay operations with unknown outcomes.` })
|
|
155
|
-
start(); return
|
|
156
|
-
}
|
|
157
|
-
if (message.method === 'ping') { reply(message.id, {}); return }
|
|
158
|
-
if (!init) { if (message.id != null) protocolError(message.id, -32002, 'Initialize the server first'); return }
|
|
159
|
-
if (message.method === 'tools/list') reply(message.id, { tools: [...catalog.tools, runtimeTool] })
|
|
160
|
-
else if (message.method === 'resources/list') reply(message.id, { resources: [] })
|
|
161
|
-
else if (message.method === 'resources/templates/list') reply(message.id, { resourceTemplates: [] })
|
|
162
|
-
else if (message.method === 'tools/call' && message.params?.name === runtimeTool.name) {
|
|
163
|
-
reply(message.id, { content: [{ type: 'text', text: JSON.stringify(status()) }], structuredContent: status(), isError: false })
|
|
164
|
-
} else if (message.method === 'notifications/initialized') { /* Child has its own handshake. */ }
|
|
165
|
-
else if (message.method === 'notifications/cancelled') {
|
|
166
|
-
if (queued.has(message.params?.requestId)) cancelQueued(message.params.requestId)
|
|
167
|
-
else if (ready) { inFlight.delete(message.params?.requestId); forward(message) }
|
|
168
|
-
} else if (message.method === 'tools/call' && !catalog.tools.some(tool => tool.name === message.params?.name)) protocolError(message.id, -32602, 'Unknown tool')
|
|
169
|
-
else if (ready) forward(message)
|
|
170
|
-
else if (message.method === 'tools/call') {
|
|
171
|
-
if (queued.has(message.id)) return
|
|
172
|
-
const timer = setTimeout(() => { queued.delete(message.id); unavailable(message.id) }, preparationWaitMs)
|
|
173
|
-
queued.set(message.id, { message, timer })
|
|
174
|
-
} else if (message.id != null) protocolError(message.id, -32002, 'Python backend is preparing or recovering')
|
|
175
|
-
})
|
|
176
|
-
inputLines.on('close', shutdown)
|
|
177
|
-
process.on('SIGTERM', shutdown); process.on('SIGINT', shutdown)
|
|
178
|
-
return { shutdown }
|
|
179
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
// A relative Cordis plugin name is anchored beside its bundle patch by DSH.
|
|
2
|
-
// Resolve the Python launcher from this module, including nested/pnpm installs.
|
|
3
|
-
import { existsSync, readFileSync, realpathSync } from 'node:fs'
|
|
4
|
-
import { isAbsolute, join, resolve } from 'node:path'
|
|
5
|
-
import { fileURLToPath } from 'node:url'
|
|
6
|
-
|
|
7
|
-
export const name = 'dsh-kline-mcp-launcher'
|
|
8
|
-
export const inject = ['loader']
|
|
9
|
-
|
|
10
|
-
export function mcpConfiguration(config = {}, env = process.env, packageRoot = fileURLToPath(new URL('..', import.meta.url))) {
|
|
11
|
-
const override = String(env.DSH_KLINE_PACKAGE_ROOT || '').trim()
|
|
12
|
-
if (override && !isAbsolute(override)) throw new Error('DSH_KLINE_PACKAGE_ROOT must be an absolute package directory')
|
|
13
|
-
let root = resolve(override || packageRoot)
|
|
14
|
-
let manifest
|
|
15
|
-
try { root = realpathSync(root); manifest = JSON.parse(readFileSync(join(root, 'package.json'), 'utf8')) } catch {}
|
|
16
|
-
if (manifest?.name !== '@ftshare-lab/dsh-kline' || !existsSync(join(root, 'scripts', 'run-dsh-kline.mjs'))) {
|
|
17
|
-
throw new Error('dsh_kline package directory is incomplete; reinstall the plugin or correct DSH_KLINE_PACKAGE_ROOT')
|
|
18
|
-
}
|
|
19
|
-
return { ...config, command: config.command || process.execPath, transport: 'stdio',
|
|
20
|
-
cwd: root, args: [join(root, 'scripts', 'run-dsh-kline.mjs')] }
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export async function apply(ctx, config) {
|
|
24
|
-
const resolved = mcpConfiguration(config)
|
|
25
|
-
const client = await ctx.loader.import('@deepseek-ai/dsh-mcp-client')
|
|
26
|
-
ctx.plugin(client.default || client, resolved)
|
|
27
|
-
}
|