agentdev 0.1.9 → 0.2.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 (42) hide show
  1. package/dist/BasicAgent-7TNMYC3X.js +13 -0
  2. package/dist/ExplorerAgent-L3ZTVQGM.js +13 -0
  3. package/dist/{chunk-QFHPUAUQ.js → chunk-35LBACUK.js} +8 -8
  4. package/dist/{chunk-QFHPUAUQ.js.map → chunk-35LBACUK.js.map} +1 -1
  5. package/dist/{chunk-NORTAQIL.js → chunk-4WK7UENZ.js} +1011 -11
  6. package/dist/chunk-4WK7UENZ.js.map +1 -0
  7. package/dist/{chunk-BAP2GCYH.js → chunk-7GTVQ55R.js} +1 -1
  8. package/dist/chunk-7GTVQ55R.js.map +1 -0
  9. package/dist/{chunk-G5ECPY4K.js → chunk-EK6KGS2M.js} +87 -8
  10. package/dist/{chunk-G5ECPY4K.js.map → chunk-EK6KGS2M.js.map} +1 -1
  11. package/dist/{chunk-5T4C2XRT.js → chunk-KE3KYZVJ.js} +21 -8
  12. package/dist/chunk-KE3KYZVJ.js.map +1 -0
  13. package/dist/{chunk-EECW6PYP.js → chunk-UL2ZBPBL.js} +60 -4
  14. package/dist/chunk-UL2ZBPBL.js.map +1 -0
  15. package/dist/{chunk-A354ZCZF.js → chunk-XRB6MD2J.js} +5593 -982
  16. package/dist/chunk-XRB6MD2J.js.map +1 -0
  17. package/dist/cli/server.js +2 -2
  18. package/dist/cli/viewer.js +2 -2
  19. package/dist/create-feature-cli.js +26 -7
  20. package/dist/features/mcp/templates/mcp-tool.render.js +14 -1
  21. package/dist/features/mcp/templates/mcp-tool.render.js.map +1 -1
  22. package/dist/features/shell/templates/bash.render.d.ts +1 -1
  23. package/dist/features/websearch/templates/web-fetch.render.d.ts +1 -1
  24. package/dist/index.d.ts +778 -21
  25. package/dist/index.js +17 -7
  26. package/dist/index.js.map +1 -1
  27. package/dist/{notification-NWVOS2WR.js → notification-QPH37BHW.js} +29 -6
  28. package/dist/notification-QPH37BHW.js.map +1 -0
  29. package/dist/{tools-LDR3LIJP.js → tools-OKH7SPMP.js} +2 -2
  30. package/dist/{types-CF5UsxD9.d.ts → types-NVwNUVFR.d.ts} +180 -14
  31. package/package.json +7 -14
  32. package/dist/BasicAgent-UWXLSZP2.js +0 -13
  33. package/dist/ExplorerAgent-LCM3JQS4.js +0 -13
  34. package/dist/chunk-5T4C2XRT.js.map +0 -1
  35. package/dist/chunk-A354ZCZF.js.map +0 -1
  36. package/dist/chunk-BAP2GCYH.js.map +0 -1
  37. package/dist/chunk-EECW6PYP.js.map +0 -1
  38. package/dist/chunk-NORTAQIL.js.map +0 -1
  39. package/dist/notification-NWVOS2WR.js.map +0 -1
  40. /package/dist/{BasicAgent-UWXLSZP2.js.map → BasicAgent-7TNMYC3X.js.map} +0 -0
  41. /package/dist/{ExplorerAgent-LCM3JQS4.js.map → ExplorerAgent-L3ZTVQGM.js.map} +0 -0
  42. /package/dist/{tools-LDR3LIJP.js.map → tools-OKH7SPMP.js.map} +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/core/notification.ts"],"sourcesContent":["/**\n * Notification System - 核心通知系统\n *\n * 职责:\n * - 定义通知类型和分类\n * - 提供通知发送接口\n * - 管理通知上下文(当前 Agent ID)\n * - 节流高频通知\n */\n\nimport type { Notification, NotificationCategory, LLMPhase } from './types.js';\nimport { DebugHub } from './debug-hub.js';\n\n// ========== 模块级状态 ==========\n\n/**\n * 当前通知上下文的 Agent ID\n */\nlet currentAgentId: string | null = null;\n\n/**\n * 节流控制:上次发送通知的时间戳\n */\nlet lastNotificationTime: number = 0;\n\n/**\n * 节流间隔(毫秒)\n */\nconst THROTTLE_INTERVAL = 100;\n\n// ========== 公开 API ==========\n\n/**\n * 设置通知上下文\n * @param agentId Agent ID\n */\nexport function _setNotificationAgent(agentId: string): void {\n currentAgentId = agentId;\n}\n\n/**\n * 清除通知上下文\n */\nexport function _clearNotificationAgent(): void {\n currentAgentId = null;\n // 重置节流状态\n lastNotificationTime = 0;\n}\n\n/**\n * 获取当前通知上下文的 Agent ID\n */\nexport function _getCurrentNotificationAgent(): string | null {\n return currentAgentId;\n}\n\n/**\n * 发送通知到 DebugHub\n * @param notification 通知对象\n */\nexport function emitNotification(notification: Notification): void {\n if (!currentAgentId) {\n // 没有通知上下文,静默忽略\n return;\n }\n\n const now = Date.now();\n\n // 节流:状态类通知需要节流,事件类通知不需要\n if (notification.category === 'state') {\n const timeSinceLast = now - lastNotificationTime;\n if (timeSinceLast < THROTTLE_INTERVAL) {\n // 跳过此次通知\n return;\n }\n lastNotificationTime = now;\n }\n\n // 推送到 DebugHub\n const debugHub = DebugHub.getInstance();\n debugHub.pushNotification(currentAgentId, notification);\n}\n\n// ========== 通知构造函数 ==========\n\n/**\n * 创建 LLM 字符计数通知\n * @param charCount 当前累积字符数\n * @param phase LLM 生成阶段\n */\nexport function createLLMCharCount(\n charCount: number,\n phase: LLMPhase\n): Notification {\n return {\n type: 'llm.char_count',\n category: 'state',\n timestamp: Date.now(),\n data: {\n charCount,\n phase,\n },\n };\n}\n\n/**\n * 创建 LLM 完成通知\n * @param totalChars 总字符数\n */\nexport function createLLMComplete(totalChars: number): Notification {\n return {\n type: 'llm.complete',\n category: 'state',\n timestamp: Date.now(),\n data: {\n totalChars,\n },\n };\n}\n\n/**\n * 创建工具开始通知\n * @param toolName 工具名称\n */\nexport function createToolStart(toolName: string): Notification {\n return {\n type: 'tool.start',\n category: 'event',\n timestamp: Date.now(),\n data: {\n toolName,\n },\n };\n}\n\n/**\n * 创建工具完成通知\n * @param toolName 工具名称\n * @param success 是否成功\n * @param duration 耗时(毫秒)\n */\nexport function createToolComplete(\n toolName: string,\n success: boolean,\n duration: number\n): Notification {\n return {\n type: 'tool.complete',\n category: 'event',\n timestamp: Date.now(),\n data: {\n toolName,\n success,\n duration,\n },\n };\n}\n"],"mappings":";;;;;;;AAkBA,IAAI,iBAAgC;AAKpC,IAAI,uBAA+B;AAKnC,IAAM,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