@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.
- package/CHANGELOG.md +611 -0
- package/LICENSE +21 -0
- package/PROVENANCE.md +13 -0
- package/README.en.md +171 -0
- package/README.md +170 -2
- package/chart_service.py +687 -0
- package/config/basic-symbols.json +570 -0
- package/config/dsh-kline.patch.yml +4 -0
- package/config/dsh-tool-catalog.json +3875 -0
- package/cordis.patch.yml +33 -0
- package/core/__init__.py +0 -0
- package/core/adjustment.py +16 -0
- package/core/calc.py +691 -0
- package/core/rows.py +228 -0
- package/core/ta_engine.py +99 -0
- package/docs/anonymous-market-support.md +33 -0
- package/docs/automatic-drawing.md +24 -0
- package/docs/chart-functions.md +136 -0
- package/docs/drawing-examples.en.md +13 -0
- package/docs/drawing-examples.md +13 -0
- package/docs/embedding.md +77 -0
- package/docs/fixtures/price-pattern-real-v1.json +1 -0
- package/docs/free-foreign-daily.md +44 -0
- package/docs/guide.en.md +232 -0
- package/docs/guide.md +248 -0
- package/docs/images/abc-drawing-v0.5.0.jpg +0 -0
- package/docs/images/channel-drawing-v0.5.0.jpg +0 -0
- package/docs/images/drawing-workbench-v0.5.0.jpg +0 -0
- package/docs/images/dsh-kline-tab-workspace.png +0 -0
- package/docs/images/dsh-market.png +0 -0
- package/docs/images/kline-news.png +0 -0
- package/docs/images/kline-range-stats.png +0 -0
- package/docs/images/kline-support.png +0 -0
- package/docs/images/main-chart-comparison-v0.6.9.png +0 -0
- package/docs/images/market-overview-v0.6.9.png +0 -0
- package/docs/images/natural-language-abc-wolong-2026-10-27.png +0 -0
- package/docs/images/natural-language-descending-channel-wolong-2026-10-27.png +0 -0
- package/docs/images/platform-breakout-msft-v0.6.9.png +0 -0
- package/docs/npm-release.md +33 -0
- package/docs/price-pattern-rules-v1.md +40 -0
- package/docs/price-pattern-samples-v1.md +42 -0
- package/docs/provider-adaptation.md +73 -0
- package/docs/release-acceptance-v0.4.0.md +46 -0
- package/docs/release-acceptance-v0.4.1.md +43 -0
- package/docs/release-acceptance-v0.5.0.md +40 -0
- package/docs/release-acceptance-v0.6.0.md +33 -0
- package/docs/release-acceptance-v0.6.1.md +19 -0
- package/docs/release-acceptance-v0.6.10.md +21 -0
- package/docs/release-acceptance-v0.6.11.md +21 -0
- package/docs/release-acceptance-v0.6.2.md +31 -0
- package/docs/release-acceptance-v0.6.3.md +25 -0
- package/docs/release-acceptance-v0.6.4.md +24 -0
- package/docs/release-acceptance-v0.6.5.md +21 -0
- package/docs/release-acceptance-v0.6.6.md +21 -0
- package/docs/release-acceptance-v0.6.7.md +18 -0
- package/docs/release-acceptance-v0.6.8.md +18 -0
- package/docs/release-acceptance-v0.6.9.md +98 -0
- package/docs/release-notes-v0.5.0.md +23 -0
- package/docs/release-notes-v0.6.0.md +11 -0
- package/docs/release-notes-v0.6.1.md +20 -0
- package/docs/release-notes-v0.6.10.md +11 -0
- package/docs/release-notes-v0.6.11.md +16 -0
- package/docs/release-notes-v0.6.2.md +14 -0
- package/docs/release-notes-v0.6.3.md +26 -0
- package/docs/release-notes-v0.6.4.md +12 -0
- package/docs/release-notes-v0.6.5.md +13 -0
- package/docs/release-notes-v0.6.6.md +13 -0
- package/docs/release-notes-v0.6.7.md +17 -0
- package/docs/release-notes-v0.6.8.md +10 -0
- package/docs/release-notes-v0.6.9.md +16 -0
- package/lib/candle-sequence.js +15 -0
- package/lib/chart-adjustment.js +7 -0
- package/lib/chart-annotations.js +33 -0
- package/lib/chart-applications.js +171 -0
- package/lib/chart-context.js +164 -0
- package/lib/chart-observation.js +251 -0
- package/lib/chart-service-status.js +82 -0
- package/lib/chart-source-status.js +39 -0
- package/lib/chart-sources.js +354 -0
- package/lib/client/BetterSidebarTab.js +70 -0
- package/lib/client/ClassicShell.js +254 -0
- package/lib/client/KlineContent.js +155 -0
- package/lib/client/PanelHost.js +46 -0
- package/lib/client/chart-apply.js +73 -0
- package/lib/client/chart-context.js +233 -0
- package/lib/client/chart-handoff.js +34 -0
- package/lib/client/chart-session-resolver.js +74 -0
- package/lib/client/client-context.js +1 -0
- package/lib/client/conversation.js +88 -0
- package/lib/client/default-tab.js +83 -0
- package/lib/client/embed.js +50 -0
- package/lib/client/generated-view.js +12983 -0
- package/lib/client/horizontal-lines.js +19 -0
- package/lib/client/host-options.js +41 -0
- package/lib/client/host-panels.js +111 -0
- package/lib/client/index.js +77 -0
- package/lib/client/mode-preferences.js +48 -0
- package/lib/client/native-sidebar-contract.js +45 -0
- package/lib/client/native-sidebar-register.js +133 -0
- package/lib/client/native-sidebar-services.js +1 -0
- package/lib/client/native-sidebar.js +98 -0
- package/lib/client/sidebar-integration.js +93 -0
- package/lib/client/ui-onboarding.js +48 -0
- package/lib/client/version.js +14 -0
- package/lib/client.js +17581 -0
- package/lib/client.js.map +1 -0
- package/lib/drawing-feedback.js +284 -0
- package/lib/fibonacci.js +18 -0
- package/lib/ftshare-settings-bridge.js +159 -0
- package/lib/index.js +279 -0
- package/lib/labeled-polyline.js +17 -0
- package/lib/pattern-groups.js +91 -0
- package/lib/price-bands.js +55 -0
- package/lib/price-series.js +47 -0
- package/lib/price-sticks.js +32 -0
- package/lib/types/candle-sequence.d.ts +2 -0
- package/lib/types/chart-adjustment.d.ts +2 -0
- package/lib/types/chart-annotations.d.ts +4 -0
- package/lib/types/chart-applications.d.ts +26 -0
- package/lib/types/chart-context.d.ts +14 -0
- package/lib/types/chart-observation.d.ts +8 -0
- package/lib/types/chart-service-status.d.ts +22 -0
- package/lib/types/chart-source-status.d.ts +47 -0
- package/lib/types/chart-sources.d.ts +25 -0
- package/lib/types/client/BetterSidebarTab.d.ts +12 -0
- package/lib/types/client/ClassicShell.d.ts +4 -0
- package/lib/types/client/KlineContent.d.ts +37 -0
- package/lib/types/client/PanelHost.d.ts +25 -0
- package/lib/types/client/chart-apply.d.ts +13 -0
- package/lib/types/client/chart-context.d.ts +23 -0
- package/lib/types/client/chart-handoff.d.ts +5 -0
- package/lib/types/client/chart-session-resolver.d.ts +2 -0
- package/lib/types/client/client-context.d.ts +16 -0
- package/lib/types/client/conversation.d.ts +43 -0
- package/lib/types/client/default-tab.d.ts +3 -0
- package/lib/types/client/embed.d.ts +37 -0
- package/lib/types/client/generated-view.d.ts +2 -0
- package/lib/types/client/horizontal-lines.d.ts +1 -0
- package/lib/types/client/host-options.d.ts +38 -0
- package/lib/types/client/host-panels.d.ts +55 -0
- package/lib/types/client/index.d.ts +4 -0
- package/lib/types/client/mode-preferences.d.ts +25 -0
- package/lib/types/client/native-sidebar-contract.d.ts +52 -0
- package/lib/types/client/native-sidebar-register.d.ts +46 -0
- package/lib/types/client/native-sidebar-services.d.ts +45 -0
- package/lib/types/client/native-sidebar.d.ts +47 -0
- package/lib/types/client/sidebar-integration.d.ts +12 -0
- package/lib/types/client/ui-onboarding.d.ts +7 -0
- package/lib/types/client/version.d.ts +1 -0
- package/lib/types/drawing-feedback.d.ts +5 -0
- package/lib/types/fibonacci.d.ts +5 -0
- package/lib/types/ftshare-settings-bridge.d.ts +50 -0
- package/lib/types/index.d.ts +26 -0
- package/lib/types/labeled-polyline.d.ts +11 -0
- package/lib/types/pattern-groups.d.ts +2 -0
- package/lib/types/price-bands.d.ts +3 -0
- package/lib/types/price-series.d.ts +5 -0
- package/lib/types/price-sticks.d.ts +3 -0
- package/package.json +155 -4
- package/requirements.txt +6 -0
- package/screenshots.json +8 -0
- package/scripts/bootstrap.sh +5 -0
- package/scripts/dsh-bootstrap.mjs +179 -0
- package/scripts/dsh-mcp-plugin.mjs +27 -0
- package/scripts/run-dsh-kline.mjs +658 -0
- package/scripts/run-dsh-kline.sh +5 -0
- package/server.py +1755 -0
- package/tools/__init__.py +0 -0
- package/tools/annotations.py +119 -0
- package/tools/automatic_analysis.py +158 -0
- package/tools/baostock_source.py +176 -0
- package/tools/calc.py +39 -0
- package/tools/channel_candidates.py +260 -0
- package/tools/channel_preview.py +82 -0
- package/tools/channels.py +104 -0
- package/tools/chart_applications.py +204 -0
- package/tools/chart_context.py +186 -0
- package/tools/chart_edits.py +363 -0
- package/tools/chart_functions.py +451 -0
- package/tools/chart_indicators.py +65 -0
- package/tools/chart_measurements.py +84 -0
- package/tools/chart_source_status.py +32 -0
- package/tools/chart_sources.py +31 -0
- package/tools/closed_daily.py +68 -0
- package/tools/draw.py +410 -0
- package/tools/drawing_feedback.py +45 -0
- package/tools/drawing_interaction.py +117 -0
- package/tools/drawing_verification.py +141 -0
- package/tools/fetch.py +4680 -0
- package/tools/fibonacci.py +83 -0
- package/tools/foreign_daily.py +185 -0
- package/tools/free_sources.py +483 -0
- package/tools/lines.py +91 -0
- package/tools/nine_count.py +66 -0
- package/tools/pattern_groups.py +103 -0
- package/tools/pivots.py +60 -0
- package/tools/polylines.py +131 -0
- package/tools/price_bands.py +165 -0
- package/tools/price_patterns.py +311 -0
- package/tools/price_series.py +162 -0
- package/tools/price_sticks.py +114 -0
- package/tools/range_candidates.py +170 -0
- package/tools/recent_drawing_candidates.py +123 -0
- package/tools/rectangles.py +76 -0
- package/tools/regression_channels.py +87 -0
- package/tools/ta_functions.py +228 -0
- package/tools/trend_lines.py +106 -0
- package/tools/watchlist.py +149 -0
- package/view/ft-logo.jpg +0 -0
- package/view/kline.html +12436 -0
- package/view/vendor/klinecharts.min.js +7 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/** Diagnostic only: never an edit capability, alignment bypass or rendering receipt. */
|
|
2
|
+
export declare const SOURCE_STATUS_REASONS: {
|
|
3
|
+
readonly not_checked: readonly ["not_checked", "retry_observation"];
|
|
4
|
+
readonly chart_not_ready: readonly ["not_checked", "wait_for_chart"];
|
|
5
|
+
readonly client_unsupported: readonly ["blocked", "reload_client"];
|
|
6
|
+
readonly view_inactive: readonly ["blocked", "activate_view"];
|
|
7
|
+
readonly ambiguous_views: readonly ["blocked", "keep_one_active_view"];
|
|
8
|
+
readonly source_missing: readonly ["blocked", "reopen_chart"];
|
|
9
|
+
readonly source_unavailable: readonly ["blocked", "reopen_chart"];
|
|
10
|
+
readonly source_owner_mismatch: readonly ["blocked", "reopen_chart"];
|
|
11
|
+
readonly source_unconfirmed: readonly ["blocked", "check_drawing_status"];
|
|
12
|
+
readonly source_metadata_unknown: readonly ["blocked", "check_chart_settings"];
|
|
13
|
+
readonly source_limit_exceeded: readonly ["blocked", "reduce_range"];
|
|
14
|
+
readonly drawing_pending: readonly ["checking", "check_drawing_status"];
|
|
15
|
+
readonly drawing_outcome_unknown: readonly ["blocked", "check_drawing_status"];
|
|
16
|
+
readonly source_snapshot_mismatch: readonly ["blocked", "retry_observation"];
|
|
17
|
+
readonly source_payload_invalid: readonly ["blocked", "retry_observation"];
|
|
18
|
+
readonly source_handoff_pending: readonly ["checking", "wait_for_report"];
|
|
19
|
+
readonly source_handoff_rejected: readonly ["blocked", "retry_observation"];
|
|
20
|
+
readonly source_matches_view: readonly ["aligned", "continue_guarded_workflow"];
|
|
21
|
+
readonly context_transport_unavailable: readonly ["blocked", "retry_observation"];
|
|
22
|
+
readonly source_handoff_unavailable: readonly ["blocked", "retry_observation"];
|
|
23
|
+
};
|
|
24
|
+
export declare function sourceStatus(reason?: keyof typeof SOURCE_STATUS_REASONS): {
|
|
25
|
+
schema_version: number;
|
|
26
|
+
scope: string;
|
|
27
|
+
phase: "not_checked" | "blocked" | "checking" | "aligned";
|
|
28
|
+
reason: "not_checked" | "chart_not_ready" | "client_unsupported" | "view_inactive" | "ambiguous_views" | "source_missing" | "source_unavailable" | "source_owner_mismatch" | "source_unconfirmed" | "source_metadata_unknown" | "source_limit_exceeded" | "drawing_pending" | "drawing_outcome_unknown" | "source_snapshot_mismatch" | "source_payload_invalid" | "source_handoff_pending" | "source_handoff_rejected" | "source_matches_view" | "context_transport_unavailable" | "source_handoff_unavailable";
|
|
29
|
+
next_action: "retry_observation" | "wait_for_chart" | "reload_client" | "activate_view" | "keep_one_active_view" | "reopen_chart" | "check_drawing_status" | "check_chart_settings" | "reduce_range" | "wait_for_report" | "continue_guarded_workflow";
|
|
30
|
+
edit_authorized: boolean;
|
|
31
|
+
};
|
|
32
|
+
export declare function sanitizeSourceStatus(raw: any): {
|
|
33
|
+
schema_version: number;
|
|
34
|
+
scope: string;
|
|
35
|
+
phase: "not_checked" | "blocked" | "checking" | "aligned";
|
|
36
|
+
reason: "not_checked" | "chart_not_ready" | "client_unsupported" | "view_inactive" | "ambiguous_views" | "source_missing" | "source_unavailable" | "source_owner_mismatch" | "source_unconfirmed" | "source_metadata_unknown" | "source_limit_exceeded" | "drawing_pending" | "drawing_outcome_unknown" | "source_snapshot_mismatch" | "source_payload_invalid" | "source_handoff_pending" | "source_handoff_rejected" | "source_matches_view" | "context_transport_unavailable" | "source_handoff_unavailable";
|
|
37
|
+
next_action: "retry_observation" | "wait_for_chart" | "reload_client" | "activate_view" | "keep_one_active_view" | "reopen_chart" | "check_drawing_status" | "check_chart_settings" | "reduce_range" | "wait_for_report" | "continue_guarded_workflow";
|
|
38
|
+
edit_authorized: boolean;
|
|
39
|
+
};
|
|
40
|
+
export declare function sourceFailure(error: any): {
|
|
41
|
+
schema_version: number;
|
|
42
|
+
scope: string;
|
|
43
|
+
phase: "not_checked" | "blocked" | "checking" | "aligned";
|
|
44
|
+
reason: "not_checked" | "chart_not_ready" | "client_unsupported" | "view_inactive" | "ambiguous_views" | "source_missing" | "source_unavailable" | "source_owner_mismatch" | "source_unconfirmed" | "source_metadata_unknown" | "source_limit_exceeded" | "drawing_pending" | "drawing_outcome_unknown" | "source_snapshot_mismatch" | "source_payload_invalid" | "source_handoff_pending" | "source_handoff_rejected" | "source_matches_view" | "context_transport_unavailable" | "source_handoff_unavailable";
|
|
45
|
+
next_action: "retry_observation" | "wait_for_chart" | "reload_client" | "activate_view" | "keep_one_active_view" | "reopen_chart" | "check_drawing_status" | "check_chart_settings" | "reduce_range" | "wait_for_report" | "continue_guarded_workflow";
|
|
46
|
+
edit_authorized: boolean;
|
|
47
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** Keep only renderer fields; never copy arbitrary metadata, URLs or provider secrets. */
|
|
2
|
+
export declare function sanitizeSourcePayload(raw: any, state: any): any;
|
|
3
|
+
interface SourceView {
|
|
4
|
+
ref: string;
|
|
5
|
+
conversation: string;
|
|
6
|
+
view: string;
|
|
7
|
+
revision: number;
|
|
8
|
+
active: boolean;
|
|
9
|
+
ambiguous: boolean;
|
|
10
|
+
applyCapable: boolean;
|
|
11
|
+
state: any;
|
|
12
|
+
}
|
|
13
|
+
export declare class ChartSources {
|
|
14
|
+
private offers;
|
|
15
|
+
private runtime;
|
|
16
|
+
private now;
|
|
17
|
+
constructor(runtime: string, now?: () => number);
|
|
18
|
+
private proofPath;
|
|
19
|
+
private read;
|
|
20
|
+
private write;
|
|
21
|
+
acknowledge(view: SourceView, receipt: any): Promise<any>;
|
|
22
|
+
offer(view: SourceView, raw: any): Promise<any>;
|
|
23
|
+
assess(view: SourceView, raw?: any): Promise<any>;
|
|
24
|
+
}
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { BetterSidebarService } from 'dsh-better-sidebar';
|
|
2
|
+
import { type Sessions } from './conversation';
|
|
3
|
+
/** The chart itself, shared by every host tab: Better Sidebar and the native one. */
|
|
4
|
+
export declare function KlineTabContent({ sessions, conversationId, visible }: {
|
|
5
|
+
sessions: Sessions;
|
|
6
|
+
conversationId?: string;
|
|
7
|
+
visible?: boolean;
|
|
8
|
+
}): import("react").JSX.Element;
|
|
9
|
+
export declare function BetterSidebarBridge({ service, sessions }: {
|
|
10
|
+
service: BetterSidebarService;
|
|
11
|
+
sessions: Sessions;
|
|
12
|
+
}): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { type KlineHostProps } from './embed';
|
|
2
|
+
export interface ChartSession {
|
|
3
|
+
ok: true;
|
|
4
|
+
session: string;
|
|
5
|
+
symbol?: string;
|
|
6
|
+
name?: string;
|
|
7
|
+
published_at: number;
|
|
8
|
+
recovery?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface ChartIdentity {
|
|
11
|
+
symbol?: string;
|
|
12
|
+
name?: string;
|
|
13
|
+
}
|
|
14
|
+
export declare function standaloneChartSession(conversationId?: string): string;
|
|
15
|
+
export declare function standaloneWorkspaceScope(conversationId?: string): string;
|
|
16
|
+
export declare function isSymbolLikeName(value: string | undefined, symbol: string | undefined): boolean;
|
|
17
|
+
declare global {
|
|
18
|
+
interface Window {
|
|
19
|
+
klinecharts?: any;
|
|
20
|
+
__dshKlineVendorPromise?: Promise<any>;
|
|
21
|
+
__dshKlineVwapRegistered?: boolean;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
export declare function NativeKlineApp({ session, conversationId, ownerConversationId, visible, onIdentity }: {
|
|
25
|
+
session: ChartSession;
|
|
26
|
+
conversationId: string;
|
|
27
|
+
ownerConversationId?: string;
|
|
28
|
+
visible?: boolean;
|
|
29
|
+
onIdentity: (symbol?: string, name?: string) => void;
|
|
30
|
+
}): import("react").JSX.Element;
|
|
31
|
+
export type { KlineChrome, KlineHostProps, KlineEmbedApi } from './embed';
|
|
32
|
+
export declare function StandaloneKlineApp({ conversationId, ownerConversationId, visible, onIdentity, embedded, chrome, theme, symbol, name }: {
|
|
33
|
+
conversationId: string;
|
|
34
|
+
ownerConversationId?: string;
|
|
35
|
+
visible?: boolean;
|
|
36
|
+
onIdentity: (symbol?: string, name?: string) => void;
|
|
37
|
+
} & KlineHostProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ClientContext } from './client-context';
|
|
2
|
+
import type { KlineChrome } from './embed';
|
|
3
|
+
import { type KlinePanelProps } from './host-panels.ts';
|
|
4
|
+
/**
|
|
5
|
+
* The chart as a host panel body.
|
|
6
|
+
*
|
|
7
|
+
* The host declares a slot, renders it with `{ symbol, name, onIdentity }` and
|
|
8
|
+
* asks the chart to fill it through `klinePanels.mount(seat)`. The body is the
|
|
9
|
+
* same chart the sidebar and the tab draw, only bounded and without the
|
|
10
|
+
* workspace chrome that belongs to the sidebar.
|
|
11
|
+
*/
|
|
12
|
+
export declare function KlinePanelHost({ seat, chrome, symbol, name, onIdentity }: KlinePanelProps & {
|
|
13
|
+
seat: string;
|
|
14
|
+
chrome?: KlineChrome;
|
|
15
|
+
}): import("react").JSX.Element;
|
|
16
|
+
/**
|
|
17
|
+
* Register the optional host panel contract.
|
|
18
|
+
*
|
|
19
|
+
* The `klinePanels` service exists for every host, but it registers nothing
|
|
20
|
+
* until a host mounts a seat: without a caller no slot is injected, so a host
|
|
21
|
+
* that does not know this contract sees the plugin exactly as before. Mounts
|
|
22
|
+
* requested before the `slots` service settles are applied once it does.
|
|
23
|
+
* @param ctx - the client context to register on.
|
|
24
|
+
*/
|
|
25
|
+
export declare function registerPanelHosts(ctx: ClientContext): void;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
interface Options {
|
|
2
|
+
conversationId?: string;
|
|
3
|
+
viewId: string;
|
|
4
|
+
capture: () => any;
|
|
5
|
+
isActive: () => boolean;
|
|
6
|
+
apply: (payload: any, token: string) => any;
|
|
7
|
+
confirm?: (token: string) => void;
|
|
8
|
+
}
|
|
9
|
+
export declare function createChartApplyController(options: Options): {
|
|
10
|
+
consume(command: any, publication: any): any;
|
|
11
|
+
confirm(ack: any): void;
|
|
12
|
+
};
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export declare const CONTEXT_PUBLICATION_TIMEOUT_MS = 8000;
|
|
2
|
+
interface Options {
|
|
3
|
+
conversationId?: string;
|
|
4
|
+
capture: () => any;
|
|
5
|
+
isActive: () => boolean;
|
|
6
|
+
transport?: (body: any, signal?: AbortSignal) => Promise<any>;
|
|
7
|
+
viewId?: string;
|
|
8
|
+
publicationTimeoutMs?: number;
|
|
9
|
+
apply?: (payload: any, token: string) => any;
|
|
10
|
+
confirm?: (token: string) => void;
|
|
11
|
+
feedback?: () => any;
|
|
12
|
+
captureSource?: () => any;
|
|
13
|
+
bindSource?: (token: string, previous: string | null) => void;
|
|
14
|
+
confirmSource?: (token: string, confirmed: boolean) => void;
|
|
15
|
+
onSourceStatus?: (status: any) => void;
|
|
16
|
+
onPublished?: (publication: any) => void;
|
|
17
|
+
}
|
|
18
|
+
export declare function createChartContextPublisher(options: Options): {
|
|
19
|
+
notify(): void;
|
|
20
|
+
retrySource(): void;
|
|
21
|
+
dispose(): void;
|
|
22
|
+
};
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type ChartReference, type Sessions, type SessionEventWindow } from './conversation.ts';
|
|
2
|
+
/** Distinguish live appends from history hydration using the host's delta. */
|
|
3
|
+
export declare function observeLiveCharts(initial: SessionEventWindow): (window: SessionEventWindow) => ChartReference | undefined;
|
|
4
|
+
export declare function handoffLiveChart(sessions: Sessions, conversationId: string, reference: ChartReference): void;
|
|
5
|
+
export declare function liveChartFor(sessions: Sessions, conversationId?: string): ChartReference | undefined;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Sessions } from './conversation';
|
|
2
|
+
/**
|
|
3
|
+
* The client context `apply` receives (only the members this plugin uses).
|
|
4
|
+
*
|
|
5
|
+
* Kept in its own module so host adapters can name the context without
|
|
6
|
+
* importing the plugin entry: this file has no runtime code, so it cannot
|
|
7
|
+
* create an import cycle.
|
|
8
|
+
*/
|
|
9
|
+
export interface ClientContext {
|
|
10
|
+
effect(callback: () => () => void, label?: string): void;
|
|
11
|
+
inject(deps: string[], callback: (ctx: ClientContext) => void): unknown;
|
|
12
|
+
get(name: string): unknown;
|
|
13
|
+
/** Publish an optional service another plugin may inject, such as a host contract. */
|
|
14
|
+
provide(name: string, value: unknown): void;
|
|
15
|
+
sessions: Sessions;
|
|
16
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export interface ChartReference {
|
|
2
|
+
session: string;
|
|
3
|
+
order: number;
|
|
4
|
+
recovery?: boolean;
|
|
5
|
+
recoverySourceSessions?: string[];
|
|
6
|
+
}
|
|
7
|
+
export interface Observable<T> {
|
|
8
|
+
getSnapshot(): T;
|
|
9
|
+
subscribe(listener: () => void): () => void;
|
|
10
|
+
}
|
|
11
|
+
export interface ConversationSnapshot {
|
|
12
|
+
nodes?: readonly any[];
|
|
13
|
+
}
|
|
14
|
+
export interface SessionEventWindow {
|
|
15
|
+
entries: readonly {
|
|
16
|
+
type: string;
|
|
17
|
+
event: any;
|
|
18
|
+
}[];
|
|
19
|
+
revision?: number;
|
|
20
|
+
change?: {
|
|
21
|
+
kind: string;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export interface SessionListSnapshot {
|
|
25
|
+
current?: string;
|
|
26
|
+
byId?: Record<string, {
|
|
27
|
+
retainedBy?: {
|
|
28
|
+
mainView?: number;
|
|
29
|
+
};
|
|
30
|
+
}>;
|
|
31
|
+
}
|
|
32
|
+
export interface Sessions {
|
|
33
|
+
list: Observable<SessionListSnapshot>;
|
|
34
|
+
binding(id: string): {
|
|
35
|
+
session: Observable<ConversationSnapshot>;
|
|
36
|
+
eventSource?: Observable<SessionEventWindow>;
|
|
37
|
+
} | undefined;
|
|
38
|
+
}
|
|
39
|
+
/** Resolve one active conversation across the two public DSH session shapes. */
|
|
40
|
+
export declare function currentConversationId(snapshot: SessionListSnapshot): string | undefined;
|
|
41
|
+
export declare function latestChartFromEvents(entries: SessionEventWindow['entries']): ChartReference | undefined;
|
|
42
|
+
export declare function latestChart(nodes: readonly any[]): ChartReference | undefined;
|
|
43
|
+
export declare function chartStorageKey(conversationId: string): string;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The host-facing contract of the embeddable chart.
|
|
3
|
+
*
|
|
4
|
+
* Kept free of React and of the generated view so both the component and the
|
|
5
|
+
* tests can rely on it: the sidebar mount passes nothing, and every helper here
|
|
6
|
+
* is a no-op for the defaults.
|
|
7
|
+
*/
|
|
8
|
+
/** Chrome an embedded host keeps: the full workspace, the chart page only, or the chart page plus symbol search. */
|
|
9
|
+
export type KlineChrome = 'full' | 'chart' | 'chart-search';
|
|
10
|
+
/** Host options for a chart that lives inside a bounded panel (a canvas panel, a rail, a card). */
|
|
11
|
+
export interface KlineHostProps {
|
|
12
|
+
/** Bounded panel: anchor dialogs to the panel and lay the chart out for the panel height. */
|
|
13
|
+
embedded?: boolean;
|
|
14
|
+
/** Which workspace chrome to keep. Defaults to the full sidebar workspace. */
|
|
15
|
+
chrome?: KlineChrome;
|
|
16
|
+
/** Pin the palette instead of following the host document. */
|
|
17
|
+
theme?: 'dark' | 'light';
|
|
18
|
+
/** Follow an external instrument selection (the canvas `instrument` channel). */
|
|
19
|
+
symbol?: string;
|
|
20
|
+
name?: string;
|
|
21
|
+
}
|
|
22
|
+
/** The window-level bridge the view installs for an embedded mount. */
|
|
23
|
+
export interface KlineEmbedApi {
|
|
24
|
+
ready: Promise<unknown>;
|
|
25
|
+
openSymbol(symbol: string, name?: string): Promise<unknown>;
|
|
26
|
+
currentSymbol(): string;
|
|
27
|
+
setTheme(theme: 'dark' | 'light' | 'host'): void;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* The attributes an embedded host turns on. The sidebar passes the defaults and
|
|
31
|
+
* gets `{}` — no attribute, so none of the embedding CSS can ever match it.
|
|
32
|
+
*/
|
|
33
|
+
export declare function klineHostDataset({ embedded, chrome }?: Pick<KlineHostProps, 'embedded' | 'chrome'>): Record<string, string>;
|
|
34
|
+
/** Normalize host identities using the chart's input conventions, retaining the market. */
|
|
35
|
+
export declare function symbolKey(value: string | undefined): string;
|
|
36
|
+
/** Only an exact normalized identity is the same instrument; empty never matches. */
|
|
37
|
+
export declare function sameSymbol(left: string | undefined, right: string | undefined): boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function mergeHorizontalLineSnapshot(payload: any, saved: any): any;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The optional host contract for the chrome the chart draws itself.
|
|
3
|
+
*
|
|
4
|
+
* A host client plugin provides the `klineHost` service; nothing else changes
|
|
5
|
+
* when it is absent, which is what keeps every upstream default intact. Only
|
|
6
|
+
* the members a host may switch are modelled here, and unknown values collapse
|
|
7
|
+
* to the default, so a newer host can never put the chart in a half-configured
|
|
8
|
+
* state.
|
|
9
|
+
*
|
|
10
|
+
* The store is deliberately framework-free: the router subscribes with
|
|
11
|
+
* `useSyncExternalStore`, and the onboarding classifier reads it once per open.
|
|
12
|
+
*/
|
|
13
|
+
/** What a host may change; every field omitted means the upstream behavior. */
|
|
14
|
+
export interface KlineHostOptions {
|
|
15
|
+
/**
|
|
16
|
+
* `'tab'` — the host owns the chart entry (its own right column), so the
|
|
17
|
+
* chart must not draw the floating classic launcher. Omitted: the user's
|
|
18
|
+
* stored interface preference decides, with the launcher as the fallback.
|
|
19
|
+
*/
|
|
20
|
+
entry?: 'tab';
|
|
21
|
+
/**
|
|
22
|
+
* `'off'` — the host suppresses the first-run welcome and the one-time
|
|
23
|
+
* interface notice. Omitted: upstream onboarding.
|
|
24
|
+
*/
|
|
25
|
+
onboarding?: 'off';
|
|
26
|
+
}
|
|
27
|
+
/** The options the active host provided, if it provided any. */
|
|
28
|
+
export declare function readHostOptions(): KlineHostOptions | undefined;
|
|
29
|
+
/** Subscribe to host option changes; the router repaints when they arrive. */
|
|
30
|
+
export declare function subscribeHostOptions(listener: () => void): () => void;
|
|
31
|
+
/**
|
|
32
|
+
* Take the options a host provided.
|
|
33
|
+
*
|
|
34
|
+
* Unknown or malformed values are dropped rather than trusted, so this stays a
|
|
35
|
+
* closed contract: only the switches this build understands ever take effect.
|
|
36
|
+
* @param value - the service value, or undefined when the host withdrew it.
|
|
37
|
+
*/
|
|
38
|
+
export declare function setHostOptions(value: unknown): void;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The optional host contract for panel mounts.
|
|
3
|
+
*
|
|
4
|
+
* A host that already owns a bounded panel declares a slot of its own and asks
|
|
5
|
+
* the chart to fill it through the `klinePanels` service. The chart therefore
|
|
6
|
+
* never learns a host's slot names, and a host that does not ask sees the
|
|
7
|
+
* plugin exactly as it was before this contract existed.
|
|
8
|
+
*
|
|
9
|
+
* Kept free of React, like `native-sidebar-register.ts`, so the registration
|
|
10
|
+
* policy is testable with fake slot services.
|
|
11
|
+
*/
|
|
12
|
+
import type { KlineChrome } from './embed.ts';
|
|
13
|
+
import type { SlotsService } from './native-sidebar-services.ts';
|
|
14
|
+
/** Props a host slot passes to the chart panel it mounts. */
|
|
15
|
+
export interface KlinePanelProps {
|
|
16
|
+
/** The instrument the host currently has selected. */
|
|
17
|
+
symbol?: string;
|
|
18
|
+
/** Display name of that instrument, when the host has one. */
|
|
19
|
+
name?: string;
|
|
20
|
+
/** The chart's own selection, published back so the host can update its ticket. */
|
|
21
|
+
onIdentity?: (symbol?: string, name?: string) => void;
|
|
22
|
+
}
|
|
23
|
+
/** The optional service a host calls to fill its own panel seat with the chart. */
|
|
24
|
+
export interface KlinePanelsService {
|
|
25
|
+
/**
|
|
26
|
+
* Fill `seat` with the chart panel.
|
|
27
|
+
* @param seat - a slot name the host itself declares and renders.
|
|
28
|
+
* @param options.chrome - chrome the panel keeps (default `chart-search`).
|
|
29
|
+
* Repeated mounts with the same chrome share one panel until all callers
|
|
30
|
+
* release it. Conflicting chrome is rejected while the seat is in use.
|
|
31
|
+
* @returns an idempotent disposer for this caller's mount.
|
|
32
|
+
*/
|
|
33
|
+
mount(seat: string, options?: {
|
|
34
|
+
chrome?: KlineChrome;
|
|
35
|
+
}): () => void;
|
|
36
|
+
}
|
|
37
|
+
/** The host slice a mount needs: only the slot registry. */
|
|
38
|
+
export interface PanelMountHost {
|
|
39
|
+
readonly slots: SlotsService;
|
|
40
|
+
}
|
|
41
|
+
/** Build the body for one seat; the component side supplies the React element. */
|
|
42
|
+
export type PanelBodyFactory = (seat: string, chrome: KlineChrome | undefined) => unknown;
|
|
43
|
+
/** Pending requests survive slot-service replacement; callers own separate leases. */
|
|
44
|
+
export interface PanelMountRegistry extends KlinePanelsService {
|
|
45
|
+
connect(service: KlinePanelsService): () => void;
|
|
46
|
+
}
|
|
47
|
+
/** Coordinate caller lifetimes independently of the current slot-service lifetime. */
|
|
48
|
+
export declare function createPanelMountRegistry(): PanelMountRegistry;
|
|
49
|
+
/**
|
|
50
|
+
* Turn slot services plus a body factory into the `klinePanels` service.
|
|
51
|
+
* @param host - the host services a mount registers into.
|
|
52
|
+
* @param body - the component body for one seat (one per mounted seat).
|
|
53
|
+
* @returns the service a host calls; nothing is registered until it calls.
|
|
54
|
+
*/
|
|
55
|
+
export declare function createPanelMounts(host: PanelMountHost, body: PanelBodyFactory): KlinePanelsService;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { KlineHostOptions } from './host-options.ts';
|
|
2
|
+
export type DisplayMode = 'auto' | 'classic' | 'better-sidebar';
|
|
3
|
+
export declare const DISPLAY_MODE_KEY = "dsh-kline:display-mode:v1";
|
|
4
|
+
export declare const AUTO_OPEN_KEY = "dsh-kline:auto-open-after-analysis:v1";
|
|
5
|
+
export declare const UI_SEEN_KEY = "dsh-kline:ui-change-seen:v0.2.0";
|
|
6
|
+
export interface InterfaceState {
|
|
7
|
+
preference: DisplayMode;
|
|
8
|
+
mode: Exclude<DisplayMode, 'auto'>;
|
|
9
|
+
available: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare const InterfaceContext: import("react").Context<InterfaceState>;
|
|
12
|
+
export declare function readDisplayMode(storage?: Storage): DisplayMode;
|
|
13
|
+
export declare function resolveDisplayMode(preference: DisplayMode, available: boolean, host?: KlineHostOptions): InterfaceState['mode'];
|
|
14
|
+
/**
|
|
15
|
+
* Whether the floating classic launcher is drawn for this frame.
|
|
16
|
+
*
|
|
17
|
+
* Upstream keeps it for classic mode and for screens without a Session, where
|
|
18
|
+
* the tab body cannot live yet. A host that declared `entry: 'tab'` owns the
|
|
19
|
+
* chart entry instead, so it never draws the launcher.
|
|
20
|
+
* @param host - the host options, if the host provided any.
|
|
21
|
+
* @param mode - the interface mode this frame resolved to.
|
|
22
|
+
* @param hasConversation - whether a Session exists to host a tab body.
|
|
23
|
+
*/
|
|
24
|
+
export declare function shouldDrawClassicLauncher(host: KlineHostOptions | undefined, mode: InterfaceState['mode'], hasConversation: boolean): boolean;
|
|
25
|
+
export declare function readAutoOpen(storage?: Storage): boolean;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The static half of the native right-Sidebar integration.
|
|
3
|
+
*
|
|
4
|
+
* Kept free of JSX so the tests can import it directly: the registration itself
|
|
5
|
+
* needs a host context, but what this plugin contributes — the tab kind, the
|
|
6
|
+
* band it registers in, the chip title and the guide entry — is plain data.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Implementation identity of the tab type; also the key its body registers
|
|
10
|
+
* under. The host only requires it to be unique across every registration, and
|
|
11
|
+
* a package name is the natural value for a type shipped from another package.
|
|
12
|
+
*/
|
|
13
|
+
export declare const NATIVE_TAB_ID = "@ftshare-lab/dsh-kline";
|
|
14
|
+
/** One tab type as DSH's own right-Sidebar registry takes it (the members this plugin sets). */
|
|
15
|
+
export interface NativeSidebarTabDefinition {
|
|
16
|
+
/** Implementation identity, unique across registrations; the body seat dispatches by it. */
|
|
17
|
+
id: string;
|
|
18
|
+
/** Type discriminator — what `openTab` names and what every tab of this type is. */
|
|
19
|
+
kind: string;
|
|
20
|
+
/** Every opening of this type is one page per pane: the chart is a singleton. */
|
|
21
|
+
multiple?: boolean;
|
|
22
|
+
/** Keep a visited body mounted through hiding, Session changes and docking. */
|
|
23
|
+
keepMounted?: boolean;
|
|
24
|
+
/** `extension` is the band for a type shipped outside the product, which is this one. */
|
|
25
|
+
priority?: 'extension' | 'builtin' | 'fallback';
|
|
26
|
+
/** The chip text captured when a tab of this type opens. */
|
|
27
|
+
title: (address: string) => string;
|
|
28
|
+
/** Entry boxes the host's guide page offers for opening this type. */
|
|
29
|
+
guide?: readonly NativeSidebarGuideEntry[];
|
|
30
|
+
}
|
|
31
|
+
/** One guide entry: a capsule that opens this tab type when picked. */
|
|
32
|
+
export interface NativeSidebarGuideEntry {
|
|
33
|
+
id: string;
|
|
34
|
+
order: number;
|
|
35
|
+
title: () => string;
|
|
36
|
+
description?: () => string;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* The type definition this plugin contributes.
|
|
40
|
+
*
|
|
41
|
+
* A page type (no address `patterns`) is opened by kind, which is what the
|
|
42
|
+
* auto-open path does; the guide entry is how a person reaches the chart from
|
|
43
|
+
* the host's own add-tab page. Both keep the product label separate from the
|
|
44
|
+
* internal kind, exactly like the Better Sidebar title does.
|
|
45
|
+
*
|
|
46
|
+
* `keepMounted` matters for the chart: collapsing the right column or
|
|
47
|
+
* switching tabs must not tear the chart down, because the view keeps its
|
|
48
|
+
* own state (last instrument reference, zoom, drawings) that a remount loses.
|
|
49
|
+
*/
|
|
50
|
+
export declare function nativeTabDefinition(): NativeSidebarTabDefinition;
|
|
51
|
+
/** One line under the guide capsule: what picking it opens, in the host language. */
|
|
52
|
+
export declare function nativeTabDescription(locale?: string): string;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { SidebarRightService, SidebarRightTabsService, SlotsService } from './native-sidebar-services';
|
|
2
|
+
/**
|
|
3
|
+
* The native right-Sidebar registration, without React and without a host
|
|
4
|
+
* context: a pure function over the three host services, so the bootstrap
|
|
5
|
+
* policy (both stages, their teardown order, the deferred body seat) is
|
|
6
|
+
* testable with fakes.
|
|
7
|
+
*
|
|
8
|
+
* A DSH host that owns its right column publishes `sidebarRightTabs` (stage
|
|
9
|
+
* one — what the tab type is) and a keyed `sidebar.right.pane.tab` seat
|
|
10
|
+
* (stage two — the body), navigated by `sidebarRight`. A type without a body
|
|
11
|
+
* makes the host draw "nothing can view this", so the two stages are one unit
|
|
12
|
+
* and any failure backs the type out again.
|
|
13
|
+
*/
|
|
14
|
+
/** The seat a tab type's body registers under. */
|
|
15
|
+
export declare const BODY_SEAT = "sidebar.right.pane.tab";
|
|
16
|
+
/** The host services registration needs, all of them already resolved. */
|
|
17
|
+
export interface NativeTabHost {
|
|
18
|
+
readonly tabs: SidebarRightTabsService;
|
|
19
|
+
readonly navigation: SidebarRightService;
|
|
20
|
+
readonly slots: SlotsService;
|
|
21
|
+
}
|
|
22
|
+
/** What to register, and how the caller wants to hear about it. */
|
|
23
|
+
export interface NativeTabOptions {
|
|
24
|
+
/** The body component registered into the keyed seat. */
|
|
25
|
+
readonly body: unknown;
|
|
26
|
+
/** Business props the body receives; the framework adds its own standard share. */
|
|
27
|
+
readonly bodyProps?: (sessionId: string) => Record<string, unknown>;
|
|
28
|
+
/** Called whenever `available()` changes. */
|
|
29
|
+
readonly onChange?: () => void;
|
|
30
|
+
}
|
|
31
|
+
/** A live native tab: what the router asks, and how the auto-open path opens it. */
|
|
32
|
+
export interface NativeTabRegistration {
|
|
33
|
+
/** Both stages are in place: the tab can actually draw. */
|
|
34
|
+
available(): boolean;
|
|
35
|
+
/** Open (or reveal) the chart tab of the session on screen. */
|
|
36
|
+
open(): void;
|
|
37
|
+
/** Back both stages out. Idempotent, and every teardown is failure-isolated. */
|
|
38
|
+
dispose(): void;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Register the chart as a tab type of the host's right column.
|
|
42
|
+
* @param host - the resolved host services.
|
|
43
|
+
* @param options - the body, its props, and the availability callback.
|
|
44
|
+
* @returns the registration, live until `dispose()`.
|
|
45
|
+
*/
|
|
46
|
+
export declare function registerNativeTab(host: NativeTabHost, options: NativeTabOptions): NativeTabRegistration;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { Sessions } from './conversation';
|
|
2
|
+
import type { NativeSidebarTabDefinition } from './native-sidebar-contract';
|
|
3
|
+
/**
|
|
4
|
+
* The slices of the host services this plugin reaches for.
|
|
5
|
+
*
|
|
6
|
+
* Each slice names only the members used here, so a host that ships a
|
|
7
|
+
* compatible implementation works without this package depending on the
|
|
8
|
+
* host's client packages. The shapes follow DSH 0.2.1's public faces:
|
|
9
|
+
* `@deepseek-ai/dsh-client-ui-sidebar-right/client` (tab registry and
|
|
10
|
+
* navigation), and `@deepseek-ai/dsh-client-ui-slots` (the keyed seat).
|
|
11
|
+
*/
|
|
12
|
+
/** The right-Sidebar tab registry: stage one of a tab type's registration. */
|
|
13
|
+
export interface SidebarRightTabsService {
|
|
14
|
+
register(definition: NativeSidebarTabDefinition): () => void;
|
|
15
|
+
}
|
|
16
|
+
/** The right-Sidebar navigation face: how a page type is opened. */
|
|
17
|
+
export interface SidebarRightService {
|
|
18
|
+
openTab(kind: string, options?: {
|
|
19
|
+
params?: unknown;
|
|
20
|
+
}): void;
|
|
21
|
+
}
|
|
22
|
+
/** The host `slots` service, limited to the keyed body seat. */
|
|
23
|
+
export interface SlotsService {
|
|
24
|
+
inject(name: string, factory: () => unknown): unknown;
|
|
25
|
+
register(options: SlotsRegistration, component: unknown): () => void;
|
|
26
|
+
}
|
|
27
|
+
/** One keyed seat registration: the body that draws the tabs of `key`'s type. */
|
|
28
|
+
export interface SlotsRegistration {
|
|
29
|
+
name: string;
|
|
30
|
+
key?: string;
|
|
31
|
+
/** Business props for the body; the framework adds the standard share. */
|
|
32
|
+
inject?: (sessionId: string) => Record<string, unknown>;
|
|
33
|
+
}
|
|
34
|
+
/** The metadata hook the host seat binds into every tab body. */
|
|
35
|
+
export interface NativeTabInfo {
|
|
36
|
+
tab: {
|
|
37
|
+
readonly visible: boolean;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
/** What the body seat hands a registered body: its session and the props it needs. */
|
|
41
|
+
export interface NativeTabBodyProps {
|
|
42
|
+
readonly sessionId: string;
|
|
43
|
+
readonly sessions: Sessions;
|
|
44
|
+
readonly useTabInfo: () => NativeTabInfo;
|
|
45
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { ClientContext } from './client-context';
|
|
2
|
+
import { type Sessions } from './conversation';
|
|
3
|
+
import type { NativeTabBodyProps } from './native-sidebar-services';
|
|
4
|
+
/**
|
|
5
|
+
* The chart as a tab of the host's own right column.
|
|
6
|
+
*
|
|
7
|
+
* The registration policy lives in `native-sidebar-register.ts`; this module
|
|
8
|
+
* owns the two things that need React or the client context: the tab body and
|
|
9
|
+
* the auto-open trigger. The body is the same chart the Better Sidebar tab
|
|
10
|
+
* draws, mounted against the tab's own conversation.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* One tab body: the chart of the tab's session.
|
|
14
|
+
*
|
|
15
|
+
* A registered tab can still be opened while the user chose Classic mode, or
|
|
16
|
+
* remain mounted while the host changes Sessions. Only the active conversation
|
|
17
|
+
* in Tab mode may publish a chart; otherwise show a harmless explanation.
|
|
18
|
+
* When that conversation owns the tab, visibility is passed through so a
|
|
19
|
+
* collapsed column does not discard the chart's viewport.
|
|
20
|
+
*/
|
|
21
|
+
export declare function NativeKlineTabBody({ sessionId, sessions, useTabInfo }: NativeTabBodyProps): import("react").JSX.Element;
|
|
22
|
+
/**
|
|
23
|
+
* Auto-open lives in the tab's own session, exactly like the Better Sidebar
|
|
24
|
+
* path; the router decides whether this path is the active interface.
|
|
25
|
+
*/
|
|
26
|
+
export declare function NativeSidebarBridgeView({ bridge, sessions }: {
|
|
27
|
+
bridge: NativeSidebarBridge;
|
|
28
|
+
sessions: Sessions;
|
|
29
|
+
}): import("react").JSX.Element | null;
|
|
30
|
+
/** The host-facing handle the router polls to decide which interface to draw. */
|
|
31
|
+
export interface NativeSidebarBridge {
|
|
32
|
+
/** Both stages registered: the host can draw the chart tab. */
|
|
33
|
+
available(): boolean;
|
|
34
|
+
/** Open (or reveal) the chart tab of the session on screen. */
|
|
35
|
+
open(): void;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Register the chart tab into the host's native right Sidebar.
|
|
39
|
+
*
|
|
40
|
+
* Every host service is optional: a host without `sidebarRightTabs`,
|
|
41
|
+
* `sidebarRight` or `slots` keeps `available() === false` and the plugin's
|
|
42
|
+
* existing interfaces untouched.
|
|
43
|
+
* @param ctx - the client context to register on.
|
|
44
|
+
* @param onChange - called whenever availability changes, so the router repaints.
|
|
45
|
+
* @returns the handle the router and the auto-open path share.
|
|
46
|
+
*/
|
|
47
|
+
export declare function registerNativeSidebar(ctx: ClientContext, onChange: () => void): NativeSidebarBridge;
|