@nodeskai/genehub-types 2026.3.2-11 → 2026.3.2-13

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 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/dist/index.d.ts CHANGED
@@ -797,7 +797,7 @@ declare const GeneCategory: z.ZodEnum<["development", "data", "operations", "net
797
797
  type GeneCategory = z.infer<typeof GeneCategory>;
798
798
  declare const GeneTag: z.ZodEnum<["ability", "personality", "knowledge", "tool"]>;
799
799
  type GeneTag = z.infer<typeof GeneTag>;
800
- declare const GeneSource: z.ZodEnum<["official", "clawhub", "evomap", "community", "agent"]>;
800
+ declare const GeneSource: z.ZodEnum<["official", "clawhub", "evomap", "community", "agent", "github"]>;
801
801
  type GeneSource = z.infer<typeof GeneSource>;
802
802
  declare const ReviewStatus: z.ZodEnum<["draft", "pending", "approved", "rejected", "flagged"]>;
803
803
  type ReviewStatus = z.infer<typeof ReviewStatus>;
@@ -838,11 +838,31 @@ type Gene = {
838
838
  ai_score: number | null;
839
839
  ai_verdict: string | null;
840
840
  ai_enriched: boolean;
841
+ publisher_id: string | null;
841
842
  is_published: boolean;
842
843
  created_at: string;
843
844
  updated_at: string;
844
845
  deleted_at: string | null;
845
846
  };
847
+ type Publisher = {
848
+ id: string;
849
+ github_id: number;
850
+ github_login: string;
851
+ github_name: string;
852
+ github_avatar_url: string;
853
+ github_profile_url: string;
854
+ created_at: string;
855
+ last_login_at: string;
856
+ };
857
+ type ApiKey = {
858
+ id: string;
859
+ publisher_id: string;
860
+ token_prefix: string;
861
+ name: string;
862
+ last_used_at: string | null;
863
+ created_at: string;
864
+ revoked_at: string | null;
865
+ };
846
866
  type GenomeGeneRef = {
847
867
  slug: string;
848
868
  version: string;
@@ -1076,4 +1096,4 @@ declare const ERROR_CODES: {
1076
1096
  readonly INTERNAL_ERROR: 90001;
1077
1097
  };
1078
1098
 
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 };
1099
+ export { type ApiErrorResponse, type ApiKey, 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 Publisher, type ResolveRequest, type ResolveResponse, type ResolvedGene, ReviewStatus, type Rule, RuleSchema, type Skill, SkillSchema, type UninstallOptions, type UninstallResult };
package/dist/index.js CHANGED
@@ -33,7 +33,7 @@ var GeneCategory = z.enum([
33
33
  "efficiency"
34
34
  ]);
35
35
  var GeneTag = z.enum(["ability", "personality", "knowledge", "tool"]);
36
- var GeneSource = z.enum(["official", "clawhub", "evomap", "community", "agent"]);
36
+ var GeneSource = z.enum(["official", "clawhub", "evomap", "community", "agent", "github"]);
37
37
  var ReviewStatus = z.enum(["draft", "pending", "approved", "rejected", "flagged"]);
38
38
  var ProductId = z.enum(["openclaw", "nanobot", "deskclaw", "generic"]);
39
39
  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,EAAE,KAAK,CAAC,SAAS,OAAO,CAAC;AAG5C,IAAM,eAAe,EAAE,KAAK,CAAC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;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 { 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', '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":";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,SAAS,QAAQ,CAAC;AAG3F,IAAM,eAAe,EAAE,KAAK,C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E,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-11",
3
+ "version": "2026.3.2-13",
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
+ }