@dreanzy/dsh-skill-pack 0.1.0
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/README.en.md +75 -0
- package/README.md +91 -0
- package/client/client.js +2024 -0
- package/cordis.patch.yml +3 -0
- package/icon.svg +6 -0
- package/lib/effective.d.ts +46 -0
- package/lib/effective.js +39 -0
- package/lib/hooks.d.ts +32 -0
- package/lib/hooks.js +403 -0
- package/lib/index.d.ts +10 -0
- package/lib/index.js +109 -0
- package/lib/inventory.d.ts +54 -0
- package/lib/inventory.js +34 -0
- package/lib/policy.d.ts +85 -0
- package/lib/policy.js +386 -0
- package/lib/reconcile.d.ts +18 -0
- package/lib/reconcile.js +60 -0
- package/lib/routes.d.ts +102 -0
- package/lib/routes.js +511 -0
- package/lib/snapshot.d.ts +55 -0
- package/lib/snapshot.js +135 -0
- package/lib/store.d.ts +46 -0
- package/lib/store.js +434 -0
- package/lib/types.d.ts +120 -0
- package/lib/types.js +13 -0
- package/locale/en.json +47 -0
- package/locale/zh.json +47 -0
- package/package.json +79 -0
package/lib/types.d.ts
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 一张具名策略表:项级与组级两条决定。
|
|
3
|
+
*
|
|
4
|
+
* 只含覆盖决定、不含成员清单。键不存在即跟随下一层,`false` 是有效取值,
|
|
5
|
+
* 不是「跟随」——这与旧的 `LayerPolicy` 语义完全一致。
|
|
6
|
+
*/
|
|
7
|
+
export interface Pack {
|
|
8
|
+
readonly name: string;
|
|
9
|
+
readonly items: Readonly<Record<string, boolean>>;
|
|
10
|
+
readonly groups: Readonly<Record<string, boolean>>;
|
|
11
|
+
}
|
|
12
|
+
/** `packs.json` 里的 pack 名册。`default` 是内置项,永远存在。 */
|
|
13
|
+
export interface PackBook {
|
|
14
|
+
readonly packs: Readonly<Record<string, Pack>>;
|
|
15
|
+
}
|
|
16
|
+
/** 工作区绑定表。`bindings` 的键是 `normalizeCwd` 之后的 cwd。 */
|
|
17
|
+
export interface Bindings {
|
|
18
|
+
readonly bindings: Readonly<Record<string, string>>;
|
|
19
|
+
readonly extra: readonly string[];
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* 单机 UI 开关,落在 `packs.json` 的 `ui` 段。
|
|
23
|
+
*
|
|
24
|
+
* `defaultTab` 是「打开设置时默认显示」的那一页,与「当前正在看哪一页」是两件事:
|
|
25
|
+
* 临时切页不写盘,只有设置页顶部那组单选才改这个值。
|
|
26
|
+
*/
|
|
27
|
+
export interface UiState {
|
|
28
|
+
showOfficialSkills: boolean;
|
|
29
|
+
showChip: boolean;
|
|
30
|
+
defaultTab: SettingsTab;
|
|
31
|
+
}
|
|
32
|
+
/** 设置页的三页,顺序固定。 */
|
|
33
|
+
export type SettingsTab = 'groups' | 'packs' | 'workspace';
|
|
34
|
+
/** 分组身份。id 稳定,name 可改。 */
|
|
35
|
+
export interface GroupDef {
|
|
36
|
+
readonly id: string;
|
|
37
|
+
readonly name: string;
|
|
38
|
+
}
|
|
39
|
+
/** 组定义:跨工作区共享,不含任何开关决定。 */
|
|
40
|
+
export interface GroupRegistry {
|
|
41
|
+
readonly groups: readonly GroupDef[];
|
|
42
|
+
/** 能力项名 → 分组 id。没有条目的项即未分组。 */
|
|
43
|
+
readonly assignments: Readonly<Record<string, string>>;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* 一次策略变更的意图。
|
|
47
|
+
*
|
|
48
|
+
* `null` 一律表示「删掉这条键,回到跟随」,而不是「设成某个值」——
|
|
49
|
+
* 写同值不等于跟随(见 ADR 0001)。
|
|
50
|
+
*
|
|
51
|
+
* `bind` 的 `cwd` 由调用方给出并在此处规范化;`packId: null` 表示解除绑定。
|
|
52
|
+
*/
|
|
53
|
+
export type Command = {
|
|
54
|
+
readonly op: 'packItem';
|
|
55
|
+
readonly packId: string;
|
|
56
|
+
readonly name: string;
|
|
57
|
+
readonly value: boolean | null;
|
|
58
|
+
} | {
|
|
59
|
+
readonly op: 'packGroup';
|
|
60
|
+
readonly packId: string;
|
|
61
|
+
readonly groupId: string;
|
|
62
|
+
readonly value: boolean | null;
|
|
63
|
+
} | {
|
|
64
|
+
readonly op: 'createPack';
|
|
65
|
+
readonly name: string;
|
|
66
|
+
} | {
|
|
67
|
+
readonly op: 'renamePack';
|
|
68
|
+
readonly packId: string;
|
|
69
|
+
readonly name: string;
|
|
70
|
+
} | {
|
|
71
|
+
readonly op: 'deletePack';
|
|
72
|
+
readonly packId: string;
|
|
73
|
+
} | {
|
|
74
|
+
readonly op: 'bind';
|
|
75
|
+
readonly cwd: string;
|
|
76
|
+
readonly packId: string | null;
|
|
77
|
+
} | {
|
|
78
|
+
readonly op: 'addExtra';
|
|
79
|
+
readonly cwd: string;
|
|
80
|
+
} | {
|
|
81
|
+
readonly op: 'removeExtra';
|
|
82
|
+
readonly cwd: string;
|
|
83
|
+
} | {
|
|
84
|
+
readonly op: 'assign';
|
|
85
|
+
readonly name: string;
|
|
86
|
+
readonly groupId: string | null;
|
|
87
|
+
} | {
|
|
88
|
+
readonly op: 'createGroup';
|
|
89
|
+
readonly name: string;
|
|
90
|
+
} | {
|
|
91
|
+
readonly op: 'renameGroup';
|
|
92
|
+
readonly groupId: string;
|
|
93
|
+
readonly name: string;
|
|
94
|
+
} | {
|
|
95
|
+
readonly op: 'deleteGroup';
|
|
96
|
+
readonly groupId: string;
|
|
97
|
+
} | {
|
|
98
|
+
readonly op: 'showOfficialSkills';
|
|
99
|
+
readonly value: boolean;
|
|
100
|
+
} | {
|
|
101
|
+
readonly op: 'showChip';
|
|
102
|
+
readonly value: boolean;
|
|
103
|
+
} | {
|
|
104
|
+
readonly op: 'defaultTab';
|
|
105
|
+
readonly value: SettingsTab;
|
|
106
|
+
};
|
|
107
|
+
/** 解析结果:坏数据永不抛错,降级成空策略并附一条可读的说明。 */
|
|
108
|
+
export interface ParseResult<T> {
|
|
109
|
+
readonly value: T;
|
|
110
|
+
readonly warnings: readonly string[];
|
|
111
|
+
}
|
|
112
|
+
/** 内置 pack 的 id。它同时是求值链的终点,也是未绑定工作区的取值来源。 */
|
|
113
|
+
export declare const DEFAULT_PACK_ID = "default";
|
|
114
|
+
/** 内置 pack 的固定显示名:界面与落盘都只用这一个,旧名在读写两侧都会归一。 */
|
|
115
|
+
export declare const DEFAULT_PACK_NAME = "\u9ED8\u8BA4";
|
|
116
|
+
export declare const EMPTY_PACK: Pack;
|
|
117
|
+
export declare const EMPTY_PACK_BOOK: PackBook;
|
|
118
|
+
export declare const EMPTY_BINDINGS: Bindings;
|
|
119
|
+
export declare const EMPTY_UI: UiState;
|
|
120
|
+
export declare const EMPTY_GROUPS: GroupRegistry;
|
package/lib/types.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** 内置 pack 的 id。它同时是求值链的终点,也是未绑定工作区的取值来源。 */
|
|
2
|
+
export const DEFAULT_PACK_ID = 'default';
|
|
3
|
+
/** 内置 pack 的固定显示名:界面与落盘都只用这一个,旧名在读写两侧都会归一。 */
|
|
4
|
+
export const DEFAULT_PACK_NAME = '默认';
|
|
5
|
+
export const EMPTY_PACK = { name: DEFAULT_PACK_NAME, items: {}, groups: {} };
|
|
6
|
+
export const EMPTY_PACK_BOOK = { packs: { [DEFAULT_PACK_ID]: EMPTY_PACK } };
|
|
7
|
+
export const EMPTY_BINDINGS = { bindings: {}, extra: [] };
|
|
8
|
+
export const EMPTY_UI = {
|
|
9
|
+
showOfficialSkills: false,
|
|
10
|
+
showChip: true,
|
|
11
|
+
defaultTab: 'groups',
|
|
12
|
+
};
|
|
13
|
+
export const EMPTY_GROUPS = { groups: [], assignments: {} };
|
package/locale/en.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"meta": {
|
|
3
|
+
"title": "Skill Pack",
|
|
4
|
+
"description": "Control which skills the model may auto-invoke with packs: a workspace binds one pack, and unbound workspaces follow default."
|
|
5
|
+
},
|
|
6
|
+
"ui": {
|
|
7
|
+
"tabs": {
|
|
8
|
+
"groups": "Groups",
|
|
9
|
+
"packs": "Packs"
|
|
10
|
+
},
|
|
11
|
+
"packs": {
|
|
12
|
+
"title": "Packs",
|
|
13
|
+
"newPlaceholder": "New pack name",
|
|
14
|
+
"create": "Create pack",
|
|
15
|
+
"rename": "Rename pack",
|
|
16
|
+
"delete": "Delete pack",
|
|
17
|
+
"builtin": "Default",
|
|
18
|
+
"overrides": "{count} overrides",
|
|
19
|
+
"editing": "Editing"
|
|
20
|
+
},
|
|
21
|
+
"switches": {
|
|
22
|
+
"title": "Switches in this pack",
|
|
23
|
+
"on": "On",
|
|
24
|
+
"off": "Off",
|
|
25
|
+
"follow": "Follow",
|
|
26
|
+
"followOn": "Follow (on)",
|
|
27
|
+
"followOff": "Follow (off)",
|
|
28
|
+
"hint": "Each switch has three states: on, off and follow. Follow means this pack records no decision."
|
|
29
|
+
},
|
|
30
|
+
"workspaces": {
|
|
31
|
+
"title": "Workspace bindings",
|
|
32
|
+
"followDefault": "Follow default",
|
|
33
|
+
"addPlaceholder": "Add a path, e.g. D:/work/repo",
|
|
34
|
+
"add": "Add",
|
|
35
|
+
"fromSession": "From sessions",
|
|
36
|
+
"manual": "Added manually",
|
|
37
|
+
"remove": "Remove from the manual list"
|
|
38
|
+
},
|
|
39
|
+
"chip": {
|
|
40
|
+
"label": "Skills",
|
|
41
|
+
"unbound": "Default",
|
|
42
|
+
"goSettings": "Open settings",
|
|
43
|
+
"goSettingsHint": "Open settings switches the settings default tab to Packs; open the settings dialog itself from the sidebar gear.",
|
|
44
|
+
"close": "Close"
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
package/locale/zh.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"meta": {
|
|
3
|
+
"title": "Skill Pack",
|
|
4
|
+
"description": "用 pack 控制模型可以自动调用哪些 skill:工作区只绑一个 pack,未绑定按默认求值。"
|
|
5
|
+
},
|
|
6
|
+
"ui": {
|
|
7
|
+
"tabs": {
|
|
8
|
+
"groups": "分组",
|
|
9
|
+
"packs": "分包"
|
|
10
|
+
},
|
|
11
|
+
"packs": {
|
|
12
|
+
"title": "pack",
|
|
13
|
+
"newPlaceholder": "新 pack 名",
|
|
14
|
+
"create": "新建 pack",
|
|
15
|
+
"rename": "重命名 pack",
|
|
16
|
+
"delete": "删除 pack",
|
|
17
|
+
"builtin": "默认",
|
|
18
|
+
"overrides": "{count} 条覆盖",
|
|
19
|
+
"editing": "正在编辑"
|
|
20
|
+
},
|
|
21
|
+
"switches": {
|
|
22
|
+
"title": "包内开关",
|
|
23
|
+
"on": "开",
|
|
24
|
+
"off": "关",
|
|
25
|
+
"follow": "跟随",
|
|
26
|
+
"followOn": "跟随(开)",
|
|
27
|
+
"followOff": "跟随(关)",
|
|
28
|
+
"hint": "每个开关三态:开 / 关 / 跟随。「跟随」表示该 pack 不记录这条决定。"
|
|
29
|
+
},
|
|
30
|
+
"workspaces": {
|
|
31
|
+
"title": "工作区绑定",
|
|
32
|
+
"followDefault": "默认",
|
|
33
|
+
"addPlaceholder": "手动添加路径,例如 D:/work/repo",
|
|
34
|
+
"add": "添加",
|
|
35
|
+
"fromSession": "来自会话",
|
|
36
|
+
"manual": "手动添加",
|
|
37
|
+
"remove": "从手动清单移除"
|
|
38
|
+
},
|
|
39
|
+
"chip": {
|
|
40
|
+
"label": "Skills",
|
|
41
|
+
"unbound": "Default",
|
|
42
|
+
"goSettings": "去设置",
|
|
43
|
+
"goSettingsHint": "「去设置」会把设置页的默认分页切到「分包」;设置弹层本身请点侧栏的 ⚙ 打开。",
|
|
44
|
+
"close": "关闭"
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@dreanzy/dsh-skill-pack",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "按工作区控制 DSH skill 的可见性:工作区绑定一个 pack,pack 是具名的开关表。",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"dsh",
|
|
7
|
+
"dsh-plugin",
|
|
8
|
+
"skill",
|
|
9
|
+
"skill-manager",
|
|
10
|
+
"pack",
|
|
11
|
+
"workspace"
|
|
12
|
+
],
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"author": "dreanzy <dreanzy@outlook.com>",
|
|
15
|
+
"homepage": "https://github.com/dreanzy/dsh-plg/tree/main/packages/dsh-skill-pack#readme",
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "git+https://github.com/dreanzy/dsh-plg.git",
|
|
19
|
+
"directory": "packages/dsh-skill-pack"
|
|
20
|
+
},
|
|
21
|
+
"bugs": {
|
|
22
|
+
"url": "https://github.com/dreanzy/dsh-plg/issues"
|
|
23
|
+
},
|
|
24
|
+
"publishConfig": {
|
|
25
|
+
"access": "public"
|
|
26
|
+
},
|
|
27
|
+
"type": "module",
|
|
28
|
+
"main": "./lib/index.js",
|
|
29
|
+
"exports": {
|
|
30
|
+
".": {
|
|
31
|
+
"types": "./lib/index.d.ts",
|
|
32
|
+
"import": "./lib/index.js"
|
|
33
|
+
},
|
|
34
|
+
"./client": "./client/client.js",
|
|
35
|
+
"./locale/*.json": "./locale/*.json",
|
|
36
|
+
"./icon": "./icon.svg",
|
|
37
|
+
"./package.json": "./package.json"
|
|
38
|
+
},
|
|
39
|
+
"files": [
|
|
40
|
+
"lib",
|
|
41
|
+
"client",
|
|
42
|
+
"locale/*.json",
|
|
43
|
+
"icon.svg",
|
|
44
|
+
"cordis.patch.yml"
|
|
45
|
+
],
|
|
46
|
+
"sideEffects": false,
|
|
47
|
+
"engines": {
|
|
48
|
+
"node": ">=22"
|
|
49
|
+
},
|
|
50
|
+
"dsh": {
|
|
51
|
+
"bundle": {
|
|
52
|
+
"patch": "./cordis.patch.yml"
|
|
53
|
+
},
|
|
54
|
+
"client": {
|
|
55
|
+
"platform": "web",
|
|
56
|
+
"inject": [
|
|
57
|
+
"@deepseek-ai/dsh-client-connection",
|
|
58
|
+
"@deepseek-ai/dsh-client-ui-conversation",
|
|
59
|
+
"@deepseek-ai/dsh-client-ui-layout",
|
|
60
|
+
"@deepseek-ai/dsh-client-locale"
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
"scripts": {
|
|
65
|
+
"build": "tsc -p tsconfig.json",
|
|
66
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
67
|
+
"test": "tsc -p tsconfig.json && node --test --test-isolation=none test/",
|
|
68
|
+
"prepare": "tsc -p tsconfig.json",
|
|
69
|
+
"prepublishOnly": "tsc -p tsconfig.json && node --test --test-isolation=none test/"
|
|
70
|
+
},
|
|
71
|
+
"dependencies": {
|
|
72
|
+
"@deepseek-ai/dsh-atomic-write": "^0.2.0-rc.2 || ^0.2.1-0 || ^0.2.2-rc.0",
|
|
73
|
+
"@deepseek-ai/dsh-home-paths": "^0.2.0-rc.2 || ^0.2.1-0 || ^0.2.2-rc.0"
|
|
74
|
+
},
|
|
75
|
+
"devDependencies": {
|
|
76
|
+
"@types/node": "^22.0.0",
|
|
77
|
+
"typescript": "^5.0.0"
|
|
78
|
+
}
|
|
79
|
+
}
|