@liujitcn/kratos-admin-system 0.0.27 → 0.0.28

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 (24) hide show
  1. package/dist/package/declarations/src/api/system/runtime_log.d.ts +13 -0
  2. package/dist/package/declarations/src/api/system/runtime_log_sse.d.ts +8 -0
  3. package/dist/package/declarations/src/locales/generated.d.ts +116 -0
  4. package/dist/package/declarations/src/rpc/system/admin/v1/ops_monitoring.d.ts +4 -0
  5. package/dist/package/declarations/src/rpc/system/admin/v1/project_document.d.ts +4 -6
  6. package/dist/package/declarations/src/rpc/system/admin/v1/runtime_log.d.ts +96 -0
  7. package/dist/package/declarations/src/views/tool/runtime-log/index.vue.d.ts +3 -0
  8. package/dist/package/src/api/system/runtime_log.ts +80 -0
  9. package/dist/package/src/api/system/runtime_log_sse.ts +40 -0
  10. package/dist/package/src/locales/en-US.json +31 -2
  11. package/dist/package/src/locales/ja-JP.json +31 -2
  12. package/dist/package/src/locales/zh-CN.json +31 -2
  13. package/dist/package/src/locales/zh-TW.json +31 -2
  14. package/dist/package/src/rpc/system/admin/v1/ops_monitoring.ts +4 -0
  15. package/dist/package/src/rpc/system/admin/v1/project_document.ts +4 -7
  16. package/dist/package/src/rpc/system/admin/v1/runtime_log.ts +113 -0
  17. package/dist/package/src/views/tool/api-doc/index.vue +14 -6
  18. package/dist/package/src/views/tool/code-gen/code-preview/index.vue +17 -0
  19. package/dist/package/src/views/tool/code-gen/components/CodeGenLocaleEditor.vue +96 -14
  20. package/dist/package/src/views/tool/code-gen/table/index.vue +32 -0
  21. package/dist/package/src/views/tool/ops-monitoring/index.vue +130 -24
  22. package/dist/package/src/views/tool/project-doc/index.vue +9 -4
  23. package/dist/package/src/views/tool/runtime-log/index.vue +883 -0
  24. package/package.json +2 -2
@@ -0,0 +1,13 @@
1
+ import type { DownloadRuntimeLogFileRequest, ListRuntimeLogFilesRequest, ListRuntimeLogFilesResponse, OpenRuntimeConsoleRequest, OpenRuntimeConsoleResponse, ReadRuntimeLogFileRequest, ReadRuntimeLogFileResponse } from "@liujitcn/kratos-admin-system/rpc/system/admin/v1/runtime_log";
2
+ /** Admin运行日志服务。 */
3
+ export declare class RuntimeLogServiceImpl {
4
+ /** 查询历史日志文件列表。 */
5
+ ListRuntimeLogFiles(request: ListRuntimeLogFilesRequest): Promise<ListRuntimeLogFilesResponse>;
6
+ /** 分页读取历史日志文件内容。 */
7
+ ReadRuntimeLogFile(request: ReadRuntimeLogFileRequest): Promise<ReadRuntimeLogFileResponse>;
8
+ /** 创建当前用户的实时控制台频道。 */
9
+ OpenRuntimeConsole(request: OpenRuntimeConsoleRequest): Promise<OpenRuntimeConsoleResponse>;
10
+ /** 下载历史日志原文件。 */
11
+ DownloadRuntimeLogFile(request: DownloadRuntimeLogFileRequest, fallbackName: string): Promise<void>;
12
+ }
13
+ export declare const defRuntimeLogService: RuntimeLogServiceImpl;
@@ -0,0 +1,8 @@
1
+ import { type SseStop } from "../base/sse";
2
+ import type { RuntimeLogEntry, RuntimeLogGap } from "@liujitcn/kratos-admin-system/rpc/system/admin/v1/runtime_log";
3
+ /** 实时日志事件处理函数。 */
4
+ export type RuntimeLogEntryHandler = (entry: RuntimeLogEntry) => void;
5
+ /** 实时日志丢失事件处理函数。 */
6
+ export type RuntimeLogGapHandler = (gap: RuntimeLogGap) => void;
7
+ /** 订阅指定用户频道的实时日志和丢失提示事件。 */
8
+ export declare function subscribeRuntimeLog(channelId: string, entryHandler: RuntimeLogEntryHandler, gapHandler: RuntimeLogGapHandler): SseStop;
@@ -914,6 +914,11 @@ export declare const LOCALE_MESSAGES: {
914
914
  "system.ops_monitoring.status.label": string;
915
915
  "system.ops_monitoring.instance_resources": string;
916
916
  "system.ops_monitoring.current_recent_sample": string;
917
+ "system.ops_monitoring.node_metric.heap_memory": string;
918
+ "system.ops_monitoring.node_metric.memory": string;
919
+ "system.ops_monitoring.node_metric.disk": string;
920
+ "system.ops_monitoring.node_metric.current": string;
921
+ "system.ops_monitoring.node_metric.total": string;
917
922
  "system.ops_monitoring.instance_count": string;
918
923
  "system.ops_monitoring.alert_events": string;
919
924
  "system.ops_monitoring.alert_attention": string;
@@ -933,6 +938,30 @@ export declare const LOCALE_MESSAGES: {
933
938
  "system.ops_monitoring.kpi.error_rate": string;
934
939
  "system.ops_monitoring.kpi.availability": string;
935
940
  "system.ops_monitoring.kpi.current_window": string;
941
+ "system.runtime.log.section.sources": string;
942
+ "system.runtime.log.section.history_files": string;
943
+ "system.runtime.log.section.viewer": string;
944
+ "system.runtime.log.value.live_console": string;
945
+ "system.runtime.log.value.instance": string;
946
+ "system.runtime.log.value.entry_count": string;
947
+ "system.runtime.log.placeholder.search_file": string;
948
+ "system.runtime.log.placeholder.search_content": string;
949
+ "system.runtime.log.placeholder.level": string;
950
+ "system.runtime.log.action.resume": string;
951
+ "system.runtime.log.action.pause": string;
952
+ "system.runtime.log.action.auto_scroll": string;
953
+ "system.runtime.log.action.download": string;
954
+ "system.runtime.log.action.load_older": string;
955
+ "system.runtime.log.empty.files": string;
956
+ "system.runtime.log.empty.entries": string;
957
+ "system.runtime.log.status.connecting": string;
958
+ "system.runtime.log.status.live": string;
959
+ "system.runtime.log.status.paused": string;
960
+ "system.runtime.log.status.disconnected": string;
961
+ "system.runtime.log.status.loading": string;
962
+ "system.runtime.log.message.gap": string;
963
+ "system.runtime.log.message.file_changed": string;
964
+ "system.runtime.log.message.download_started": string;
936
965
  };
937
966
  readonly 'en-US': {
938
967
  "system.ai.request_failed_with_status": string;
@@ -1849,6 +1878,11 @@ export declare const LOCALE_MESSAGES: {
1849
1878
  "system.ops_monitoring.status.label": string;
1850
1879
  "system.ops_monitoring.instance_resources": string;
1851
1880
  "system.ops_monitoring.current_recent_sample": string;
1881
+ "system.ops_monitoring.node_metric.heap_memory": string;
1882
+ "system.ops_monitoring.node_metric.memory": string;
1883
+ "system.ops_monitoring.node_metric.disk": string;
1884
+ "system.ops_monitoring.node_metric.current": string;
1885
+ "system.ops_monitoring.node_metric.total": string;
1852
1886
  "system.ops_monitoring.instance_count": string;
1853
1887
  "system.ops_monitoring.alert_events": string;
1854
1888
  "system.ops_monitoring.alert_attention": string;
@@ -1868,6 +1902,30 @@ export declare const LOCALE_MESSAGES: {
1868
1902
  "system.ops_monitoring.kpi.error_rate": string;
1869
1903
  "system.ops_monitoring.kpi.availability": string;
1870
1904
  "system.ops_monitoring.kpi.current_window": string;
1905
+ "system.runtime.log.section.sources": string;
1906
+ "system.runtime.log.section.history_files": string;
1907
+ "system.runtime.log.section.viewer": string;
1908
+ "system.runtime.log.value.live_console": string;
1909
+ "system.runtime.log.value.instance": string;
1910
+ "system.runtime.log.value.entry_count": string;
1911
+ "system.runtime.log.placeholder.search_file": string;
1912
+ "system.runtime.log.placeholder.search_content": string;
1913
+ "system.runtime.log.placeholder.level": string;
1914
+ "system.runtime.log.action.resume": string;
1915
+ "system.runtime.log.action.pause": string;
1916
+ "system.runtime.log.action.auto_scroll": string;
1917
+ "system.runtime.log.action.download": string;
1918
+ "system.runtime.log.action.load_older": string;
1919
+ "system.runtime.log.empty.files": string;
1920
+ "system.runtime.log.empty.entries": string;
1921
+ "system.runtime.log.status.connecting": string;
1922
+ "system.runtime.log.status.live": string;
1923
+ "system.runtime.log.status.paused": string;
1924
+ "system.runtime.log.status.disconnected": string;
1925
+ "system.runtime.log.status.loading": string;
1926
+ "system.runtime.log.message.gap": string;
1927
+ "system.runtime.log.message.file_changed": string;
1928
+ "system.runtime.log.message.download_started": string;
1871
1929
  };
1872
1930
  readonly 'ja-JP': {
1873
1931
  "system.ai.request_failed_with_status": string;
@@ -2784,6 +2842,11 @@ export declare const LOCALE_MESSAGES: {
2784
2842
  "system.ops_monitoring.status.label": string;
2785
2843
  "system.ops_monitoring.instance_resources": string;
2786
2844
  "system.ops_monitoring.current_recent_sample": string;
2845
+ "system.ops_monitoring.node_metric.heap_memory": string;
2846
+ "system.ops_monitoring.node_metric.memory": string;
2847
+ "system.ops_monitoring.node_metric.disk": string;
2848
+ "system.ops_monitoring.node_metric.current": string;
2849
+ "system.ops_monitoring.node_metric.total": string;
2787
2850
  "system.ops_monitoring.instance_count": string;
2788
2851
  "system.ops_monitoring.alert_events": string;
2789
2852
  "system.ops_monitoring.alert_attention": string;
@@ -2803,6 +2866,30 @@ export declare const LOCALE_MESSAGES: {
2803
2866
  "system.ops_monitoring.kpi.error_rate": string;
2804
2867
  "system.ops_monitoring.kpi.availability": string;
2805
2868
  "system.ops_monitoring.kpi.current_window": string;
2869
+ "system.runtime.log.section.sources": string;
2870
+ "system.runtime.log.section.history_files": string;
2871
+ "system.runtime.log.section.viewer": string;
2872
+ "system.runtime.log.value.live_console": string;
2873
+ "system.runtime.log.value.instance": string;
2874
+ "system.runtime.log.value.entry_count": string;
2875
+ "system.runtime.log.placeholder.search_file": string;
2876
+ "system.runtime.log.placeholder.search_content": string;
2877
+ "system.runtime.log.placeholder.level": string;
2878
+ "system.runtime.log.action.resume": string;
2879
+ "system.runtime.log.action.pause": string;
2880
+ "system.runtime.log.action.auto_scroll": string;
2881
+ "system.runtime.log.action.download": string;
2882
+ "system.runtime.log.action.load_older": string;
2883
+ "system.runtime.log.empty.files": string;
2884
+ "system.runtime.log.empty.entries": string;
2885
+ "system.runtime.log.status.connecting": string;
2886
+ "system.runtime.log.status.live": string;
2887
+ "system.runtime.log.status.paused": string;
2888
+ "system.runtime.log.status.disconnected": string;
2889
+ "system.runtime.log.status.loading": string;
2890
+ "system.runtime.log.message.gap": string;
2891
+ "system.runtime.log.message.file_changed": string;
2892
+ "system.runtime.log.message.download_started": string;
2806
2893
  };
2807
2894
  readonly 'zh-TW': {
2808
2895
  "system.ai.request_failed_with_status": string;
@@ -3719,6 +3806,11 @@ export declare const LOCALE_MESSAGES: {
3719
3806
  "system.ops_monitoring.status.label": string;
3720
3807
  "system.ops_monitoring.instance_resources": string;
3721
3808
  "system.ops_monitoring.current_recent_sample": string;
3809
+ "system.ops_monitoring.node_metric.heap_memory": string;
3810
+ "system.ops_monitoring.node_metric.memory": string;
3811
+ "system.ops_monitoring.node_metric.disk": string;
3812
+ "system.ops_monitoring.node_metric.current": string;
3813
+ "system.ops_monitoring.node_metric.total": string;
3722
3814
  "system.ops_monitoring.instance_count": string;
3723
3815
  "system.ops_monitoring.alert_events": string;
3724
3816
  "system.ops_monitoring.alert_attention": string;
@@ -3738,6 +3830,30 @@ export declare const LOCALE_MESSAGES: {
3738
3830
  "system.ops_monitoring.kpi.error_rate": string;
3739
3831
  "system.ops_monitoring.kpi.availability": string;
3740
3832
  "system.ops_monitoring.kpi.current_window": string;
3833
+ "system.runtime.log.section.sources": string;
3834
+ "system.runtime.log.section.history_files": string;
3835
+ "system.runtime.log.section.viewer": string;
3836
+ "system.runtime.log.value.live_console": string;
3837
+ "system.runtime.log.value.instance": string;
3838
+ "system.runtime.log.value.entry_count": string;
3839
+ "system.runtime.log.placeholder.search_file": string;
3840
+ "system.runtime.log.placeholder.search_content": string;
3841
+ "system.runtime.log.placeholder.level": string;
3842
+ "system.runtime.log.action.resume": string;
3843
+ "system.runtime.log.action.pause": string;
3844
+ "system.runtime.log.action.auto_scroll": string;
3845
+ "system.runtime.log.action.download": string;
3846
+ "system.runtime.log.action.load_older": string;
3847
+ "system.runtime.log.empty.files": string;
3848
+ "system.runtime.log.empty.entries": string;
3849
+ "system.runtime.log.status.connecting": string;
3850
+ "system.runtime.log.status.live": string;
3851
+ "system.runtime.log.status.paused": string;
3852
+ "system.runtime.log.status.disconnected": string;
3853
+ "system.runtime.log.status.loading": string;
3854
+ "system.runtime.log.message.gap": string;
3855
+ "system.runtime.log.message.file_changed": string;
3856
+ "system.runtime.log.message.download_started": string;
3741
3857
  };
3742
3858
  };
3743
3859
  export type GeneratedLocale = keyof typeof LOCALE_MESSAGES;
@@ -191,6 +191,10 @@ export interface OpsNodeMetric {
191
191
  label: string;
192
192
  /** 指标使用百分比 */
193
193
  value: number;
194
+ /** 当前已用容量,单位字节 */
195
+ used_bytes: number;
196
+ /** 总容量,单位字节 */
197
+ total_bytes: number;
194
198
  }
195
199
  /** 告警事件。 */
196
200
  export interface OpsAlert {
@@ -17,6 +17,8 @@ export interface ProjectDocumentListItem {
17
17
  id: string;
18
18
  /** 项目内相对路径 */
19
19
  path: string;
20
+ /** 当前语言下的文档显示文件名 */
21
+ name: string;
20
22
  /** Markdown文件更新时间,RFC3339格式 */
21
23
  updated_at: string;
22
24
  }
@@ -52,17 +54,13 @@ export interface ProjectDocument {
52
54
  project_name: string;
53
55
  /** 项目内相对路径 */
54
56
  path: string;
57
+ /** 当前语言下的文档显示文件名 */
58
+ name: string;
55
59
  /** Markdown文档内容 */
56
60
  content: string;
57
- /** 按语言标识索引的Markdown翻译内容 */
58
- locale: Map<string, string>;
59
61
  /** Markdown文件更新时间,RFC3339格式 */
60
62
  updated_at: string;
61
63
  }
62
- export interface ProjectDocument_LocaleEntry {
63
- key: string;
64
- value: string;
65
- }
66
64
  /** 项目文档服务 */
67
65
  export interface ProjectDocumentService {
68
66
  /** 查询项目文档树 */
@@ -0,0 +1,96 @@
1
+ /** 历史日志文件列表查询条件。 */
2
+ export interface ListRuntimeLogFilesRequest {
3
+ }
4
+ /** 历史日志文件列表响应。 */
5
+ export interface ListRuntimeLogFilesResponse {
6
+ /** 历史日志文件列表 */
7
+ files: RuntimeLogFile[];
8
+ }
9
+ /** 历史日志文件信息。 */
10
+ export interface RuntimeLogFile {
11
+ /** 服务端签发的日志文件标识 */
12
+ file_id: string;
13
+ /** 日志文件名称 */
14
+ name: string;
15
+ /** 日志文件大小,单位字节 */
16
+ size_bytes: number;
17
+ /** 最后修改时间,RFC3339格式 */
18
+ modified_at: string;
19
+ /** 是否为Gzip压缩文件 */
20
+ is_compressed: boolean;
21
+ /** 是否为当前活动日志文件 */
22
+ is_active: boolean;
23
+ }
24
+ /** 历史日志文件读取条件。 */
25
+ export interface ReadRuntimeLogFileRequest {
26
+ /** 服务端签发的日志文件标识 */
27
+ file_id: string;
28
+ /** 向更早日志翻页的不透明游标,留空时从文件尾部读取 */
29
+ cursor: string;
30
+ /** 单次读取条数,0使用默认值,最大500 */
31
+ limit: number;
32
+ /** 日志内容搜索关键字 */
33
+ keyword: string;
34
+ /** 日志级别筛选列表 */
35
+ levels: string[];
36
+ }
37
+ /** 历史日志文件读取响应。 */
38
+ export interface ReadRuntimeLogFileResponse {
39
+ /** 按时间正序排列的日志条目 */
40
+ entries: RuntimeLogEntry[];
41
+ /** 继续读取更早日志的不透明游标 */
42
+ next_cursor: string;
43
+ /** 是否还有更早日志 */
44
+ has_more: boolean;
45
+ /** 读取期间日志文件是否已滚动或截断 */
46
+ file_changed: boolean;
47
+ }
48
+ /** 实时或历史日志条目。 */
49
+ export interface RuntimeLogEntry {
50
+ /** 当前进程内的日志序号,历史文件日志为空 */
51
+ sequence: string;
52
+ /** 日志时间 */
53
+ timestamp: string;
54
+ /** 日志级别 */
55
+ level: string;
56
+ /** 日志来源 */
57
+ source: string;
58
+ /** 日志消息 */
59
+ message: string;
60
+ /** 可直接展示的纯文本日志行 */
61
+ line: string;
62
+ /** 日志行是否因长度限制被截断 */
63
+ is_truncated: boolean;
64
+ }
65
+ /** 实时控制台开启条件。 */
66
+ export interface OpenRuntimeConsoleRequest {
67
+ /** 首次返回的最近日志条数,0使用默认值,最大500 */
68
+ backlog_limit: number;
69
+ }
70
+ /** 实时控制台开启响应。 */
71
+ export interface OpenRuntimeConsoleResponse {
72
+ /** SSE业务流标识 */
73
+ stream: string;
74
+ /** 当前用户专属SSE频道标识 */
75
+ channel_id: string;
76
+ /** 频道过期时间,RFC3339格式 */
77
+ expires_at: string;
78
+ /** 当前服务实例标识 */
79
+ instance_id: string;
80
+ /** 当前进程最新日志序号 */
81
+ latest_sequence: string;
82
+ /** 当前进程最近日志 */
83
+ entries: RuntimeLogEntry[];
84
+ }
85
+ /** 实时控制台丢失消息提示。 */
86
+ export interface RuntimeLogGap {
87
+ /** 本次丢弃的日志条数 */
88
+ dropped_count: number;
89
+ /** 发生丢弃时的最新日志序号 */
90
+ latest_sequence: string;
91
+ }
92
+ /** 历史日志文件下载条件。 */
93
+ export interface DownloadRuntimeLogFileRequest {
94
+ /** 服务端签发的日志文件标识 */
95
+ file_id: string;
96
+ }
@@ -0,0 +1,3 @@
1
+ declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
+ declare const _default: typeof __VLS_export;
3
+ export default _default;
@@ -0,0 +1,80 @@
1
+ import service from "@liujitcn/kratos-admin-core/request";
2
+ import type {
3
+ DownloadRuntimeLogFileRequest,
4
+ ListRuntimeLogFilesRequest,
5
+ ListRuntimeLogFilesResponse,
6
+ OpenRuntimeConsoleRequest,
7
+ OpenRuntimeConsoleResponse,
8
+ ReadRuntimeLogFileRequest,
9
+ ReadRuntimeLogFileResponse
10
+ } from "@liujitcn/kratos-admin-system/rpc/system/admin/v1/runtime_log";
11
+
12
+ const RUNTIME_LOG_URL = "/v1/admin/runtime-log";
13
+
14
+ /** Admin运行日志服务。 */
15
+ export class RuntimeLogServiceImpl {
16
+ /** 查询历史日志文件列表。 */
17
+ ListRuntimeLogFiles(request: ListRuntimeLogFilesRequest): Promise<ListRuntimeLogFilesResponse> {
18
+ return service<ListRuntimeLogFilesRequest, ListRuntimeLogFilesResponse>({
19
+ url: `${RUNTIME_LOG_URL}/files`,
20
+ method: "get",
21
+ params: request
22
+ });
23
+ }
24
+
25
+ /** 分页读取历史日志文件内容。 */
26
+ ReadRuntimeLogFile(request: ReadRuntimeLogFileRequest): Promise<ReadRuntimeLogFileResponse> {
27
+ return service<ReadRuntimeLogFileRequest, ReadRuntimeLogFileResponse>({
28
+ url: `${RUNTIME_LOG_URL}/files/${encodeURIComponent(request.file_id)}`,
29
+ method: "get",
30
+ params: {
31
+ cursor: request.cursor,
32
+ limit: request.limit,
33
+ keyword: request.keyword,
34
+ levels: request.levels
35
+ }
36
+ });
37
+ }
38
+
39
+ /** 创建当前用户的实时控制台频道。 */
40
+ OpenRuntimeConsole(request: OpenRuntimeConsoleRequest): Promise<OpenRuntimeConsoleResponse> {
41
+ return service<OpenRuntimeConsoleRequest, OpenRuntimeConsoleResponse>({
42
+ url: `${RUNTIME_LOG_URL}/console`,
43
+ method: "post",
44
+ data: request
45
+ });
46
+ }
47
+
48
+ /** 下载历史日志原文件。 */
49
+ async DownloadRuntimeLogFile(request: DownloadRuntimeLogFileRequest, fallbackName: string): Promise<void> {
50
+ const response = await service<DownloadRuntimeLogFileRequest, any>({
51
+ url: `${RUNTIME_LOG_URL}/files/${encodeURIComponent(request.file_id)}/download`,
52
+ method: "get",
53
+ responseType: "blob"
54
+ });
55
+ const contentDisposition = String(response.headers?.["content-disposition"] ?? "");
56
+ const encodedName = contentDisposition.match(/filename\*=UTF-8''([^;]+)/i)?.[1];
57
+ const plainName = contentDisposition.match(/filename="?([^";]+)"?/i)?.[1];
58
+ let filename = fallbackName;
59
+ if (encodedName) {
60
+ try {
61
+ filename = decodeURIComponent(encodedName);
62
+ } catch {
63
+ filename = fallbackName;
64
+ }
65
+ } else if (plainName) {
66
+ filename = plainName;
67
+ }
68
+ const blob = response.data instanceof Blob ? response.data : new Blob([response.data]);
69
+ const objectURL = window.URL.createObjectURL(blob);
70
+ const anchor = document.createElement("a");
71
+ anchor.href = objectURL;
72
+ anchor.download = filename;
73
+ document.body.appendChild(anchor);
74
+ anchor.click();
75
+ anchor.remove();
76
+ window.URL.revokeObjectURL(objectURL);
77
+ }
78
+ }
79
+
80
+ export const defRuntimeLogService = new RuntimeLogServiceImpl();
@@ -0,0 +1,40 @@
1
+ import { subscribeSseEvent, type SseStop } from "../base/sse";
2
+ import type {
3
+ RuntimeLogEntry,
4
+ RuntimeLogGap
5
+ } from "@liujitcn/kratos-admin-system/rpc/system/admin/v1/runtime_log";
6
+
7
+ const RUNTIME_LOG_SSE_STREAM = "system.admin.runtime-console";
8
+ const RUNTIME_LOG_SSE_ENTRY = "runtime.log";
9
+ const RUNTIME_LOG_SSE_GAP = "runtime.gap";
10
+
11
+ /** 实时日志事件处理函数。 */
12
+ export type RuntimeLogEntryHandler = (entry: RuntimeLogEntry) => void;
13
+
14
+ /** 实时日志丢失事件处理函数。 */
15
+ export type RuntimeLogGapHandler = (gap: RuntimeLogGap) => void;
16
+
17
+ /** 订阅指定用户频道的实时日志和丢失提示事件。 */
18
+ export function subscribeRuntimeLog(
19
+ channelId: string,
20
+ entryHandler: RuntimeLogEntryHandler,
21
+ gapHandler: RuntimeLogGapHandler
22
+ ): SseStop {
23
+ const request = { stream: RUNTIME_LOG_SSE_STREAM, channel_id: channelId };
24
+ const stopEntry = subscribeSseEvent(request, RUNTIME_LOG_SSE_ENTRY, parsePayload<RuntimeLogEntry>, entryHandler);
25
+ const stopGap = subscribeSseEvent(request, RUNTIME_LOG_SSE_GAP, parsePayload<RuntimeLogGap>, gapHandler);
26
+ return () => {
27
+ stopGap();
28
+ stopEntry();
29
+ };
30
+ }
31
+
32
+ /** 解析实时日志 SSE JSON 负载。 */
33
+ function parsePayload<T>(raw: string): T | null {
34
+ if (!raw) return null;
35
+ try {
36
+ return JSON.parse(raw) as T;
37
+ } catch {
38
+ return null;
39
+ }
40
+ }
@@ -912,7 +912,12 @@
912
912
  "system.ops_monitoring.error_rate": "Error rate",
913
913
  "system.ops_monitoring.status.label": "Status",
914
914
  "system.ops_monitoring.instance_resources": "Instance resources",
915
- "system.ops_monitoring.current_recent_sample": "Most recent process sample",
915
+ "system.ops_monitoring.current_recent_sample": "Most recent instance resource sample",
916
+ "system.ops_monitoring.node_metric.heap_memory": "Heap memory",
917
+ "system.ops_monitoring.node_metric.memory": "Memory",
918
+ "system.ops_monitoring.node_metric.disk": "Disk",
919
+ "system.ops_monitoring.node_metric.current": "Used",
920
+ "system.ops_monitoring.node_metric.total": "Total",
916
921
  "system.ops_monitoring.instance_count": "{count} instances",
917
922
  "system.ops_monitoring.alert_events": "Alert events",
918
923
  "system.ops_monitoring.alert_attention": "Failed requests requiring operations attention",
@@ -931,5 +936,29 @@
931
936
  "system.ops_monitoring.kpi.p95_latency": "P95 latency",
932
937
  "system.ops_monitoring.kpi.error_rate": "Error rate",
933
938
  "system.ops_monitoring.kpi.availability": "Availability",
934
- "system.ops_monitoring.kpi.current_window": "Current window"
939
+ "system.ops_monitoring.kpi.current_window": "Current window",
940
+ "system.runtime.log.section.sources": "Log sources",
941
+ "system.runtime.log.section.history_files": "History files",
942
+ "system.runtime.log.section.viewer": "Log viewer",
943
+ "system.runtime.log.value.live_console": "Live console",
944
+ "system.runtime.log.value.instance": "Instance {id}",
945
+ "system.runtime.log.value.entry_count": "{count} entries",
946
+ "system.runtime.log.placeholder.search_file": "Search log files",
947
+ "system.runtime.log.placeholder.search_content": "Search log content",
948
+ "system.runtime.log.placeholder.level": "Log level",
949
+ "system.runtime.log.action.resume": "Resume",
950
+ "system.runtime.log.action.pause": "Pause",
951
+ "system.runtime.log.action.auto_scroll": "Auto-scroll",
952
+ "system.runtime.log.action.download": "Download original",
953
+ "system.runtime.log.action.load_older": "Load older logs",
954
+ "system.runtime.log.empty.files": "No history log files",
955
+ "system.runtime.log.empty.entries": "No matching logs",
956
+ "system.runtime.log.status.connecting": "Connecting",
957
+ "system.runtime.log.status.live": "Live",
958
+ "system.runtime.log.status.paused": "Paused",
959
+ "system.runtime.log.status.disconnected": "Disconnected",
960
+ "system.runtime.log.status.loading": "Reading logs",
961
+ "system.runtime.log.message.gap": "The live stream skipped {count} entries. Check the history file for the missing logs.",
962
+ "system.runtime.log.message.file_changed": "The log file rotated or was truncated. Reading again from the end.",
963
+ "system.runtime.log.message.download_started": "Log file download started"
935
964
  }
@@ -912,7 +912,12 @@
912
912
  "system.ops_monitoring.error_rate": "エラー率",
913
913
  "system.ops_monitoring.status.label": "ステータス",
914
914
  "system.ops_monitoring.instance_resources": "インスタンス リソース",
915
- "system.ops_monitoring.current_recent_sample": "現在のプロセスの最新サンプル",
915
+ "system.ops_monitoring.current_recent_sample": "現在のインスタンスリソースの最新サンプル",
916
+ "system.ops_monitoring.node_metric.heap_memory": "ヒープメモリ",
917
+ "system.ops_monitoring.node_metric.memory": "メモリ",
918
+ "system.ops_monitoring.node_metric.disk": "ディスク",
919
+ "system.ops_monitoring.node_metric.current": "使用中",
920
+ "system.ops_monitoring.node_metric.total": "合計",
916
921
  "system.ops_monitoring.instance_count": "{count} インスタンス",
917
922
  "system.ops_monitoring.alert_events": "アラームイベント",
918
923
  "system.ops_monitoring.alert_attention": "ウィンドウ内でリクエストが失敗しました。運用とメンテナンスの注意が必要なイベントです。",
@@ -931,5 +936,29 @@
931
936
  "system.ops_monitoring.kpi.p95_latency": "P95 遅延",
932
937
  "system.ops_monitoring.kpi.error_rate": "エラー率",
933
938
  "system.ops_monitoring.kpi.availability": "可用性",
934
- "system.ops_monitoring.kpi.current_window": "現在のウィンドウ"
939
+ "system.ops_monitoring.kpi.current_window": "現在のウィンドウ",
940
+ "system.runtime.log.section.sources": "ログソース",
941
+ "system.runtime.log.section.history_files": "履歴ログ",
942
+ "system.runtime.log.section.viewer": "ログビューアー",
943
+ "system.runtime.log.value.live_console": "リアルタイムコンソール",
944
+ "system.runtime.log.value.instance": "インスタンス {id}",
945
+ "system.runtime.log.value.entry_count": "{count} 件",
946
+ "system.runtime.log.placeholder.search_file": "ログファイルを検索",
947
+ "system.runtime.log.placeholder.search_content": "ログ内容を検索",
948
+ "system.runtime.log.placeholder.level": "ログレベル",
949
+ "system.runtime.log.action.resume": "再開",
950
+ "system.runtime.log.action.pause": "一時停止",
951
+ "system.runtime.log.action.auto_scroll": "自動スクロール",
952
+ "system.runtime.log.action.download": "元のファイルをダウンロード",
953
+ "system.runtime.log.action.load_older": "以前のログを読み込む",
954
+ "system.runtime.log.empty.files": "履歴ログファイルはありません",
955
+ "system.runtime.log.empty.entries": "一致するログはありません",
956
+ "system.runtime.log.status.connecting": "接続中",
957
+ "system.runtime.log.status.live": "リアルタイム",
958
+ "system.runtime.log.status.paused": "一時停止中",
959
+ "system.runtime.log.status.disconnected": "未接続",
960
+ "system.runtime.log.status.loading": "ログを読み込み中",
961
+ "system.runtime.log.message.gap": "リアルタイムログが速すぎるため {count} 件をスキップしました。履歴ファイルで確認してください。",
962
+ "system.runtime.log.message.file_changed": "ログファイルがローテーションまたは切り詰められました。末尾から再読み込みします。",
963
+ "system.runtime.log.message.download_started": "ログファイルのダウンロードを開始しました"
935
964
  }
@@ -912,7 +912,12 @@
912
912
  "system.ops_monitoring.error_rate": "错误率",
913
913
  "system.ops_monitoring.status.label": "状态",
914
914
  "system.ops_monitoring.instance_resources": "实例资源",
915
- "system.ops_monitoring.current_recent_sample": "当前进程最近采样",
915
+ "system.ops_monitoring.current_recent_sample": "当前实例资源最近采样",
916
+ "system.ops_monitoring.node_metric.heap_memory": "堆内存",
917
+ "system.ops_monitoring.node_metric.memory": "内存",
918
+ "system.ops_monitoring.node_metric.disk": "硬盘",
919
+ "system.ops_monitoring.node_metric.current": "当前",
920
+ "system.ops_monitoring.node_metric.total": "总计",
916
921
  "system.ops_monitoring.instance_count": "{count} 个实例",
917
922
  "system.ops_monitoring.alert_events": "告警事件",
918
923
  "system.ops_monitoring.alert_attention": "窗口内失败请求,需要运维关注的事件",
@@ -931,5 +936,29 @@
931
936
  "system.ops_monitoring.kpi.p95_latency": "P95 延迟",
932
937
  "system.ops_monitoring.kpi.error_rate": "错误率",
933
938
  "system.ops_monitoring.kpi.availability": "可用性",
934
- "system.ops_monitoring.kpi.current_window": "当前窗口"
939
+ "system.ops_monitoring.kpi.current_window": "当前窗口",
940
+ "system.runtime.log.section.sources": "日志来源",
941
+ "system.runtime.log.section.history_files": "历史日志",
942
+ "system.runtime.log.section.viewer": "日志查看器",
943
+ "system.runtime.log.value.live_console": "实时控制台",
944
+ "system.runtime.log.value.instance": "实例 {id}",
945
+ "system.runtime.log.value.entry_count": "{count} 条",
946
+ "system.runtime.log.placeholder.search_file": "搜索日志文件",
947
+ "system.runtime.log.placeholder.search_content": "搜索日志内容",
948
+ "system.runtime.log.placeholder.level": "日志级别",
949
+ "system.runtime.log.action.resume": "继续",
950
+ "system.runtime.log.action.pause": "暂停",
951
+ "system.runtime.log.action.auto_scroll": "自动滚动",
952
+ "system.runtime.log.action.download": "下载原文件",
953
+ "system.runtime.log.action.load_older": "加载更早日志",
954
+ "system.runtime.log.empty.files": "暂无历史日志文件",
955
+ "system.runtime.log.empty.entries": "暂无匹配日志",
956
+ "system.runtime.log.status.connecting": "连接中",
957
+ "system.runtime.log.status.live": "实时",
958
+ "system.runtime.log.status.paused": "已暂停",
959
+ "system.runtime.log.status.disconnected": "未连接",
960
+ "system.runtime.log.status.loading": "正在读取日志",
961
+ "system.runtime.log.message.gap": "实时日志过快,已跳过 {count} 条,请查询历史文件补全",
962
+ "system.runtime.log.message.file_changed": "日志文件已滚动或截断,已重新从文件尾部读取",
963
+ "system.runtime.log.message.download_started": "日志文件下载已开始"
935
964
  }
@@ -912,7 +912,12 @@
912
912
  "system.ops_monitoring.error_rate": "錯誤率",
913
913
  "system.ops_monitoring.status.label": "狀態",
914
914
  "system.ops_monitoring.instance_resources": "執行個體資源",
915
- "system.ops_monitoring.current_recent_sample": "目前程序最近取樣",
915
+ "system.ops_monitoring.current_recent_sample": "目前執行個體資源最近取樣",
916
+ "system.ops_monitoring.node_metric.heap_memory": "堆積記憶體",
917
+ "system.ops_monitoring.node_metric.memory": "記憶體",
918
+ "system.ops_monitoring.node_metric.disk": "磁碟",
919
+ "system.ops_monitoring.node_metric.current": "目前",
920
+ "system.ops_monitoring.node_metric.total": "總計",
916
921
  "system.ops_monitoring.instance_count": "{count} 個執行個體",
917
922
  "system.ops_monitoring.alert_events": "告警事件",
918
923
  "system.ops_monitoring.alert_attention": "視窗內失敗請求,需要運維關注的事件",
@@ -931,5 +936,29 @@
931
936
  "system.ops_monitoring.kpi.p95_latency": "P95 延遲",
932
937
  "system.ops_monitoring.kpi.error_rate": "錯誤率",
933
938
  "system.ops_monitoring.kpi.availability": "可用性",
934
- "system.ops_monitoring.kpi.current_window": "目前視窗"
939
+ "system.ops_monitoring.kpi.current_window": "目前視窗",
940
+ "system.runtime.log.section.sources": "日誌來源",
941
+ "system.runtime.log.section.history_files": "歷史日誌",
942
+ "system.runtime.log.section.viewer": "日誌檢視器",
943
+ "system.runtime.log.value.live_console": "即時主控台",
944
+ "system.runtime.log.value.instance": "執行個體 {id}",
945
+ "system.runtime.log.value.entry_count": "{count} 筆",
946
+ "system.runtime.log.placeholder.search_file": "搜尋日誌檔案",
947
+ "system.runtime.log.placeholder.search_content": "搜尋日誌內容",
948
+ "system.runtime.log.placeholder.level": "日誌層級",
949
+ "system.runtime.log.action.resume": "繼續",
950
+ "system.runtime.log.action.pause": "暫停",
951
+ "system.runtime.log.action.auto_scroll": "自動捲動",
952
+ "system.runtime.log.action.download": "下載原始檔案",
953
+ "system.runtime.log.action.load_older": "載入更早日誌",
954
+ "system.runtime.log.empty.files": "暫無歷史日誌檔案",
955
+ "system.runtime.log.empty.entries": "暫無符合的日誌",
956
+ "system.runtime.log.status.connecting": "連線中",
957
+ "system.runtime.log.status.live": "即時",
958
+ "system.runtime.log.status.paused": "已暫停",
959
+ "system.runtime.log.status.disconnected": "未連線",
960
+ "system.runtime.log.status.loading": "正在讀取日誌",
961
+ "system.runtime.log.message.gap": "即時日誌過快,已略過 {count} 筆,請查詢歷史檔案補全",
962
+ "system.runtime.log.message.file_changed": "日誌檔案已輪替或截斷,已重新從檔案尾端讀取",
963
+ "system.runtime.log.message.download_started": "日誌檔案下載已開始"
935
964
  }
@@ -222,6 +222,10 @@ export interface OpsNodeMetric {
222
222
  label: string;
223
223
  /** 指标使用百分比 */
224
224
  value: number;
225
+ /** 当前已用容量,单位字节 */
226
+ used_bytes: number;
227
+ /** 总容量,单位字节 */
228
+ total_bytes: number;
225
229
  }
226
230
 
227
231
  /** 告警事件。 */