@nodeskai/genehub-types 2026.3.2-9 → 2026.3.3-2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +51 -0
- package/dist/index.d.ts +167 -7
- package/dist/index.js +8 -1
- package/dist/index.js.map +1 -1
- package/package.json +9 -10
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 NoDeskAI
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# @nodeskai/genehub-types
|
|
2
|
+
|
|
3
|
+
GeneHub 共享类型定义与 Zod schemas,供 Registry、SDK、CLI 共用。
|
|
4
|
+
|
|
5
|
+
## 安装
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @nodeskai/genehub-types
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## 导出内容
|
|
12
|
+
|
|
13
|
+
### Zod Schemas
|
|
14
|
+
|
|
15
|
+
- `GeneManifestSchema` -- 基因 Manifest 完整校验
|
|
16
|
+
- `AuthorSchema` -- 作者信息
|
|
17
|
+
- `CompatibilityEntrySchema` -- 产品兼容性
|
|
18
|
+
- `SkillSchema` / `RuleSchema` / `McpServerSchema` -- 技能、规则、MCP 配置
|
|
19
|
+
|
|
20
|
+
### 枚举
|
|
21
|
+
|
|
22
|
+
- `GeneCategory` -- `development` | `data` | `operations` | `network` | `creative` | `communication` | `security` | `efficiency`
|
|
23
|
+
- `GeneTag` -- `ability` | `personality` | `knowledge` | `tool`
|
|
24
|
+
- `GeneSource` -- `official` | `clawhub` | `evomap` | `community` | `agent` | `github`
|
|
25
|
+
- `ReviewStatus` -- `draft` | `pending` | `approved` | `rejected` | `flagged`
|
|
26
|
+
- `ProductId` -- `openclaw` | `nanobot` | `deskclaw`
|
|
27
|
+
|
|
28
|
+
### 实体类型
|
|
29
|
+
|
|
30
|
+
- `Gene` / `GeneVersion` / `GeneManifest` -- 基因相关
|
|
31
|
+
- `Genome` / `GenomeVersion` -- 基因组相关
|
|
32
|
+
- `Author` -- 作者
|
|
33
|
+
|
|
34
|
+
### API 类型
|
|
35
|
+
|
|
36
|
+
- `GeneListParams` / `GenomeListParams` -- 列表查询参数
|
|
37
|
+
- `GeneUpdateInput` / `GenomeUpdateInput` -- 更新输入
|
|
38
|
+
- `FederatedSearchParams` / `FederatedSearchResult` -- 联邦搜索
|
|
39
|
+
- `ResolveResult` -- 依赖解析结果
|
|
40
|
+
|
|
41
|
+
### 适配器接口
|
|
42
|
+
|
|
43
|
+
- `GeneAdapter` -- 产品适配器标准接口(`install` / `uninstall` / `list` / `detect`)
|
|
44
|
+
|
|
45
|
+
## 开发
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
pnpm build # 构建
|
|
49
|
+
pnpm dev # 开发模式(watch)
|
|
50
|
+
pnpm test # 运行测试
|
|
51
|
+
```
|
package/dist/index.d.ts
CHANGED
|
@@ -781,23 +781,25 @@ interface GeneAdapter {
|
|
|
781
781
|
readonly product: string;
|
|
782
782
|
detect(): Promise<boolean>;
|
|
783
783
|
install(manifest: GeneManifest, options?: InstallOptions): Promise<InstallResult>;
|
|
784
|
+
/**
|
|
785
|
+
* Install a gene from an extracted directory containing all gene files.
|
|
786
|
+
* Used for multi-file genes downloaded as tarballs from the registry.
|
|
787
|
+
* Falls back to manifest-based install if not implemented.
|
|
788
|
+
*/
|
|
789
|
+
installFromDirectory?(geneDir: string, manifest: GeneManifest, options?: InstallOptions): Promise<InstallResult>;
|
|
784
790
|
uninstall(slug: string, options?: UninstallOptions): Promise<UninstallResult>;
|
|
785
791
|
list(): Promise<InstalledGene[]>;
|
|
786
792
|
isInstalled(slug: string): Promise<boolean>;
|
|
787
793
|
getInstalledVersion(slug: string): Promise<string | null>;
|
|
788
|
-
/**
|
|
789
|
-
* Notify the host that a skill was added/removed/updated.
|
|
790
|
-
* Implementations should invalidate caches and inject notifications
|
|
791
|
-
* so the agent sees the change immediately.
|
|
792
|
-
*/
|
|
793
794
|
notifySkillChange?(geneName: string, action: 'installed' | 'updated' | 'uninstalled'): Promise<void>;
|
|
795
|
+
triggerLearning?(prompt: string): Promise<void>;
|
|
794
796
|
}
|
|
795
797
|
|
|
796
798
|
declare const GeneCategory: z.ZodEnum<["development", "data", "operations", "network", "creative", "communication", "security", "efficiency"]>;
|
|
797
799
|
type GeneCategory = z.infer<typeof GeneCategory>;
|
|
798
800
|
declare const GeneTag: z.ZodEnum<["ability", "personality", "knowledge", "tool"]>;
|
|
799
801
|
type GeneTag = z.infer<typeof GeneTag>;
|
|
800
|
-
declare const GeneSource: z.ZodEnum<["official", "clawhub", "evomap", "community", "agent"]>;
|
|
802
|
+
declare const GeneSource: z.ZodEnum<["official", "clawhub", "evomap", "community", "agent", "github"]>;
|
|
801
803
|
type GeneSource = z.infer<typeof GeneSource>;
|
|
802
804
|
declare const ReviewStatus: z.ZodEnum<["draft", "pending", "approved", "rejected", "flagged"]>;
|
|
803
805
|
type ReviewStatus = z.infer<typeof ReviewStatus>;
|
|
@@ -838,11 +840,31 @@ type Gene = {
|
|
|
838
840
|
ai_score: number | null;
|
|
839
841
|
ai_verdict: string | null;
|
|
840
842
|
ai_enriched: boolean;
|
|
843
|
+
publisher_id: string | null;
|
|
841
844
|
is_published: boolean;
|
|
842
845
|
created_at: string;
|
|
843
846
|
updated_at: string;
|
|
844
847
|
deleted_at: string | null;
|
|
845
848
|
};
|
|
849
|
+
type Publisher = {
|
|
850
|
+
id: string;
|
|
851
|
+
github_id: number;
|
|
852
|
+
github_login: string;
|
|
853
|
+
github_name: string;
|
|
854
|
+
github_avatar_url: string;
|
|
855
|
+
github_profile_url: string;
|
|
856
|
+
created_at: string;
|
|
857
|
+
last_login_at: string;
|
|
858
|
+
};
|
|
859
|
+
type ApiKey = {
|
|
860
|
+
id: string;
|
|
861
|
+
publisher_id: string;
|
|
862
|
+
token_prefix: string;
|
|
863
|
+
name: string;
|
|
864
|
+
last_used_at: string | null;
|
|
865
|
+
created_at: string;
|
|
866
|
+
revoked_at: string | null;
|
|
867
|
+
};
|
|
846
868
|
type GenomeGeneRef = {
|
|
847
869
|
slug: string;
|
|
848
870
|
version: string;
|
|
@@ -863,6 +885,8 @@ type Genome = {
|
|
|
863
885
|
install_count: number;
|
|
864
886
|
avg_rating: number;
|
|
865
887
|
author: Author;
|
|
888
|
+
repository_url: string | null;
|
|
889
|
+
file_count: number;
|
|
866
890
|
is_published: boolean;
|
|
867
891
|
created_at: string;
|
|
868
892
|
updated_at: string;
|
|
@@ -873,6 +897,13 @@ type GenomeVersion = {
|
|
|
873
897
|
genome_id: string;
|
|
874
898
|
version: string;
|
|
875
899
|
genes: GenomeGeneRef[];
|
|
900
|
+
commit_sha: string | null;
|
|
901
|
+
git_tag: string | null;
|
|
902
|
+
files: {
|
|
903
|
+
path: string;
|
|
904
|
+
size: number;
|
|
905
|
+
sha: string;
|
|
906
|
+
}[] | null;
|
|
876
907
|
changelog: string;
|
|
877
908
|
is_latest: boolean;
|
|
878
909
|
published_at: string;
|
|
@@ -916,6 +947,53 @@ type GeneRelation = {
|
|
|
916
947
|
created_by: string;
|
|
917
948
|
created_at: string;
|
|
918
949
|
};
|
|
950
|
+
type AgentTemplateGeneRef = {
|
|
951
|
+
slug: string;
|
|
952
|
+
version: string;
|
|
953
|
+
};
|
|
954
|
+
type AgentTemplate = {
|
|
955
|
+
id: string;
|
|
956
|
+
name: string;
|
|
957
|
+
slug: string;
|
|
958
|
+
version: string;
|
|
959
|
+
description: string;
|
|
960
|
+
short_description: string;
|
|
961
|
+
role: string | null;
|
|
962
|
+
category: string;
|
|
963
|
+
tags: string[];
|
|
964
|
+
icon: string | null;
|
|
965
|
+
avatar_url: string | null;
|
|
966
|
+
genomes: AgentTemplateGeneRef[];
|
|
967
|
+
genes: AgentTemplateGeneRef[];
|
|
968
|
+
compatibility: string[];
|
|
969
|
+
install_count: number;
|
|
970
|
+
avg_rating: number;
|
|
971
|
+
author: Author;
|
|
972
|
+
publisher_id: string | null;
|
|
973
|
+
repository_url: string | null;
|
|
974
|
+
file_count: number;
|
|
975
|
+
is_published: boolean;
|
|
976
|
+
created_at: string;
|
|
977
|
+
updated_at: string;
|
|
978
|
+
deleted_at: string | null;
|
|
979
|
+
};
|
|
980
|
+
type AgentTemplateVersion = {
|
|
981
|
+
id: string;
|
|
982
|
+
template_id: string;
|
|
983
|
+
version: string;
|
|
984
|
+
genomes: AgentTemplateGeneRef[];
|
|
985
|
+
genes: AgentTemplateGeneRef[];
|
|
986
|
+
commit_sha: string | null;
|
|
987
|
+
git_tag: string | null;
|
|
988
|
+
files: {
|
|
989
|
+
path: string;
|
|
990
|
+
size: number;
|
|
991
|
+
sha: string;
|
|
992
|
+
}[] | null;
|
|
993
|
+
changelog: string;
|
|
994
|
+
is_latest: boolean;
|
|
995
|
+
published_at: string;
|
|
996
|
+
};
|
|
919
997
|
type GeneVersion = {
|
|
920
998
|
id: string;
|
|
921
999
|
gene_id: string;
|
|
@@ -988,6 +1066,7 @@ type CreateGenomeRequest = {
|
|
|
988
1066
|
id?: string;
|
|
989
1067
|
name: string;
|
|
990
1068
|
};
|
|
1069
|
+
files?: Record<string, string>;
|
|
991
1070
|
};
|
|
992
1071
|
type PublishGenomeVersionRequest = {
|
|
993
1072
|
version: string;
|
|
@@ -997,7 +1076,13 @@ type PublishGenomeVersionRequest = {
|
|
|
997
1076
|
config_override?: Record<string, unknown>;
|
|
998
1077
|
}[];
|
|
999
1078
|
changelog?: string;
|
|
1079
|
+
files?: Record<string, string>;
|
|
1000
1080
|
};
|
|
1081
|
+
type GenomeFileTreeResponse = ApiResponse<GeneFileEntry[]>;
|
|
1082
|
+
type GenomeFileContentResponse = ApiResponse<{
|
|
1083
|
+
path: string;
|
|
1084
|
+
content: string;
|
|
1085
|
+
}>;
|
|
1001
1086
|
type FederatedSearchParams = {
|
|
1002
1087
|
q: string;
|
|
1003
1088
|
category?: string;
|
|
@@ -1025,8 +1110,76 @@ type FederatedSearchResponse = ApiResponse<{
|
|
|
1025
1110
|
clawhub: number;
|
|
1026
1111
|
};
|
|
1027
1112
|
}>;
|
|
1113
|
+
type AgentTemplateListParams = {
|
|
1114
|
+
q?: string;
|
|
1115
|
+
category?: string;
|
|
1116
|
+
role?: string;
|
|
1117
|
+
sort?: 'newest' | 'popular' | 'rating';
|
|
1118
|
+
page?: number;
|
|
1119
|
+
page_size?: number;
|
|
1120
|
+
};
|
|
1121
|
+
type AgentTemplateListResponse = ApiResponse<PaginatedData<AgentTemplate>>;
|
|
1122
|
+
type AgentTemplateDetailResponse = ApiResponse<AgentTemplate>;
|
|
1123
|
+
type AgentTemplateVersionsResponse = ApiResponse<AgentTemplateVersion[]>;
|
|
1124
|
+
type CreateAgentTemplateRequest = {
|
|
1125
|
+
name: string;
|
|
1126
|
+
slug: string;
|
|
1127
|
+
version: string;
|
|
1128
|
+
description?: string;
|
|
1129
|
+
short_description?: string;
|
|
1130
|
+
role?: string;
|
|
1131
|
+
category?: string;
|
|
1132
|
+
tags?: string[];
|
|
1133
|
+
icon?: string;
|
|
1134
|
+
avatar_url?: string;
|
|
1135
|
+
genomes: {
|
|
1136
|
+
slug: string;
|
|
1137
|
+
version: string;
|
|
1138
|
+
}[];
|
|
1139
|
+
genes?: {
|
|
1140
|
+
slug: string;
|
|
1141
|
+
version: string;
|
|
1142
|
+
}[];
|
|
1143
|
+
compatibility?: string[];
|
|
1144
|
+
author?: {
|
|
1145
|
+
type: string;
|
|
1146
|
+
id?: string;
|
|
1147
|
+
name: string;
|
|
1148
|
+
};
|
|
1149
|
+
files?: Record<string, string>;
|
|
1150
|
+
};
|
|
1151
|
+
type PublishAgentTemplateVersionRequest = {
|
|
1152
|
+
version: string;
|
|
1153
|
+
genomes: {
|
|
1154
|
+
slug: string;
|
|
1155
|
+
version: string;
|
|
1156
|
+
}[];
|
|
1157
|
+
genes?: {
|
|
1158
|
+
slug: string;
|
|
1159
|
+
version: string;
|
|
1160
|
+
}[];
|
|
1161
|
+
changelog?: string;
|
|
1162
|
+
files?: Record<string, string>;
|
|
1163
|
+
};
|
|
1164
|
+
type AgentTemplateFileTreeResponse = ApiResponse<GeneFileEntry[]>;
|
|
1165
|
+
type AgentTemplateFileContentResponse = ApiResponse<{
|
|
1166
|
+
path: string;
|
|
1167
|
+
content: string;
|
|
1168
|
+
}>;
|
|
1169
|
+
type GeneFileEntry = {
|
|
1170
|
+
path: string;
|
|
1171
|
+
size: number;
|
|
1172
|
+
sha: string;
|
|
1173
|
+
type: 'file' | 'dir';
|
|
1174
|
+
};
|
|
1175
|
+
type GeneFileTreeResponse = ApiResponse<GeneFileEntry[]>;
|
|
1176
|
+
type GeneFileContentResponse = ApiResponse<{
|
|
1177
|
+
path: string;
|
|
1178
|
+
content: string;
|
|
1179
|
+
}>;
|
|
1028
1180
|
type CreateGeneRequest = {
|
|
1029
1181
|
manifest: Gene['manifest'];
|
|
1182
|
+
files?: Record<string, string>;
|
|
1030
1183
|
source?: string;
|
|
1031
1184
|
source_ref?: string;
|
|
1032
1185
|
};
|
|
@@ -1069,11 +1222,18 @@ declare const ERROR_CODES: {
|
|
|
1069
1222
|
readonly GENOME_VERSION_CONFLICT: 30003;
|
|
1070
1223
|
readonly GENOME_VALIDATION_FAILED: 30004;
|
|
1071
1224
|
readonly GENOME_VERSION_NOT_FOUND: 30005;
|
|
1225
|
+
readonly TEMPLATE_NOT_FOUND: 60001;
|
|
1226
|
+
readonly TEMPLATE_SLUG_EXISTS: 60002;
|
|
1227
|
+
readonly TEMPLATE_VERSION_CONFLICT: 60003;
|
|
1228
|
+
readonly TEMPLATE_VALIDATION_FAILED: 60004;
|
|
1229
|
+
readonly TEMPLATE_VERSION_NOT_FOUND: 60005;
|
|
1072
1230
|
readonly DEPENDENCY_RESOLVE_FAILED: 40001;
|
|
1073
1231
|
readonly COMPATIBILITY_MISMATCH: 40002;
|
|
1232
|
+
readonly GITEA_UNAVAILABLE: 50101;
|
|
1233
|
+
readonly GITEA_REPO_ERROR: 50102;
|
|
1074
1234
|
readonly LEARNING_TASK_TIMEOUT: 50001;
|
|
1075
1235
|
readonly LEARNING_CALLBACK_FAILED: 50002;
|
|
1076
1236
|
readonly INTERNAL_ERROR: 90001;
|
|
1077
1237
|
};
|
|
1078
1238
|
|
|
1079
|
-
export { type ApiErrorResponse, type ApiResponse, type Author, AuthorSchema, AuthorType, type CompatibilityEntry, CompatibilityEntrySchema, type CreateGeneRequest, type CreateGenomeRequest, type DependencyEntry, DependencyEntrySchema, ERROR_CODES, type EffectivenessReport, type FederatedGeneItem, type FederatedSearchParams, type FederatedSearchResponse, type Gene, type GeneAdapter, GeneCategory, type GeneConfig, GeneConfigSchema, type GeneDetailResponse, type GeneListParams, type GeneListResponse, type GeneManifest, type GeneManifestResponse, GeneManifestSchema, type GeneRelation, type GeneReview, GeneSource, GeneTag, type GeneVersion, type GeneVersionsResponse, type Genome, type GenomeDetailResponse, type GenomeGeneRef, type GenomeListParams, type GenomeListResponse, type GenomeResolveResponse, type GenomeResolveResult, type GenomeVersion, type GenomeVersionsResponse, type InstallOptions, type InstallResult, type InstalledGene, type Learning, LearningDecision, LearningMode, type LearningScenario, LearningScenarioSchema, LearningSchema, type McpServer, McpServerSchema, NanobotConfigSchema, OpenClawConfigSchema, type PaginatedData, ProductId, type PublishGenomeVersionRequest, type ResolveRequest, type ResolveResponse, type ResolvedGene, ReviewStatus, type Rule, RuleSchema, type Skill, SkillSchema, type UninstallOptions, type UninstallResult };
|
|
1239
|
+
export { type AgentTemplate, type AgentTemplateDetailResponse, type AgentTemplateFileContentResponse, type AgentTemplateFileTreeResponse, type AgentTemplateGeneRef, type AgentTemplateListParams, type AgentTemplateListResponse, type AgentTemplateVersion, type AgentTemplateVersionsResponse, type ApiErrorResponse, type ApiKey, type ApiResponse, type Author, AuthorSchema, AuthorType, type CompatibilityEntry, CompatibilityEntrySchema, type CreateAgentTemplateRequest, type CreateGeneRequest, type CreateGenomeRequest, type DependencyEntry, DependencyEntrySchema, ERROR_CODES, type EffectivenessReport, type FederatedGeneItem, type FederatedSearchParams, type FederatedSearchResponse, type Gene, type GeneAdapter, GeneCategory, type GeneConfig, GeneConfigSchema, type GeneDetailResponse, type GeneFileContentResponse, type GeneFileEntry, type GeneFileTreeResponse, type GeneListParams, type GeneListResponse, type GeneManifest, type GeneManifestResponse, GeneManifestSchema, type GeneRelation, type GeneReview, GeneSource, GeneTag, type GeneVersion, type GeneVersionsResponse, type Genome, type GenomeDetailResponse, type GenomeFileContentResponse, type GenomeFileTreeResponse, type GenomeGeneRef, type GenomeListParams, type GenomeListResponse, type GenomeResolveResponse, type GenomeResolveResult, type GenomeVersion, type GenomeVersionsResponse, type InstallOptions, type InstallResult, type InstalledGene, type Learning, LearningDecision, LearningMode, type LearningScenario, LearningScenarioSchema, LearningSchema, type McpServer, McpServerSchema, NanobotConfigSchema, OpenClawConfigSchema, type PaginatedData, ProductId, type PublishAgentTemplateVersionRequest, type PublishGenomeVersionRequest, type Publisher, type ResolveRequest, type ResolveResponse, type ResolvedGene, ReviewStatus, type Rule, RuleSchema, type Skill, SkillSchema, type UninstallOptions, type UninstallResult };
|
package/dist/index.js
CHANGED
|
@@ -13,8 +13,15 @@ var ERROR_CODES = {
|
|
|
13
13
|
GENOME_VERSION_CONFLICT: 30003,
|
|
14
14
|
GENOME_VALIDATION_FAILED: 30004,
|
|
15
15
|
GENOME_VERSION_NOT_FOUND: 30005,
|
|
16
|
+
TEMPLATE_NOT_FOUND: 60001,
|
|
17
|
+
TEMPLATE_SLUG_EXISTS: 60002,
|
|
18
|
+
TEMPLATE_VERSION_CONFLICT: 60003,
|
|
19
|
+
TEMPLATE_VALIDATION_FAILED: 60004,
|
|
20
|
+
TEMPLATE_VERSION_NOT_FOUND: 60005,
|
|
16
21
|
DEPENDENCY_RESOLVE_FAILED: 40001,
|
|
17
22
|
COMPATIBILITY_MISMATCH: 40002,
|
|
23
|
+
GITEA_UNAVAILABLE: 50101,
|
|
24
|
+
GITEA_REPO_ERROR: 50102,
|
|
18
25
|
LEARNING_TASK_TIMEOUT: 50001,
|
|
19
26
|
LEARNING_CALLBACK_FAILED: 50002,
|
|
20
27
|
INTERNAL_ERROR: 90001
|
|
@@ -33,7 +40,7 @@ var GeneCategory = z.enum([
|
|
|
33
40
|
"efficiency"
|
|
34
41
|
]);
|
|
35
42
|
var GeneTag = z.enum(["ability", "personality", "knowledge", "tool"]);
|
|
36
|
-
var GeneSource = z.enum(["official", "clawhub", "evomap", "community", "agent"]);
|
|
43
|
+
var GeneSource = z.enum(["official", "clawhub", "evomap", "community", "agent", "github"]);
|
|
37
44
|
var ReviewStatus = z.enum(["draft", "pending", "approved", "rejected", "flagged"]);
|
|
38
45
|
var ProductId = z.enum(["openclaw", "nanobot", "deskclaw", "generic"]);
|
|
39
46
|
var AuthorType = z.enum(["human", "agent"]);
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/api.ts","../src/enums.ts","../src/manifest.ts"],"sourcesContent":["import type { Gene, GeneVersion, Genome, GenomeResolveResult, GenomeVersion } from './gene.js';\n\nexport type ApiResponse<T = unknown> = {\n code: number;\n message: string;\n data: T;\n};\n\nexport type ApiErrorResponse = {\n code: number;\n error_code: string;\n message: string;\n data: null;\n};\n\nexport type PaginatedData<T> = {\n items: T[];\n total: number;\n page: number;\n page_size: number;\n total_pages: number;\n};\n\nexport type GeneListParams = {\n q?: string;\n category?: string;\n tags?: string[];\n compatibility?: string;\n sort?: 'newest' | 'popular' | 'rating';\n page?: number;\n page_size?: number;\n};\n\nexport type GeneListResponse = ApiResponse<PaginatedData<Gene>>;\nexport type GeneDetailResponse = ApiResponse<Gene>;\nexport type GeneManifestResponse = ApiResponse<Gene['manifest']>;\nexport type GeneVersionsResponse = ApiResponse<GeneVersion[]>;\nexport type GenomeListParams = {\n q?: string;\n category?: string;\n sort?: 'newest' | 'popular' | 'rating';\n page?: number;\n page_size?: number;\n};\n\nexport type GenomeListResponse = ApiResponse<PaginatedData<Genome>>;\nexport type GenomeDetailResponse = ApiResponse<Genome>;\nexport type GenomeVersionsResponse = ApiResponse<GenomeVersion[]>;\nexport type GenomeResolveResponse = ApiResponse<GenomeResolveResult>;\n\nexport type CreateGenomeRequest = {\n name: string;\n slug: string;\n version: string;\n description?: string;\n short_description?: string;\n category?: string;\n tags?: string[];\n icon?: string;\n genes: { slug: string; version: string; config_override?: Record<string, unknown> }[];\n compatibility?: string[];\n author?: { type: string; id?: string; name: string };\n};\n\nexport type PublishGenomeVersionRequest = {\n version: string;\n genes: { slug: string; version: string; config_override?: Record<string, unknown> }[];\n changelog?: string;\n};\n\nexport type FederatedSearchParams = {\n q: string;\n category?: string;\n limit?: number;\n};\n\nexport type FederatedGeneItem = {\n slug: string;\n name: string;\n description: string | null;\n version: string | null;\n category: string | null;\n tags: string[];\n source: 'local' | 'clawhub';\n score: number;\n install_count: number | null;\n avg_rating: number | null;\n clawhub_display_name?: string;\n};\n\nexport type FederatedSearchResponse = ApiResponse<{\n query: string;\n total: number;\n items: FederatedGeneItem[];\n sources: { local: number; clawhub: number };\n}>;\n\nexport type CreateGeneRequest = {\n manifest: Gene['manifest'];\n source?: string;\n source_ref?: string;\n};\n\nexport type ResolveRequest = {\n slug: string;\n version?: string;\n product?: string;\n};\n\nexport type ResolvedGene = {\n slug: string;\n version: string;\n manifest: unknown;\n optional: boolean;\n};\n\nexport type ResolveResponse = ApiResponse<{\n plan: ResolvedGene[];\n warnings: string[];\n}>;\n\nexport type EffectivenessReport = {\n gene_slug: string;\n gene_version: string;\n product: string;\n instance_id: string;\n metric_type: 'user_positive' | 'user_negative' | 'agent_self_eval' | 'task_success';\n value: number;\n context?: string;\n timestamp: string;\n};\n\nexport const ERROR_CODES = {\n TOKEN_INVALID: 10001,\n TOKEN_EXPIRED: 10002,\n PERMISSION_DENIED: 10003,\n GENE_NOT_FOUND: 20001,\n GENE_VERSION_CONFLICT: 20002,\n GENE_SLUG_EXISTS: 20003,\n GENE_MANIFEST_INVALID: 20004,\n GENE_VERSION_NOT_FOUND: 20005,\n GENOME_NOT_FOUND: 30001,\n GENOME_SLUG_EXISTS: 30002,\n GENOME_VERSION_CONFLICT: 30003,\n GENOME_VALIDATION_FAILED: 30004,\n GENOME_VERSION_NOT_FOUND: 30005,\n DEPENDENCY_RESOLVE_FAILED: 40001,\n COMPATIBILITY_MISMATCH: 40002,\n LEARNING_TASK_TIMEOUT: 50001,\n LEARNING_CALLBACK_FAILED: 50002,\n INTERNAL_ERROR: 90001,\n} as const;\n","import { z } from 'zod';\n\nexport const GeneCategory = z.enum([\n 'development',\n 'data',\n 'operations',\n 'network',\n 'creative',\n 'communication',\n 'security',\n 'efficiency',\n]);\nexport type GeneCategory = z.infer<typeof GeneCategory>;\n\nexport const GeneTag = z.enum(['ability', 'personality', 'knowledge', 'tool']);\nexport type GeneTag = z.infer<typeof GeneTag>;\n\nexport const GeneSource = z.enum(['official', 'clawhub', 'evomap', 'community', 'agent']);\nexport type GeneSource = z.infer<typeof GeneSource>;\n\nexport const ReviewStatus = z.enum(['draft', 'pending', 'approved', 'rejected', 'flagged']);\nexport type ReviewStatus = z.infer<typeof ReviewStatus>;\n\nexport const ProductId = z.enum(['openclaw', 'nanobot', 'deskclaw', 'generic']);\nexport type ProductId = z.infer<typeof ProductId>;\n\nexport const AuthorType = z.enum(['human', 'agent']);\nexport type AuthorType = z.infer<typeof AuthorType>;\n\nexport const LearningMode = z.enum(['learn', 'create', 'forget']);\nexport type LearningMode = z.infer<typeof LearningMode>;\n\nexport const LearningDecision = z.enum([\n 'direct_install',\n 'learned',\n 'failed',\n 'created',\n 'forgotten',\n 'simplified',\n 'forget_failed',\n]);\nexport type LearningDecision = z.infer<typeof LearningDecision>;\n","import { z } from 'zod';\nimport { AuthorType, GeneCategory, GeneTag, ProductId } from './enums.js';\n\nconst SLUG_REGEX = /^[a-z0-9][a-z0-9-]{1,62}[a-z0-9]$/;\nconst SEMVER_REGEX = /^\\d+\\.\\d+\\.\\d+(-[a-zA-Z0-9.]+)?$/;\n\nexport const AuthorSchema = z.object({\n type: AuthorType,\n name: z.string().max(128),\n ref: z.string().optional().default(''),\n});\nexport type Author = z.infer<typeof AuthorSchema>;\n\nexport const CompatibilityEntrySchema = z.object({\n product: ProductId,\n min_version: z.string().optional().default('0.0.0'),\n});\nexport type CompatibilityEntry = z.infer<typeof CompatibilityEntrySchema>;\n\nexport const DependencyEntrySchema = z.object({\n slug: z.string().regex(SLUG_REGEX),\n version: z.string(),\n optional: z.boolean().optional().default(false),\n});\nexport type DependencyEntry = z.infer<typeof DependencyEntrySchema>;\n\nexport const SkillSchema = z.object({\n name: z.string().min(1).max(128),\n always: z.boolean().optional().default(false),\n content: z.string().optional(),\n file: z.string().optional(),\n});\nexport type Skill = z.infer<typeof SkillSchema>;\n\nexport const RuleSchema = z.object({\n name: z.string().min(1).max(128),\n content: z.string(),\n applies_to: z.string().optional(),\n});\nexport type Rule = z.infer<typeof RuleSchema>;\n\nexport const OpenClawConfigSchema = z.object({\n openclaw_config: z.record(z.unknown()).optional(),\n tool_allow: z.array(z.string()).optional(),\n});\n\nexport const NanobotConfigSchema = z.object({\n capabilities: z.array(z.string()).optional(),\n requires: z\n .object({\n bins: z.array(z.string()).optional(),\n env: z.array(z.string()).optional(),\n })\n .optional(),\n always: z.boolean().optional(),\n os: z.array(z.string()).optional(),\n install: z\n .array(\n z.object({\n id: z.string(),\n kind: z.string(),\n formula: z.string().optional(),\n bins: z.array(z.string()).optional(),\n label: z.string().optional(),\n }),\n )\n .optional(),\n});\n\nexport const GeneConfigSchema = z.object({\n common: z.record(z.unknown()).optional(),\n openclaw: OpenClawConfigSchema.optional(),\n nanobot: NanobotConfigSchema.optional(),\n});\nexport type GeneConfig = z.infer<typeof GeneConfigSchema>;\n\nexport const McpServerSchema = z.object({\n name: z.string(),\n transport: z.enum(['stdio', 'http']).optional().default('stdio'),\n command: z.string().optional(),\n args: z.array(z.string()).optional(),\n env: z.record(z.string()).optional(),\n url: z.string().optional(),\n headers: z.record(z.string()).optional(),\n});\nexport type McpServer = z.infer<typeof McpServerSchema>;\n\nexport const LearningScenarioSchema = z.object({\n title: z.string(),\n context: z.string(),\n expected_focus: z.string(),\n});\nexport type LearningScenario = z.infer<typeof LearningScenarioSchema>;\n\nexport const LearningSchema = z.object({\n force_deep_learn: z.boolean().optional().default(false),\n objectives: z.array(z.string()).optional(),\n scenarios: z.array(LearningScenarioSchema).optional(),\n});\nexport type Learning = z.infer<typeof LearningSchema>;\n\nexport const GeneManifestSchema = z.object({\n slug: z.string().regex(SLUG_REGEX, 'slug 必须为 kebab-case,3-64 字符'),\n name: z.string().min(1).max(128),\n version: z.string().regex(SEMVER_REGEX, '版本号必须符合 SemVer'),\n description: z.string(),\n short_description: z.string().max(256),\n category: GeneCategory,\n tags: z.array(GeneTag).min(1),\n icon: z.string().max(64).optional(),\n author: AuthorSchema.optional(),\n\n compatibility: z.array(CompatibilityEntrySchema).min(1),\n\n dependencies: z.array(DependencyEntrySchema).optional().default([]),\n synergies: z.array(z.string()).optional().default([]),\n\n skill: SkillSchema,\n rules: z.array(RuleSchema).optional().default([]),\n config: GeneConfigSchema.optional(),\n mcp_servers: z.array(McpServerSchema).optional().default([]),\n learning: LearningSchema.optional(),\n});\nexport type GeneManifest = z.infer<typeof GeneManifestSchema>;\n"],"mappings":";AAoIO,IAAM,cAAc;AAAA,EACzB,eAAe;AAAA,EACf,eAAe;AAAA,EACf,mBAAmB;AAAA,EACnB,gBAAgB;AAAA,EAChB,uBAAuB;AAAA,EACvB,kBAAkB;AAAA,EAClB,uBAAuB;AAAA,EACvB,wBAAwB;AAAA,EACxB,kBAAkB;AAAA,EAClB,oBAAoB;AAAA,EACpB,yBAAyB;AAAA,EACzB,0BAA0B;AAAA,EAC1B,0BAA0B;AAAA,EAC1B,2BAA2B;AAAA,EAC3B,wBAAwB;AAAA,EACxB,uBAAuB;AAAA,EACvB,0BAA0B;AAAA,EAC1B,gBAAgB;AAClB;;;ACvJA,SAAS,SAAS;AAEX,IAAM,eAAe,EAAE,KAAK;AAAA,EACjC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAGM,IAAM,UAAU,EAAE,KAAK,CAAC,WAAW,eAAe,aAAa,MAAM,CAAC;AAGtE,IAAM,aAAa,EAAE,KAAK,CAAC,YAAY,WAAW,UAAU,aAAa,OAAO,CAAC;AAGjF,IAAM,eAAe,EAAE,KAAK,CAAC,SAAS,WAAW,YAAY,YAAY,SAAS,CAAC;AAGnF,IAAM,YAAY,EAAE,KAAK,CAAC,YAAY,WAAW,YAAY,SAAS,CAAC;AAGvE,IAAM,aAAa,EAA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,GAAE,MAAMA,GAAE,OAAO,CAAC,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;AAAA,EAEpD,OAAO;AAAA,EACP,OAAOA,GAAE,MAAM,UAAU,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;AAAA,EAChD,QAAQ,iBAAiB,SAAS;AAAA,EAClC,aAAaA,GAAE,MAAM,eAAe,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;AAAA,EAC3D,UAAU,eAAe,SAAS;AACpC,CAAC;","names":["z","z"]}
|
|
1
|
+
{"version":3,"sources":["../src/api.ts","../src/enums.ts","../src/manifest.ts"],"sourcesContent":["import type {\n AgentTemplate,\n AgentTemplateVersion,\n Gene,\n GeneVersion,\n Genome,\n GenomeResolveResult,\n GenomeVersion,\n} from './gene.js';\n\nexport type ApiResponse<T = unknown> = {\n code: number;\n message: string;\n data: T;\n};\n\nexport type ApiErrorResponse = {\n code: number;\n error_code: string;\n message: string;\n data: null;\n};\n\nexport type PaginatedData<T> = {\n items: T[];\n total: number;\n page: number;\n page_size: number;\n total_pages: number;\n};\n\nexport type GeneListParams = {\n q?: string;\n category?: string;\n tags?: string[];\n compatibility?: string;\n sort?: 'newest' | 'popular' | 'rating';\n page?: number;\n page_size?: number;\n};\n\nexport type GeneListResponse = ApiResponse<PaginatedData<Gene>>;\nexport type GeneDetailResponse = ApiResponse<Gene>;\nexport type GeneManifestResponse = ApiResponse<Gene['manifest']>;\nexport type GeneVersionsResponse = ApiResponse<GeneVersion[]>;\nexport type GenomeListParams = {\n q?: string;\n category?: string;\n sort?: 'newest' | 'popular' | 'rating';\n page?: number;\n page_size?: number;\n};\n\nexport type GenomeListResponse = ApiResponse<PaginatedData<Genome>>;\nexport type GenomeDetailResponse = ApiResponse<Genome>;\nexport type GenomeVersionsResponse = ApiResponse<GenomeVersion[]>;\nexport type GenomeResolveResponse = ApiResponse<GenomeResolveResult>;\n\nexport type CreateGenomeRequest = {\n name: string;\n slug: string;\n version: string;\n description?: string;\n short_description?: string;\n category?: string;\n tags?: string[];\n icon?: string;\n genes: { slug: string; version: string; config_override?: Record<string, unknown> }[];\n compatibility?: string[];\n author?: { type: string; id?: string; name: string };\n files?: Record<string, string>;\n};\n\nexport type PublishGenomeVersionRequest = {\n version: string;\n genes: { slug: string; version: string; config_override?: Record<string, unknown> }[];\n changelog?: string;\n files?: Record<string, string>;\n};\n\nexport type GenomeFileTreeResponse = ApiResponse<GeneFileEntry[]>;\nexport type GenomeFileContentResponse = ApiResponse<{ path: string; content: string }>;\n\nexport type FederatedSearchParams = {\n q: string;\n category?: string;\n limit?: number;\n};\n\nexport type FederatedGeneItem = {\n slug: string;\n name: string;\n description: string | null;\n version: string | null;\n category: string | null;\n tags: string[];\n source: 'local' | 'clawhub';\n score: number;\n install_count: number | null;\n avg_rating: number | null;\n clawhub_display_name?: string;\n};\n\nexport type FederatedSearchResponse = ApiResponse<{\n query: string;\n total: number;\n items: FederatedGeneItem[];\n sources: { local: number; clawhub: number };\n}>;\n\nexport type AgentTemplateListParams = {\n q?: string;\n category?: string;\n role?: string;\n sort?: 'newest' | 'popular' | 'rating';\n page?: number;\n page_size?: number;\n};\n\nexport type AgentTemplateListResponse = ApiResponse<PaginatedData<AgentTemplate>>;\nexport type AgentTemplateDetailResponse = ApiResponse<AgentTemplate>;\nexport type AgentTemplateVersionsResponse = ApiResponse<AgentTemplateVersion[]>;\n\nexport type CreateAgentTemplateRequest = {\n name: string;\n slug: string;\n version: string;\n description?: string;\n short_description?: string;\n role?: string;\n category?: string;\n tags?: string[];\n icon?: string;\n avatar_url?: string;\n genomes: { slug: string; version: string }[];\n genes?: { slug: string; version: string }[];\n compatibility?: string[];\n author?: { type: string; id?: string; name: string };\n files?: Record<string, string>;\n};\n\nexport type PublishAgentTemplateVersionRequest = {\n version: string;\n genomes: { slug: string; version: string }[];\n genes?: { slug: string; version: string }[];\n changelog?: string;\n files?: Record<string, string>;\n};\n\nexport type AgentTemplateFileTreeResponse = ApiResponse<GeneFileEntry[]>;\nexport type AgentTemplateFileContentResponse = ApiResponse<{ path: string; content: string }>;\n\nexport type GeneFileEntry = {\n path: string;\n size: number;\n sha: string;\n type: 'file' | 'dir';\n};\n\nexport type GeneFileTreeResponse = ApiResponse<GeneFileEntry[]>;\nexport type GeneFileContentResponse = ApiResponse<{ path: string; content: string }>;\n\nexport type CreateGeneRequest = {\n manifest: Gene['manifest'];\n files?: Record<string, string>;\n source?: string;\n source_ref?: string;\n};\n\nexport type ResolveRequest = {\n slug: string;\n version?: string;\n product?: string;\n};\n\nexport type ResolvedGene = {\n slug: string;\n version: string;\n manifest: unknown;\n optional: boolean;\n};\n\nexport type ResolveResponse = ApiResponse<{\n plan: ResolvedGene[];\n warnings: string[];\n}>;\n\nexport type EffectivenessReport = {\n gene_slug: string;\n gene_version: string;\n product: string;\n instance_id: string;\n metric_type: 'user_positive' | 'user_negative' | 'agent_self_eval' | 'task_success';\n value: number;\n context?: string;\n timestamp: string;\n};\n\nexport const ERROR_CODES = {\n TOKEN_INVALID: 10001,\n TOKEN_EXPIRED: 10002,\n PERMISSION_DENIED: 10003,\n GENE_NOT_FOUND: 20001,\n GENE_VERSION_CONFLICT: 20002,\n GENE_SLUG_EXISTS: 20003,\n GENE_MANIFEST_INVALID: 20004,\n GENE_VERSION_NOT_FOUND: 20005,\n GENOME_NOT_FOUND: 30001,\n GENOME_SLUG_EXISTS: 30002,\n GENOME_VERSION_CONFLICT: 30003,\n GENOME_VALIDATION_FAILED: 30004,\n GENOME_VERSION_NOT_FOUND: 30005,\n TEMPLATE_NOT_FOUND: 60001,\n TEMPLATE_SLUG_EXISTS: 60002,\n TEMPLATE_VERSION_CONFLICT: 60003,\n TEMPLATE_VALIDATION_FAILED: 60004,\n TEMPLATE_VERSION_NOT_FOUND: 60005,\n DEPENDENCY_RESOLVE_FAILED: 40001,\n COMPATIBILITY_MISMATCH: 40002,\n GITEA_UNAVAILABLE: 50101,\n GITEA_REPO_ERROR: 50102,\n LEARNING_TASK_TIMEOUT: 50001,\n LEARNING_CALLBACK_FAILED: 50002,\n INTERNAL_ERROR: 90001,\n} as const;\n","import { z } from 'zod';\n\nexport const GeneCategory = z.enum([\n 'development',\n 'data',\n 'operations',\n 'network',\n 'creative',\n 'communication',\n 'security',\n 'efficiency',\n]);\nexport type GeneCategory = z.infer<typeof GeneCategory>;\n\nexport const GeneTag = z.enum(['ability', 'personality', 'knowledge', 'tool']);\nexport type GeneTag = z.infer<typeof GeneTag>;\n\nexport const GeneSource = z.enum(['official', 'clawhub', 'evomap', 'community', 'agent', 'github']);\nexport type GeneSource = z.infer<typeof GeneSource>;\n\nexport const ReviewStatus = z.enum(['draft', 'pending', 'approved', 'rejected', 'flagged']);\nexport type ReviewStatus = z.infer<typeof ReviewStatus>;\n\nexport const ProductId = z.enum(['openclaw', 'nanobot', 'deskclaw', 'generic']);\nexport type ProductId = z.infer<typeof ProductId>;\n\nexport const AuthorType = z.enum(['human', 'agent']);\nexport type AuthorType = z.infer<typeof AuthorType>;\n\nexport const LearningMode = z.enum(['learn', 'create', 'forget']);\nexport type LearningMode = z.infer<typeof LearningMode>;\n\nexport const LearningDecision = z.enum([\n 'direct_install',\n 'learned',\n 'failed',\n 'created',\n 'forgotten',\n 'simplified',\n 'forget_failed',\n]);\nexport type LearningDecision = z.infer<typeof LearningDecision>;\n","import { z } from 'zod';\nimport { AuthorType, GeneCategory, GeneTag, ProductId } from './enums.js';\n\nconst SLUG_REGEX = /^[a-z0-9][a-z0-9-]{1,62}[a-z0-9]$/;\nconst SEMVER_REGEX = /^\\d+\\.\\d+\\.\\d+(-[a-zA-Z0-9.]+)?$/;\n\nexport const AuthorSchema = z.object({\n type: AuthorType,\n name: z.string().max(128),\n ref: z.string().optional().default(''),\n});\nexport type Author = z.infer<typeof AuthorSchema>;\n\nexport const CompatibilityEntrySchema = z.object({\n product: ProductId,\n min_version: z.string().optional().default('0.0.0'),\n});\nexport type CompatibilityEntry = z.infer<typeof CompatibilityEntrySchema>;\n\nexport const DependencyEntrySchema = z.object({\n slug: z.string().regex(SLUG_REGEX),\n version: z.string(),\n optional: z.boolean().optional().default(false),\n});\nexport type DependencyEntry = z.infer<typeof DependencyEntrySchema>;\n\nexport const SkillSchema = z.object({\n name: z.string().min(1).max(128),\n always: z.boolean().optional().default(false),\n content: z.string().optional(),\n file: z.string().optional(),\n});\nexport type Skill = z.infer<typeof SkillSchema>;\n\nexport const RuleSchema = z.object({\n name: z.string().min(1).max(128),\n content: z.string(),\n applies_to: z.string().optional(),\n});\nexport type Rule = z.infer<typeof RuleSchema>;\n\nexport const OpenClawConfigSchema = z.object({\n openclaw_config: z.record(z.unknown()).optional(),\n tool_allow: z.array(z.string()).optional(),\n});\n\nexport const NanobotConfigSchema = z.object({\n capabilities: z.array(z.string()).optional(),\n requires: z\n .object({\n bins: z.array(z.string()).optional(),\n env: z.array(z.string()).optional(),\n })\n .optional(),\n always: z.boolean().optional(),\n os: z.array(z.string()).optional(),\n install: z\n .array(\n z.object({\n id: z.string(),\n kind: z.string(),\n formula: z.string().optional(),\n bins: z.array(z.string()).optional(),\n label: z.string().optional(),\n }),\n )\n .optional(),\n});\n\nexport const GeneConfigSchema = z.object({\n common: z.record(z.unknown()).optional(),\n openclaw: OpenClawConfigSchema.optional(),\n nanobot: NanobotConfigSchema.optional(),\n});\nexport type GeneConfig = z.infer<typeof GeneConfigSchema>;\n\nexport const McpServerSchema = z.object({\n name: z.string(),\n transport: z.enum(['stdio', 'http']).optional().default('stdio'),\n command: z.string().optional(),\n args: z.array(z.string()).optional(),\n env: z.record(z.string()).optional(),\n url: z.string().optional(),\n headers: z.record(z.string()).optional(),\n});\nexport type McpServer = z.infer<typeof McpServerSchema>;\n\nexport const LearningScenarioSchema = z.object({\n title: z.string(),\n context: z.string(),\n expected_focus: z.string(),\n});\nexport type LearningScenario = z.infer<typeof LearningScenarioSchema>;\n\nexport const LearningSchema = z.object({\n force_deep_learn: z.boolean().optional().default(false),\n objectives: z.array(z.string()).optional(),\n scenarios: z.array(LearningScenarioSchema).optional(),\n});\nexport type Learning = z.infer<typeof LearningSchema>;\n\nexport const GeneManifestSchema = z.object({\n slug: z.string().regex(SLUG_REGEX, 'slug 必须为 kebab-case,3-64 字符'),\n name: z.string().min(1).max(128),\n version: z.string().regex(SEMVER_REGEX, '版本号必须符合 SemVer'),\n description: z.string(),\n short_description: z.string().max(256),\n category: GeneCategory,\n tags: z.array(GeneTag).min(1),\n icon: z.string().max(64).optional(),\n author: AuthorSchema.optional(),\n\n compatibility: z.array(CompatibilityEntrySchema).min(1),\n\n dependencies: z.array(DependencyEntrySchema).optional().default([]),\n synergies: z.array(z.string()).optional().default([]),\n\n skill: SkillSchema,\n rules: z.array(RuleSchema).optional().default([]),\n config: GeneConfigSchema.optional(),\n mcp_servers: z.array(McpServerSchema).optional().default([]),\n learning: LearningSchema.optional(),\n});\nexport type GeneManifest = z.infer<typeof GeneManifestSchema>;\n"],"mappings":";AAsMO,IAAM,cAAc;AAAA,EACzB,eAAe;AAAA,EACf,eAAe;AAAA,EACf,mBAAmB;AAAA,EACnB,gBAAgB;AAAA,EAChB,uBAAuB;AAAA,EACvB,kBAAkB;AAAA,EAClB,uBAAuB;AAAA,EACvB,wBAAwB;AAAA,EACxB,kBAAkB;AAAA,EAClB,oBAAoB;AAAA,EACpB,yBAAyB;AAAA,EACzB,0BAA0B;AAAA,EAC1B,0BAA0B;AAAA,EAC1B,oBAAoB;AAAA,EACpB,sBAAsB;AAAA,EACtB,2BAA2B;AAAA,EAC3B,4BAA4B;AAAA,EAC5B,4BAA4B;AAAA,EAC5B,2BAA2B;AAAA,EAC3B,wBAAwB;AAAA,EACxB,mBAAmB;AAAA,EACnB,kBAAkB;AAAA,EAClB,uBAAuB;AAAA,EACvB,0BAA0B;AAAA,EAC1B,gBAAgB;AAClB;;;AChOA,SAAS,SAAS;AAEX,IAAM,eAAe,EAAE,KAAK;AAAA,EACjC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAC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G;AAAA,EACrC,UAAU;AAAA,EACV,MAAMA,GAAE,MAAM,OAAO,EAAE,IAAI,CAAC;AAAA,EAC5B,MAAMA,GAAE,OAAO,EAAE,IAAI,EAAE,EAAE,SAAS;AAAA,EAClC,QAAQ,aAAa,SAAS;AAAA,EAE9B,eAAeA,GAAE,MAAM,wBAAwB,EAAE,IAAI,CAAC;AAAA,EAEtD,cAAcA,GAAE,MAAM,qBAAqB,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;AAAA,EAClE,WAAWA,GAAE,MAAMA,GAAE,OAAO,CAAC,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;AAAA,EAEpD,OAAO;AAAA,EACP,OAAOA,GAAE,MAAM,UAAU,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;AAAA,EAChD,QAAQ,iBAAiB,SAAS;AAAA,EAClC,aAAaA,GAAE,MAAM,eAAe,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;AAAA,EAC3D,UAAU,eAAe,SAAS;AACpC,CAAC;","names":["z","z"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nodeskai/genehub-types",
|
|
3
|
-
"version": "2026.3.2
|
|
3
|
+
"version": "2026.3.3-2",
|
|
4
4
|
"description": "GeneHub 共享类型定义与 Zod schemas",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -14,13 +14,6 @@
|
|
|
14
14
|
"files": [
|
|
15
15
|
"dist"
|
|
16
16
|
],
|
|
17
|
-
"scripts": {
|
|
18
|
-
"build": "tsup",
|
|
19
|
-
"dev": "tsup --watch",
|
|
20
|
-
"prepublishOnly": "pnpm build",
|
|
21
|
-
"test": "vitest run",
|
|
22
|
-
"test:watch": "vitest"
|
|
23
|
-
},
|
|
24
17
|
"dependencies": {
|
|
25
18
|
"zod": "^3.24"
|
|
26
19
|
},
|
|
@@ -43,5 +36,11 @@
|
|
|
43
36
|
"gene",
|
|
44
37
|
"types"
|
|
45
38
|
],
|
|
46
|
-
"license": "MIT"
|
|
47
|
-
|
|
39
|
+
"license": "MIT",
|
|
40
|
+
"scripts": {
|
|
41
|
+
"build": "tsup",
|
|
42
|
+
"dev": "tsup --watch",
|
|
43
|
+
"test": "vitest run",
|
|
44
|
+
"test:watch": "vitest"
|
|
45
|
+
}
|
|
46
|
+
}
|