@petercatai/whisker-client 5.0.0 → 6.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/api.d.ts +651 -204
  2. package/dist/api.js +100 -34
  3. package/package.json +4 -4
package/dist/api.js CHANGED
@@ -22,7 +22,14 @@ var __rest = (this && this.__rest) || function (s, e) {
22
22
  return t;
23
23
  };
24
24
  Object.defineProperty(exports, "__esModule", { value: true });
25
- exports.Api = exports.HttpClient = exports.ContentType = exports.IAction = exports.ICliApplyStatus = exports.ICliChangeOp = exports.IKnowledgeSourceEnum = exports.IKnowledgeTypeEnum = exports.ILanguage = exports.IMemoryStatusEnum = exports.IMemoryTypeEnum = exports.IOperator = exports.IPublicEndpointId = exports.IResource = exports.ISchedulerCronTimezone = exports.ISchedulerIntervalType = exports.ISchedulerJobStatus = exports.ISchedulerJobType = exports.ISchedulerRunResult = exports.ISchedulerTargetType = exports.ITagObjectType = exports.ITaskStatus = exports.ITextKnowledgeContentUpdateStatusEnum = exports.IWebhookDeliveryStatus = exports.IWebhookEventType = exports.IWebhookOutboxStatus = exports.IWebhookSubscriptionStatus = void 0;
25
+ exports.Api = exports.HttpClient = exports.ContentType = exports.IAction = exports.ICliApplyStatus = exports.ICliChangeOp = exports.IKnowledgeSourceEnum = exports.IKnowledgeTypeEnum = exports.ILanguage = exports.IMemoryCortexEnum = exports.IMemoryInputTypeEnum = exports.IMemoryStatusEnum = exports.IMemoryTypeEnum = exports.IOperator = exports.IPublicEndpointId = exports.IResource = exports.ISchedulerCronTimezone = exports.ISchedulerIntervalType = exports.ISchedulerJobStatus = exports.ISchedulerJobType = exports.ISchedulerRunResult = exports.ISchedulerTargetType = exports.ITagObjectType = exports.ITaskStatus = exports.ITextKnowledgeContentUpdateStatusEnum = exports.IWebhookDeliveryStatus = exports.IWebhookEventType = exports.IWebhookOutboxStatus = exports.IWebhookSubscriptionStatus = exports.IWohuSpaceRole = void 0;
26
+ /** WohuSpaceRole */
27
+ var IWohuSpaceRole;
28
+ (function (IWohuSpaceRole) {
29
+ IWohuSpaceRole["SPACE_MASTER"] = "SPACE_MASTER";
30
+ IWohuSpaceRole["SPACE_MEMBER"] = "SPACE_MEMBER";
31
+ IWohuSpaceRole["SPACE_GUEST"] = "SPACE_GUEST";
32
+ })(IWohuSpaceRole || (exports.IWohuSpaceRole = IWohuSpaceRole = {}));
26
33
  /**
27
34
  * WebhookSubscriptionStatus
28
35
  * Webhook订阅状态
@@ -55,6 +62,7 @@ var IWebhookEventType;
55
62
  IWebhookEventType["KnowledgeCreated"] = "knowledge.created";
56
63
  IWebhookEventType["KnowledgeUpdated"] = "knowledge.updated";
57
64
  IWebhookEventType["KnowledgeDeleted"] = "knowledge.deleted";
65
+ IWebhookEventType["TaskCompleted"] = "task.completed";
58
66
  IWebhookEventType["TaskHituPackageCompleted"] = "task.hitu_package.completed";
59
67
  IWebhookEventType["TaskHituPackageAnalyseCompleted"] = "task.hitu_package_analyse.completed";
60
68
  IWebhookEventType["TaskComponentRepoAnalyseCompleted"] = "task.component_repo_analyse.completed";
@@ -128,6 +136,7 @@ var ISchedulerRunResult;
128
136
  var ISchedulerJobType;
129
137
  (function (ISchedulerJobType) {
130
138
  ISchedulerJobType["KnowledgeRefresh"] = "knowledge_refresh";
139
+ ISchedulerJobType["MemoryConsolidation"] = "memory_consolidation";
131
140
  })(ISchedulerJobType || (exports.ISchedulerJobType = ISchedulerJobType = {}));
132
141
  /**
133
142
  * SchedulerJobStatus
@@ -198,13 +207,12 @@ var IOperator;
198
207
  })(IOperator || (exports.IOperator = IOperator = {}));
199
208
  /**
200
209
  * MemoryTypeEnum
201
- * Memory type enumeration
210
+ * Memory lifecycle type
202
211
  */
203
212
  var IMemoryTypeEnum;
204
213
  (function (IMemoryTypeEnum) {
205
214
  IMemoryTypeEnum["MemoryWorking"] = "memory_working";
206
215
  IMemoryTypeEnum["MemoryLongTerm"] = "memory_long_term";
207
- IMemoryTypeEnum["MemoryUser"] = "memory_user";
208
216
  })(IMemoryTypeEnum || (exports.IMemoryTypeEnum = IMemoryTypeEnum = {}));
209
217
  /**
210
218
  * MemoryStatusEnum
@@ -215,6 +223,28 @@ var IMemoryStatusEnum;
215
223
  IMemoryStatusEnum["Activated"] = "activated";
216
224
  IMemoryStatusEnum["Archived"] = "archived";
217
225
  })(IMemoryStatusEnum || (exports.IMemoryStatusEnum = IMemoryStatusEnum = {}));
226
+ /**
227
+ * MemoryInputTypeEnum
228
+ * Memory input type
229
+ */
230
+ var IMemoryInputTypeEnum;
231
+ (function (IMemoryInputTypeEnum) {
232
+ IMemoryInputTypeEnum["Direct"] = "direct";
233
+ IMemoryInputTypeEnum["Conversation"] = "conversation";
234
+ IMemoryInputTypeEnum["Consolidation"] = "consolidation";
235
+ })(IMemoryInputTypeEnum || (exports.IMemoryInputTypeEnum = IMemoryInputTypeEnum = {}));
236
+ /**
237
+ * MemoryCortexEnum
238
+ * Brain cortex region enum - maps to space_id
239
+ */
240
+ var IMemoryCortexEnum;
241
+ (function (IMemoryCortexEnum) {
242
+ IMemoryCortexEnum["MemHippocampus"] = "mem_hippocampus";
243
+ IMemoryCortexEnum["MemSemantic"] = "mem_semantic";
244
+ IMemoryCortexEnum["MemEpisodic"] = "mem_episodic";
245
+ IMemoryCortexEnum["MemPreference"] = "mem_preference";
246
+ IMemoryCortexEnum["MemProcedural"] = "mem_procedural";
247
+ })(IMemoryCortexEnum || (exports.IMemoryCortexEnum = IMemoryCortexEnum = {}));
218
248
  /**
219
249
  * Language
220
250
  * Enum of the programming languages.
@@ -230,6 +260,7 @@ var ILanguage;
230
260
  ILanguage["Php"] = "php";
231
261
  ILanguage["Proto"] = "proto";
232
262
  ILanguage["Python"] = "python";
263
+ ILanguage["R"] = "r";
233
264
  ILanguage["Rst"] = "rst";
234
265
  ILanguage["Ruby"] = "ruby";
235
266
  ILanguage["Rust"] = "rust";
@@ -302,7 +333,6 @@ var IKnowledgeTypeEnum;
302
333
  IKnowledgeTypeEnum["NodePackageElement"] = "node_package_element";
303
334
  IKnowledgeTypeEnum["MemoryWorking"] = "memory_working";
304
335
  IKnowledgeTypeEnum["MemoryLongTerm"] = "memory_long_term";
305
- IKnowledgeTypeEnum["MemoryUser"] = "memory_user";
306
336
  })(IKnowledgeTypeEnum || (exports.IKnowledgeTypeEnum = IKnowledgeTypeEnum = {}));
307
337
  /**
308
338
  * KnowledgeSourceEnum
@@ -526,6 +556,15 @@ class Api extends HttpClient {
526
556
  * @request POST:/api/knowledge/add
527
557
  */
528
558
  addKnowledge: (data, params = {}) => this.request(Object.assign({ path: `/api/knowledge/add`, method: "POST", body: data, type: ContentType.Json, format: "json" }, params)),
559
+ /**
560
+ * @description 通过文件信息批量添加知识(简化接口) 仅需提供文件基础信息(名称、扩展名、URL、MD5、大小),系统根据扩展名自动推导 knowledge_type、source_type、source_config、split_config 等配置。 - 扩展名可映射到已知类型(md/txt/json/image/docx/pdf/pptx 等):自动组装配置并创建处理任务 - 扩展名不可映射:以扩展名原值作为 knowledge_type 存储,不创建处理任务
561
+ *
562
+ * @tags knowledge
563
+ * @name AddKnowledgeByFile
564
+ * @summary Add Knowledge By File
565
+ * @request POST:/api/knowledge/add_by_file
566
+ */
567
+ addKnowledgeByFile: (data, params = {}) => this.request(Object.assign({ path: `/api/knowledge/add_by_file`, method: "POST", body: data, type: ContentType.Json, format: "json" }, params)),
529
568
  /**
530
569
  * @description 更新知识(全量更新) 更新知识的完整信息,支持以下字段变更: - 元数据(metadata)变更:同步更新对应 chunk 的 metadata - 启用状态(enabled)变更:同步更新对应 chunk 的启用状态 - 嵌入模型/分片配置/来源配置变更:自动触发重新入库任务 注意:knowledge_type、source_type 等核心字段不可变更。 Args: knowledge: 完整的知识对象,需包含 knowledge_id Returns: 更新后的知识对象(auth_info 字段已脱敏)
531
570
  *
@@ -861,7 +900,7 @@ class Api extends HttpClient {
861
900
  */
862
901
  checkTenantName: (data, params = {}) => this.request(Object.assign({ path: `/api/tenant/check-name`, method: "POST", body: data, type: ContentType.Json, format: "json" }, params)),
863
902
  /**
864
- * @description 创建租户 创建新租户并自动生成认证密钥(secret_key): - tenant_id 可自定义或由系统自动生成 - secret_key 由系统自动生成,仅在创建时返回一次 - 创建成功后根据 notify 参数决定是否发送通知邮件 - 如果 metadata.default_space_id 存在,则自动创建默认空间 Args: params.tenant_name: 租户名称,必须唯一 params.email: 联系邮箱,用于接收通知 params.metadata: 自定义元数据(可选),可包含 default_space_id params.notify: 是否发送邮件通知,默认 true params.default_spaces_config: 默认知识库配置(可选) params.tenant_id: 自定义租户ID(可选),支持字母、数字、下划线、中划线 Returns: 创建的租户信息,包含 secret_key(仅此一次) Raises: 400: 租户名称或ID已存在
903
+ * @description 创建租户 创建新租户并自动生成认证密钥(secret_key): - tenant_id 可自定义或由系统自动生成 - secret_key 由系统自动生成,仅在创建时返回一次 - 创建成功后根据 notify 参数决定是否发送通知邮件 - 如果 metadata.default_space_id 存在,则自动创建默认空间 Args: params.tenant_name: 租户名称,必须唯一 params.email: 联系邮箱,用于接收通知 params.metadata: 自定义元数据(可选),可包含 default_space_id params.notify: 是否发送邮件通知,默认 true params.default_spaces_config: 默认知识库配置(可选) params.tenant_id: 自定义租户ID(可选),支持字母、数字、下划线、中划线 Returns: 创建的租户信息,包含 secret_key(仅此一次) Raises: 400: 租户名称或ID已存在 403: 无权使用 personal_ 前缀的自定义租户ID
865
904
  *
866
905
  * @tags tenant
867
906
  * @name CreateTenant
@@ -1448,6 +1487,42 @@ class Api extends HttpClient {
1448
1487
  * @request POST:/api/admin/scheduler/manage
1449
1488
  */
1450
1489
  adminManageSchedulerByFilter: (data, params = {}) => this.request(Object.assign({ path: `/api/admin/scheduler/manage`, method: "POST", body: data, type: ContentType.Json, format: "json" }, params)),
1490
+ /**
1491
+ * @description 批量为指定前缀的租户绑定记忆巩固 scheduler job。 对每个匹配的活跃租户,使用 upsert 语义创建或更新 job_type=memory_consolidation / target_type=space / target_id=mem_hippocampus 的定时任务。
1492
+ *
1493
+ * @tags admin
1494
+ * @name AdminBindMemoryConsolidationJobs
1495
+ * @summary Admin Bind Memory Consolidation Jobs
1496
+ * @request POST:/api/admin/scheduler/bind-memory-consolidation
1497
+ */
1498
+ adminBindMemoryConsolidationJobs: (data, params = {}) => this.request(Object.assign({ path: `/api/admin/scheduler/bind-memory-consolidation`, method: "POST", body: data, type: ContentType.Json, format: "json" }, params)),
1499
+ /**
1500
+ * @description 管理员接口:校验 tenant 下 chunk 与 knowledge 的存在一致性。 使用 ES 聚合(composite terms)获取 distinct knowledge_id 集合; 以 DB 校验知识是否存在;对缺失 knowledge_id 对应 chunk 做物理删除。
1501
+ *
1502
+ * @tags admin
1503
+ * @name AdminCheckChunkKnowledgeConsistency
1504
+ * @summary Admin Check Chunk Knowledge Consistency
1505
+ * @request POST:/api/admin/chunk/knowledge-consistency/check
1506
+ */
1507
+ adminCheckChunkKnowledgeConsistency: (data, params = {}) => this.request(Object.assign({ path: `/api/admin/chunk/knowledge-consistency/check`, method: "POST", body: data, type: ContentType.Json, format: "json" }, params)),
1508
+ /**
1509
+ * @description 管理员接口:回填 AntCode 仓库知识的 source_config.branch(写入数据库)。 仅处理: - source_type = github_repo - source_config.url 包含 code.alipay.com - source_config.branch 为空 回填策略: - 优先调用 AntCode v3 project API 获取 default_branch - 失败/无 token 兜底写入 master(保证 webhook 严格匹配可用)
1510
+ *
1511
+ * @tags admin
1512
+ * @name AdminBackfillAntcodeKnowledgeBranch
1513
+ * @summary Admin Backfill Antcode Knowledge Branch
1514
+ * @request POST:/api/admin/knowledge-source/antcode/branch/backfill
1515
+ */
1516
+ adminBackfillAntcodeKnowledgeBranch: (data, params = {}) => this.request(Object.assign({ path: `/api/admin/knowledge-source/antcode/branch/backfill`, method: "POST", body: data, type: ContentType.Json, format: "json" }, params)),
1517
+ /**
1518
+ * @description 管理员接口:删除卧虎产品空间(space + space_user_role)。
1519
+ *
1520
+ * @tags admin
1521
+ * @name AdminDeleteWohuProductSpace
1522
+ * @summary Admin Delete Wohu Product Space
1523
+ * @request POST:/api/admin/wohu/product-space/delete
1524
+ */
1525
+ adminDeleteWohuProductSpace: (data, params = {}) => this.request(Object.assign({ path: `/api/admin/wohu/product-space/delete`, method: "POST", body: data, type: ContentType.Json, format: "json" }, params)),
1451
1526
  };
1452
1527
  this.llmTxt = {
1453
1528
  /**
@@ -1471,34 +1546,34 @@ class Api extends HttpClient {
1471
1546
  };
1472
1547
  this.memory = {
1473
1548
  /**
1474
- * @description Add a new memory Creates a new memory entry for the specified agent. Memory type is automatically classified if not specified. Working memories are subject to FIFO eviction when exceeding the limit. Args: body: MemoryCreate request with content and optional configuration Returns: Created memory object
1549
+ * @description Add a new working memory to hippocampus.
1475
1550
  *
1476
1551
  * @tags memory
1477
- * @name AddMemory
1478
- * @summary Add Memory
1479
- * @request POST:/api/memory/add
1552
+ * @name AddWorkingMemory
1553
+ * @summary Add Working Memory
1554
+ * @request POST:/api/memory/working
1480
1555
  */
1481
- addMemory: (data, params = {}) => this.request(Object.assign({ path: `/api/memory/add`, method: "POST", body: data, type: ContentType.Json, format: "json" }, params)),
1556
+ addWorkingMemory: (data, params = {}) => this.request(Object.assign({ path: `/api/memory/working`, method: "POST", body: data, type: ContentType.Json, format: "json" }, params)),
1482
1557
  /**
1483
- * @description Get a memory by ID Retrieves a single memory entry by its unique identifier. Args: memory_id: Unique identifier of the memory Returns: Memory object if found, None otherwise
1558
+ * @description Add a new long-term memory to a specific cortex region.
1484
1559
  *
1485
1560
  * @tags memory
1486
- * @name GetMemoryById
1487
- * @summary Get Memory By Id
1488
- * @request GET:/api/memory/{memory_id}
1561
+ * @name AddLongTermMemory
1562
+ * @summary Add Long Term Memory
1563
+ * @request POST:/api/memory/long-term
1489
1564
  */
1490
- getMemoryById: (memoryId, params = {}) => this.request(Object.assign({ path: `/api/memory/${memoryId}`, method: "GET", format: "json" }, params)),
1565
+ addLongTermMemory: (data, params = {}) => this.request(Object.assign({ path: `/api/memory/long-term`, method: "POST", body: data, type: ContentType.Json, format: "json" }, params)),
1491
1566
  /**
1492
- * @description Update a memory Updates an existing memory entry. Only provided fields will be updated. Args: memory_id: Unique identifier of the memory to update body: MemoryUpdate request with fields to update Returns: Updated memory object if found
1567
+ * @description Get a memory by ID.
1493
1568
  *
1494
1569
  * @tags memory
1495
- * @name UpdateMemory
1496
- * @summary Update Memory
1497
- * @request PUT:/api/memory/{memory_id}
1570
+ * @name GetMemoryById
1571
+ * @summary Get Memory By Id
1572
+ * @request GET:/api/memory/{memory_id}
1498
1573
  */
1499
- updateMemory: (memoryId, data, params = {}) => this.request(Object.assign({ path: `/api/memory/${memoryId}`, method: "PUT", body: data, type: ContentType.Json, format: "json" }, params)),
1574
+ getMemoryById: (memoryId, params = {}) => this.request(Object.assign({ path: `/api/memory/${memoryId}`, method: "GET", format: "json" }, params)),
1500
1575
  /**
1501
- * @description Delete a memory Permanently deletes a memory entry and its associated chunks. Args: memory_id: Unique identifier of the memory to delete Returns: True if deleted successfully, False if not found
1576
+ * @description Delete a memory.
1502
1577
  *
1503
1578
  * @tags memory
1504
1579
  * @name DeleteMemory
@@ -1507,7 +1582,7 @@ class Api extends HttpClient {
1507
1582
  */
1508
1583
  deleteMemory: (memoryId, params = {}) => this.request(Object.assign({ path: `/api/memory/${memoryId}`, method: "DELETE", format: "json" }, params)),
1509
1584
  /**
1510
- * @description Retrieve memories using semantic search Performs semantic search to retrieve relevant memories based on the query. Combines working memory (from database) and long-term memory (via vector search). Process: 1. Get working memories from database (if enabled) 2. Vector search for long-term memories 3. Deduplicate and merge results 4. Optional rerank 5. Return results with similarity scores Args: body: MemoryRetrievalRequest with query and configuration Returns: MemoryRetrievalResponse with retrieved memories and statistics
1585
+ * @description Retrieve memories using semantic search across cortex regions. Specify cortex_regions to limit search scope.
1511
1586
  *
1512
1587
  * @tags memory
1513
1588
  * @name RetrieveMemory
@@ -1516,7 +1591,7 @@ class Api extends HttpClient {
1516
1591
  */
1517
1592
  retrieveMemory: (data, params = {}) => this.request(Object.assign({ path: `/api/memory/retrieve`, method: "POST", body: data, type: ContentType.Json, format: "json" }, params)),
1518
1593
  /**
1519
- * @description Archive a memory (soft delete) Marks a memory as archived without permanently deleting it. Archived memories are not included in retrieval results. Args: memory_id: Unique identifier of the memory to archive Returns: Archived memory object if found
1594
+ * @description Archive a memory (soft delete).
1520
1595
  *
1521
1596
  * @tags memory
1522
1597
  * @name ArchiveMemory
@@ -1525,23 +1600,14 @@ class Api extends HttpClient {
1525
1600
  */
1526
1601
  archiveMemory: (memoryId, params = {}) => this.request(Object.assign({ path: `/api/memory/${memoryId}/archive`, method: "POST", format: "json" }, params)),
1527
1602
  /**
1528
- * @description Get memories for a specific agent Retrieves all memories associated with a specific agent ID. Args: agent_id: Agent ID to filter memories memory_type: Optional filter by memory type limit: Optional limit on number of results Returns: List of memories for the agent
1529
- *
1530
- * @tags memory
1531
- * @name GetMemoriesByAgent
1532
- * @summary Get Memories By Agent
1533
- * @request GET:/api/memory/agent/{agent_id}
1534
- */
1535
- getMemoriesByAgent: (agentId, query, params = {}) => this.request(Object.assign({ path: `/api/memory/agent/${agentId}`, method: "GET", query: query, format: "json" }, params)),
1536
- /**
1537
- * @description Trigger memory consolidation (Phase 2 placeholder) Reserved endpoint for Phase 2 memory consolidation feature. Currently returns a placeholder response. Args: agent_id: Optional agent ID to consolidate memories for Returns: Status message
1603
+ * @description Manually trigger memory consolidation for pending hippocampus memories.
1538
1604
  *
1539
1605
  * @tags memory
1540
1606
  * @name ConsolidateMemory
1541
1607
  * @summary Consolidate Memory
1542
1608
  * @request POST:/api/memory/consolidate
1543
1609
  */
1544
- consolidateMemory: (query, params = {}) => this.request(Object.assign({ path: `/api/memory/consolidate`, method: "POST", query: query, format: "json" }, params)),
1610
+ consolidateMemory: (params = {}) => this.request(Object.assign({ path: `/api/memory/consolidate`, method: "POST", format: "json" }, params)),
1545
1611
  };
1546
1612
  this.scheduler = {
1547
1613
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@petercatai/whisker-client",
3
- "version": "5.0.0",
3
+ "version": "6.0.1",
4
4
  "description": "Generated API client (Production)",
5
5
  "main": "dist/api.js",
6
6
  "types": "dist/api.d.ts",
@@ -16,8 +16,8 @@
16
16
  "tag": "latest"
17
17
  },
18
18
  "devDependencies": {
19
- "@types/node": "^25.5.0",
20
- "axios": "^1.13.6",
21
- "typescript": "^5.9.3"
19
+ "@types/node": "^25.5.2",
20
+ "axios": "^1.15.0",
21
+ "typescript": "^6.0.2"
22
22
  }
23
23
  }