@dsh-workbench/shared 0.3.4 → 0.3.6
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/dist/api/blocker-table.d.ts +13 -0
- package/dist/api/blocker-table.js +13 -0
- package/dist/api/blocker.d.ts +6 -0
- package/dist/api/context-ref.d.ts +31 -0
- package/dist/api/context-ref.js +28 -0
- package/dist/api/dsh-client.d.ts +99 -0
- package/dist/api/dsh.d.ts +55 -3
- package/dist/api/facts.d.ts +42 -0
- package/dist/api/facts.js +33 -0
- package/dist/api/host-write.d.ts +18 -0
- package/dist/api/host-write.js +12 -0
- package/dist/api/long-task.d.ts +66 -1
- package/dist/api/long-task.js +59 -0
- package/dist/api/unit-board.d.ts +25 -0
- package/dist/api/unit-board.js +16 -0
- package/dist/api/unit-declaration.d.ts +36 -0
- package/dist/api/unit-declaration.js +24 -0
- package/dist/api/unit.d.ts +32 -0
- package/dist/api/unit.js +5 -0
- package/dist/api/workbench-client.d.ts +25 -0
- package/dist/api/workbench-client.js +13 -0
- package/dist/api/workbench-contract.d.ts +12 -0
- package/dist/components/Activity.d.ts +33 -0
- package/dist/components/Activity.js +24 -0
- package/dist/components/ApprovalDetail.d.ts +12 -0
- package/dist/components/ApprovalDetail.js +9 -0
- package/dist/components/ApprovalPlan.d.ts +14 -0
- package/dist/components/ApprovalPlan.js +8 -0
- package/dist/components/Card.d.ts +13 -0
- package/dist/components/Card.js +10 -0
- package/dist/components/CardAnchor.d.ts +14 -0
- package/dist/components/CardAnchor.js +11 -0
- package/dist/components/CardBoundary.d.ts +20 -0
- package/dist/components/CardBoundary.js +14 -0
- package/dist/components/CardHead.d.ts +13 -0
- package/dist/components/CardHead.js +10 -0
- package/dist/components/ChoiceGroup.d.ts +24 -0
- package/dist/components/ChoiceGroup.js +12 -0
- package/dist/components/Field.d.ts +10 -0
- package/dist/components/Field.js +7 -0
- package/dist/components/Form.css +6 -0
- package/dist/components/Form.d.ts +20 -0
- package/dist/components/Form.js +58 -0
- package/dist/components/FormActions.d.ts +14 -0
- package/dist/components/FormActions.js +5 -0
- package/dist/components/FormNodes.d.ts +103 -0
- package/dist/components/FormNodes.js +153 -0
- package/dist/components/FormRows.css +31 -0
- package/dist/components/FormRows.d.ts +20 -0
- package/dist/components/FormRows.js +14 -0
- package/dist/components/FormTypes.d.ts +59 -0
- package/dist/components/FormTypes.js +1 -0
- package/dist/components/Link.d.ts +12 -0
- package/dist/components/Link.js +9 -0
- package/dist/components/LongTaskRow.css +52 -0
- package/dist/components/LongTaskRow.d.ts +35 -0
- package/dist/components/LongTaskRow.js +45 -4
- package/dist/components/Note.d.ts +11 -0
- package/dist/components/Note.js +8 -0
- package/dist/components/ResourceStates.d.ts +25 -0
- package/dist/components/ResourceStates.js +22 -0
- package/dist/components/Rows.d.ts +17 -0
- package/dist/components/Rows.js +11 -0
- package/dist/components/SaveBar.d.ts +12 -0
- package/dist/components/SaveBar.js +9 -0
- package/dist/components/SelectField.d.ts +26 -0
- package/dist/components/SelectField.js +22 -0
- package/dist/components/SelectFieldNodes.d.ts +24 -0
- package/dist/components/SelectFieldNodes.js +24 -0
- package/dist/components/SettingsSection.d.ts +11 -0
- package/dist/components/SettingsSection.js +8 -0
- package/dist/components/Spinner.d.ts +9 -0
- package/dist/components/Spinner.js +6 -0
- package/dist/components/Stack.d.ts +8 -0
- package/dist/components/Stack.js +5 -0
- package/dist/components/StateBlock.d.ts +13 -0
- package/dist/components/StateBlock.js +10 -0
- package/dist/components/TextField.d.ts +8 -0
- package/dist/components/TextField.js +5 -0
- package/dist/components/board-module.d.ts +30 -0
- package/dist/components/icons.d.ts +38 -0
- package/dist/components/icons.js +35 -0
- package/dist/config/constants.d.ts +42 -0
- package/dist/config/constants.js +42 -0
- package/dist/config/storage.d.ts +4 -0
- package/dist/config/storage.js +4 -0
- package/dist/host/long-task.d.ts +7 -0
- package/dist/host/long-task.js +31 -5
- package/dist/host/tool-approval.d.ts +1 -0
- package/dist/host/unit-face.d.ts +6 -1
- package/dist/i18n/en.d.ts +1 -0
- package/dist/i18n/en.js +10 -8
- package/dist/i18n/index.d.ts +13 -9
- package/dist/i18n/index.js +1 -0
- package/dist/i18n/merge.d.ts +5 -0
- package/dist/i18n/merge.js +2 -0
- package/dist/i18n/zh.d.ts +11 -8
- package/dist/i18n/zh.js +10 -8
- package/dist/index.d.ts +6 -2
- package/dist/index.js +6 -2
- package/dist/lib/blocker-action.d.ts +22 -0
- package/dist/lib/blocker-action.js +13 -0
- package/dist/lib/board-fact.d.ts +27 -0
- package/dist/lib/board-fact.js +18 -0
- package/dist/lib/busy.d.ts +10 -0
- package/dist/lib/busy.js +7 -0
- package/dist/lib/diy-debug.d.ts +42 -2
- package/dist/lib/diy-debug.js +19 -1
- package/dist/lib/diy-record.d.ts +41 -0
- package/dist/lib/diy-record.js +17 -0
- package/dist/lib/form-problem.d.ts +10 -0
- package/dist/lib/form-problem.js +10 -0
- package/dist/lib/panel-state.d.ts +60 -0
- package/dist/lib/panel-state.js +30 -0
- package/dist/lib/react.d.ts +39 -0
- package/dist/lib/react.js +36 -0
- package/dist/lib/text.d.ts +22 -0
- package/dist/lib/text.js +22 -0
- package/dist/lib/ui.d.ts +50 -0
- package/dist/lib/ui.js +41 -0
- package/package.json +1 -1
- package/src/api/__tests__/long-task.test.ts +41 -1
- package/src/api/blocker-table.ts +13 -0
- package/src/api/blocker.ts +6 -0
- package/src/api/context-ref.ts +31 -0
- package/src/api/dsh-client.ts +99 -0
- package/src/api/dsh.ts +56 -1
- package/src/api/facts.ts +42 -0
- package/src/api/host-write.ts +18 -0
- package/src/api/long-task.ts +79 -1
- package/src/api/unit-board.ts +25 -0
- package/src/api/unit-declaration.ts +36 -0
- package/src/api/unit.ts +32 -0
- package/src/api/workbench-client.ts +25 -0
- package/src/api/workbench-contract.ts +12 -0
- package/src/components/Activity.tsx +33 -0
- package/src/components/ApprovalDetail.tsx +12 -0
- package/src/components/ApprovalPlan.tsx +14 -0
- package/src/components/Card.tsx +13 -0
- package/src/components/CardAnchor.tsx +14 -0
- package/src/components/CardBoundary.tsx +20 -0
- package/src/components/CardHead.tsx +13 -0
- package/src/components/ChoiceGroup.tsx +24 -0
- package/src/components/Field.tsx +10 -0
- package/src/components/Form.css +6 -0
- package/src/components/Form.test.tsx +475 -0
- package/src/components/Form.tsx +78 -0
- package/src/components/FormActions.tsx +14 -0
- package/src/components/FormNodes.tsx +193 -0
- package/src/components/FormRows.css +31 -0
- package/src/components/FormRows.test.tsx +71 -1
- package/src/components/FormRows.tsx +20 -0
- package/src/components/FormTypes.ts +65 -0
- package/src/components/FormWiring.test.tsx +88 -0
- package/src/components/Link.tsx +12 -0
- package/src/components/LongTaskRow.css +52 -0
- package/src/components/LongTaskRow.tsx +76 -2
- package/src/components/Note.tsx +11 -0
- package/src/components/ResourceStates.tsx +25 -0
- package/src/components/Rows.tsx +17 -0
- package/src/components/SaveBar.tsx +12 -0
- package/src/components/SelectField.tsx +26 -0
- package/src/components/SelectFieldNodes.tsx +24 -0
- package/src/components/SettingsSection.tsx +11 -0
- package/src/components/Spinner.tsx +9 -0
- package/src/components/Stack.tsx +8 -0
- package/src/components/StateBlock.tsx +13 -0
- package/src/components/TextField.tsx +8 -0
- package/src/components/__tests__/long-task-row.test.ts +115 -0
- package/src/components/board-module.ts +30 -0
- package/src/components/icons.tsx +38 -0
- package/src/config/constants.ts +43 -0
- package/src/config/storage.ts +4 -0
- package/src/host/__tests__/long-task.test.ts +264 -0
- package/src/host/long-task.ts +43 -7
- package/src/host/tool-approval.ts +1 -0
- package/src/host/unit-face.ts +7 -1
- package/src/i18n/en.ts +11 -8
- package/src/i18n/index.ts +3 -0
- package/src/i18n/merge.ts +5 -0
- package/src/i18n/zh.ts +11 -8
- package/src/index.ts +6 -2
- package/src/lib/blocker-action.ts +22 -0
- package/src/lib/board-fact.ts +27 -0
- package/src/lib/busy.ts +10 -0
- package/src/lib/diy-debug.test.ts +2 -1
- package/src/lib/diy-debug.ts +44 -3
- package/src/lib/diy-record.ts +41 -0
- package/src/lib/form-problem.ts +10 -0
- package/src/lib/panel-state.ts +60 -0
- package/src/lib/react.ts +39 -0
- package/src/lib/text.ts +22 -0
- package/src/lib/ui.ts +50 -0
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
import { describe, expect, it } from 'vitest';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
longTaskDot,
|
|
4
|
+
longTaskPollMs,
|
|
5
|
+
longTaskRunsOf,
|
|
6
|
+
longTaskStopPress,
|
|
7
|
+
longTaskStopStage,
|
|
8
|
+
LONG_TASK_STOP_ARM_MS,
|
|
9
|
+
runsRouteOf,
|
|
10
|
+
stopRouteOf,
|
|
11
|
+
} from '../long-task.js';
|
|
3
12
|
|
|
4
13
|
describe('runsRouteOf', () => {
|
|
5
14
|
it('★ 事实名 = 路由名(三处同一个来源,改一处不可能漏另一处)', () => {
|
|
@@ -8,6 +17,14 @@ describe('runsRouteOf', () => {
|
|
|
8
17
|
});
|
|
9
18
|
});
|
|
10
19
|
|
|
20
|
+
describe('stopRouteOf(停止那条写路由)', () => {
|
|
21
|
+
it('★ 就是读路由 + `/stop`(读口与写口同一个单元名,不另造一套命名)', () => {
|
|
22
|
+
expect(stopRouteOf('cmdb')).toBe('cmdb/runs/stop');
|
|
23
|
+
expect(stopRouteOf('issues')).toBe('issues/runs/stop');
|
|
24
|
+
expect(stopRouteOf('cmdb')).toBe(`${runsRouteOf('cmdb')}/stop`);
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
|
|
11
28
|
describe('longTaskDot', () => {
|
|
12
29
|
it('★ 两个"还在等"的状态都转圈:等编排与等你登录是同一个信号', () => {
|
|
13
30
|
expect(longTaskDot('running')).toBe('ongoing');
|
|
@@ -15,6 +32,29 @@ describe('longTaskDot', () => {
|
|
|
15
32
|
expect(longTaskDot('ok')).toBe('done');
|
|
16
33
|
expect(longTaskDot('failed')).toBe('error');
|
|
17
34
|
});
|
|
35
|
+
|
|
36
|
+
it('★ 用户按停的那一趟是灰点:不是成功、不是出错,落进 idle', () => {
|
|
37
|
+
expect(longTaskDot('stopped')).toBe('idle');
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
describe('longTaskStopStage / longTaskStopPress(两按:第一次上膛,第二次才真发)', () => {
|
|
42
|
+
it('★ 三档:没上膛 / 上了膛 / 请求在飞;在飞压过一切', () => {
|
|
43
|
+
expect(longTaskStopStage({ armed: false, busy: false })).toBe('idle');
|
|
44
|
+
expect(longTaskStopStage({ armed: true, busy: false })).toBe('armed');
|
|
45
|
+
expect(longTaskStopStage({ armed: false, busy: true })).toBe('busy');
|
|
46
|
+
expect(longTaskStopStage({ armed: true, busy: true })).toBe('busy');
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it('★ 按一下该干什么:idle → arm、armed → fire、busy → ignore(在飞时按不动)', () => {
|
|
50
|
+
expect(longTaskStopPress('idle')).toBe('arm');
|
|
51
|
+
expect(longTaskStopPress('armed')).toBe('fire');
|
|
52
|
+
expect(longTaskStopPress('busy')).toBe('ignore');
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
it('★ 上膛时限照 dsh:3 秒自己落膛', () => {
|
|
56
|
+
expect(LONG_TASK_STOP_ARM_MS).toBe(3000);
|
|
57
|
+
});
|
|
18
58
|
});
|
|
19
59
|
|
|
20
60
|
describe('longTaskRunsOf(这一读交回的"当前那些趟")', () => {
|
package/src/api/blocker-table.ts
CHANGED
|
@@ -12,6 +12,13 @@ function copyAction(t: Translate, text: string): BlockerAction {
|
|
|
12
12
|
return { kind: 'copy', label: t('blocker.copy'), text };
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
+
/**
|
|
16
|
+
* 把一次读失败翻成一张卡住态,交给卡片直接渲染。
|
|
17
|
+
* @param error 读口回的错误;undefined 表示连错误都没拿到(多半是网络断,回「原因未知」)。
|
|
18
|
+
* @param t 文案函数,只取 blocker.* 命名空间的键。
|
|
19
|
+
* @param context 判定现场;platform 缺省时标题不带平台名。
|
|
20
|
+
* @returns 一定有一张卡,actions 至少一颗「重试」。
|
|
21
|
+
*/
|
|
15
22
|
export function blockerOfError(
|
|
16
23
|
error: ApiError | undefined,
|
|
17
24
|
t: Translate,
|
|
@@ -103,6 +110,12 @@ export function blockerOfError(
|
|
|
103
110
|
}
|
|
104
111
|
}
|
|
105
112
|
|
|
113
|
+
/**
|
|
114
|
+
* 把宿主回的环境读数翻成卡住态:探针没查过(unchecked)只算提示,不挡卡片。
|
|
115
|
+
* @param capability 宿主回的单元环境读数。
|
|
116
|
+
* @param t 文案函数,键都在 env.unit.* / blocker.* 下。
|
|
117
|
+
* @returns status 为 'ok' 时给 undefined(没有卡住态),其余状态一律给一张。
|
|
118
|
+
*/
|
|
106
119
|
export function blockerOfCapability(capability: CapabilityPayload, t: Translate): ModuleBlocker | undefined {
|
|
107
120
|
if (capability.status === 'ok') return undefined;
|
|
108
121
|
|
package/src/api/blocker.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 卡住时用户能点的那一下(开链接 / 复制命令 / 重试 / 装或升模块):由判据产出,卡片照原样渲染。
|
|
3
|
+
*/
|
|
1
4
|
export type BlockerAction =
|
|
2
5
|
| {
|
|
3
6
|
readonly kind: 'open-url';
|
|
@@ -15,6 +18,9 @@ export type BlockerAction =
|
|
|
15
18
|
}
|
|
16
19
|
| { readonly kind: 'open-market'; readonly label: string; readonly unit: string };
|
|
17
20
|
|
|
21
|
+
/**
|
|
22
|
+
* 一个单元此刻的卡住态:block 顶掉整张卡片,notice 只在角上提示一句;读口与探针产出,卡片消费。
|
|
23
|
+
*/
|
|
18
24
|
export interface ModuleBlocker {
|
|
19
25
|
readonly id: string;
|
|
20
26
|
readonly severity: 'block' | 'notice';
|
package/src/api/context-ref.ts
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 引用标记的固定名字;完整标记是 @<这个名字>:<编码文本>,改它等于作废历史会话里已写下的引用。
|
|
3
|
+
*/
|
|
1
4
|
export const CONTEXT_MARKER_NAME = '工作台';
|
|
2
5
|
|
|
6
|
+
/**
|
|
7
|
+
* 一条解析后的引用(种类加路径分段):输入框写标记时产出,跳转与展示时消费。
|
|
8
|
+
*/
|
|
3
9
|
export interface ContextRef {
|
|
4
10
|
readonly kind: string;
|
|
5
11
|
readonly parts: readonly string[];
|
|
@@ -9,10 +15,20 @@ const MARKER = new RegExp(`@${CONTEXT_MARKER_NAME}:([a-z][a-z0-9-]*:[A-Za-z0-9._
|
|
|
9
15
|
|
|
10
16
|
const TRAILING_PUNCTUATION = /[.,;:!?]+$/;
|
|
11
17
|
|
|
18
|
+
/**
|
|
19
|
+
* 把引用拼回标记体里的那一段文本(不含 @ 与标记名)。
|
|
20
|
+
* @param ref 要拼的引用。
|
|
21
|
+
* @returns 形如 kind:part/part;分段里的 / 不转义,所以分段名本身不能含 /。
|
|
22
|
+
*/
|
|
12
23
|
export function encodeRef(ref: ContextRef): string {
|
|
13
24
|
return `${ref.kind}:${ref.parts.join('/')}`;
|
|
14
25
|
}
|
|
15
26
|
|
|
27
|
+
/**
|
|
28
|
+
* 把 kind:part/part 文本读回引用。
|
|
29
|
+
* @param text 待解析文本。
|
|
30
|
+
* @returns 没冒号、冒号在首尾、种类不是小写字母开头、或冒号后为空时给 undefined;不抛异常。
|
|
31
|
+
*/
|
|
16
32
|
export function decodeRef(text: string): ContextRef | undefined {
|
|
17
33
|
const at = text.indexOf(':');
|
|
18
34
|
if (at <= 0 || at === text.length - 1) return undefined;
|
|
@@ -23,14 +39,29 @@ export function decodeRef(text: string): ContextRef | undefined {
|
|
|
23
39
|
return { kind, parts };
|
|
24
40
|
}
|
|
25
41
|
|
|
42
|
+
/**
|
|
43
|
+
* 拼出 @ 后面那半截(标记名加已编码文本),比较与拼接都用它。
|
|
44
|
+
* @param encoded encodeRef 的结果。
|
|
45
|
+
* @returns 形如 工作台:file:src/a.ts。
|
|
46
|
+
*/
|
|
26
47
|
export function markerBody(encoded: string): string {
|
|
27
48
|
return `${CONTEXT_MARKER_NAME}:${encoded}`;
|
|
28
49
|
}
|
|
29
50
|
|
|
51
|
+
/**
|
|
52
|
+
* 把一条引用拼成能写进对话文本的完整标记。
|
|
53
|
+
* @param ref 要标记的引用。
|
|
54
|
+
* @returns 形如 @工作台:file:src/a.ts 的一段文本。
|
|
55
|
+
*/
|
|
30
56
|
export function buildMarker(ref: ContextRef): string {
|
|
31
57
|
return `@${markerBody(encodeRef(ref))}`;
|
|
32
58
|
}
|
|
33
59
|
|
|
60
|
+
/**
|
|
61
|
+
* 从一段文本里按出现顺序捞出所有标记引用,同一个引用只留第一次。
|
|
62
|
+
* @param text 任意文本;null / undefined 当空串。
|
|
63
|
+
* @returns 解析不出来的标记会被丢掉,所以结果只含合法引用,可能为空数组。
|
|
64
|
+
*/
|
|
34
65
|
export function parseMarkers(text: string): ContextRef[] {
|
|
35
66
|
const seen = new Set<string>();
|
|
36
67
|
const refs: ContextRef[] = [];
|
package/src/api/dsh-client.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* 左栏一行的来源:dsh workspaces.list 快照里的一项,两个时间戳都是毫秒。
|
|
5
|
+
*/
|
|
3
6
|
export interface WorkspaceView {
|
|
4
7
|
readonly workspaceId: string;
|
|
5
8
|
readonly path: string;
|
|
@@ -9,12 +12,18 @@ export interface WorkspaceView {
|
|
|
9
12
|
readonly updatedAt: number;
|
|
10
13
|
}
|
|
11
14
|
|
|
15
|
+
/**
|
|
16
|
+
* workspaces.list 的整份快照:可见工作区,加上归档与置顶的会话 id;外壳只读不改。
|
|
17
|
+
*/
|
|
12
18
|
export interface WorkspaceSnapshot {
|
|
13
19
|
readonly items: readonly WorkspaceView[];
|
|
14
20
|
readonly archivedSessionIds: readonly string[];
|
|
15
21
|
readonly pinnedSessionIds: readonly string[];
|
|
16
22
|
}
|
|
17
23
|
|
|
24
|
+
/**
|
|
25
|
+
* 会话一行的来源(标题、空会话、在跑与否、被谁留住);retainedBy 按视图名记留住它的份数,mainView 大于 0 即正被主视图占着。
|
|
26
|
+
*/
|
|
18
27
|
export interface SessionSummary {
|
|
19
28
|
readonly id: string;
|
|
20
29
|
readonly displayTitle: string;
|
|
@@ -25,10 +34,16 @@ export interface SessionSummary {
|
|
|
25
34
|
readonly retainedBy: Readonly<Partial<Record<string, number>>>;
|
|
26
35
|
}
|
|
27
36
|
|
|
37
|
+
/**
|
|
38
|
+
* 会话投影里的一条子代理目录项;外壳只认 id,其余字段随 dsh 变。
|
|
39
|
+
*/
|
|
28
40
|
export interface SubagentCatalogEntry {
|
|
29
41
|
readonly id: string;
|
|
30
42
|
}
|
|
31
43
|
|
|
44
|
+
/**
|
|
45
|
+
* dsh sessions.list 的快照:按 id 找会话,投影里可能挂着一串子代理目录。
|
|
46
|
+
*/
|
|
32
47
|
export interface SessionsSnapshot {
|
|
33
48
|
readonly byId: Readonly<Record<string, SessionSummary>>;
|
|
34
49
|
readonly projectionsBySession: Readonly<
|
|
@@ -36,34 +51,58 @@ export interface SessionsSnapshot {
|
|
|
36
51
|
>;
|
|
37
52
|
}
|
|
38
53
|
|
|
54
|
+
/**
|
|
55
|
+
* 一个会话的三个状态位(在跑 / 有未读完成 / 等着用户交互);字段缺省就是这一位不知道。
|
|
56
|
+
*/
|
|
39
57
|
export interface SessionStatus {
|
|
40
58
|
readonly running?: boolean;
|
|
41
59
|
readonly completionUnread?: boolean;
|
|
42
60
|
readonly pendingInteraction?: { readonly kind?: string };
|
|
43
61
|
}
|
|
44
62
|
|
|
63
|
+
/**
|
|
64
|
+
* 会话 id 到状态位的只读表;查不到的 id 就是没有这一条状态。
|
|
65
|
+
*/
|
|
45
66
|
export type SessionStatusSnapshot = ReadonlyMap<string, SessionStatus>;
|
|
46
67
|
|
|
68
|
+
/**
|
|
69
|
+
* dsh layout 的面板选择位;activePanelId 为 null 表示用户把面板关了。
|
|
70
|
+
*/
|
|
47
71
|
export interface PanelInfo {
|
|
48
72
|
readonly activePanelId: string | null;
|
|
49
73
|
}
|
|
50
74
|
|
|
75
|
+
/**
|
|
76
|
+
* 某个插槽上注册着的一项(id、顺序、文案);label 允许是函数,因为文案要跟语言走。
|
|
77
|
+
*/
|
|
51
78
|
export interface PanelEntry {
|
|
52
79
|
readonly id: string;
|
|
53
80
|
readonly order: number;
|
|
54
81
|
readonly label: string | (() => string);
|
|
55
82
|
}
|
|
56
83
|
|
|
84
|
+
/**
|
|
85
|
+
* 选择器 hook 的形状(dsh 那套 useSyncExternalStore):外壳拿它从快照里取一小块并在变更时重取。
|
|
86
|
+
*/
|
|
57
87
|
export type SnapshotSelectorHook<T> = <R>(selector: (state: T) => R) => R;
|
|
58
88
|
|
|
89
|
+
/**
|
|
90
|
+
* 渲染 dsh 某个插槽的函数;key 定插槽,fallback 是空槽兜底,only 用来只渲染其中一个注册项。
|
|
91
|
+
*/
|
|
59
92
|
export type RenderSlot = (
|
|
60
93
|
key: string,
|
|
61
94
|
owner?: Record<string, unknown>,
|
|
62
95
|
options?: { fallback?: ReactNode; hookContext?: unknown; only?: string },
|
|
63
96
|
) => ReactNode;
|
|
64
97
|
|
|
98
|
+
/**
|
|
99
|
+
* 文案函数:给键(可带参数)回一句当前语言的文本;缺键时由 dsh 决定回什么,调用点不兜。
|
|
100
|
+
*/
|
|
65
101
|
export type Translate = (key: string, params?: Record<string, unknown>) => string;
|
|
66
102
|
|
|
103
|
+
/**
|
|
104
|
+
* 往 dsh 插槽注册一项要给的参数;priority 与 order 小者靠前,inject 声明这一项要用到的作用域。
|
|
105
|
+
*/
|
|
67
106
|
export interface SlotRegisterOptions {
|
|
68
107
|
name: string;
|
|
69
108
|
priority?: number;
|
|
@@ -76,6 +115,9 @@ export interface SlotRegisterOptions {
|
|
|
76
115
|
inject?: (scope?: unknown) => Record<string, unknown>;
|
|
77
116
|
}
|
|
78
117
|
|
|
118
|
+
/**
|
|
119
|
+
* dsh 的插槽服务:注册一项、注入作用域、订阅变更,以及按名取已注册项。
|
|
120
|
+
*/
|
|
79
121
|
export interface DshSlots {
|
|
80
122
|
inject(name: string, callback: () => void | (() => void) | Iterable<() => void>): () => void;
|
|
81
123
|
register(options: SlotRegisterOptions, component: unknown): () => void;
|
|
@@ -85,11 +127,17 @@ export interface DshSlots {
|
|
|
85
127
|
onMutate?(callback: (name: string) => void): () => void;
|
|
86
128
|
}
|
|
87
129
|
|
|
130
|
+
/**
|
|
131
|
+
* dsh 的语言服务:按命名空间注册字典,再取回那个命名空间的文案函数。
|
|
132
|
+
*/
|
|
88
133
|
export interface DshLocale {
|
|
89
134
|
register(namespace: string, dictionaries: Record<string, Record<string, string>>): () => void;
|
|
90
135
|
bind(namespace: string): Translate;
|
|
91
136
|
}
|
|
92
137
|
|
|
138
|
+
/**
|
|
139
|
+
* dsh 的布局服务:选面板、开关左栏、开合右栏;右栏宽度经可选的 panels 写。
|
|
140
|
+
*/
|
|
93
141
|
export interface DshLayout {
|
|
94
142
|
selectPanel(panelId: string | null): void;
|
|
95
143
|
toggleSidebar(): void;
|
|
@@ -98,18 +146,30 @@ export interface DshLayout {
|
|
|
98
146
|
readonly panels?: DshLayoutPanels;
|
|
99
147
|
}
|
|
100
148
|
|
|
149
|
+
/**
|
|
150
|
+
* layout 上那个可选的右栏宽度写口;dsh 没给这一位时右栏宽度就只是内存态。
|
|
151
|
+
*/
|
|
101
152
|
export interface DshLayoutPanels {
|
|
102
153
|
setRightbar?(px: number): void;
|
|
103
154
|
}
|
|
104
155
|
|
|
156
|
+
/**
|
|
157
|
+
* 快捷键目录的口子;外壳只把它透出去,形状与内容随 dsh。
|
|
158
|
+
*/
|
|
105
159
|
export interface DshShortcutCatalog {
|
|
106
160
|
readonly catalog: unknown;
|
|
107
161
|
}
|
|
108
162
|
|
|
163
|
+
/**
|
|
164
|
+
* 起一个新会话时能带的选项;目前只有 agent 预设这一项。
|
|
165
|
+
*/
|
|
109
166
|
export interface DshSessionStartOptions {
|
|
110
167
|
readonly agentPreset?: string;
|
|
111
168
|
}
|
|
112
169
|
|
|
170
|
+
/**
|
|
171
|
+
* dsh 的工作区与会话动作:开工作区、开会话、起会话、挑目录。
|
|
172
|
+
*/
|
|
113
173
|
export interface DshUiWorkspace {
|
|
114
174
|
openWorkspace(workspaceId: string): Promise<unknown>;
|
|
115
175
|
openSession(sessionId: string): void;
|
|
@@ -117,17 +177,26 @@ export interface DshUiWorkspace {
|
|
|
117
177
|
pickDirectory(): Promise<string | null>;
|
|
118
178
|
}
|
|
119
179
|
|
|
180
|
+
/**
|
|
181
|
+
* 工作区写口回的那点事实(新 id 或新标题);字段都可能缺,缺了按「没写回」算。
|
|
182
|
+
*/
|
|
120
183
|
export interface DshWorkspaceWritten {
|
|
121
184
|
readonly workspaceId?: string;
|
|
122
185
|
readonly title?: string;
|
|
123
186
|
}
|
|
124
187
|
|
|
188
|
+
/**
|
|
189
|
+
* dsh 的工作区服务:list 是可订阅快照,create 与 rename 是写口。
|
|
190
|
+
*/
|
|
125
191
|
export interface DshWorkspaces {
|
|
126
192
|
readonly list: DshObservable<WorkspaceSnapshot>;
|
|
127
193
|
create(request: { path: string }): Promise<DshWorkspaceWritten | undefined>;
|
|
128
194
|
rename(workspaceId: string, title: string): Promise<DshWorkspaceWritten>;
|
|
129
195
|
}
|
|
130
196
|
|
|
197
|
+
/**
|
|
198
|
+
* 往输入框插一条引用时要给的载荷:来源、引用文本、显示文案与剪贴板文本。
|
|
199
|
+
*/
|
|
131
200
|
export interface DshReferenceInsert {
|
|
132
201
|
readonly source: string;
|
|
133
202
|
readonly ref: string;
|
|
@@ -136,12 +205,18 @@ export interface DshReferenceInsert {
|
|
|
136
205
|
readonly clipboardText: string;
|
|
137
206
|
}
|
|
138
207
|
|
|
208
|
+
/**
|
|
209
|
+
* 输入框里一段 token 的区间;draftRev 用来确认还是同一版草稿,插入引用时用它定位。
|
|
210
|
+
*/
|
|
139
211
|
export interface DshTokenSpan {
|
|
140
212
|
readonly start: number;
|
|
141
213
|
readonly end: number;
|
|
142
214
|
readonly draftRev: number;
|
|
143
215
|
}
|
|
144
216
|
|
|
217
|
+
/**
|
|
218
|
+
* 某一个会话的输入框句柄;外壳借它插引用与弹提示,state 用来核对草稿版本。
|
|
219
|
+
*/
|
|
145
220
|
export interface DshSessionInput {
|
|
146
221
|
caretSpan?: () => { start: number; end: number };
|
|
147
222
|
readonly state: { getSnapshot(): { draftRev: number } | undefined };
|
|
@@ -149,6 +224,9 @@ export interface DshSessionInput {
|
|
|
149
224
|
notify(level: 'info' | 'error', text: string): void;
|
|
150
225
|
}
|
|
151
226
|
|
|
227
|
+
/**
|
|
228
|
+
* 注册 @ 触发源的口子:候选由外壳现取,选中后的动作也归外壳,dsh 只负责触发。
|
|
229
|
+
*/
|
|
152
230
|
export interface DshInputTriggers {
|
|
153
231
|
registerSource(source: {
|
|
154
232
|
readonly trigger: '@';
|
|
@@ -165,10 +243,16 @@ export interface DshInputTriggers {
|
|
|
165
243
|
}): () => void;
|
|
166
244
|
}
|
|
167
245
|
|
|
246
|
+
/**
|
|
247
|
+
* dsh 的对话服务;外壳只用它按会话取输入框句柄。
|
|
248
|
+
*/
|
|
168
249
|
export interface DshConversationService {
|
|
169
250
|
readonly input: { for(actx: unknown): DshSessionInput };
|
|
170
251
|
}
|
|
171
252
|
|
|
253
|
+
/**
|
|
254
|
+
* 浏览器侧的会话服务:快照加按 id 取作用域;create 是可选写口,不是每个 dsh 版本都有。
|
|
255
|
+
*/
|
|
172
256
|
export interface DshSessionsService {
|
|
173
257
|
readonly list: { getSnapshot(): SessionsSnapshot };
|
|
174
258
|
scope(sessionId: string): unknown | undefined;
|
|
@@ -180,11 +264,17 @@ export interface DshSessionsService {
|
|
|
180
264
|
}): Promise<unknown>;
|
|
181
265
|
}
|
|
182
266
|
|
|
267
|
+
/**
|
|
268
|
+
* dsh 侧最小的可订阅值:取当前快照加订阅变更,外壳用它接进 React。
|
|
269
|
+
*/
|
|
183
270
|
export interface DshObservable<T> {
|
|
184
271
|
getSnapshot(): T;
|
|
185
272
|
subscribe(listener: () => void): () => void;
|
|
186
273
|
}
|
|
187
274
|
|
|
275
|
+
/**
|
|
276
|
+
* dsh 的右栏服务:mounted 是在场与否的可订阅值,展开与开资源另走方法。
|
|
277
|
+
*/
|
|
188
278
|
export interface DshSidebarRight {
|
|
189
279
|
readonly mounted: DshObservable<string | undefined>;
|
|
190
280
|
isExpanded(): boolean;
|
|
@@ -193,6 +283,9 @@ export interface DshSidebarRight {
|
|
|
193
283
|
openTab(kind: string, options?: unknown): void;
|
|
194
284
|
}
|
|
195
285
|
|
|
286
|
+
/**
|
|
287
|
+
* remote.sessions 写口:在宿主侧建会话并回会话 id。
|
|
288
|
+
*/
|
|
196
289
|
export interface DshSessionsRemote {
|
|
197
290
|
create(request: {
|
|
198
291
|
readonly workspaceId?: string;
|
|
@@ -201,10 +294,16 @@ export interface DshSessionsRemote {
|
|
|
201
294
|
}): Promise<{ readonly sessionId: string }>;
|
|
202
295
|
}
|
|
203
296
|
|
|
297
|
+
/**
|
|
298
|
+
* dsh 客户端的远端写口集合;目前只有会话一家。
|
|
299
|
+
*/
|
|
204
300
|
export interface DshClientRemote {
|
|
205
301
|
readonly sessions: DshSessionsRemote;
|
|
206
302
|
}
|
|
207
303
|
|
|
304
|
+
/**
|
|
305
|
+
* 客户端插件拿到的上下文:所有服务从它取,effect 注册的清理随插件卸载跑。
|
|
306
|
+
*/
|
|
208
307
|
export interface DshClientContext {
|
|
209
308
|
get<T = unknown>(name: string): T | undefined;
|
|
210
309
|
provide(name: string, value: unknown): void;
|
package/src/api/dsh.ts
CHANGED
|
@@ -1,14 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 宿主侧的日志口;info 与 warn 都可能没有,调用前要判存在。
|
|
3
|
+
*/
|
|
1
4
|
export interface DshLogger {
|
|
2
5
|
info?(message: string): void;
|
|
3
6
|
warn?(message: string): void;
|
|
4
7
|
}
|
|
5
8
|
|
|
9
|
+
/**
|
|
10
|
+
* 宿主 HTTP 路由拿到的请求:方法与 URL,请求体是异步可迭代的字节流。
|
|
11
|
+
*/
|
|
6
12
|
export interface DshRequest {
|
|
7
13
|
readonly method?: string;
|
|
8
14
|
readonly url?: string;
|
|
9
15
|
[Symbol.asyncIterator]?(): AsyncIterator<Uint8Array>;
|
|
10
16
|
}
|
|
11
17
|
|
|
18
|
+
/**
|
|
19
|
+
* 宿主 HTTP 路由要写的响应:statusCode、setHeader 与 end 必备,流式那几个方法可选。
|
|
20
|
+
*/
|
|
12
21
|
export interface DshResponse {
|
|
13
22
|
statusCode: number;
|
|
14
23
|
setHeader(name: string, value: string): void;
|
|
@@ -18,32 +27,50 @@ export interface DshResponse {
|
|
|
18
27
|
on?(event: 'close', listener: () => void): void;
|
|
19
28
|
}
|
|
20
29
|
|
|
30
|
+
/**
|
|
31
|
+
* 一条挂到 dsh web 服务器上的路由;kind 说明 path 是前缀还是全等匹配,handler 自己写响应。
|
|
32
|
+
*/
|
|
21
33
|
export interface DshWebRoute {
|
|
22
34
|
readonly kind: 'prefix' | 'exact';
|
|
23
35
|
readonly path: string;
|
|
24
36
|
readonly handler: (req: DshRequest, res: DshResponse) => void | Promise<void>;
|
|
25
37
|
}
|
|
26
38
|
|
|
39
|
+
/**
|
|
40
|
+
* 宿主插件能看到的 profile 现场;dir 缺省表示 dsh 没给这个信息。
|
|
41
|
+
*/
|
|
27
42
|
export interface DshProfileContext {
|
|
28
43
|
readonly dir?: string;
|
|
29
44
|
}
|
|
30
45
|
|
|
46
|
+
/**
|
|
47
|
+
* 工具声明的静态半(名字加其余关键字);外壳只按 name 认工具。
|
|
48
|
+
*/
|
|
31
49
|
export interface DshToolSchema {
|
|
32
50
|
readonly name: string;
|
|
33
51
|
readonly [key: string]: unknown;
|
|
34
52
|
}
|
|
35
53
|
|
|
54
|
+
/**
|
|
55
|
+
* 系统提示词装配到一半的那份;tools 是可改的工具表,其余字段随 dsh。
|
|
56
|
+
*/
|
|
36
57
|
export interface DshPromptAssembly {
|
|
37
58
|
readonly tools?: readonly DshToolSchema[] | undefined;
|
|
38
59
|
readonly [key: string]: unknown;
|
|
39
60
|
}
|
|
40
61
|
|
|
62
|
+
/**
|
|
63
|
+
* 装配提示词时给判定方的现场(哪个 agent、哪个作用域);两者都可能缺。
|
|
64
|
+
*/
|
|
41
65
|
export interface DshAssemblyContext {
|
|
42
66
|
readonly agent?: unknown;
|
|
43
67
|
readonly scope?: unknown;
|
|
44
68
|
readonly [key: string]: unknown;
|
|
45
69
|
}
|
|
46
70
|
|
|
71
|
+
/**
|
|
72
|
+
* 宿主插件上下文:on 订阅 dsh 的钩子(提示词装配、工具执行前后、agent 生命周期),webServer 挂路由。
|
|
73
|
+
*/
|
|
47
74
|
export interface DshHostContext {
|
|
48
75
|
on?: {
|
|
49
76
|
(
|
|
@@ -107,6 +134,9 @@ export interface DshHostContext {
|
|
|
107
134
|
readonly webServer: { register(route: DshWebRoute): () => void };
|
|
108
135
|
}
|
|
109
136
|
|
|
137
|
+
/**
|
|
138
|
+
* 一次 shell 执行的结果口:result() 给退出码、超时与中断标志,以及截断过的 stdout / stderr。
|
|
139
|
+
*/
|
|
110
140
|
export interface DshShellExecution {
|
|
111
141
|
result(): Promise<{
|
|
112
142
|
exitCode: number | null;
|
|
@@ -117,6 +147,9 @@ export interface DshShellExecution {
|
|
|
117
147
|
}>;
|
|
118
148
|
}
|
|
119
149
|
|
|
150
|
+
/**
|
|
151
|
+
* dsh 的 shell 服务:先 resolve 出执行规格,再把它原样喂给 execute。
|
|
152
|
+
*/
|
|
120
153
|
export interface DshShell {
|
|
121
154
|
resolve(request: {
|
|
122
155
|
command: string;
|
|
@@ -129,14 +162,30 @@ export interface DshShell {
|
|
|
129
162
|
execute(spec: unknown): Promise<DshShellExecution>;
|
|
130
163
|
}
|
|
131
164
|
|
|
165
|
+
/** 一条工作区记录:id、磁盘路径与显示名(登记处按路径认领 / 新建时认的就是它)。 */
|
|
166
|
+
export interface DshWorkspaceRecord {
|
|
167
|
+
readonly id: string;
|
|
168
|
+
readonly path: string;
|
|
169
|
+
readonly title: string;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* 宿主侧的工作区登记处:按 id 查、按路径认领、按路径新建。
|
|
174
|
+
*/
|
|
132
175
|
export interface DshWorkspaceRegistry {
|
|
133
176
|
get(id: string): { id: string; path?: string; title?: string } | undefined;
|
|
134
|
-
resolveByPath(path: string): Promise<
|
|
177
|
+
resolveByPath(path: string): Promise<DshWorkspaceRecord | undefined>;
|
|
135
178
|
create(path: string, title?: string): Promise<{ id?: string; path?: string; title?: string } | undefined>;
|
|
136
179
|
}
|
|
137
180
|
|
|
181
|
+
/**
|
|
182
|
+
* 把相对路径拼成 dsh home 下的绝对路径(服务名 dshHomePath);外壳存自己的状态用它,不自己拼 home。
|
|
183
|
+
*/
|
|
138
184
|
export type DshHomePath = (relative: string) => string;
|
|
139
185
|
|
|
186
|
+
/**
|
|
187
|
+
* 要注册进 dsh 的一把工具:名字、描述、参数表、输出渲染与执行体。
|
|
188
|
+
*/
|
|
140
189
|
export interface DshToolDefinition {
|
|
141
190
|
name: string;
|
|
142
191
|
description: string;
|
|
@@ -148,6 +197,9 @@ export interface DshToolDefinition {
|
|
|
148
197
|
execute(args: unknown, exec: DshToolRunContext): Promise<unknown>;
|
|
149
198
|
}
|
|
150
199
|
|
|
200
|
+
/**
|
|
201
|
+
* 工具执行时给的那点现场(会话 id 与 cwd);层级都可能缺,缺了就当不知道。
|
|
202
|
+
*/
|
|
151
203
|
export interface DshToolRunContext {
|
|
152
204
|
readonly agent?:
|
|
153
205
|
| {
|
|
@@ -161,6 +213,9 @@ export interface DshToolRunContext {
|
|
|
161
213
|
| undefined;
|
|
162
214
|
}
|
|
163
215
|
|
|
216
|
+
/**
|
|
217
|
+
* dsh 的工具表;register 回的清理函数负责在插件卸载时摘掉这条工具。
|
|
218
|
+
*/
|
|
164
219
|
export interface DshToolRegistry {
|
|
165
220
|
register(definition: DshToolDefinition): () => void;
|
|
166
221
|
}
|
package/src/api/facts.ts
CHANGED
|
@@ -1,27 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 宿主推来的一帧事实变更:rev 在同一纪元里单调,facts 是这一帧动过的名字。
|
|
3
|
+
*/
|
|
1
4
|
export interface FactFrame {
|
|
2
5
|
readonly epoch?: string;
|
|
3
6
|
readonly rev: number;
|
|
4
7
|
readonly facts: readonly string[];
|
|
5
8
|
}
|
|
6
9
|
|
|
10
|
+
/**
|
|
11
|
+
* 范围查法的后缀:cmdb/* 这类名字表示「这个前缀下的一族」,不是一条事实。
|
|
12
|
+
*/
|
|
7
13
|
export const FACT_SCOPE_SUFFIX = '*';
|
|
8
14
|
|
|
15
|
+
/**
|
|
16
|
+
* 由单元 id 拼出它那一族事实的范围名。
|
|
17
|
+
* @param unit 单元 id,不带后缀。
|
|
18
|
+
* @returns <unit>* —— 永远是范围名,不是某一条事实。
|
|
19
|
+
*/
|
|
9
20
|
export function unitFactScope(unit: string): string {
|
|
10
21
|
return `${unit}${FACT_SCOPE_SUFFIX}`;
|
|
11
22
|
}
|
|
12
23
|
|
|
24
|
+
/**
|
|
25
|
+
* 判一个名字是不是范围查法,不是问这条事实存不存在。
|
|
26
|
+
* @param name 事实名或范围名。
|
|
27
|
+
* @returns 单字符 * 不算范围;只有「至少一个字符加 *」才算。
|
|
28
|
+
*/
|
|
13
29
|
export function isFactScope(name: string): boolean {
|
|
14
30
|
return name.length > 1 && name.endsWith(FACT_SCOPE_SUFFIX);
|
|
15
31
|
}
|
|
16
32
|
|
|
33
|
+
/**
|
|
34
|
+
* 取范围名对应的前缀,普通事实名原样返回。
|
|
35
|
+
* @param name 事实名或范围名。
|
|
36
|
+
* @returns 去掉末尾 * 的前缀;本来不是范围就给原值。
|
|
37
|
+
*/
|
|
17
38
|
export function scopePrefixOf(name: string): string {
|
|
18
39
|
return isFactScope(name) ? name.slice(0, -FACT_SCOPE_SUFFIX.length) : name;
|
|
19
40
|
}
|
|
20
41
|
|
|
42
|
+
/**
|
|
43
|
+
* 事实的来路:start 建连并按帧回调,cursor 报已收到的宿主 rev(断线重连时交给宿主)。
|
|
44
|
+
*/
|
|
21
45
|
export interface FactTransport {
|
|
22
46
|
start(handlers: { readonly onFrame: (frame: FactFrame) => void; readonly cursor: () => number }): () => void;
|
|
23
47
|
}
|
|
24
48
|
|
|
49
|
+
/**
|
|
50
|
+
* 浏览器侧的事实通道:订阅、读版本、手动刷新,帧到了由它分发给订阅者。
|
|
51
|
+
*/
|
|
25
52
|
export interface FactChannel {
|
|
26
53
|
subscribe(fact: string, listener: () => void): () => void;
|
|
27
54
|
revisionOf(fact: string): number;
|
|
@@ -35,6 +62,11 @@ interface FactEntry {
|
|
|
35
62
|
readonly listeners: Set<() => void>;
|
|
36
63
|
}
|
|
37
64
|
|
|
65
|
+
/**
|
|
66
|
+
* 造一条事实通道:第一次订阅时才连传输层,最后一个订阅者走掉就断开。
|
|
67
|
+
* @param options 传输层,用来连宿主。
|
|
68
|
+
* @returns 通道句柄;没记录过的事实版本给 0,refresh() 不带事实名时刷新全部并逐个通知。
|
|
69
|
+
*/
|
|
38
70
|
export function createFactChannel(options: { readonly transport: FactTransport }): FactChannel {
|
|
39
71
|
const entries = new Map<string, FactEntry>();
|
|
40
72
|
let epoch: string | null = null;
|
|
@@ -146,6 +178,11 @@ export function createFactChannel(options: { readonly transport: FactTransport }
|
|
|
146
178
|
return channel;
|
|
147
179
|
}
|
|
148
180
|
|
|
181
|
+
/**
|
|
182
|
+
* 把传输层收到的原始数据读成一帧;坏数据当没收到。
|
|
183
|
+
* @param data 帧的原始数据,期望是 JSON 字符串。
|
|
184
|
+
* @returns 合法帧;不是字符串、JSON 坏了、或 rev 不是数字都给 null。
|
|
185
|
+
*/
|
|
149
186
|
export function parseFactFrame(data: unknown): FactFrame | null {
|
|
150
187
|
if (typeof data !== 'string') return null;
|
|
151
188
|
try {
|
|
@@ -161,6 +198,11 @@ export function parseFactFrame(data: unknown): FactFrame | null {
|
|
|
161
198
|
}
|
|
162
199
|
}
|
|
163
200
|
|
|
201
|
+
/**
|
|
202
|
+
* 读口路由到事实名的映射,当前一对一。
|
|
203
|
+
* @param route 读口路由。
|
|
204
|
+
* @returns 该路由对应的事实名(就是路由本身)。
|
|
205
|
+
*/
|
|
164
206
|
export function factOfRoute(route: string): string {
|
|
165
207
|
return route;
|
|
166
208
|
}
|