@sinm/kai 1.16.1 → 1.16.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.
Files changed (20) hide show
  1. package/README.md +97 -198
  2. package/RELEASE_NOTES.md +31 -0
  3. package/dist-cli/kai-cli.js +1129 -573
  4. package/dist-electron/main/plugin-host.js +10 -2
  5. package/dist-electron/renderer/assets/{ContextDraftStrip-DyidtNKX.js → ContextDraftStrip-CWXg4hmU.js} +3 -3
  6. package/dist-electron/renderer/assets/{desktop-overlay-reason-DOOOru05.js → desktop-overlay-reason-cfmtdoP4.js} +34 -18
  7. package/dist-electron/renderer/assets/{index-Ds9SVVR0.js → index-BBL4bwnW.js} +2 -2
  8. package/dist-electron/renderer/assets/{index-rkJjipr_.js → index-CObwhkO8.js} +6744 -6411
  9. package/dist-electron/renderer/assets/{index-DMpSWjb2.css → index-DSggA-B_.css} +2479 -2112
  10. package/dist-electron/renderer/assets/{index-BFNKFjuv.js → index-PLhxSKC5.js} +33 -4
  11. package/dist-electron/renderer/assets/{localUrlCodec-BgpHB7et.js → localUrlCodec-Bg7FpeI8.js} +10 -2
  12. package/dist-electron/renderer/assets/{office-preview-Bi474exi.js → office-preview-CyqocXBw.js} +3 -3
  13. package/dist-electron/renderer/assets/{overlay-BO-1tkat.js → overlay-D8OF8lDc.js} +10 -10
  14. package/dist-electron/renderer/assets/{overlay-C9ghz5je.css → overlay-HLCSQ-UD.css} +29 -23
  15. package/dist-electron/renderer/assets/{parser-Dpx0j1yO.js → parser-qf1_X8VO.js} +1 -1
  16. package/dist-electron/renderer/assets/{spreadsheet-AxcoOBpQ.js → spreadsheet-kLECX3ut.js} +3 -3
  17. package/dist-electron/renderer/index.html +4 -4
  18. package/dist-electron/renderer/office-preview.html +2 -2
  19. package/dist-electron/renderer/overlay.html +4 -4
  20. package/package.json +1 -1
@@ -4651,7 +4651,7 @@ var init_office_preview_sheet_contract = __esm({
4651
4651
  });
4652
4652
 
4653
4653
  // src/main/domain/wire/ipc-events.ts
4654
- var IPC_SEND_USER_MESSAGE, IPC_STOP_RUN, IPC_DELEGATE_ABORT, IPC_DELEGATE_UPDATE_CONFIG, IPC_CREATE_NEW_SESSION, IPC_COMPACT_SESSION, IPC_CANCEL_COMPACT_SESSION, IPC_CANCEL_QUEUED_MESSAGES, IPC_GUIDE_QUEUED_MESSAGE, IPC_CANCEL_GUIDANCE, IPC_LIST_QUESTIONS, IPC_ANSWER_QUESTION, IPC_PRUNE_SESSION_TODO, IPC_REQUEST_SESSION_SNAPSHOT, IPC_SESSION_EVENT, IPC_REQUEST_BLOCK_SNAPSHOT, IPC_SESSION_EVENT_ENCODED, IPC_SESSION_APPLIED_SEQ, IPC_RESOURCE_CHANGED, IPC_CLONE_OBJECT, IPC_CLONE_PROGRESS, IPC_TASK_NOTIFICATION_NAVIGATE, IPC_TASK_NOTIFICATION_RENDERER_READY, IPC_TASK_NOTIFICATION_ACTIVE_SESSION, IPC_TASK_NOTIFICATION_TRACE, IPC_PLUGIN_HOST_START, IPC_PLUGIN_HOST_STATUS, IPC_PLUGIN_HOST_EVENT, IPC_SESSION_ON_PLUGIN_ACTIVATE, IPC_PLUGIN_LIST_VIEWS, IPC_PLUGIN_LIST_PREVIEWERS, IPC_PLUGIN_LIST_THREAD_STORE_PRESETS, IPC_PLUGIN_PAGE_OPEN, IPC_PLUGIN_PAGE_CLOSE, IPC_PLUGIN_PAGE_INVOKE, IPC_OVERLAY_STATE, IPC_OVERLAY_SET, IPC_OVERLAY_MOUSE_THROUGH, IPC_OVERLAY_MOVE_BY, IPC_PLUGIN_LIST_INSTALLED, IPC_PLUGIN_GET_THEME, IPC_PLUGIN_SET_ENABLED, IPC_PLUGIN_INSTALL, IPC_PLUGIN_UNINSTALL, IPC_PLUGIN_GET_SETTINGS, IPC_PLUGIN_SET_SETTINGS, IPC_PLUGIN_PICK_PATH, IPC_PLUGIN_SET_TOOL_GRANT, IPC_PLUGIN_GET_TOOL_GRANT_STATUS, IPC_PLUGIN_GET_TOOL_SCOPE, IPC_PLUGIN_GET_GRANT_SUBJECTS, IPC_PLUGIN_APPLY_GRANTS, IPC_PLUGIN_MARKET_LIST_SOURCES, IPC_PLUGIN_MARKET_SAVE_SOURCE, IPC_PLUGIN_MARKET_DELETE_SOURCE, IPC_PLUGIN_MARKET_PROBE_SOURCE, IPC_PLUGIN_MARKET_SEARCH, IPC_PLUGIN_MARKET_INSTALL, IPC_PLUGIN_MARKET_CHECK_UPDATES, IPC_PLUGIN_README_READ, IPC_PLUGIN_LIST_STATUS_ITEMS, IPC_PLUGIN_ON_STATUS_ITEMS, IPC_PLUGIN_INVOKE_STATUS_ITEM, IPC_PLUGIN_LIST_ACTIONS, IPC_PLUGIN_INVOKE_ACTION, IPC_TRANSLATION_GET_MODEL, IPC_TRANSLATION_TRANSLATE_TEXT, IPC_CONFIG_CHANGED, IPC_GET_SETTINGS, IPC_SAVE_SETTINGS, IPC_GET_QUICK_REPLIES, IPC_SAVE_QUICK_REPLIES, IPC_FETCH_MODELS, IPC_GET_USAGE_STATISTICS, IPC_USAGE_STATISTICS_GET_SESSION_USAGE, IPC_GET_USAGE_DATA_MANAGEMENT, IPC_CLEAR_USAGE_STATISTICS, IPC_GET_FREQUENT_PHRASES, IPC_SETTINGS_GET_DATA_DIR, IPC_SETTINGS_GET_THREAD_STORE_STATUS, IPC_SETTINGS_SAVE_THREAD_STORE_SECRET, IPC_SETTINGS_HAS_THREAD_STORE_SECRET, IPC_SETTINGS_SELECT_DATA_DIR, IPC_SETTINGS_CHANGE_DATA_DIR, IPC_SETTINGS_OPEN_DATA_DIR, IPC_SETTINGS_ON_MIGRATION_PROGRESS, IPC_SETTINGS_RESTART_APP, IPC_MIGRATION_EXPORT_PREVIEW, IPC_MIGRATION_EXPORT_START, IPC_MIGRATION_INSPECT, IPC_MIGRATION_APPLY, IPC_MIGRATION_CANCEL, IPC_MIGRATION_RESTART, IPC_MIGRATION_LAST_SUMMARY, IPC_MIGRATION_PROGRESS, IPC_MIGRATION_PENDING_INSPECT, IPC_MIGRATION_PENDING_CONTINUE, IPC_MIGRATION_PENDING_DISCARD, IPC_MIGRATION_PICK_TARGET, IPC_GET_MCP_SERVERS, IPC_SAVE_MCP_SERVERS, IPC_TEST_MCP_SERVER, IPC_RESTART_MCP_SERVER, IPC_MCP_ON_RESTART_REQUEST, IPC_MCP_DECIDE_RESTART, IPC_GET_SKILLS, IPC_GET_SKILL_LISTINGS, IPC_GET_SKILL, IPC_GET_SKILL_USAGE, IPC_TOGGLE_SKILL, IPC_UNINSTALL_SKILL, IPC_LIST_SKILL_SOURCES, IPC_SAVE_SKILL_SOURCE, IPC_DELETE_SKILL_SOURCE, IPC_TEST_SKILL_SOURCE, IPC_SEARCH_CATALOG_SKILLS, IPC_GET_CATALOG_SKILL_DETAIL, IPC_INSTALL_CATALOG_SKILL, IPC_CHECK_INSTALLED_SKILL_UPDATES, IPC_UPDATE_INSTALLED_SKILL, IPC_SLASH_COMMAND_LIST, IPC_CREATE_AGENT, IPC_GET_AGENT, IPC_GET_AGENT_CONFIG, IPC_AGENT_RUNTIME_GET_PERMISSION_SETTINGS, IPC_AGENT_RUNTIME_PREVIEW_PERMISSION_POLICY, IPC_AGENT_RUNTIME_UPDATE_PERMISSION_POLICY, IPC_AGENT_RUNTIME_READ_CONFIG_OPTIONS, IPC_AGENT_RUNTIME_INSPECT_SESSION_CHANNEL, IPC_AGENT_RUNTIME_RELEASE_SESSION_CHANNEL, IPC_LIST_AGENTS, IPC_UPDATE_AGENT, IPC_DELETE_AGENT, IPC_SET_AGENT_AVATAR, IPC_REMOVE_AGENT_AVATAR, IPC_OPTIMIZE_AGENT_DESCRIPTION, IPC_POLISH_MESSAGE_DRAFT, IPC_GET_AGENT_CHANNELS, IPC_UPDATE_AGENT_CHANNELS, IPC_SWITCH_CHANNEL, IPC_GET_SESSION, IPC_LIST_SESSIONS, IPC_LIST_RUNNING_SESSIONS, IPC_GET_OWNER_DIRECTORY, IPC_GET_SESSION_SIDEBAR_STATE, IPC_GET_SESSION_AGENTS, IPC_UPDATE_SESSION, IPC_LIST_DIRECT_SESSIONS, IPC_GET_DIRECT_SESSION, IPC_CREATE_DIRECT_SESSION, IPC_UPDATE_DIRECT_SESSION, IPC_DELETE_DIRECT_SESSION, IPC_ARCHIVE_DIRECT_SESSION, IPC_ENSURE_OPENABLE_DIRECT_SESSION, IPC_FORK_SESSION, IPC_CREATE_GROUP, IPC_GET_GROUP, IPC_LIST_GROUPS, IPC_UPDATE_GROUP, IPC_DELETE_GROUP, IPC_SET_GROUP_AVATAR, IPC_REMOVE_GROUP_AVATAR, IPC_GET_GROUP_MEMBERS, IPC_SAVE_GROUP_FILE, IPC_GET_GROUP_SETTINGS, IPC_GET_GROUP_MEMORY, IPC_GET_GROUP_MODEL_POLICY, IPC_UPDATE_GROUP_MODEL_POLICY, IPC_CLEAR_GROUP_MODEL_POLICY, IPC_GET_SESSION_MODEL_EFFECTIVE_SETTINGS, IPC_SET_SESSION_MODEL_OVERRIDE, IPC_GET_SESSION_MODEL_OVERRIDE, IPC_GET_GROUP_SKILL_NAMES, IPC_UPDATE_GROUP_SKILL_NAMES, IPC_GET_GROUP_MCP_SERVER_IDS, IPC_UPDATE_GROUP_MCP_SERVER_IDS, IPC_GET_GROUP_DISABLED_TOOLS, IPC_UPDATE_GROUP_DISABLED_TOOLS, IPC_GET_GROUP_DISABLED_SKILL_NAMES, IPC_UPDATE_GROUP_DISABLED_SKILL_NAMES, IPC_GET_AVAILABLE_TOOLS, IPC_LIST_GROUP_SESSIONS, IPC_GET_GROUP_SESSION, IPC_CREATE_GROUP_SESSION, IPC_UPDATE_GROUP_SESSION, IPC_DELETE_GROUP_SESSION, IPC_ARCHIVE_GROUP_SESSION, IPC_SESSION_ENSURE_OPENABLE, IPC_SESSION_PREVIEW_RETENTION, IPC_SESSION_EXECUTE_RETENTION, IPC_SESSION_RESTORE_AUTO_TITLE, IPC_GET_MESSAGES, IPC_GET_MESSAGE, IPC_SESSION_GET_RECENT_USER_MESSAGES, IPC_SESSION_SEARCH_MESSAGES, IPC_GET_SESSION_MESSAGE_PAGE_V1, IPC_GET_SESSION_MESSAGE_V1, IPC_GET_MESSAGE_BLOCKS_V1, IPC_GET_MESSAGE_BLOCK_CHUNK_V1, IPC_GET_MESSAGE_BLOCK_SUBTREES_V2, IPC_GET_SURFACE_VIEW, IPC_EXPORT_MESSAGE_BLOCKS, IPC_GOAL_GET_LATEST, IPC_GET_SAVED_MESSAGES, IPC_SAVE_MESSAGE, IPC_UNSAVE_MESSAGE, IPC_CREATE_LLM_CHANNEL, IPC_GET_LLM_CHANNEL, IPC_LIST_LLM_CHANNELS, IPC_UPDATE_LLM_CHANNEL, IPC_DELETE_LLM_CHANNEL, IPC_SET_DEFAULT_LLM_CHANNEL, IPC_GET_WORKSPACE_FILE, IPC_UPDATE_WORKSPACE_FILE, IPC_LIST_WORKSPACE_FILES, IPC_OPEN_WORKSPACE_DIR, IPC_OPEN_CHAT_DATA_DIR, IPC_EXPORT_SESSION_EVENT_LOG, IPC_GET_WORKSPACE_DIR, IPC_VSCODE_GET_AVAILABILITY, IPC_VSCODE_OPEN_PROJECT, IPC_GET_SEARCH_ENGINES, IPC_ADD_CUSTOM_ENGINE, IPC_UPDATE_CUSTOM_ENGINE, IPC_DELETE_CUSTOM_ENGINE, IPC_SET_DEFAULT_ENGINE, IPC_CREATE_CRON_JOB, IPC_GET_CRON_JOB, IPC_LIST_CRON_JOBS, IPC_UPDATE_CRON_JOB, IPC_DELETE_CRON_JOB, IPC_TOGGLE_CRON_JOB, IPC_LIST_CRON_JOB_EXECUTIONS, IPC_CRON_JOB_EXECUTION_EVENT, IPC_TRIGGER_MEMORY_UPDATE, IPC_GET_NIGHTLY_MEMORY_CONFIG, IPC_UPDATE_NIGHTLY_MEMORY_CONFIG, IPC_RUN_NIGHTLY_MEMORY_NOW, IPC_LIST_NIGHTLY_MEMORY_EXECUTIONS, IPC_GET_OWNER_NIGHTLY_MEMORY_CONFIG, IPC_UPDATE_OWNER_NIGHTLY_MEMORY_CONFIG, IPC_RUN_OWNER_NIGHTLY_MEMORY_NOW, IPC_LIST_OWNER_NIGHTLY_MEMORY_EXECUTIONS, IPC_MEMORY_GET_POLICY, IPC_MEMORY_SET_LOCKED, IPC_OPEN_EXTERNAL_URL, IPC_OPEN_LOCAL_PATH, IPC_SAVE_LOCAL_FILE_AS, IPC_READ_FILE_CONTENT, IPC_RESOLVE_LOCAL_PREVIEW_PATH, IPC_RESOLVE_INLINE_LOCAL_PATH, IPC_READ_DIR, IPC_SEARCH_PROJECT_FILES, IPC_SHOW_LOCAL_ITEM_IN_FOLDER, IPC_COPY_IMAGE_TO_CLIPBOARD, IPC_COPY_REMOTE_IMAGE_TO_CLIPBOARD, IPC_COPY_FILE_TO_CLIPBOARD, IPC_COPY_TEXT_TO_CLIPBOARD, IPC_URL_PREVIEW_OPEN, IPC_URL_PREVIEW_SET_BOUNDS, IPC_URL_PREVIEW_DESTROY, IPC_URL_PREVIEW_ON_ERROR, IPC_URL_PREVIEW_ON_NAVIGATED, IPC_URL_PREVIEW_ON_READY, IPC_URL_PREVIEW_PICK, IPC_URL_PREVIEW_ON_PICKED, IPC_URL_PREVIEW_ON_PICK_STATE, IPC_HTML_PREVIEW_CAPTURE, IPC_OFFICE_PREVIEW_OPEN, IPC_OFFICE_PREVIEW_SET_BOUNDS, IPC_OFFICE_PREVIEW_SET_VISIBLE, IPC_OFFICE_PREVIEW_DESTROY, IPC_OFFICE_PREVIEW_ON_STATE, IPC_OFFICE_PREVIEW_ON_SOURCE_CHANGED, IPC_UPLOAD_ATTACHMENT, IPC_ATTACHMENT_UPLOAD_FILE, IPC_CREATE_DIRECTORY_ATTACHMENT, IPC_OPEN_ATTACHMENT, IPC_MEMORY_UPDATE_PROGRESS, IPC_RECORDING_START, IPC_RECORDING_APPEND, IPC_RECORDING_FINALIZE, IPC_RECORDING_CANCEL, IPC_RECORDING_TRANSCRIBE, IPC_HEALTH_GET_ALL, IPC_HEALTH_GET, IPC_HEALTH_UPDATE, IPC_REMOTE_ACCESS_START, IPC_REMOTE_ACCESS_STOP, IPC_REMOTE_ACCESS_ROTATE, IPC_REMOTE_ACCESS_STATUS, IPC_REMOTE_ACCESS_DISCONNECT_CLIENT, IPC_A2A_STATUS, IPC_A2A_START, IPC_A2A_STOP, IPC_A2A_COPY_TOKEN, IPC_SESSION_SELECT_PROJECT_DIRECTORY, IPC_SESSION_LIST_RECENT_PROJECTS, IPC_SESSION_LIST_PINNED_PROJECTS, IPC_SESSION_ADD_PINNED_PROJECT, IPC_SESSION_REMOVE_PINNED_PROJECT, IPC_GET_APP_INFO, IPC_GET_AUDIO_RECORDING_CAPABILITIES, IPC_AUDIO_RECORDING_OPEN_SCREEN_RECORDING_SETTINGS, IPC_GET_RELEASE_NOTES, IPC_UPDATE_CHECK, IPC_UPDATE_VERSION_INFO, IPC_UPDATE_DOWNLOAD, IPC_UPDATE_INSTALL, IPC_UPDATE_STATUS, IPC_UPDATE_STATUS_EVENT, IPC_UPDATE_AVAILABLE_EVENT, IPC_UPDATE_PROGRESS_EVENT, IPC_UPDATE_DOWNLOADED_EVENT, IPC_UPDATE_ERROR_EVENT, IPC_GET_PINNED, IPC_TOGGLE_PIN, IPC_PIN_SESSION_TAB, IPC_UNPIN_SESSION_TAB, IPC_REORDER_SESSION_TABS, IPC_GET_PINNED_TAB_SESSION_IDS, IPC_PINNED_TABS_CHANGED, IPC_CHANNEL_LIST, IPC_CHANNEL_BIND, IPC_CHANNEL_UPDATE_TARGET, IPC_CHANNEL_UNBIND, IPC_CHANNEL_TEST, IPC_CHANNEL_RECONNECT, IPC_CHANNEL_STATUS, IPC_CHANNEL_ACTIVITY, IPC_CHANNEL_QRCODE, IPC_CHANNEL_QRCODE_POLL, IPC_CHANNEL_WECHAT_PERSONAL_QRCODE, IPC_CHANNEL_WECHAT_PERSONAL_QRCODE_POLL, IPC_CHANNEL_FEISHU_QRCODE, IPC_CHANNEL_FEISHU_QRCODE_POLL, IPC_CHANNEL_LIST_DELIVERY_REVIEWS, IPC_CHANNEL_CONFIRM_TERMINAL_DELIVERY, IPC_CHANNEL_RETRY_TERMINAL_DELIVERY, IPC_CHANNEL_GET_DELIVERY_RECOVERY, IPC_CHANNEL_CLEAR_DELIVERY_RECOVERY, IPC_CHANNEL_ABANDON_ARCHIVED_ROUTE, IPC_TELEMETRY_TRACK, IPC_TELEMETRY_FEEDBACK, IPC_TELEMETRY_SET_ENABLED, IPC_TELEMETRY_IS_ENABLED, IPC_PTY_CREATE, IPC_PTY_WRITE, IPC_PTY_READ, IPC_PTY_KILL, IPC_PTY_LIST, IPC_PTY_DATA, IPC_PTY_RESIZE, IPC_PTY_STATE, IPC_PTY_OWNERSHIP, IPC_SHELL_JOB_LIST, IPC_SHELL_JOB_KILL, IPC_SHELL_JOB_READ, IPC_SHELL_JOB_DISMISS_FINISHED, IPC_STORAGE_GET_OVERVIEW, IPC_STORAGE_GET_USAGE, IPC_STORAGE_CLEAN, IPC_STORAGE_GET_SESSION_REGISTRY_STATUS, IPC_AGENT_RUNTIME_PROBE_INSTALLATION, IPC_AGENT_RUNTIME_LIST_RUNTIMES, IPC_AGENT_RUNTIME_GET_DIAGNOSTICS, IPC_APP_OPEN_PANEL, IPC_EXTERNAL_APPROVAL_LIST, IPC_EXTERNAL_APPROVAL_DECIDE, IPC_EXTERNAL_APPROVAL_ACKNOWLEDGE, IPC_EXTERNAL_APPROVAL_ON_EVENT;
4654
+ var IPC_SEND_USER_MESSAGE, IPC_STOP_RUN, IPC_DELEGATE_ABORT, IPC_DELEGATE_UPDATE_CONFIG, IPC_CREATE_NEW_SESSION, IPC_COMPACT_SESSION, IPC_CANCEL_COMPACT_SESSION, IPC_CANCEL_QUEUED_MESSAGES, IPC_GUIDE_QUEUED_MESSAGE, IPC_CANCEL_GUIDANCE, IPC_LIST_QUESTIONS, IPC_ANSWER_QUESTION, IPC_PRUNE_SESSION_TODO, IPC_REQUEST_SESSION_SNAPSHOT, IPC_SESSION_EVENT, IPC_REQUEST_BLOCK_SNAPSHOT, IPC_SESSION_EVENT_ENCODED, IPC_SESSION_APPLIED_SEQ, IPC_RESOURCE_CHANGED, IPC_CLONE_OBJECT, IPC_CLONE_PROGRESS, IPC_TASK_NOTIFICATION_NAVIGATE, IPC_TASK_NOTIFICATION_RENDERER_READY, IPC_TASK_NOTIFICATION_ACTIVE_SESSION, IPC_TASK_NOTIFICATION_TRACE, IPC_TASK_UNREAD_REQUEST, IPC_TASK_UNREAD_CLEAR, IPC_TASK_UNREAD_CHANGED, IPC_PLUGIN_HOST_START, IPC_PLUGIN_HOST_STATUS, IPC_PLUGIN_HOST_EVENT, IPC_SESSION_ON_PLUGIN_ACTIVATE, IPC_PLUGIN_LIST_VIEWS, IPC_PLUGIN_LIST_PREVIEWERS, IPC_PLUGIN_LIST_THREAD_STORE_PRESETS, IPC_PLUGIN_PAGE_OPEN, IPC_PLUGIN_PAGE_CLOSE, IPC_PLUGIN_PAGE_INVOKE, IPC_OVERLAY_STATE, IPC_OVERLAY_SET, IPC_OVERLAY_MOUSE_THROUGH, IPC_OVERLAY_MOVE_BY, IPC_PLUGIN_LIST_INSTALLED, IPC_PLUGIN_GET_THEME, IPC_PLUGIN_SET_ENABLED, IPC_PLUGIN_INSTALL, IPC_PLUGIN_UNINSTALL, IPC_PLUGIN_GET_SETTINGS, IPC_PLUGIN_SET_SETTINGS, IPC_PLUGIN_PICK_PATH, IPC_PLUGIN_SET_TOOL_GRANT, IPC_PLUGIN_GET_TOOL_GRANT_STATUS, IPC_PLUGIN_GET_TOOL_SCOPE, IPC_PLUGIN_GET_GRANT_SUBJECTS, IPC_PLUGIN_APPLY_GRANTS, IPC_PLUGIN_MARKET_LIST_SOURCES, IPC_PLUGIN_MARKET_SAVE_SOURCE, IPC_PLUGIN_MARKET_DELETE_SOURCE, IPC_PLUGIN_MARKET_PROBE_SOURCE, IPC_PLUGIN_MARKET_SEARCH, IPC_PLUGIN_MARKET_INSTALL, IPC_PLUGIN_MARKET_CHECK_UPDATES, IPC_PLUGIN_README_READ, IPC_PLUGIN_LIST_STATUS_ITEMS, IPC_PLUGIN_ON_STATUS_ITEMS, IPC_PLUGIN_INVOKE_STATUS_ITEM, IPC_PLUGIN_LIST_ACTIONS, IPC_PLUGIN_INVOKE_ACTION, IPC_TRANSLATION_GET_MODEL, IPC_TRANSLATION_TRANSLATE_TEXT, IPC_CONFIG_CHANGED, IPC_GET_SETTINGS, IPC_SAVE_SETTINGS, IPC_GET_QUICK_REPLIES, IPC_SAVE_QUICK_REPLIES, IPC_FETCH_MODELS, IPC_GET_USAGE_STATISTICS, IPC_USAGE_STATISTICS_GET_SESSION_USAGE, IPC_GET_USAGE_DATA_MANAGEMENT, IPC_CLEAR_USAGE_STATISTICS, IPC_GET_FREQUENT_PHRASES, IPC_SETTINGS_GET_DATA_DIR, IPC_SETTINGS_GET_THREAD_STORE_STATUS, IPC_SETTINGS_SAVE_THREAD_STORE_SECRET, IPC_SETTINGS_HAS_THREAD_STORE_SECRET, IPC_SETTINGS_SELECT_DATA_DIR, IPC_SETTINGS_CHANGE_DATA_DIR, IPC_SETTINGS_OPEN_DATA_DIR, IPC_SETTINGS_ON_MIGRATION_PROGRESS, IPC_SETTINGS_RESTART_APP, IPC_MIGRATION_EXPORT_PREVIEW, IPC_MIGRATION_EXPORT_START, IPC_MIGRATION_INSPECT, IPC_MIGRATION_APPLY, IPC_MIGRATION_CANCEL, IPC_MIGRATION_RESTART, IPC_MIGRATION_LAST_SUMMARY, IPC_MIGRATION_PROGRESS, IPC_MIGRATION_PENDING_INSPECT, IPC_MIGRATION_PENDING_CONTINUE, IPC_MIGRATION_PENDING_DISCARD, IPC_MIGRATION_PICK_TARGET, IPC_GET_MCP_SERVERS, IPC_SAVE_MCP_SERVERS, IPC_TEST_MCP_SERVER, IPC_RESTART_MCP_SERVER, IPC_MCP_ON_RESTART_REQUEST, IPC_MCP_DECIDE_RESTART, IPC_GET_SKILLS, IPC_GET_SKILL_LISTINGS, IPC_GET_SKILL, IPC_GET_SKILL_USAGE, IPC_TOGGLE_SKILL, IPC_UNINSTALL_SKILL, IPC_LIST_SKILL_SOURCES, IPC_SAVE_SKILL_SOURCE, IPC_DELETE_SKILL_SOURCE, IPC_TEST_SKILL_SOURCE, IPC_SEARCH_CATALOG_SKILLS, IPC_GET_CATALOG_SKILL_DETAIL, IPC_INSTALL_CATALOG_SKILL, IPC_CHECK_INSTALLED_SKILL_UPDATES, IPC_UPDATE_INSTALLED_SKILL, IPC_SLASH_COMMAND_LIST, IPC_CREATE_AGENT, IPC_GET_AGENT, IPC_GET_AGENT_CONFIG, IPC_AGENT_RUNTIME_GET_PERMISSION_SETTINGS, IPC_AGENT_RUNTIME_PREVIEW_PERMISSION_POLICY, IPC_AGENT_RUNTIME_UPDATE_PERMISSION_POLICY, IPC_AGENT_RUNTIME_READ_CONFIG_OPTIONS, IPC_AGENT_RUNTIME_INSPECT_SESSION_CHANNEL, IPC_AGENT_RUNTIME_RELEASE_SESSION_CHANNEL, IPC_LIST_AGENTS, IPC_UPDATE_AGENT, IPC_DELETE_AGENT, IPC_SET_AGENT_AVATAR, IPC_REMOVE_AGENT_AVATAR, IPC_OPTIMIZE_AGENT_DESCRIPTION, IPC_POLISH_MESSAGE_DRAFT, IPC_GET_AGENT_CHANNELS, IPC_UPDATE_AGENT_CHANNELS, IPC_SWITCH_CHANNEL, IPC_GET_SESSION, IPC_LIST_SESSIONS, IPC_LIST_RUNNING_SESSIONS, IPC_GET_OWNER_DIRECTORY, IPC_GET_SESSION_SIDEBAR_STATE, IPC_GET_SESSION_AGENTS, IPC_UPDATE_SESSION, IPC_LIST_DIRECT_SESSIONS, IPC_GET_DIRECT_SESSION, IPC_CREATE_DIRECT_SESSION, IPC_UPDATE_DIRECT_SESSION, IPC_DELETE_DIRECT_SESSION, IPC_ARCHIVE_DIRECT_SESSION, IPC_ENSURE_OPENABLE_DIRECT_SESSION, IPC_FORK_SESSION, IPC_CREATE_GROUP, IPC_GET_GROUP, IPC_LIST_GROUPS, IPC_UPDATE_GROUP, IPC_DELETE_GROUP, IPC_SET_GROUP_AVATAR, IPC_REMOVE_GROUP_AVATAR, IPC_GET_GROUP_MEMBERS, IPC_SAVE_GROUP_FILE, IPC_GET_GROUP_SETTINGS, IPC_GET_GROUP_MEMORY, IPC_GET_GROUP_MODEL_POLICY, IPC_UPDATE_GROUP_MODEL_POLICY, IPC_CLEAR_GROUP_MODEL_POLICY, IPC_GET_SESSION_MODEL_EFFECTIVE_SETTINGS, IPC_SET_SESSION_MODEL_OVERRIDE, IPC_GET_SESSION_MODEL_OVERRIDE, IPC_GET_GROUP_SKILL_NAMES, IPC_UPDATE_GROUP_SKILL_NAMES, IPC_GET_GROUP_MCP_SERVER_IDS, IPC_UPDATE_GROUP_MCP_SERVER_IDS, IPC_GET_GROUP_DISABLED_TOOLS, IPC_UPDATE_GROUP_DISABLED_TOOLS, IPC_GET_GROUP_DISABLED_SKILL_NAMES, IPC_UPDATE_GROUP_DISABLED_SKILL_NAMES, IPC_GET_AVAILABLE_TOOLS, IPC_LIST_GROUP_SESSIONS, IPC_GET_GROUP_SESSION, IPC_CREATE_GROUP_SESSION, IPC_UPDATE_GROUP_SESSION, IPC_DELETE_GROUP_SESSION, IPC_ARCHIVE_GROUP_SESSION, IPC_SESSION_ENSURE_OPENABLE, IPC_SESSION_PREVIEW_RETENTION, IPC_SESSION_EXECUTE_RETENTION, IPC_SESSION_RESTORE_AUTO_TITLE, IPC_GET_MESSAGES, IPC_GET_MESSAGE, IPC_SESSION_GET_RECENT_USER_MESSAGES, IPC_SESSION_SEARCH_MESSAGES, IPC_GET_SESSION_MESSAGE_PAGE_V1, IPC_GET_SESSION_MESSAGE_V1, IPC_GET_MESSAGE_BLOCKS_V1, IPC_GET_MESSAGE_BLOCK_CHUNK_V1, IPC_GET_MESSAGE_BLOCK_SUBTREES_V2, IPC_GET_SURFACE_VIEW, IPC_EXPORT_MESSAGE_BLOCKS, IPC_GOAL_GET_LATEST, IPC_GET_SAVED_MESSAGES, IPC_SAVE_MESSAGE, IPC_UNSAVE_MESSAGE, IPC_CREATE_LLM_CHANNEL, IPC_GET_LLM_CHANNEL, IPC_LIST_LLM_CHANNELS, IPC_UPDATE_LLM_CHANNEL, IPC_DELETE_LLM_CHANNEL, IPC_SET_DEFAULT_LLM_CHANNEL, IPC_GET_WORKSPACE_FILE, IPC_UPDATE_WORKSPACE_FILE, IPC_LIST_WORKSPACE_FILES, IPC_OPEN_WORKSPACE_DIR, IPC_OPEN_CHAT_DATA_DIR, IPC_EXPORT_SESSION_EVENT_LOG, IPC_GET_WORKSPACE_DIR, IPC_VSCODE_GET_AVAILABILITY, IPC_VSCODE_OPEN_PROJECT, IPC_GET_SEARCH_ENGINES, IPC_ADD_CUSTOM_ENGINE, IPC_UPDATE_CUSTOM_ENGINE, IPC_DELETE_CUSTOM_ENGINE, IPC_SET_DEFAULT_ENGINE, IPC_CREATE_CRON_JOB, IPC_GET_CRON_JOB, IPC_LIST_CRON_JOBS, IPC_UPDATE_CRON_JOB, IPC_DELETE_CRON_JOB, IPC_TOGGLE_CRON_JOB, IPC_LIST_CRON_JOB_EXECUTIONS, IPC_CRON_JOB_EXECUTION_EVENT, IPC_TRIGGER_MEMORY_UPDATE, IPC_GET_NIGHTLY_MEMORY_CONFIG, IPC_UPDATE_NIGHTLY_MEMORY_CONFIG, IPC_RUN_NIGHTLY_MEMORY_NOW, IPC_LIST_NIGHTLY_MEMORY_EXECUTIONS, IPC_GET_OWNER_NIGHTLY_MEMORY_CONFIG, IPC_UPDATE_OWNER_NIGHTLY_MEMORY_CONFIG, IPC_RUN_OWNER_NIGHTLY_MEMORY_NOW, IPC_LIST_OWNER_NIGHTLY_MEMORY_EXECUTIONS, IPC_MEMORY_GET_POLICY, IPC_MEMORY_SET_LOCKED, IPC_OPEN_EXTERNAL_URL, IPC_OPEN_LOCAL_PATH, IPC_SAVE_LOCAL_FILE_AS, IPC_READ_FILE_CONTENT, IPC_RESOLVE_LOCAL_PREVIEW_PATH, IPC_RESOLVE_INLINE_LOCAL_PATH, IPC_READ_DIR, IPC_SEARCH_PROJECT_FILES, IPC_SHOW_LOCAL_ITEM_IN_FOLDER, IPC_COPY_IMAGE_TO_CLIPBOARD, IPC_COPY_REMOTE_IMAGE_TO_CLIPBOARD, IPC_COPY_FILE_TO_CLIPBOARD, IPC_COPY_TEXT_TO_CLIPBOARD, IPC_URL_PREVIEW_OPEN, IPC_URL_PREVIEW_SET_BOUNDS, IPC_URL_PREVIEW_DESTROY, IPC_URL_PREVIEW_ON_ERROR, IPC_URL_PREVIEW_ON_NAVIGATED, IPC_URL_PREVIEW_ON_READY, IPC_URL_PREVIEW_PICK, IPC_URL_PREVIEW_ON_PICKED, IPC_URL_PREVIEW_ON_PICK_STATE, IPC_HTML_PREVIEW_CAPTURE, IPC_OFFICE_PREVIEW_OPEN, IPC_OFFICE_PREVIEW_SET_BOUNDS, IPC_OFFICE_PREVIEW_SET_VISIBLE, IPC_OFFICE_PREVIEW_DESTROY, IPC_OFFICE_PREVIEW_ON_STATE, IPC_OFFICE_PREVIEW_ON_SOURCE_CHANGED, IPC_UPLOAD_ATTACHMENT, IPC_ATTACHMENT_UPLOAD_FILE, IPC_CREATE_DIRECTORY_ATTACHMENT, IPC_OPEN_ATTACHMENT, IPC_MEMORY_UPDATE_PROGRESS, IPC_RECORDING_START, IPC_RECORDING_APPEND, IPC_RECORDING_FINALIZE, IPC_RECORDING_CANCEL, IPC_RECORDING_TRANSCRIBE, IPC_HEALTH_GET_ALL, IPC_HEALTH_GET, IPC_HEALTH_UPDATE, IPC_REMOTE_ACCESS_START, IPC_REMOTE_ACCESS_STOP, IPC_REMOTE_ACCESS_ROTATE, IPC_REMOTE_ACCESS_STATUS, IPC_REMOTE_ACCESS_DISCONNECT_CLIENT, IPC_A2A_STATUS, IPC_A2A_START, IPC_A2A_STOP, IPC_A2A_COPY_TOKEN, IPC_SESSION_SELECT_PROJECT_DIRECTORY, IPC_SESSION_LIST_RECENT_PROJECTS, IPC_SESSION_LIST_PINNED_PROJECTS, IPC_SESSION_ADD_PINNED_PROJECT, IPC_SESSION_REMOVE_PINNED_PROJECT, IPC_GET_APP_INFO, IPC_GET_AUDIO_RECORDING_CAPABILITIES, IPC_AUDIO_RECORDING_OPEN_SCREEN_RECORDING_SETTINGS, IPC_GET_RELEASE_NOTES, IPC_UPDATE_CHECK, IPC_UPDATE_VERSION_INFO, IPC_UPDATE_DOWNLOAD, IPC_UPDATE_INSTALL, IPC_UPDATE_STATUS, IPC_UPDATE_STATUS_EVENT, IPC_UPDATE_AVAILABLE_EVENT, IPC_UPDATE_PROGRESS_EVENT, IPC_UPDATE_DOWNLOADED_EVENT, IPC_UPDATE_ERROR_EVENT, IPC_GET_PINNED, IPC_TOGGLE_PIN, IPC_PIN_SESSION_TAB, IPC_UNPIN_SESSION_TAB, IPC_REORDER_SESSION_TABS, IPC_GET_PINNED_TAB_SESSION_IDS, IPC_PINNED_TABS_CHANGED, IPC_CHANNEL_LIST, IPC_CHANNEL_BIND, IPC_CHANNEL_UPDATE_TARGET, IPC_CHANNEL_UNBIND, IPC_CHANNEL_TEST, IPC_CHANNEL_RECONNECT, IPC_CHANNEL_STATUS, IPC_CHANNEL_ACTIVITY, IPC_CHANNEL_QRCODE, IPC_CHANNEL_QRCODE_POLL, IPC_CHANNEL_WECHAT_PERSONAL_QRCODE, IPC_CHANNEL_WECHAT_PERSONAL_QRCODE_POLL, IPC_CHANNEL_FEISHU_QRCODE, IPC_CHANNEL_FEISHU_QRCODE_POLL, IPC_CHANNEL_LIST_DELIVERY_REVIEWS, IPC_CHANNEL_CONFIRM_TERMINAL_DELIVERY, IPC_CHANNEL_RETRY_TERMINAL_DELIVERY, IPC_CHANNEL_GET_DELIVERY_RECOVERY, IPC_CHANNEL_CLEAR_DELIVERY_RECOVERY, IPC_CHANNEL_ABANDON_ARCHIVED_ROUTE, IPC_TELEMETRY_TRACK, IPC_TELEMETRY_FEEDBACK, IPC_TELEMETRY_FEEDBACK_THREAD, IPC_TELEMETRY_SET_ENABLED, IPC_TELEMETRY_IS_ENABLED, IPC_PTY_CREATE, IPC_PTY_WRITE, IPC_PTY_READ, IPC_PTY_KILL, IPC_PTY_LIST, IPC_PTY_DATA, IPC_PTY_RESIZE, IPC_PTY_STATE, IPC_PTY_OWNERSHIP, IPC_SHELL_JOB_LIST, IPC_SHELL_JOB_KILL, IPC_SHELL_JOB_READ, IPC_SHELL_JOB_DISMISS_FINISHED, IPC_STORAGE_GET_OVERVIEW, IPC_STORAGE_GET_USAGE, IPC_STORAGE_CLEAN, IPC_STORAGE_GET_SESSION_REGISTRY_STATUS, IPC_AGENT_RUNTIME_PROBE_INSTALLATION, IPC_AGENT_RUNTIME_LIST_RUNTIMES, IPC_AGENT_RUNTIME_GET_DIAGNOSTICS, IPC_APP_OPEN_PANEL, IPC_EXTERNAL_APPROVAL_LIST, IPC_EXTERNAL_APPROVAL_DECIDE, IPC_EXTERNAL_APPROVAL_ACKNOWLEDGE, IPC_EXTERNAL_APPROVAL_ON_EVENT;
4655
4655
  var init_ipc_events = __esm({
4656
4656
  "src/main/domain/wire/ipc-events.ts"() {
4657
4657
  "use strict";
@@ -4680,6 +4680,9 @@ var init_ipc_events = __esm({
4680
4680
  IPC_TASK_NOTIFICATION_RENDERER_READY = "TASK_NOTIFICATION:RENDERER_READY";
4681
4681
  IPC_TASK_NOTIFICATION_ACTIVE_SESSION = "TASK_NOTIFICATION:ACTIVE_SESSION";
4682
4682
  IPC_TASK_NOTIFICATION_TRACE = "TASK_NOTIFICATION:TRACE";
4683
+ IPC_TASK_UNREAD_REQUEST = "TASK_UNREAD:REQUEST";
4684
+ IPC_TASK_UNREAD_CLEAR = "TASK_UNREAD:CLEAR";
4685
+ IPC_TASK_UNREAD_CHANGED = "TASK_UNREAD:CHANGED";
4683
4686
  IPC_PLUGIN_HOST_START = "PLUGIN_HOST:START";
4684
4687
  IPC_PLUGIN_HOST_STATUS = "PLUGIN_HOST:STATUS";
4685
4688
  IPC_PLUGIN_HOST_EVENT = "PLUGIN_HOST:EVENT";
@@ -4999,6 +5002,7 @@ var init_ipc_events = __esm({
4999
5002
  IPC_CHANNEL_ABANDON_ARCHIVED_ROUTE = "CHANNEL:ABANDON_ARCHIVED_ROUTE";
5000
5003
  IPC_TELEMETRY_TRACK = "TELEMETRY_TRACK";
5001
5004
  IPC_TELEMETRY_FEEDBACK = "TELEMETRY_FEEDBACK";
5005
+ IPC_TELEMETRY_FEEDBACK_THREAD = "TELEMETRY_FEEDBACK_THREAD";
5002
5006
  IPC_TELEMETRY_SET_ENABLED = "TELEMETRY_SET_ENABLED";
5003
5007
  IPC_TELEMETRY_IS_ENABLED = "TELEMETRY_IS_ENABLED";
5004
5008
  IPC_PTY_CREATE = "PTY:CREATE";
@@ -5089,8 +5093,8 @@ var init_ipc_endpoints = __esm({
5089
5093
  getMessageBlockSubtrees: { channel: IPC_GET_MESSAGE_BLOCK_SUBTREES_V2, hosts: ALL_HOSTS },
5090
5094
  getSurfaceView: { channel: IPC_GET_SURFACE_VIEW, hosts: ALL_HOSTS },
5091
5095
  exportMessageBlocks: { channel: IPC_EXPORT_MESSAGE_BLOCKS, hosts: ALL_HOSTS },
5092
- // 浏览器 / http 源拿不到本机目录,声明 ALL_HOSTS 只会让它在远端静默失败。
5093
- exportSessionEventLog: { channel: IPC_EXPORT_SESSION_EVENT_LOG, hosts: IPC_ONLY },
5096
+ // 同一入口两种出口:桌面选目录拿文件夹,远端由下载路由下发一个 zip(`GET /api/session-event-log/export/...`)。
5097
+ exportSessionEventLog: { channel: IPC_EXPORT_SESSION_EVENT_LOG, hosts: ALL_HOSTS },
5094
5098
  getMessage: { channel: IPC_GET_MESSAGE, hosts: ALL_HOSTS },
5095
5099
  getLatestGoal: { channel: IPC_GOAL_GET_LATEST, hosts: ALL_HOSTS },
5096
5100
  listDirectSessions: { channel: IPC_LIST_DIRECT_SESSIONS, hosts: ALL_HOSTS },
@@ -5279,6 +5283,9 @@ var init_ipc_endpoints = __esm({
5279
5283
  hosts: ALL_HOSTS
5280
5284
  },
5281
5285
  taskNotificationTrace: { channel: IPC_TASK_NOTIFICATION_TRACE, hosts: ALL_HOSTS },
5286
+ requestRunUnread: { channel: IPC_TASK_UNREAD_REQUEST, hosts: ALL_HOSTS },
5287
+ clearRunUnread: { channel: IPC_TASK_UNREAD_CLEAR, hosts: ALL_HOSTS },
5288
+ onRunUnreadChanged: { channel: IPC_TASK_UNREAD_CHANGED, hosts: ALL_HOSTS },
5282
5289
  remoteAccessStart: { channel: IPC_REMOTE_ACCESS_START, hosts: IPC_ONLY },
5283
5290
  remoteAccessStop: { channel: IPC_REMOTE_ACCESS_STOP, hosts: IPC_ONLY },
5284
5291
  remoteAccessRotate: { channel: IPC_REMOTE_ACCESS_ROTATE, hosts: IPC_ONLY },
@@ -5366,6 +5373,7 @@ var init_ipc_endpoints = __esm({
5366
5373
  pendingDiscard: { channel: IPC_MIGRATION_PENDING_DISCARD, hosts: ALL_HOSTS },
5367
5374
  telemetryTrack: { channel: IPC_TELEMETRY_TRACK, hosts: ALL_HOSTS },
5368
5375
  telemetryFeedback: { channel: IPC_TELEMETRY_FEEDBACK, hosts: ALL_HOSTS },
5376
+ telemetryFeedbackThread: { channel: IPC_TELEMETRY_FEEDBACK_THREAD, hosts: ALL_HOSTS },
5369
5377
  telemetrySetEnabled: { channel: IPC_TELEMETRY_SET_ENABLED, hosts: ALL_HOSTS },
5370
5378
  telemetryIsEnabled: { channel: IPC_TELEMETRY_IS_ENABLED, hosts: ALL_HOSTS },
5371
5379
  ptyCreate: { channel: IPC_PTY_CREATE, hosts: ALL_HOSTS },
@@ -6118,6 +6126,22 @@ var init_message_order = __esm({
6118
6126
  }
6119
6127
  });
6120
6128
 
6129
+ // src/main/domain/wire/session-event-log-export-url.ts
6130
+ function buildSessionEventLogExportPath(query) {
6131
+ const params = new URLSearchParams({
6132
+ ownerKind: query.owner.kind,
6133
+ ownerId: query.owner.kind === "group" ? query.owner.groupId : query.owner.agentId
6134
+ });
6135
+ return `${SESSION_EVENT_LOG_EXPORT_PATH}/${encodeURIComponent(query.sessionId)}?${params.toString()}`;
6136
+ }
6137
+ var SESSION_EVENT_LOG_EXPORT_PATH;
6138
+ var init_session_event_log_export_url = __esm({
6139
+ "src/main/domain/wire/session-event-log-export-url.ts"() {
6140
+ "use strict";
6141
+ SESSION_EVENT_LOG_EXPORT_PATH = "/api/session-event-log/export";
6142
+ }
6143
+ });
6144
+
6121
6145
  // src/main/domain/wire/index.ts
6122
6146
  var init_wire = __esm({
6123
6147
  "src/main/domain/wire/index.ts"() {
@@ -6138,6 +6162,7 @@ var init_wire = __esm({
6138
6162
  init_session_view_block_preview();
6139
6163
  init_session_view_legacy_projection();
6140
6164
  init_message_order();
6165
+ init_session_event_log_export_url();
6141
6166
  }
6142
6167
  });
6143
6168
 
@@ -9458,7 +9483,7 @@ var require_lodash = __commonJS({
9458
9483
  }
9459
9484
  return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, undefined2, comparator) : [];
9460
9485
  });
9461
- function join156(array2, separator) {
9486
+ function join157(array2, separator) {
9462
9487
  return array2 == null ? "" : nativeJoin.call(array2, separator);
9463
9488
  }
9464
9489
  function last2(array2) {
@@ -11382,7 +11407,7 @@ var require_lodash = __commonJS({
11382
11407
  lodash.isUndefined = isUndefined;
11383
11408
  lodash.isWeakMap = isWeakMap;
11384
11409
  lodash.isWeakSet = isWeakSet;
11385
- lodash.join = join156;
11410
+ lodash.join = join157;
11386
11411
  lodash.kebabCase = kebabCase;
11387
11412
  lodash.last = last2;
11388
11413
  lodash.lastIndexOf = lastIndexOf;
@@ -12014,54 +12039,54 @@ var require_polyfills = __commonJS({
12014
12039
  }
12015
12040
  var chdir;
12016
12041
  module2.exports = patch;
12017
- function patch(fs29) {
12042
+ function patch(fs30) {
12018
12043
  if (constants5.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) {
12019
- patchLchmod(fs29);
12020
- }
12021
- if (!fs29.lutimes) {
12022
- patchLutimes(fs29);
12023
- }
12024
- fs29.chown = chownFix(fs29.chown);
12025
- fs29.fchown = chownFix(fs29.fchown);
12026
- fs29.lchown = chownFix(fs29.lchown);
12027
- fs29.chmod = chmodFix(fs29.chmod);
12028
- fs29.fchmod = chmodFix(fs29.fchmod);
12029
- fs29.lchmod = chmodFix(fs29.lchmod);
12030
- fs29.chownSync = chownFixSync(fs29.chownSync);
12031
- fs29.fchownSync = chownFixSync(fs29.fchownSync);
12032
- fs29.lchownSync = chownFixSync(fs29.lchownSync);
12033
- fs29.chmodSync = chmodFixSync(fs29.chmodSync);
12034
- fs29.fchmodSync = chmodFixSync(fs29.fchmodSync);
12035
- fs29.lchmodSync = chmodFixSync(fs29.lchmodSync);
12036
- fs29.stat = statFix(fs29.stat);
12037
- fs29.fstat = statFix(fs29.fstat);
12038
- fs29.lstat = statFix(fs29.lstat);
12039
- fs29.statSync = statFixSync(fs29.statSync);
12040
- fs29.fstatSync = statFixSync(fs29.fstatSync);
12041
- fs29.lstatSync = statFixSync(fs29.lstatSync);
12042
- if (fs29.chmod && !fs29.lchmod) {
12043
- fs29.lchmod = function(path34, mode, cb) {
12044
+ patchLchmod(fs30);
12045
+ }
12046
+ if (!fs30.lutimes) {
12047
+ patchLutimes(fs30);
12048
+ }
12049
+ fs30.chown = chownFix(fs30.chown);
12050
+ fs30.fchown = chownFix(fs30.fchown);
12051
+ fs30.lchown = chownFix(fs30.lchown);
12052
+ fs30.chmod = chmodFix(fs30.chmod);
12053
+ fs30.fchmod = chmodFix(fs30.fchmod);
12054
+ fs30.lchmod = chmodFix(fs30.lchmod);
12055
+ fs30.chownSync = chownFixSync(fs30.chownSync);
12056
+ fs30.fchownSync = chownFixSync(fs30.fchownSync);
12057
+ fs30.lchownSync = chownFixSync(fs30.lchownSync);
12058
+ fs30.chmodSync = chmodFixSync(fs30.chmodSync);
12059
+ fs30.fchmodSync = chmodFixSync(fs30.fchmodSync);
12060
+ fs30.lchmodSync = chmodFixSync(fs30.lchmodSync);
12061
+ fs30.stat = statFix(fs30.stat);
12062
+ fs30.fstat = statFix(fs30.fstat);
12063
+ fs30.lstat = statFix(fs30.lstat);
12064
+ fs30.statSync = statFixSync(fs30.statSync);
12065
+ fs30.fstatSync = statFixSync(fs30.fstatSync);
12066
+ fs30.lstatSync = statFixSync(fs30.lstatSync);
12067
+ if (fs30.chmod && !fs30.lchmod) {
12068
+ fs30.lchmod = function(path34, mode, cb) {
12044
12069
  if (cb) process.nextTick(cb);
12045
12070
  };
12046
- fs29.lchmodSync = function() {
12071
+ fs30.lchmodSync = function() {
12047
12072
  };
12048
12073
  }
12049
- if (fs29.chown && !fs29.lchown) {
12050
- fs29.lchown = function(path34, uid, gid, cb) {
12074
+ if (fs30.chown && !fs30.lchown) {
12075
+ fs30.lchown = function(path34, uid, gid, cb) {
12051
12076
  if (cb) process.nextTick(cb);
12052
12077
  };
12053
- fs29.lchownSync = function() {
12078
+ fs30.lchownSync = function() {
12054
12079
  };
12055
12080
  }
12056
12081
  if (platform3 === "win32") {
12057
- fs29.rename = typeof fs29.rename !== "function" ? fs29.rename : (function(fs$rename) {
12082
+ fs30.rename = typeof fs30.rename !== "function" ? fs30.rename : (function(fs$rename) {
12058
12083
  function rename21(from, to2, cb) {
12059
12084
  var start = Date.now();
12060
12085
  var backoff = 0;
12061
12086
  fs$rename(from, to2, function CB(er2) {
12062
12087
  if (er2 && (er2.code === "EACCES" || er2.code === "EPERM" || er2.code === "EBUSY") && Date.now() - start < 6e4) {
12063
12088
  setTimeout(function() {
12064
- fs29.stat(to2, function(stater, st2) {
12089
+ fs30.stat(to2, function(stater, st2) {
12065
12090
  if (stater && stater.code === "ENOENT")
12066
12091
  fs$rename(from, to2, CB);
12067
12092
  else
@@ -12077,9 +12102,9 @@ var require_polyfills = __commonJS({
12077
12102
  }
12078
12103
  if (Object.setPrototypeOf) Object.setPrototypeOf(rename21, fs$rename);
12079
12104
  return rename21;
12080
- })(fs29.rename);
12105
+ })(fs30.rename);
12081
12106
  }
12082
- fs29.read = typeof fs29.read !== "function" ? fs29.read : (function(fs$read) {
12107
+ fs30.read = typeof fs30.read !== "function" ? fs30.read : (function(fs$read) {
12083
12108
  function read(fd2, buffer, offset, length, position2, callback_) {
12084
12109
  var callback;
12085
12110
  if (callback_ && typeof callback_ === "function") {
@@ -12087,22 +12112,22 @@ var require_polyfills = __commonJS({
12087
12112
  callback = function(er2, _3, __) {
12088
12113
  if (er2 && er2.code === "EAGAIN" && eagCounter < 10) {
12089
12114
  eagCounter++;
12090
- return fs$read.call(fs29, fd2, buffer, offset, length, position2, callback);
12115
+ return fs$read.call(fs30, fd2, buffer, offset, length, position2, callback);
12091
12116
  }
12092
12117
  callback_.apply(this, arguments);
12093
12118
  };
12094
12119
  }
12095
- return fs$read.call(fs29, fd2, buffer, offset, length, position2, callback);
12120
+ return fs$read.call(fs30, fd2, buffer, offset, length, position2, callback);
12096
12121
  }
12097
12122
  if (Object.setPrototypeOf) Object.setPrototypeOf(read, fs$read);
12098
12123
  return read;
12099
- })(fs29.read);
12100
- fs29.readSync = typeof fs29.readSync !== "function" ? fs29.readSync : /* @__PURE__ */ (function(fs$readSync) {
12124
+ })(fs30.read);
12125
+ fs30.readSync = typeof fs30.readSync !== "function" ? fs30.readSync : /* @__PURE__ */ (function(fs$readSync) {
12101
12126
  return function(fd2, buffer, offset, length, position2) {
12102
12127
  var eagCounter = 0;
12103
12128
  while (true) {
12104
12129
  try {
12105
- return fs$readSync.call(fs29, fd2, buffer, offset, length, position2);
12130
+ return fs$readSync.call(fs30, fd2, buffer, offset, length, position2);
12106
12131
  } catch (er2) {
12107
12132
  if (er2.code === "EAGAIN" && eagCounter < 10) {
12108
12133
  eagCounter++;
@@ -12112,10 +12137,10 @@ var require_polyfills = __commonJS({
12112
12137
  }
12113
12138
  }
12114
12139
  };
12115
- })(fs29.readSync);
12116
- function patchLchmod(fs30) {
12117
- fs30.lchmod = function(path34, mode, callback) {
12118
- fs30.open(
12140
+ })(fs30.readSync);
12141
+ function patchLchmod(fs31) {
12142
+ fs31.lchmod = function(path34, mode, callback) {
12143
+ fs31.open(
12119
12144
  path34,
12120
12145
  constants5.O_WRONLY | constants5.O_SYMLINK,
12121
12146
  mode,
@@ -12124,80 +12149,80 @@ var require_polyfills = __commonJS({
12124
12149
  if (callback) callback(err3);
12125
12150
  return;
12126
12151
  }
12127
- fs30.fchmod(fd2, mode, function(err4) {
12128
- fs30.close(fd2, function(err22) {
12152
+ fs31.fchmod(fd2, mode, function(err4) {
12153
+ fs31.close(fd2, function(err22) {
12129
12154
  if (callback) callback(err4 || err22);
12130
12155
  });
12131
12156
  });
12132
12157
  }
12133
12158
  );
12134
12159
  };
12135
- fs30.lchmodSync = function(path34, mode) {
12136
- var fd2 = fs30.openSync(path34, constants5.O_WRONLY | constants5.O_SYMLINK, mode);
12160
+ fs31.lchmodSync = function(path34, mode) {
12161
+ var fd2 = fs31.openSync(path34, constants5.O_WRONLY | constants5.O_SYMLINK, mode);
12137
12162
  var threw = true;
12138
12163
  var ret;
12139
12164
  try {
12140
- ret = fs30.fchmodSync(fd2, mode);
12165
+ ret = fs31.fchmodSync(fd2, mode);
12141
12166
  threw = false;
12142
12167
  } finally {
12143
12168
  if (threw) {
12144
12169
  try {
12145
- fs30.closeSync(fd2);
12170
+ fs31.closeSync(fd2);
12146
12171
  } catch (er2) {
12147
12172
  }
12148
12173
  } else {
12149
- fs30.closeSync(fd2);
12174
+ fs31.closeSync(fd2);
12150
12175
  }
12151
12176
  }
12152
12177
  return ret;
12153
12178
  };
12154
12179
  }
12155
- function patchLutimes(fs30) {
12156
- if (constants5.hasOwnProperty("O_SYMLINK") && fs30.futimes) {
12157
- fs30.lutimes = function(path34, at2, mt3, cb) {
12158
- fs30.open(path34, constants5.O_SYMLINK, function(er2, fd2) {
12180
+ function patchLutimes(fs31) {
12181
+ if (constants5.hasOwnProperty("O_SYMLINK") && fs31.futimes) {
12182
+ fs31.lutimes = function(path34, at2, mt3, cb) {
12183
+ fs31.open(path34, constants5.O_SYMLINK, function(er2, fd2) {
12159
12184
  if (er2) {
12160
12185
  if (cb) cb(er2);
12161
12186
  return;
12162
12187
  }
12163
- fs30.futimes(fd2, at2, mt3, function(er3) {
12164
- fs30.close(fd2, function(er22) {
12188
+ fs31.futimes(fd2, at2, mt3, function(er3) {
12189
+ fs31.close(fd2, function(er22) {
12165
12190
  if (cb) cb(er3 || er22);
12166
12191
  });
12167
12192
  });
12168
12193
  });
12169
12194
  };
12170
- fs30.lutimesSync = function(path34, at2, mt3) {
12171
- var fd2 = fs30.openSync(path34, constants5.O_SYMLINK);
12195
+ fs31.lutimesSync = function(path34, at2, mt3) {
12196
+ var fd2 = fs31.openSync(path34, constants5.O_SYMLINK);
12172
12197
  var ret;
12173
12198
  var threw = true;
12174
12199
  try {
12175
- ret = fs30.futimesSync(fd2, at2, mt3);
12200
+ ret = fs31.futimesSync(fd2, at2, mt3);
12176
12201
  threw = false;
12177
12202
  } finally {
12178
12203
  if (threw) {
12179
12204
  try {
12180
- fs30.closeSync(fd2);
12205
+ fs31.closeSync(fd2);
12181
12206
  } catch (er2) {
12182
12207
  }
12183
12208
  } else {
12184
- fs30.closeSync(fd2);
12209
+ fs31.closeSync(fd2);
12185
12210
  }
12186
12211
  }
12187
12212
  return ret;
12188
12213
  };
12189
- } else if (fs30.futimes) {
12190
- fs30.lutimes = function(_a12, _b2, _c, cb) {
12214
+ } else if (fs31.futimes) {
12215
+ fs31.lutimes = function(_a12, _b2, _c, cb) {
12191
12216
  if (cb) process.nextTick(cb);
12192
12217
  };
12193
- fs30.lutimesSync = function() {
12218
+ fs31.lutimesSync = function() {
12194
12219
  };
12195
12220
  }
12196
12221
  }
12197
12222
  function chmodFix(orig) {
12198
12223
  if (!orig) return orig;
12199
12224
  return function(target, mode, cb) {
12200
- return orig.call(fs29, target, mode, function(er2) {
12225
+ return orig.call(fs30, target, mode, function(er2) {
12201
12226
  if (chownErOk(er2)) er2 = null;
12202
12227
  if (cb) cb.apply(this, arguments);
12203
12228
  });
@@ -12207,7 +12232,7 @@ var require_polyfills = __commonJS({
12207
12232
  if (!orig) return orig;
12208
12233
  return function(target, mode) {
12209
12234
  try {
12210
- return orig.call(fs29, target, mode);
12235
+ return orig.call(fs30, target, mode);
12211
12236
  } catch (er2) {
12212
12237
  if (!chownErOk(er2)) throw er2;
12213
12238
  }
@@ -12216,7 +12241,7 @@ var require_polyfills = __commonJS({
12216
12241
  function chownFix(orig) {
12217
12242
  if (!orig) return orig;
12218
12243
  return function(target, uid, gid, cb) {
12219
- return orig.call(fs29, target, uid, gid, function(er2) {
12244
+ return orig.call(fs30, target, uid, gid, function(er2) {
12220
12245
  if (chownErOk(er2)) er2 = null;
12221
12246
  if (cb) cb.apply(this, arguments);
12222
12247
  });
@@ -12226,7 +12251,7 @@ var require_polyfills = __commonJS({
12226
12251
  if (!orig) return orig;
12227
12252
  return function(target, uid, gid) {
12228
12253
  try {
12229
- return orig.call(fs29, target, uid, gid);
12254
+ return orig.call(fs30, target, uid, gid);
12230
12255
  } catch (er2) {
12231
12256
  if (!chownErOk(er2)) throw er2;
12232
12257
  }
@@ -12246,13 +12271,13 @@ var require_polyfills = __commonJS({
12246
12271
  }
12247
12272
  if (cb) cb.apply(this, arguments);
12248
12273
  }
12249
- return options2 ? orig.call(fs29, target, options2, callback) : orig.call(fs29, target, callback);
12274
+ return options2 ? orig.call(fs30, target, options2, callback) : orig.call(fs30, target, callback);
12250
12275
  };
12251
12276
  }
12252
12277
  function statFixSync(orig) {
12253
12278
  if (!orig) return orig;
12254
12279
  return function(target, options2) {
12255
- var stats = options2 ? orig.call(fs29, target, options2) : orig.call(fs29, target);
12280
+ var stats = options2 ? orig.call(fs30, target, options2) : orig.call(fs30, target);
12256
12281
  if (stats) {
12257
12282
  if (stats.uid < 0) stats.uid += 4294967296;
12258
12283
  if (stats.gid < 0) stats.gid += 4294967296;
@@ -12281,7 +12306,7 @@ var require_legacy_streams = __commonJS({
12281
12306
  "node_modules/graceful-fs/legacy-streams.js"(exports2, module2) {
12282
12307
  var Stream2 = require("stream").Stream;
12283
12308
  module2.exports = legacy;
12284
- function legacy(fs29) {
12309
+ function legacy(fs30) {
12285
12310
  return {
12286
12311
  ReadStream,
12287
12312
  WriteStream
@@ -12324,7 +12349,7 @@ var require_legacy_streams = __commonJS({
12324
12349
  });
12325
12350
  return;
12326
12351
  }
12327
- fs29.open(this.path, this.flags, this.mode, function(err3, fd2) {
12352
+ fs30.open(this.path, this.flags, this.mode, function(err3, fd2) {
12328
12353
  if (err3) {
12329
12354
  self2.emit("error", err3);
12330
12355
  self2.readable = false;
@@ -12363,7 +12388,7 @@ var require_legacy_streams = __commonJS({
12363
12388
  this.busy = false;
12364
12389
  this._queue = [];
12365
12390
  if (this.fd === null) {
12366
- this._open = fs29.open;
12391
+ this._open = fs30.open;
12367
12392
  this._queue.push([this._open, this.path, this.flags, this.mode, void 0]);
12368
12393
  this.flush();
12369
12394
  }
@@ -12398,7 +12423,7 @@ var require_clone = __commonJS({
12398
12423
  // node_modules/graceful-fs/graceful-fs.js
12399
12424
  var require_graceful_fs = __commonJS({
12400
12425
  "node_modules/graceful-fs/graceful-fs.js"(exports2, module2) {
12401
- var fs29 = require("fs");
12426
+ var fs30 = require("fs");
12402
12427
  var polyfills = require_polyfills();
12403
12428
  var legacy = require_legacy_streams();
12404
12429
  var clone3 = require_clone();
@@ -12430,12 +12455,12 @@ var require_graceful_fs = __commonJS({
12430
12455
  m2 = "GFS4: " + m2.split(/\n/).join("\nGFS4: ");
12431
12456
  console.error(m2);
12432
12457
  };
12433
- if (!fs29[gracefulQueue]) {
12458
+ if (!fs30[gracefulQueue]) {
12434
12459
  queue = global[gracefulQueue] || [];
12435
- publishQueue(fs29, queue);
12436
- fs29.close = (function(fs$close) {
12460
+ publishQueue(fs30, queue);
12461
+ fs30.close = (function(fs$close) {
12437
12462
  function close(fd2, cb) {
12438
- return fs$close.call(fs29, fd2, function(err3) {
12463
+ return fs$close.call(fs30, fd2, function(err3) {
12439
12464
  if (!err3) {
12440
12465
  resetQueue();
12441
12466
  }
@@ -12447,40 +12472,40 @@ var require_graceful_fs = __commonJS({
12447
12472
  value: fs$close
12448
12473
  });
12449
12474
  return close;
12450
- })(fs29.close);
12451
- fs29.closeSync = (function(fs$closeSync) {
12475
+ })(fs30.close);
12476
+ fs30.closeSync = (function(fs$closeSync) {
12452
12477
  function closeSync5(fd2) {
12453
- fs$closeSync.apply(fs29, arguments);
12478
+ fs$closeSync.apply(fs30, arguments);
12454
12479
  resetQueue();
12455
12480
  }
12456
12481
  Object.defineProperty(closeSync5, previousSymbol, {
12457
12482
  value: fs$closeSync
12458
12483
  });
12459
12484
  return closeSync5;
12460
- })(fs29.closeSync);
12485
+ })(fs30.closeSync);
12461
12486
  if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) {
12462
12487
  process.on("exit", function() {
12463
- debug(fs29[gracefulQueue]);
12464
- require("assert").equal(fs29[gracefulQueue].length, 0);
12488
+ debug(fs30[gracefulQueue]);
12489
+ require("assert").equal(fs30[gracefulQueue].length, 0);
12465
12490
  });
12466
12491
  }
12467
12492
  }
12468
12493
  var queue;
12469
12494
  if (!global[gracefulQueue]) {
12470
- publishQueue(global, fs29[gracefulQueue]);
12471
- }
12472
- module2.exports = patch(clone3(fs29));
12473
- if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs29.__patched) {
12474
- module2.exports = patch(fs29);
12475
- fs29.__patched = true;
12476
- }
12477
- function patch(fs30) {
12478
- polyfills(fs30);
12479
- fs30.gracefulify = patch;
12480
- fs30.createReadStream = createReadStream9;
12481
- fs30.createWriteStream = createWriteStream3;
12482
- var fs$readFile = fs30.readFile;
12483
- fs30.readFile = readFile45;
12495
+ publishQueue(global, fs30[gracefulQueue]);
12496
+ }
12497
+ module2.exports = patch(clone3(fs30));
12498
+ if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs30.__patched) {
12499
+ module2.exports = patch(fs30);
12500
+ fs30.__patched = true;
12501
+ }
12502
+ function patch(fs31) {
12503
+ polyfills(fs31);
12504
+ fs31.gracefulify = patch;
12505
+ fs31.createReadStream = createReadStream10;
12506
+ fs31.createWriteStream = createWriteStream3;
12507
+ var fs$readFile = fs31.readFile;
12508
+ fs31.readFile = readFile45;
12484
12509
  function readFile45(path34, options2, cb) {
12485
12510
  if (typeof options2 === "function")
12486
12511
  cb = options2, options2 = null;
@@ -12496,8 +12521,8 @@ var require_graceful_fs = __commonJS({
12496
12521
  });
12497
12522
  }
12498
12523
  }
12499
- var fs$writeFile = fs30.writeFile;
12500
- fs30.writeFile = writeFile19;
12524
+ var fs$writeFile = fs31.writeFile;
12525
+ fs31.writeFile = writeFile19;
12501
12526
  function writeFile19(path34, data2, options2, cb) {
12502
12527
  if (typeof options2 === "function")
12503
12528
  cb = options2, options2 = null;
@@ -12513,9 +12538,9 @@ var require_graceful_fs = __commonJS({
12513
12538
  });
12514
12539
  }
12515
12540
  }
12516
- var fs$appendFile = fs30.appendFile;
12541
+ var fs$appendFile = fs31.appendFile;
12517
12542
  if (fs$appendFile)
12518
- fs30.appendFile = appendFile6;
12543
+ fs31.appendFile = appendFile6;
12519
12544
  function appendFile6(path34, data2, options2, cb) {
12520
12545
  if (typeof options2 === "function")
12521
12546
  cb = options2, options2 = null;
@@ -12531,9 +12556,9 @@ var require_graceful_fs = __commonJS({
12531
12556
  });
12532
12557
  }
12533
12558
  }
12534
- var fs$copyFile = fs30.copyFile;
12559
+ var fs$copyFile = fs31.copyFile;
12535
12560
  if (fs$copyFile)
12536
- fs30.copyFile = copyFile6;
12561
+ fs31.copyFile = copyFile6;
12537
12562
  function copyFile6(src, dest, flags, cb) {
12538
12563
  if (typeof flags === "function") {
12539
12564
  cb = flags;
@@ -12551,8 +12576,8 @@ var require_graceful_fs = __commonJS({
12551
12576
  });
12552
12577
  }
12553
12578
  }
12554
- var fs$readdir = fs30.readdir;
12555
- fs30.readdir = readdir43;
12579
+ var fs$readdir = fs31.readdir;
12580
+ fs31.readdir = readdir43;
12556
12581
  var noReaddirOptionVersions = /^v[0-5]\./;
12557
12582
  function readdir43(path34, options2, cb) {
12558
12583
  if (typeof options2 === "function")
@@ -12593,21 +12618,21 @@ var require_graceful_fs = __commonJS({
12593
12618
  }
12594
12619
  }
12595
12620
  if (process.version.substr(0, 4) === "v0.8") {
12596
- var legStreams = legacy(fs30);
12621
+ var legStreams = legacy(fs31);
12597
12622
  ReadStream = legStreams.ReadStream;
12598
12623
  WriteStream = legStreams.WriteStream;
12599
12624
  }
12600
- var fs$ReadStream = fs30.ReadStream;
12625
+ var fs$ReadStream = fs31.ReadStream;
12601
12626
  if (fs$ReadStream) {
12602
12627
  ReadStream.prototype = Object.create(fs$ReadStream.prototype);
12603
12628
  ReadStream.prototype.open = ReadStream$open;
12604
12629
  }
12605
- var fs$WriteStream = fs30.WriteStream;
12630
+ var fs$WriteStream = fs31.WriteStream;
12606
12631
  if (fs$WriteStream) {
12607
12632
  WriteStream.prototype = Object.create(fs$WriteStream.prototype);
12608
12633
  WriteStream.prototype.open = WriteStream$open;
12609
12634
  }
12610
- Object.defineProperty(fs30, "ReadStream", {
12635
+ Object.defineProperty(fs31, "ReadStream", {
12611
12636
  get: function() {
12612
12637
  return ReadStream;
12613
12638
  },
@@ -12617,7 +12642,7 @@ var require_graceful_fs = __commonJS({
12617
12642
  enumerable: true,
12618
12643
  configurable: true
12619
12644
  });
12620
- Object.defineProperty(fs30, "WriteStream", {
12645
+ Object.defineProperty(fs31, "WriteStream", {
12621
12646
  get: function() {
12622
12647
  return WriteStream;
12623
12648
  },
@@ -12628,7 +12653,7 @@ var require_graceful_fs = __commonJS({
12628
12653
  configurable: true
12629
12654
  });
12630
12655
  var FileReadStream = ReadStream;
12631
- Object.defineProperty(fs30, "FileReadStream", {
12656
+ Object.defineProperty(fs31, "FileReadStream", {
12632
12657
  get: function() {
12633
12658
  return FileReadStream;
12634
12659
  },
@@ -12639,7 +12664,7 @@ var require_graceful_fs = __commonJS({
12639
12664
  configurable: true
12640
12665
  });
12641
12666
  var FileWriteStream = WriteStream;
12642
- Object.defineProperty(fs30, "FileWriteStream", {
12667
+ Object.defineProperty(fs31, "FileWriteStream", {
12643
12668
  get: function() {
12644
12669
  return FileWriteStream;
12645
12670
  },
@@ -12687,14 +12712,14 @@ var require_graceful_fs = __commonJS({
12687
12712
  }
12688
12713
  });
12689
12714
  }
12690
- function createReadStream9(path34, options2) {
12691
- return new fs30.ReadStream(path34, options2);
12715
+ function createReadStream10(path34, options2) {
12716
+ return new fs31.ReadStream(path34, options2);
12692
12717
  }
12693
12718
  function createWriteStream3(path34, options2) {
12694
- return new fs30.WriteStream(path34, options2);
12719
+ return new fs31.WriteStream(path34, options2);
12695
12720
  }
12696
- var fs$open = fs30.open;
12697
- fs30.open = open16;
12721
+ var fs$open = fs31.open;
12722
+ fs31.open = open16;
12698
12723
  function open16(path34, flags, mode, cb) {
12699
12724
  if (typeof mode === "function")
12700
12725
  cb = mode, mode = null;
@@ -12710,20 +12735,20 @@ var require_graceful_fs = __commonJS({
12710
12735
  });
12711
12736
  }
12712
12737
  }
12713
- return fs30;
12738
+ return fs31;
12714
12739
  }
12715
12740
  function enqueue(elem) {
12716
12741
  debug("ENQUEUE", elem[0].name, elem[1]);
12717
- fs29[gracefulQueue].push(elem);
12742
+ fs30[gracefulQueue].push(elem);
12718
12743
  retry();
12719
12744
  }
12720
12745
  var retryTimer;
12721
12746
  function resetQueue() {
12722
12747
  var now2 = Date.now();
12723
- for (var i2 = 0; i2 < fs29[gracefulQueue].length; ++i2) {
12724
- if (fs29[gracefulQueue][i2].length > 2) {
12725
- fs29[gracefulQueue][i2][3] = now2;
12726
- fs29[gracefulQueue][i2][4] = now2;
12748
+ for (var i2 = 0; i2 < fs30[gracefulQueue].length; ++i2) {
12749
+ if (fs30[gracefulQueue][i2].length > 2) {
12750
+ fs30[gracefulQueue][i2][3] = now2;
12751
+ fs30[gracefulQueue][i2][4] = now2;
12727
12752
  }
12728
12753
  }
12729
12754
  retry();
@@ -12731,9 +12756,9 @@ var require_graceful_fs = __commonJS({
12731
12756
  function retry() {
12732
12757
  clearTimeout(retryTimer);
12733
12758
  retryTimer = void 0;
12734
- if (fs29[gracefulQueue].length === 0)
12759
+ if (fs30[gracefulQueue].length === 0)
12735
12760
  return;
12736
- var elem = fs29[gracefulQueue].shift();
12761
+ var elem = fs30[gracefulQueue].shift();
12737
12762
  var fn2 = elem[0];
12738
12763
  var args2 = elem[1];
12739
12764
  var err3 = elem[2];
@@ -12755,7 +12780,7 @@ var require_graceful_fs = __commonJS({
12755
12780
  debug("RETRY", fn2.name, args2);
12756
12781
  fn2.apply(null, args2.concat([startTime]));
12757
12782
  } else {
12758
- fs29[gracefulQueue].push(elem);
12783
+ fs30[gracefulQueue].push(elem);
12759
12784
  }
12760
12785
  }
12761
12786
  if (retryTimer === void 0) {
@@ -13190,10 +13215,10 @@ var require_mtime_precision = __commonJS({
13190
13215
  "node_modules/proper-lockfile/lib/mtime-precision.js"(exports2, module2) {
13191
13216
  "use strict";
13192
13217
  var cacheSymbol = /* @__PURE__ */ Symbol();
13193
- function probe3(file2, fs29, callback) {
13194
- const cachedPrecision = fs29[cacheSymbol];
13218
+ function probe3(file2, fs30, callback) {
13219
+ const cachedPrecision = fs30[cacheSymbol];
13195
13220
  if (cachedPrecision) {
13196
- return fs29.stat(file2, (err3, stat40) => {
13221
+ return fs30.stat(file2, (err3, stat40) => {
13197
13222
  if (err3) {
13198
13223
  return callback(err3);
13199
13224
  }
@@ -13201,16 +13226,16 @@ var require_mtime_precision = __commonJS({
13201
13226
  });
13202
13227
  }
13203
13228
  const mtime = new Date(Math.ceil(Date.now() / 1e3) * 1e3 + 5);
13204
- fs29.utimes(file2, mtime, mtime, (err3) => {
13229
+ fs30.utimes(file2, mtime, mtime, (err3) => {
13205
13230
  if (err3) {
13206
13231
  return callback(err3);
13207
13232
  }
13208
- fs29.stat(file2, (err4, stat40) => {
13233
+ fs30.stat(file2, (err4, stat40) => {
13209
13234
  if (err4) {
13210
13235
  return callback(err4);
13211
13236
  }
13212
13237
  const precision = stat40.mtime.getTime() % 1e3 === 0 ? "s" : "ms";
13213
- Object.defineProperty(fs29, cacheSymbol, { value: precision });
13238
+ Object.defineProperty(fs30, cacheSymbol, { value: precision });
13214
13239
  callback(null, stat40.mtime, precision);
13215
13240
  });
13216
13241
  });
@@ -13232,7 +13257,7 @@ var require_lockfile = __commonJS({
13232
13257
  "node_modules/proper-lockfile/lib/lockfile.js"(exports2, module2) {
13233
13258
  "use strict";
13234
13259
  var path34 = require("path");
13235
- var fs29 = require_graceful_fs();
13260
+ var fs30 = require_graceful_fs();
13236
13261
  var retry = require_retry2();
13237
13262
  var onExit = require_signal_exit();
13238
13263
  var mtimePrecision = require_mtime_precision();
@@ -13363,7 +13388,7 @@ var require_lockfile = __commonJS({
13363
13388
  update: null,
13364
13389
  realpath: true,
13365
13390
  retries: 0,
13366
- fs: fs29,
13391
+ fs: fs30,
13367
13392
  onCompromised: (err3) => {
13368
13393
  throw err3;
13369
13394
  },
@@ -13407,7 +13432,7 @@ var require_lockfile = __commonJS({
13407
13432
  }
13408
13433
  function unlock(file2, options2, callback) {
13409
13434
  options2 = {
13410
- fs: fs29,
13435
+ fs: fs30,
13411
13436
  realpath: true,
13412
13437
  ...options2
13413
13438
  };
@@ -13429,7 +13454,7 @@ var require_lockfile = __commonJS({
13429
13454
  options2 = {
13430
13455
  stale: 1e4,
13431
13456
  realpath: true,
13432
- fs: fs29,
13457
+ fs: fs30,
13433
13458
  ...options2
13434
13459
  };
13435
13460
  options2.stale = Math.max(options2.stale || 0, 2e3);
@@ -13468,16 +13493,16 @@ var require_lockfile = __commonJS({
13468
13493
  var require_adapter = __commonJS({
13469
13494
  "node_modules/proper-lockfile/lib/adapter.js"(exports2, module2) {
13470
13495
  "use strict";
13471
- var fs29 = require_graceful_fs();
13472
- function createSyncFs(fs30) {
13496
+ var fs30 = require_graceful_fs();
13497
+ function createSyncFs(fs31) {
13473
13498
  const methods = ["mkdir", "realpath", "stat", "rmdir", "utimes"];
13474
- const newFs = { ...fs30 };
13499
+ const newFs = { ...fs31 };
13475
13500
  methods.forEach((method) => {
13476
13501
  newFs[method] = (...args2) => {
13477
13502
  const callback = args2.pop();
13478
13503
  let ret;
13479
13504
  try {
13480
- ret = fs30[`${method}Sync`](...args2);
13505
+ ret = fs31[`${method}Sync`](...args2);
13481
13506
  } catch (err3) {
13482
13507
  return callback(err3);
13483
13508
  }
@@ -13515,7 +13540,7 @@ var require_adapter = __commonJS({
13515
13540
  }
13516
13541
  function toSyncOptions(options2) {
13517
13542
  options2 = { ...options2 };
13518
- options2.fs = createSyncFs(options2.fs || fs29);
13543
+ options2.fs = createSyncFs(options2.fs || fs30);
13519
13544
  if (typeof options2.retries === "number" && options2.retries > 0 || options2.retries && typeof options2.retries.retries === "number" && options2.retries.retries > 0) {
13520
13545
  throw Object.assign(new Error("Cannot use retries with the sync api"), { code: "ESYNC" });
13521
13546
  }
@@ -14173,16 +14198,16 @@ function logicalPathKey(path34) {
14173
14198
  const resolved = sp.resolve(path34);
14174
14199
  return isWindows || !resolved.includes("\\") ? resolved.replace(BACK_SLASH_RE, "/") : normalizePath(resolved);
14175
14200
  }
14176
- function isInsideRelativePath(relative27) {
14177
- return relative27 !== ".." && !relative27.startsWith(`..${sp.sep}`) && !sp.isAbsolute(relative27);
14201
+ function isInsideRelativePath(relative28) {
14202
+ return relative28 !== ".." && !relative28.startsWith(`..${sp.sep}`) && !sp.isAbsolute(relative28);
14178
14203
  }
14179
14204
  function isSameOrInside(root2, candidate) {
14180
- const relative27 = sp.relative(root2, candidate);
14181
- return relative27 === "" || isInsideRelativePath(relative27);
14205
+ const relative28 = sp.relative(root2, candidate);
14206
+ return relative28 === "" || isInsideRelativePath(relative28);
14182
14207
  }
14183
14208
  function isStrictlyInside(root2, candidate) {
14184
- const relative27 = sp.relative(root2, candidate);
14185
- return relative27 !== "" && isInsideRelativePath(relative27);
14209
+ const relative28 = sp.relative(root2, candidate);
14210
+ return relative28 !== "" && isInsideRelativePath(relative28);
14186
14211
  }
14187
14212
  function isMatcherObject(matcher) {
14188
14213
  return typeof matcher === "object" && matcher !== null && !(matcher instanceof RegExp);
@@ -16020,16 +16045,16 @@ var init_reconcile = __esm({
16020
16045
  return this.fsw.isPathGenerationActive(path34, wh.pathGeneration);
16021
16046
  }
16022
16047
  candidateDepth(root2, candidate) {
16023
- const relative27 = sp5.relative(root2, candidate);
16024
- return relative27 ? relative27.split(sp5.sep).length : 0;
16048
+ const relative28 = sp5.relative(root2, candidate);
16049
+ return relative28 ? relative28.split(sp5.sep).length : 0;
16025
16050
  }
16026
16051
  candidateIgnored(root2, candidate, stats) {
16027
- const relative27 = sp5.relative(root2, candidate);
16052
+ const relative28 = sp5.relative(root2, candidate);
16028
16053
  let ancestor = root2;
16029
16054
  if (this.fsw.isIgnored(ancestor))
16030
16055
  return true;
16031
- if (relative27) {
16032
- const parts = relative27.split(sp5.sep);
16056
+ if (relative28) {
16057
+ const parts = relative28.split(sp5.sep);
16033
16058
  for (let index3 = 0; index3 < parts.length - 1; index3++) {
16034
16059
  ancestor = sp5.join(ancestor, parts[index3]);
16035
16060
  if (this.fsw.isIgnored(ancestor))
@@ -18447,24 +18472,14 @@ var init_subagent_concurrency = __esm({
18447
18472
  });
18448
18473
 
18449
18474
  // src/main/domain/settings/reasoning-history.ts
18450
- function normalizeReasoningHistory(value) {
18451
- if (value === ALL_REASONING_HISTORY) return ALL_REASONING_HISTORY;
18452
- if (typeof value !== "number" || !Number.isFinite(value)) {
18453
- return DEFAULT_REASONING_HISTORY_RETENTION;
18454
- }
18455
- return Math.min(
18456
- MAX_REASONING_HISTORY_RETENTION,
18457
- Math.max(MIN_REASONING_HISTORY_RETENTION, Math.trunc(value))
18458
- );
18475
+ function normalizeReasoningHistory(_value) {
18476
+ return DEFAULT_REASONING_HISTORY_RETENTION;
18459
18477
  }
18460
- var DEFAULT_REASONING_HISTORY_RETENTION, MIN_REASONING_HISTORY_RETENTION, MAX_REASONING_HISTORY_RETENTION, ALL_REASONING_HISTORY;
18478
+ var DEFAULT_REASONING_HISTORY_RETENTION;
18461
18479
  var init_reasoning_history = __esm({
18462
18480
  "src/main/domain/settings/reasoning-history.ts"() {
18463
18481
  "use strict";
18464
18482
  DEFAULT_REASONING_HISTORY_RETENTION = "all";
18465
- MIN_REASONING_HISTORY_RETENTION = 1;
18466
- MAX_REASONING_HISTORY_RETENTION = 20;
18467
- ALL_REASONING_HISTORY = "all";
18468
18483
  }
18469
18484
  });
18470
18485
 
@@ -19325,6 +19340,33 @@ var init_channel_health = __esm({
19325
19340
  }
19326
19341
  });
19327
19342
 
19343
+ // src/main/domain/model-channel/chat-error-utils.ts
19344
+ function isConcurrencyRateLimitMessage(message2) {
19345
+ if (!message2) return false;
19346
+ return /concurrency limit exceeded/i.test(message2);
19347
+ }
19348
+ function isProviderConfigOrQuotaMessage(message2) {
19349
+ if (!message2) return false;
19350
+ return /价格未配置|未配置价格|定价未配置/.test(message2) || /price not configured|pricing not configured/i.test(message2) || /使用上限|限额|配额|额度/.test(message2) || /quota|usage limit|insufficient balance|insufficient quota/i.test(message2);
19351
+ }
19352
+ function isChannelUnavailableMessage(message2) {
19353
+ if (!message2) return false;
19354
+ return CHANNEL_UNAVAILABLE_PATTERNS.some((pattern) => pattern.test(message2));
19355
+ }
19356
+ var CHANNEL_UNAVAILABLE_PATTERNS;
19357
+ var init_chat_error_utils = __esm({
19358
+ "src/main/domain/model-channel/chat-error-utils.ts"() {
19359
+ "use strict";
19360
+ CHANNEL_UNAVAILABLE_PATTERNS = [
19361
+ /no available channel/i,
19362
+ /available channel for model/i,
19363
+ /可用渠道不存在/,
19364
+ /渠道不存在/,
19365
+ /model_not_found/i
19366
+ ];
19367
+ }
19368
+ });
19369
+
19328
19370
  // src/main/domain/model-channel/error-utils.ts
19329
19371
  function decodeMessage(message2) {
19330
19372
  return message2.replace(/\\u003e/g, ">").replace(/\\u003c/g, "<");
@@ -19431,6 +19473,19 @@ function isProviderInvalidResponseError(error62) {
19431
19473
  function isProviderInvalidResponseMessage(message2) {
19432
19474
  return PROVIDER_INVALID_RESPONSE_PATTERN.test(message2) && PROVIDER_RESPONSE_SHAPE_PATTERN.test(message2);
19433
19475
  }
19476
+ function isRequestRejectedMessage(message2) {
19477
+ return REQUEST_REJECTED_PATTERN.test(message2);
19478
+ }
19479
+ function isRequestRejectedProviderError(error62) {
19480
+ if (typeof error62 === "string") return isRequestRejectedMessage(error62);
19481
+ if (!error62 || typeof error62 !== "object") return false;
19482
+ const context = getProviderErrorContext(error62);
19483
+ if (context.statusCode === 408 || context.statusCode === 429) return false;
19484
+ if (isRequestRejectedMessage(context.message)) return true;
19485
+ if (context.nestedMessage && isRequestRejectedMessage(context.nestedMessage)) return true;
19486
+ const cause = error62.cause;
19487
+ return cause === void 0 ? false : isRequestRejectedProviderError(cause);
19488
+ }
19434
19489
  function isProviderOverloadError(error62) {
19435
19490
  if (typeof error62 === "string") return PROVIDER_OVERLOAD_PATTERN.test(error62);
19436
19491
  if (!error62 || typeof error62 !== "object") return false;
@@ -19523,6 +19578,10 @@ function classifyProviderFailureReason(error62) {
19523
19578
  }
19524
19579
  function isRetryableProviderError(error62) {
19525
19580
  const context = getProviderErrorContext(error62);
19581
+ if (isChannelUnavailableMessage(context.message) || isChannelUnavailableMessage(context.nestedMessage)) {
19582
+ return false;
19583
+ }
19584
+ if (isRequestRejectedProviderError(error62)) return false;
19526
19585
  if (context.statusCode === 429 || context.statusCode === 408) return true;
19527
19586
  if (typeof context.statusCode === "number" && context.statusCode >= 500) return true;
19528
19587
  if (isProviderInvalidResponseError(error62)) return true;
@@ -19530,10 +19589,11 @@ function isRetryableProviderError(error62) {
19530
19589
  const reason = classifyProviderFailureReason(error62);
19531
19590
  return reason === "rate_limit" || reason === "quota" || reason === "timeout";
19532
19591
  }
19533
- var DIAGNOSTIC_MESSAGE_MAX_LENGTH, DIAGNOSTIC_STACK_MAX_LENGTH, DIAGNOSTIC_CAUSE_MAX_LENGTH, MAX_ERROR_CAUSE_DEPTH, CONTEXT_OVERFLOW_TEXT_PATTERN, STREAM_READ_ERROR_PATTERN, RESPONSE_PROCESSING_WRAPPER_MESSAGES, PROVIDER_INVALID_RESPONSE_PATTERN, PROVIDER_RESPONSE_SHAPE_PATTERN, TIMEOUT_ERROR_PATTERN, PROVIDER_OVERLOAD_PATTERN;
19592
+ var DIAGNOSTIC_MESSAGE_MAX_LENGTH, DIAGNOSTIC_STACK_MAX_LENGTH, DIAGNOSTIC_CAUSE_MAX_LENGTH, MAX_ERROR_CAUSE_DEPTH, CONTEXT_OVERFLOW_TEXT_PATTERN, STREAM_READ_ERROR_PATTERN, RESPONSE_PROCESSING_WRAPPER_MESSAGES, PROVIDER_INVALID_RESPONSE_PATTERN, PROVIDER_RESPONSE_SHAPE_PATTERN, TIMEOUT_ERROR_PATTERN, PROVIDER_OVERLOAD_PATTERN, REQUEST_REJECTED_PATTERN;
19534
19593
  var init_error_utils = __esm({
19535
19594
  "src/main/domain/model-channel/error-utils.ts"() {
19536
19595
  "use strict";
19596
+ init_chat_error_utils();
19537
19597
  DIAGNOSTIC_MESSAGE_MAX_LENGTH = 1e3;
19538
19598
  DIAGNOSTIC_STACK_MAX_LENGTH = 8e3;
19539
19599
  DIAGNOSTIC_CAUSE_MAX_LENGTH = 1e3;
@@ -19548,21 +19608,7 @@ var init_error_utils = __esm({
19548
19608
  PROVIDER_RESPONSE_SHAPE_PATTERN = /\bchoices\b|\berror\b|\bchat completions?\b/i;
19549
19609
  TIMEOUT_ERROR_PATTERN = /(?:^|[^a-z0-9])timeout(?:$|[^a-z0-9])|timed out/i;
19550
19610
  PROVIDER_OVERLOAD_PATTERN = /currently overloaded|overloaded|try again later|service unavailable|temporarily unavailable|internal server error|bad gateway|gateway timeout|server error/i;
19551
- }
19552
- });
19553
-
19554
- // src/main/domain/model-channel/chat-error-utils.ts
19555
- function isConcurrencyRateLimitMessage(message2) {
19556
- if (!message2) return false;
19557
- return /concurrency limit exceeded/i.test(message2);
19558
- }
19559
- function isProviderConfigOrQuotaMessage(message2) {
19560
- if (!message2) return false;
19561
- return /价格未配置|未配置价格|定价未配置/.test(message2) || /price not configured|pricing not configured/i.test(message2) || /使用上限|限额|配额|额度/.test(message2) || /quota|usage limit|insufficient balance|insufficient quota/i.test(message2);
19562
- }
19563
- var init_chat_error_utils = __esm({
19564
- "src/main/domain/model-channel/chat-error-utils.ts"() {
19565
- "use strict";
19611
+ REQUEST_REJECTED_PATTERN = /request is invalid|invalid request (?:body|format)|check the request body|required fields|request format|request body is|请求体|请求格式|请求参数|参数错误/i;
19566
19612
  }
19567
19613
  });
19568
19614
 
@@ -22756,18 +22802,18 @@ function createOutputDecoder() {
22756
22802
  let pending2 = [];
22757
22803
  let pendingBytes = 0;
22758
22804
  let stream = null;
22759
- let encoding2 = "utf8";
22805
+ let encoding = "utf8";
22760
22806
  const decide2 = () => {
22761
22807
  const bytes = pending2.length === 1 ? pending2[0] : Buffer.concat(pending2);
22762
22808
  pending2 = [];
22763
22809
  pendingBytes = 0;
22764
- encoding2 = decideOutputEncoding(bytes);
22765
- stream = new StreamDecoder(encoding2);
22810
+ encoding = decideOutputEncoding(bytes);
22811
+ stream = new StreamDecoder(encoding);
22766
22812
  return stream.write(bytes);
22767
22813
  };
22768
22814
  return {
22769
22815
  get encoding() {
22770
- return encoding2;
22816
+ return encoding;
22771
22817
  },
22772
22818
  write(chunk3) {
22773
22819
  if (stream) return stream.write(chunk3);
@@ -22796,9 +22842,9 @@ var init_decode_output = __esm({
22796
22842
  MAX_UNDECIDED_BYTES = 4096;
22797
22843
  CONTENT_REPLACEMENT = /\uFFFD/g;
22798
22844
  StreamDecoder = class {
22799
- constructor(encoding2) {
22800
- this.encoding = encoding2;
22801
- this.decoder = encoding2 === "gbk" ? new TextDecoder("gbk") : new TextDecoder("utf-8", { ignoreBOM: true });
22845
+ constructor(encoding) {
22846
+ this.encoding = encoding;
22847
+ this.decoder = encoding === "gbk" ? new TextDecoder("gbk") : new TextDecoder("utf-8", { ignoreBOM: true });
22802
22848
  }
22803
22849
  encoding;
22804
22850
  decoder;
@@ -23238,7 +23284,7 @@ var require_windows = __commonJS({
23238
23284
  "node_modules/isexe/windows.js"(exports2, module2) {
23239
23285
  module2.exports = isexe;
23240
23286
  isexe.sync = sync;
23241
- var fs29 = require("fs");
23287
+ var fs30 = require("fs");
23242
23288
  function checkPathExt(path34, options2) {
23243
23289
  var pathext = options2.pathExt !== void 0 ? options2.pathExt : process.env.PATHEXT;
23244
23290
  if (!pathext) {
@@ -23263,12 +23309,12 @@ var require_windows = __commonJS({
23263
23309
  return checkPathExt(path34, options2);
23264
23310
  }
23265
23311
  function isexe(path34, options2, cb) {
23266
- fs29.stat(path34, function(er2, stat40) {
23312
+ fs30.stat(path34, function(er2, stat40) {
23267
23313
  cb(er2, er2 ? false : checkStat(stat40, path34, options2));
23268
23314
  });
23269
23315
  }
23270
23316
  function sync(path34, options2) {
23271
- return checkStat(fs29.statSync(path34), path34, options2);
23317
+ return checkStat(fs30.statSync(path34), path34, options2);
23272
23318
  }
23273
23319
  }
23274
23320
  });
@@ -23278,14 +23324,14 @@ var require_mode = __commonJS({
23278
23324
  "node_modules/isexe/mode.js"(exports2, module2) {
23279
23325
  module2.exports = isexe;
23280
23326
  isexe.sync = sync;
23281
- var fs29 = require("fs");
23327
+ var fs30 = require("fs");
23282
23328
  function isexe(path34, options2, cb) {
23283
- fs29.stat(path34, function(er2, stat40) {
23329
+ fs30.stat(path34, function(er2, stat40) {
23284
23330
  cb(er2, er2 ? false : checkStat(stat40, options2));
23285
23331
  });
23286
23332
  }
23287
23333
  function sync(path34, options2) {
23288
- return checkStat(fs29.statSync(path34), options2);
23334
+ return checkStat(fs30.statSync(path34), options2);
23289
23335
  }
23290
23336
  function checkStat(stat40, options2) {
23291
23337
  return stat40.isFile() && checkMode(stat40, options2);
@@ -23309,7 +23355,7 @@ var require_mode = __commonJS({
23309
23355
  // node_modules/isexe/index.js
23310
23356
  var require_isexe = __commonJS({
23311
23357
  "node_modules/isexe/index.js"(exports2, module2) {
23312
- var fs29 = require("fs");
23358
+ var fs30 = require("fs");
23313
23359
  var core;
23314
23360
  if (process.platform === "win32" || global.TESTING_WINDOWS) {
23315
23361
  core = require_windows();
@@ -23573,16 +23619,16 @@ var require_shebang_command = __commonJS({
23573
23619
  var require_readShebang = __commonJS({
23574
23620
  "node_modules/cross-spawn/lib/util/readShebang.js"(exports2, module2) {
23575
23621
  "use strict";
23576
- var fs29 = require("fs");
23622
+ var fs30 = require("fs");
23577
23623
  var shebangCommand = require_shebang_command();
23578
23624
  function readShebang(command) {
23579
23625
  const size = 150;
23580
23626
  const buffer = Buffer.alloc(size);
23581
23627
  let fd2;
23582
23628
  try {
23583
- fd2 = fs29.openSync(command, "r");
23584
- fs29.readSync(fd2, buffer, 0, size, 0);
23585
- fs29.closeSync(fd2);
23629
+ fd2 = fs30.openSync(command, "r");
23630
+ fs30.readSync(fd2, buffer, 0, size, 0);
23631
+ fs30.closeSync(fd2);
23586
23632
  } catch (e) {
23587
23633
  }
23588
23634
  return shebangCommand(buffer.toString());
@@ -24470,20 +24516,20 @@ var require_buffer_stream = __commonJS({
24470
24516
  module2.exports = (options2) => {
24471
24517
  options2 = { ...options2 };
24472
24518
  const { array: array2 } = options2;
24473
- let { encoding: encoding2 } = options2;
24474
- const isBuffer2 = encoding2 === "buffer";
24519
+ let { encoding } = options2;
24520
+ const isBuffer2 = encoding === "buffer";
24475
24521
  let objectMode = false;
24476
24522
  if (array2) {
24477
- objectMode = !(encoding2 || isBuffer2);
24523
+ objectMode = !(encoding || isBuffer2);
24478
24524
  } else {
24479
- encoding2 = encoding2 || "utf8";
24525
+ encoding = encoding || "utf8";
24480
24526
  }
24481
24527
  if (isBuffer2) {
24482
- encoding2 = null;
24528
+ encoding = null;
24483
24529
  }
24484
24530
  const stream = new PassThroughStream({ objectMode });
24485
- if (encoding2) {
24486
- stream.setEncoding(encoding2);
24531
+ if (encoding) {
24532
+ stream.setEncoding(encoding);
24487
24533
  }
24488
24534
  let length = 0;
24489
24535
  const chunks = [];
@@ -24643,19 +24689,19 @@ var require_stream = __commonJS({
24643
24689
  return error62.bufferedData;
24644
24690
  }
24645
24691
  };
24646
- var getStreamPromise = (stream, { encoding: encoding2, buffer, maxBuffer }) => {
24692
+ var getStreamPromise = (stream, { encoding, buffer, maxBuffer }) => {
24647
24693
  if (!stream || !buffer) {
24648
24694
  return;
24649
24695
  }
24650
- if (encoding2) {
24651
- return getStream(stream, { encoding: encoding2, maxBuffer });
24696
+ if (encoding) {
24697
+ return getStream(stream, { encoding, maxBuffer });
24652
24698
  }
24653
24699
  return getStream.buffer(stream, { maxBuffer });
24654
24700
  };
24655
- var getSpawnedResult = async ({ stdout, stderr, all: all2 }, { encoding: encoding2, buffer, maxBuffer }, processDone) => {
24656
- const stdoutPromise = getStreamPromise(stdout, { encoding: encoding2, buffer, maxBuffer });
24657
- const stderrPromise = getStreamPromise(stderr, { encoding: encoding2, buffer, maxBuffer });
24658
- const allPromise = getStreamPromise(all2, { encoding: encoding2, buffer, maxBuffer: maxBuffer * 2 });
24701
+ var getSpawnedResult = async ({ stdout, stderr, all: all2 }, { encoding, buffer, maxBuffer }, processDone) => {
24702
+ const stdoutPromise = getStreamPromise(stdout, { encoding, buffer, maxBuffer });
24703
+ const stderrPromise = getStreamPromise(stderr, { encoding, buffer, maxBuffer });
24704
+ const allPromise = getStreamPromise(all2, { encoding, buffer, maxBuffer: maxBuffer * 2 });
24659
24705
  try {
24660
24706
  return await Promise.all([processDone, stdoutPromise, stderrPromise, allPromise]);
24661
24707
  } catch (error62) {
@@ -25378,22 +25424,11 @@ function readTailBytes(path34, maxBytes) {
25378
25424
  }
25379
25425
  }
25380
25426
  function readShellJobLog(dataPath2, jobId, maxChars) {
25381
- const path34 = getShellJobLogPath(dataPath2, jobId);
25382
- const olderPath = getShellJobOlderLogPath(dataPath2, jobId);
25383
25427
  try {
25384
- const currentBytes = statBytes(path34);
25385
- if (currentBytes >= maxChars) {
25386
- return { text: readTailBytes(path34, maxChars), truncated: true };
25387
- }
25388
- const current2 = (0, import_fs33.readFileSync)(path34, "utf-8");
25389
- const older = statBytes(olderPath) > 0 ? (0, import_fs33.readFileSync)(olderPath, "utf-8") : "";
25390
- const needed = maxChars - current2.length;
25391
- const olderTail = older.slice(Math.max(0, older.length - needed));
25392
- return {
25393
- text: olderTail + current2,
25394
- // 只有真切掉了东西才叫截断:older 恰好等于预算时一个字都没少。
25395
- truncated: older.length > needed
25396
- };
25428
+ const tail = readShellJobLogTail(dataPath2, jobId, maxChars * 4);
25429
+ if (tail.missing) return { text: "", truncated: false };
25430
+ if (tail.text.length <= maxChars) return { text: tail.text, truncated: tail.truncated };
25431
+ return { text: tail.text.slice(tail.text.length - maxChars), truncated: true };
25397
25432
  } catch {
25398
25433
  return { text: "", truncated: false };
25399
25434
  }
@@ -56368,50 +56403,50 @@ var require_fast_uri = __commonJS({
56368
56403
  schemelessOptions.skipEscape = true;
56369
56404
  return serialize5(resolved, schemelessOptions);
56370
56405
  }
56371
- function resolveComponent(base, relative27, options2, skipNormalization) {
56406
+ function resolveComponent(base, relative28, options2, skipNormalization) {
56372
56407
  const target = {};
56373
56408
  if (!skipNormalization) {
56374
56409
  base = parse13(serialize5(base, options2), options2);
56375
- relative27 = parse13(serialize5(relative27, options2), options2);
56410
+ relative28 = parse13(serialize5(relative28, options2), options2);
56376
56411
  }
56377
56412
  options2 = options2 || {};
56378
- if (!options2.tolerant && relative27.scheme) {
56379
- target.scheme = relative27.scheme;
56380
- target.userinfo = relative27.userinfo;
56381
- target.host = relative27.host;
56382
- target.port = relative27.port;
56383
- target.path = removeDotSegments(relative27.path || "");
56384
- target.query = relative27.query;
56413
+ if (!options2.tolerant && relative28.scheme) {
56414
+ target.scheme = relative28.scheme;
56415
+ target.userinfo = relative28.userinfo;
56416
+ target.host = relative28.host;
56417
+ target.port = relative28.port;
56418
+ target.path = removeDotSegments(relative28.path || "");
56419
+ target.query = relative28.query;
56385
56420
  } else {
56386
- if (relative27.userinfo !== void 0 || relative27.host !== void 0 || relative27.port !== void 0) {
56387
- target.userinfo = relative27.userinfo;
56388
- target.host = relative27.host;
56389
- target.port = relative27.port;
56390
- target.path = removeDotSegments(relative27.path || "");
56391
- target.query = relative27.query;
56421
+ if (relative28.userinfo !== void 0 || relative28.host !== void 0 || relative28.port !== void 0) {
56422
+ target.userinfo = relative28.userinfo;
56423
+ target.host = relative28.host;
56424
+ target.port = relative28.port;
56425
+ target.path = removeDotSegments(relative28.path || "");
56426
+ target.query = relative28.query;
56392
56427
  } else {
56393
- if (!relative27.path) {
56428
+ if (!relative28.path) {
56394
56429
  target.path = base.path;
56395
- if (relative27.query !== void 0) {
56396
- target.query = relative27.query;
56430
+ if (relative28.query !== void 0) {
56431
+ target.query = relative28.query;
56397
56432
  } else {
56398
56433
  target.query = base.query;
56399
56434
  }
56400
56435
  } else {
56401
- if (relative27.path[0] === "/") {
56402
- target.path = removeDotSegments(relative27.path);
56436
+ if (relative28.path[0] === "/") {
56437
+ target.path = removeDotSegments(relative28.path);
56403
56438
  } else {
56404
56439
  const baseHasAuthority = base.userinfo !== void 0 || base.host !== void 0 || base.port !== void 0;
56405
56440
  if (baseHasAuthority && !base.path) {
56406
- target.path = "/" + relative27.path;
56441
+ target.path = "/" + relative28.path;
56407
56442
  } else if (!base.path) {
56408
- target.path = relative27.path;
56443
+ target.path = relative28.path;
56409
56444
  } else {
56410
- target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) + relative27.path;
56445
+ target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) + relative28.path;
56411
56446
  }
56412
56447
  target.path = base.scheme === void 0 && !baseHasAuthority && target.path[0] !== "/" ? removeDotSegmentsRelative(target.path) : removeDotSegments(target.path);
56413
56448
  }
56414
- target.query = relative27.query;
56449
+ target.query = relative28.query;
56415
56450
  }
56416
56451
  target.userinfo = base.userinfo;
56417
56452
  target.host = base.host;
@@ -56419,7 +56454,7 @@ var require_fast_uri = __commonJS({
56419
56454
  }
56420
56455
  target.scheme = base.scheme;
56421
56456
  }
56422
- target.fragment = relative27.fragment;
56457
+ target.fragment = relative28.fragment;
56423
56458
  return target;
56424
56459
  }
56425
56460
  function equal(uriA, uriB, options2) {
@@ -59699,12 +59734,12 @@ var require_dist = __commonJS({
59699
59734
  throw new Error(`Unknown format "${name5}"`);
59700
59735
  return f2;
59701
59736
  };
59702
- function addFormats(ajv, list2, fs29, exportName) {
59737
+ function addFormats(ajv, list2, fs30, exportName) {
59703
59738
  var _a12;
59704
59739
  var _b2;
59705
59740
  (_a12 = (_b2 = ajv.opts.code).formats) !== null && _a12 !== void 0 ? _a12 : _b2.formats = (0, codegen_1._)`require("ajv-formats/dist/formats").${exportName}`;
59706
59741
  for (const f2 of list2)
59707
- ajv.addFormat(f2, fs29[f2]);
59742
+ ajv.addFormat(f2, fs30[f2]);
59708
59743
  }
59709
59744
  module2.exports = exports2 = formatsPlugin;
59710
59745
  Object.defineProperty(exports2, "__esModule", { value: true });
@@ -67868,15 +67903,15 @@ var require_pg_connection_string = __commonJS({
67868
67903
  if (config3.sslnegotiation === "direct" && config3.ssl === void 0) {
67869
67904
  config3.ssl = true;
67870
67905
  }
67871
- const fs29 = config3.sslcert || config3.sslkey || config3.sslrootcert ? require("fs") : null;
67906
+ const fs30 = config3.sslcert || config3.sslkey || config3.sslrootcert ? require("fs") : null;
67872
67907
  if (config3.sslcert) {
67873
- config3.ssl.cert = fs29.readFileSync(config3.sslcert).toString();
67908
+ config3.ssl.cert = fs30.readFileSync(config3.sslcert).toString();
67874
67909
  }
67875
67910
  if (config3.sslkey) {
67876
- config3.ssl.key = fs29.readFileSync(config3.sslkey).toString();
67911
+ config3.ssl.key = fs30.readFileSync(config3.sslkey).toString();
67877
67912
  }
67878
67913
  if (config3.sslrootcert) {
67879
- config3.ssl.ca = fs29.readFileSync(config3.sslrootcert).toString();
67914
+ config3.ssl.ca = fs30.readFileSync(config3.sslrootcert).toString();
67880
67915
  }
67881
67916
  if (options2.useLibpqCompat && config3.uselibpqcompat) {
67882
67917
  throw new Error("Both useLibpqCompat and uselibpqcompat are set. Please use only one of them.");
@@ -99632,9 +99667,9 @@ var require_query_generator = __commonJS({
99632
99667
  }
99633
99668
  return `json_unquote(json_extract(${quotedColumn},${pathStr}))`;
99634
99669
  case "postgres":
99635
- const join156 = isJson ? "#>" : "#>>";
99670
+ const join157 = isJson ? "#>" : "#>>";
99636
99671
  pathStr = this.escape(`{${paths.join(",")}}`);
99637
- return `(${quotedColumn}${join156}${pathStr})`;
99672
+ return `(${quotedColumn}${join157}${pathStr})`;
99638
99673
  default:
99639
99674
  throw new Error(`Unsupported ${this.dialect} for JSON operations`);
99640
99675
  }
@@ -100322,7 +100357,7 @@ https://github.com/sequelize/sequelize/discussions/15694`);
100322
100357
  const isBelongsTo = topAssociation.associationType === "BelongsTo";
100323
100358
  const sourceField = isBelongsTo ? topAssociation.identifierField : topAssociation.sourceKeyField || topParent.model.primaryKeyField;
100324
100359
  const targetField = isBelongsTo ? topAssociation.sourceKeyField || topInclude.model.primaryKeyField : topAssociation.identifierField;
100325
- const join156 = [
100360
+ const join157 = [
100326
100361
  `${this.quoteIdentifier(topInclude.as)}.${this.quoteIdentifier(targetField)}`,
100327
100362
  `${this.quoteTable(topParent.as || topParent.model.name)}.${this.quoteIdentifier(sourceField)}`
100328
100363
  ].join(" = ");
@@ -100333,7 +100368,7 @@ https://github.com/sequelize/sequelize/discussions/15694`);
100333
100368
  where: {
100334
100369
  [Op2.and]: [
100335
100370
  topInclude.where,
100336
- { [Op2.join]: this.sequelize.literal(join156) }
100371
+ { [Op2.join]: this.sequelize.literal(join157) }
100337
100372
  ]
100338
100373
  },
100339
100374
  limit: 1,
@@ -106820,7 +106855,7 @@ var require_postgres = __commonJS({
106820
106855
  var require_connection_manager7 = __commonJS({
106821
106856
  "node_modules/sequelize/lib/dialects/sqlite/connection-manager.js"(exports2, module2) {
106822
106857
  "use strict";
106823
- var fs29 = require("fs");
106858
+ var fs30 = require("fs");
106824
106859
  var path34 = require("path");
106825
106860
  var AbstractConnectionManager = require_connection_manager();
106826
106861
  var { logger: logger107 } = require_logger();
@@ -106865,7 +106900,7 @@ var require_connection_manager7 = __commonJS({
106865
106900
  return this.connections[options2.inMemory || options2.uuid];
106866
106901
  }
106867
106902
  if (!options2.inMemory && (options2.readWriteMode & this.lib.OPEN_CREATE) !== 0) {
106868
- fs29.mkdirSync(path34.dirname(options2.storage), { recursive: true });
106903
+ fs30.mkdirSync(path34.dirname(options2.storage), { recursive: true });
106869
106904
  }
106870
106905
  const connection = await new Promise((resolve29, reject2) => {
106871
106906
  this.connections[options2.inMemory || options2.uuid] = new this.lib.Database(options2.storage, options2.readWriteMode, (err3) => {
@@ -112492,6 +112527,11 @@ async function ensureMessageBlockSchema(sequelize) {
112492
112527
  CREATE INDEX IF NOT EXISTS idx_message_blocks_children
112493
112528
  ON message_blocks(message_id, parent_block_id, relation, slot_key, ordinal)
112494
112529
  `);
112530
+ await sequelize.query(`
112531
+ CREATE INDEX IF NOT EXISTS idx_message_blocks_declarative_ui
112532
+ ON message_blocks(type)
112533
+ WHERE type = 'declarative-ui'
112534
+ `);
112495
112535
  }
112496
112536
  async function messageBlockSchemaNeedsRebuild(sequelize) {
112497
112537
  const columns = await sequelize.query("PRAGMA table_info(message_blocks)", {
@@ -115443,6 +115483,16 @@ var init_SavedMessageRepository = __esm({
115443
115483
  }
115444
115484
  });
115445
115485
 
115486
+ // src/main/infra/db/repositories/index.ts
115487
+ var init_repositories = __esm({
115488
+ "src/main/infra/db/repositories/index.ts"() {
115489
+ "use strict";
115490
+ init_MessageRepository();
115491
+ init_GuidanceRequestRepository();
115492
+ init_SavedMessageRepository();
115493
+ }
115494
+ });
115495
+
115446
115496
  // node_modules/cron-parser/dist/fields/types.js
115447
115497
  var require_types3 = __commonJS({
115448
115498
  "node_modules/cron-parser/dist/fields/types.js"(exports2) {
@@ -126960,7 +127010,6 @@ var init_tool_names = __esm({
126960
127010
  COORDINATION_TOOL_NAMES.TASK_LIST,
126961
127011
  COORDINATION_TOOL_NAMES.GOAL_REVIEW,
126962
127012
  COORDINATION_TOOL_NAMES.GOAL_BREAK,
126963
- BUILT_IN_TOOL_NAMES.TODO,
126964
127013
  BUILT_IN_TOOL_NAMES.CONTEXT_ROTATE,
126965
127014
  BUILT_IN_TOOL_NAMES.HOST_ACTION,
126966
127015
  BUILT_IN_TOOL_NAMES.E2E_COUNTER
@@ -131297,17 +131346,6 @@ var init_repository = __esm({
131297
131346
  }
131298
131347
  });
131299
131348
 
131300
- // src/main/infra/db/repositories/index.ts
131301
- var init_repositories = __esm({
131302
- "src/main/infra/db/repositories/index.ts"() {
131303
- "use strict";
131304
- init_MessageRepository();
131305
- init_GuidanceRequestRepository();
131306
- init_SavedMessageRepository();
131307
- init_repository();
131308
- }
131309
- });
131310
-
131311
131349
  // src/main/infra/db/Database.ts
131312
131350
  var import_path68, logger24, Database;
131313
131351
  var init_Database = __esm({
@@ -146551,7 +146589,7 @@ var require_form_data = __commonJS({
146551
146589
  var http2 = require("http");
146552
146590
  var https2 = require("https");
146553
146591
  var parseUrl = require("url").parse;
146554
- var fs29 = require("fs");
146592
+ var fs30 = require("fs");
146555
146593
  var Stream2 = require("stream").Stream;
146556
146594
  var crypto10 = require("crypto");
146557
146595
  var mime = require_mime_types();
@@ -146621,7 +146659,7 @@ var require_form_data = __commonJS({
146621
146659
  if (value.end != void 0 && value.end != Infinity && value.start != void 0) {
146622
146660
  callback(null, value.end + 1 - (value.start ? value.start : 0));
146623
146661
  } else {
146624
- fs29.stat(value.path, function(err3, stat40) {
146662
+ fs30.stat(value.path, function(err3, stat40) {
146625
146663
  if (err3) {
146626
146664
  callback(err3);
146627
146665
  return;
@@ -147440,16 +147478,16 @@ var require_follow_redirects = __commonJS({
147440
147478
  destroy.call(this, error62);
147441
147479
  return this;
147442
147480
  };
147443
- RedirectableRequest.prototype.write = function(data2, encoding2, callback) {
147481
+ RedirectableRequest.prototype.write = function(data2, encoding, callback) {
147444
147482
  if (this._ending) {
147445
147483
  throw new WriteAfterEndError();
147446
147484
  }
147447
147485
  if (!isString2(data2) && !isBuffer2(data2)) {
147448
147486
  throw new TypeError("data should be a string, Buffer or Uint8Array");
147449
147487
  }
147450
- if (isFunction(encoding2)) {
147451
- callback = encoding2;
147452
- encoding2 = null;
147488
+ if (isFunction(encoding)) {
147489
+ callback = encoding;
147490
+ encoding = null;
147453
147491
  }
147454
147492
  if (data2.length === 0) {
147455
147493
  if (callback) {
@@ -147459,20 +147497,20 @@ var require_follow_redirects = __commonJS({
147459
147497
  }
147460
147498
  if (this._requestBodyLength + data2.length <= this._options.maxBodyLength) {
147461
147499
  this._requestBodyLength += data2.length;
147462
- this._requestBodyBuffers.push({ data: data2, encoding: encoding2 });
147463
- this._currentRequest.write(data2, encoding2, callback);
147500
+ this._requestBodyBuffers.push({ data: data2, encoding });
147501
+ this._currentRequest.write(data2, encoding, callback);
147464
147502
  } else {
147465
147503
  this.emit("error", new MaxBodyLengthExceededError());
147466
147504
  this.abort();
147467
147505
  }
147468
147506
  };
147469
- RedirectableRequest.prototype.end = function(data2, encoding2, callback) {
147507
+ RedirectableRequest.prototype.end = function(data2, encoding, callback) {
147470
147508
  if (isFunction(data2)) {
147471
147509
  callback = data2;
147472
- data2 = encoding2 = null;
147473
- } else if (isFunction(encoding2)) {
147474
- callback = encoding2;
147475
- encoding2 = null;
147510
+ data2 = encoding = null;
147511
+ } else if (isFunction(encoding)) {
147512
+ callback = encoding;
147513
+ encoding = null;
147476
147514
  }
147477
147515
  if (!data2) {
147478
147516
  this._ended = this._ending = true;
@@ -147480,7 +147518,7 @@ var require_follow_redirects = __commonJS({
147480
147518
  } else {
147481
147519
  var self2 = this;
147482
147520
  var currentRequest = this._currentRequest;
147483
- this.write(data2, encoding2, function() {
147521
+ this.write(data2, encoding, function() {
147484
147522
  self2._ended = true;
147485
147523
  currentRequest.end(null, null, callback);
147486
147524
  });
@@ -147757,8 +147795,8 @@ var require_follow_redirects = __commonJS({
147757
147795
  }
147758
147796
  return parsed;
147759
147797
  }
147760
- function resolveUrl2(relative27, base) {
147761
- return useNativeURL ? new URL4(relative27, base) : parseUrl(url2.resolve(base, relative27));
147798
+ function resolveUrl2(relative28, base) {
147799
+ return useNativeURL ? new URL4(relative28, base) : parseUrl(url2.resolve(base, relative28));
147762
147800
  }
147763
147801
  function validateUrl(input2) {
147764
147802
  if (/^\[/.test(input2.hostname) && !/^\[[:0-9a-f]+\]$/i.test(input2.hostname)) {
@@ -149825,7 +149863,7 @@ var require_axios = __commonJS({
149825
149863
  }
149826
149864
  const type = match[1];
149827
149865
  const params = match[2];
149828
- const encoding2 = match[3] ? "base64" : "utf8";
149866
+ const encoding = match[3] ? "base64" : "utf8";
149829
149867
  const body = match[4];
149830
149868
  let mime = "";
149831
149869
  if (type) {
@@ -149833,7 +149871,7 @@ var require_axios = __commonJS({
149833
149871
  } else if (params) {
149834
149872
  mime = "text/plain" + params;
149835
149873
  }
149836
- const buffer = encoding2 === "base64" ? Buffer.from(body.replace(/%([\da-f]{2})/gi, (_3, hex3) => String.fromCharCode(parseInt(hex3, 16))), "base64") : Buffer.from(decodeURIComponent(body), encoding2);
149874
+ const buffer = encoding === "base64" ? Buffer.from(body.replace(/%([\da-f]{2})/gi, (_3, hex3) => String.fromCharCode(parseInt(hex3, 16))), "base64") : Buffer.from(decodeURIComponent(body), encoding);
149837
149875
  if (asBlob) {
149838
149876
  if (!_Blob) {
149839
149877
  throw new AxiosError("Blob is not supported", AxiosError.ERR_NOT_SUPPORT);
@@ -149901,7 +149939,7 @@ var require_axios = __commonJS({
149901
149939
  }
149902
149940
  return super._read(size);
149903
149941
  }
149904
- _transform(chunk3, encoding2, callback) {
149942
+ _transform(chunk3, encoding, callback) {
149905
149943
  const internals = this[kInternals];
149906
149944
  const maxRate = internals.maxRate;
149907
149945
  const readableHighWaterMark = this.readableHighWaterMark;
@@ -150071,21 +150109,21 @@ var require_axios = __commonJS({
150071
150109
  })());
150072
150110
  };
150073
150111
  var ZlibHeaderTransformStream = class extends stream.Transform {
150074
- __transform(chunk3, encoding2, callback) {
150112
+ __transform(chunk3, encoding, callback) {
150075
150113
  this.push(chunk3);
150076
150114
  callback();
150077
150115
  }
150078
- _transform(chunk3, encoding2, callback) {
150116
+ _transform(chunk3, encoding, callback) {
150079
150117
  if (chunk3.length !== 0) {
150080
150118
  this._transform = this.__transform;
150081
150119
  if (chunk3[0] !== 120) {
150082
150120
  const header = Buffer.alloc(2);
150083
150121
  header[0] = 120;
150084
150122
  header[1] = 156;
150085
- this.push(header, encoding2);
150123
+ this.push(header, encoding);
150086
150124
  }
150087
150125
  }
150088
- this.__transform(chunk3, encoding2, callback);
150126
+ this.__transform(chunk3, encoding, callback);
150089
150127
  }
150090
150128
  };
150091
150129
  var Http2Sessions = class {
@@ -154365,7 +154403,7 @@ var require_receiver = __commonJS({
154365
154403
  * @param {Function} cb Callback
154366
154404
  * @private
154367
154405
  */
154368
- _write(chunk3, encoding2, cb) {
154406
+ _write(chunk3, encoding, cb) {
154369
154407
  if (this._opcode === 8 && this._state == GET_INFO) return cb();
154370
154408
  if (this._maxBufferedChunks > 0 && this._buffers.length >= this._maxBufferedChunks) {
154371
154409
  cb(
@@ -156774,10 +156812,10 @@ var require_stream2 = __commonJS({
156774
156812
  duplex._read = function() {
156775
156813
  if (ws2.isPaused) ws2.resume();
156776
156814
  };
156777
- duplex._write = function(chunk3, encoding2, callback) {
156815
+ duplex._write = function(chunk3, encoding, callback) {
156778
156816
  if (ws2.readyState === ws2.CONNECTING) {
156779
156817
  ws2.once("open", function open16() {
156780
- duplex._write(chunk3, encoding2, callback);
156818
+ duplex._write(chunk3, encoding, callback);
156781
156819
  });
156782
156820
  return;
156783
156821
  }
@@ -165784,8 +165822,8 @@ var require_minimal = __commonJS({
165784
165822
  return;
165785
165823
  }
165786
165824
  util._Buffer_from = Buffer2.from !== Uint8Array.from && Buffer2.from || /* istanbul ignore next */
165787
- function Buffer_from(value, encoding2) {
165788
- return new Buffer2(value, encoding2);
165825
+ function Buffer_from(value, encoding) {
165826
+ return new Buffer2(value, encoding);
165789
165827
  };
165790
165828
  util._Buffer_allocUnsafe = Buffer2.allocUnsafe || /* istanbul ignore next */
165791
165829
  function Buffer_allocUnsafe(size) {
@@ -166435,7 +166473,7 @@ var require_lib4 = __commonJS({
166435
166473
  "use strict";
166436
166474
  Object.defineProperty(exports2, "__esModule", { value: true });
166437
166475
  var axios = require_axios();
166438
- var fs29 = require("fs");
166476
+ var fs30 = require("fs");
166439
166477
  var path34 = require("path");
166440
166478
  var crypto10 = require("crypto");
166441
166479
  var qs2 = require_lib3();
@@ -166453,7 +166491,7 @@ var require_lib4 = __commonJS({
166453
166491
  return e && typeof e === "object" && "default" in e ? e : { "default": e };
166454
166492
  }
166455
166493
  var axios__default = /* @__PURE__ */ _interopDefaultLegacy(axios);
166456
- var fs__default = /* @__PURE__ */ _interopDefaultLegacy(fs29);
166494
+ var fs__default = /* @__PURE__ */ _interopDefaultLegacy(fs30);
166457
166495
  var path__default = /* @__PURE__ */ _interopDefaultLegacy(path34);
166458
166496
  var crypto__default = /* @__PURE__ */ _interopDefaultLegacy(crypto10);
166459
166497
  var identity__default = /* @__PURE__ */ _interopDefaultLegacy(identity);
@@ -275165,8 +275203,8 @@ function preprocess2() {
275165
275203
  let start = true;
275166
275204
  let atCarriageReturn;
275167
275205
  return preprocessor;
275168
- function preprocessor(value, encoding2, end2) {
275169
- value = buffer + (typeof value === "string" ? value.toString() : new TextDecoder(encoding2 || void 0).decode(value));
275206
+ function preprocessor(value, encoding, end2) {
275207
+ value = buffer + (typeof value === "string" ? value.toString() : new TextDecoder(encoding || void 0).decode(value));
275170
275208
  const chunks = [];
275171
275209
  let startPosition = 0;
275172
275210
  buffer = "";
@@ -275315,12 +275353,12 @@ var init_unist_util_stringify_position = __esm({
275315
275353
  });
275316
275354
 
275317
275355
  // node_modules/mdast-util-from-markdown/lib/index.js
275318
- function fromMarkdown(value, encoding2, options2) {
275319
- if (encoding2 && typeof encoding2 === "object") {
275320
- options2 = encoding2;
275321
- encoding2 = void 0;
275356
+ function fromMarkdown(value, encoding, options2) {
275357
+ if (encoding && typeof encoding === "object") {
275358
+ options2 = encoding;
275359
+ encoding = void 0;
275322
275360
  }
275323
- return compiler(options2)(postprocess(parse5(options2).document().write(preprocess2()(value, encoding2, true))));
275361
+ return compiler(options2)(postprocess(parse5(options2).document().write(preprocess2()(value, encoding, true))));
275324
275362
  }
275325
275363
  function compiler(options2) {
275326
275364
  const config3 = {
@@ -280327,7 +280365,7 @@ var require_auth_config = __commonJS({
280327
280365
  writeAuthConfig: () => writeAuthConfig
280328
280366
  });
280329
280367
  module2.exports = __toCommonJS2(auth_config_exports);
280330
- var fs29 = __toESM2(require("fs"));
280368
+ var fs30 = __toESM2(require("fs"));
280331
280369
  var path34 = __toESM2(require("path"));
280332
280370
  var import_token_util = require_token_util();
280333
280371
  function getAuthConfigPath() {
@@ -280342,10 +280380,10 @@ var require_auth_config = __commonJS({
280342
280380
  function readAuthConfig() {
280343
280381
  try {
280344
280382
  const authPath = getAuthConfigPath();
280345
- if (!fs29.existsSync(authPath)) {
280383
+ if (!fs30.existsSync(authPath)) {
280346
280384
  return null;
280347
280385
  }
280348
- const content3 = fs29.readFileSync(authPath, "utf8");
280386
+ const content3 = fs30.readFileSync(authPath, "utf8");
280349
280387
  if (!content3) {
280350
280388
  return null;
280351
280389
  }
@@ -280357,10 +280395,10 @@ var require_auth_config = __commonJS({
280357
280395
  function writeAuthConfig(config3) {
280358
280396
  const authPath = getAuthConfigPath();
280359
280397
  const authDir = path34.dirname(authPath);
280360
- if (!fs29.existsSync(authDir)) {
280361
- fs29.mkdirSync(authDir, { mode: 504, recursive: true });
280398
+ if (!fs30.existsSync(authDir)) {
280399
+ fs30.mkdirSync(authDir, { mode: 504, recursive: true });
280362
280400
  }
280363
- fs29.writeFileSync(authPath, JSON.stringify(config3, null, 2), { mode: 384 });
280401
+ fs30.writeFileSync(authPath, JSON.stringify(config3, null, 2), { mode: 384 });
280364
280402
  }
280365
280403
  function isValidAccessToken(authConfig, expirationBufferMs = 0) {
280366
280404
  if (!authConfig.token)
@@ -280552,7 +280590,7 @@ var require_token_util = __commonJS({
280552
280590
  });
280553
280591
  module2.exports = __toCommonJS2(token_util_exports);
280554
280592
  var path34 = __toESM2(require("path"));
280555
- var fs29 = __toESM2(require("fs"));
280593
+ var fs30 = __toESM2(require("fs"));
280556
280594
  var import_token_error = require_token_error();
280557
280595
  var import_token_io = require_token_io();
280558
280596
  var import_auth_config = require_auth_config();
@@ -280641,12 +280679,12 @@ var require_token_util = __commonJS({
280641
280679
  );
280642
280680
  }
280643
280681
  const prjPath = path34.join(dir, ".vercel", "project.json");
280644
- if (!fs29.existsSync(prjPath)) {
280682
+ if (!fs30.existsSync(prjPath)) {
280645
280683
  throw new import_token_error.VercelOidcTokenError(
280646
280684
  "project.json not found, have you linked your project with `vc link?`"
280647
280685
  );
280648
280686
  }
280649
- const prj = JSON.parse(fs29.readFileSync(prjPath, "utf8"));
280687
+ const prj = JSON.parse(fs30.readFileSync(prjPath, "utf8"));
280650
280688
  if (typeof prj.projectId !== "string" && typeof prj.orgId !== "string") {
280651
280689
  throw new TypeError(
280652
280690
  "Expected a string-valued projectId property. Try running `vc link` to re-link your project."
@@ -280663,9 +280701,9 @@ var require_token_util = __commonJS({
280663
280701
  }
280664
280702
  const tokenPath = path34.join(dir, "com.vercel.token", `${projectId}.json`);
280665
280703
  const tokenJson = JSON.stringify(token);
280666
- fs29.mkdirSync(path34.dirname(tokenPath), { mode: 504, recursive: true });
280667
- fs29.writeFileSync(tokenPath, tokenJson);
280668
- fs29.chmodSync(tokenPath, 432);
280704
+ fs30.mkdirSync(path34.dirname(tokenPath), { mode: 504, recursive: true });
280705
+ fs30.writeFileSync(tokenPath, tokenJson);
280706
+ fs30.chmodSync(tokenPath, 432);
280669
280707
  return;
280670
280708
  }
280671
280709
  function loadToken(projectId) {
@@ -280676,10 +280714,10 @@ var require_token_util = __commonJS({
280676
280714
  );
280677
280715
  }
280678
280716
  const tokenPath = path34.join(dir, "com.vercel.token", `${projectId}.json`);
280679
- if (!fs29.existsSync(tokenPath)) {
280717
+ if (!fs30.existsSync(tokenPath)) {
280680
280718
  return null;
280681
280719
  }
280682
- const token = JSON.parse(fs29.readFileSync(tokenPath, "utf8"));
280720
+ const token = JSON.parse(fs30.readFileSync(tokenPath, "utf8"));
280683
280721
  assertVercelOidcTokenResponse(token);
280684
280722
  return token;
280685
280723
  }
@@ -340683,11 +340721,11 @@ var require_excerpt = __commonJS({
340683
340721
  if (typeof opts.excerpt === "function") {
340684
340722
  return opts.excerpt(file2, opts);
340685
340723
  }
340686
- const sep19 = file2.data.excerpt_separator || opts.excerpt_separator;
340687
- if (sep19 == null && (opts.excerpt === false || opts.excerpt == null)) {
340724
+ const sep20 = file2.data.excerpt_separator || opts.excerpt_separator;
340725
+ if (sep20 == null && (opts.excerpt === false || opts.excerpt == null)) {
340688
340726
  return file2;
340689
340727
  }
340690
- const delimiter = typeof opts.excerpt === "string" ? opts.excerpt : sep19 || opts.delimiters[0];
340728
+ const delimiter = typeof opts.excerpt === "string" ? opts.excerpt : sep20 || opts.delimiters[0];
340691
340729
  const idx = file2.content.indexOf(delimiter);
340692
340730
  if (idx !== -1) {
340693
340731
  file2.excerpt = file2.content.slice(0, idx);
@@ -340752,7 +340790,7 @@ var require_parse4 = __commonJS({
340752
340790
  var require_gray_matter = __commonJS({
340753
340791
  "node_modules/gray-matter/index.js"(exports2, module2) {
340754
340792
  "use strict";
340755
- var fs29 = require("fs");
340793
+ var fs30 = require("fs");
340756
340794
  var sections = require_section_matter();
340757
340795
  var defaults3 = require_defaults2();
340758
340796
  var stringify4 = require_stringify2();
@@ -340836,7 +340874,7 @@ var require_gray_matter = __commonJS({
340836
340874
  return stringify4(file2, data2, options2);
340837
340875
  };
340838
340876
  matter6.read = function(filepath, options2) {
340839
- const str2 = fs29.readFileSync(filepath, "utf8");
340877
+ const str2 = fs30.readFileSync(filepath, "utf8");
340840
340878
  const file2 = matter6(str2, options2);
340841
340879
  file2.path = filepath;
340842
340880
  return file2;
@@ -343019,11 +343057,11 @@ function derivePluginSourceEndpoints(address) {
343019
343057
  parsed.search = "";
343020
343058
  parsed.hash = "";
343021
343059
  if (!parsed.pathname.endsWith("/")) parsed.pathname = `${parsed.pathname}/`;
343022
- const join156 = (relative27) => new URL(relative27, parsed.toString()).toString();
343060
+ const join157 = (relative28) => new URL(relative28, parsed.toString()).toString();
343023
343061
  return {
343024
- host: join156(PLUGIN_SOURCE_HOST_FILENAME),
343025
- list: join156(PLUGIN_SOURCE_LIST_FILENAME),
343026
- detail: (pluginId) => join156(`plugins/${pluginId}/manifest.json`)
343062
+ host: join157(PLUGIN_SOURCE_HOST_FILENAME),
343063
+ list: join157(PLUGIN_SOURCE_LIST_FILENAME),
343064
+ detail: (pluginId) => join157(`plugins/${pluginId}/manifest.json`)
343027
343065
  };
343028
343066
  }
343029
343067
  function parseSourceHostDescriptor(raw) {
@@ -347706,7 +347744,7 @@ async function createSwarmTools(calls, options2 = {}) {
347706
347744
  }
347707
347745
  function createGoalBreakTool(calls) {
347708
347746
  return tool({
347709
- description: 'Stop the current Goal loop. Use status="paused" only when the user has asked to stop temporarily; use status="blocked" only when the Goal cannot continue autonomously because user input, an external dependency, or a system limitation is required. Do not use blocked merely because work remains or the current execution budget ended.',
347747
+ description: "Stop the Goal loop. paused = the user asked to stop for now. blocked = it cannot continue autonomously (needs user input, an external dependency, or hits a system limit); it also requires `blockedBy` and a concrete `resumeAction`. Never use blocked just because work remains or the budget ran out.",
347710
347748
  inputSchema: external_exports.object({
347711
347749
  status: external_exports.enum(["paused", "blocked"]).describe(
347712
347750
  "paused: user asked to stop temporarily; blocked: the Goal cannot continue autonomously"
@@ -347738,7 +347776,7 @@ function createGoalBreakTool(calls) {
347738
347776
  }
347739
347777
  function createHandoffTool(calls) {
347740
347778
  return tool({
347741
- description: "Transfer the conversation to another agent when the next response should primarily come from that agent. Use this when the user request is mainly in another member's specialty or when the current agent lacks the right specialty to answer well. After handoff, the current agent stops responding. Use `summary` to pass the essential context the next agent needs. For supplemental expert input while you remain responsible, use `task_delegate`; for parallel viewpoints, use `broadcast`.",
347779
+ description: "Transfer the conversation to another agent when the next response should primarily come from that agent \u2014 the request is mainly in another member's specialty, or the current agent lacks the right specialty to answer well. After handoff you stop responding; pass `summary` with the context it needs. Stay responsible yourself \u2192 use `task_delegate`; want parallel viewpoints \u2192 use `broadcast`.",
347742
347780
  inputSchema: external_exports.object({
347743
347781
  targetAgentId: external_exports.string(),
347744
347782
  reason: external_exports.string(),
@@ -347816,11 +347854,11 @@ function createTaskTool(calls, delegation) {
347816
347854
  }
347817
347855
  function createContinueTaskTool(calls) {
347818
347856
  return tool({
347819
- description: 'Continue a task that has already finished (`completed` / `failed` / `killed` / `ambiguous`) while keeping its own context. The sub-agent picks up from the conversation of its previous attempt and runs one more round, so it still knows what it already did and why. Use this when the previous work is still valid but insufficient. If the previous approach itself was wrong, use `task_delegate` to start a fresh task instead: carrying a wrong context forward makes the sub-agent defend its earlier mistakes. `instruction` is required when the task is `completed` \u2014 a finished task needs new work to continue \u2014 and optional when it failed or was stopped, where omitting it means "keep going with the unfinished work". This is the only way to keep working on a finished task: `task_send` refuses it (`task_finished`). Effects of the previous attempt may already have landed: verify before redoing them. Once it restarts, steer it with `task_send` and collect the outcome with `task_wait`.',
347857
+ description: "Continue a task that has already finished (`completed` / `failed` / `killed` / `ambiguous`) with its own context: it runs one more round knowing what it already did. Use it when the earlier work is still valid but insufficient \u2014 if the approach itself was wrong, `task_delegate` fresh: carrying a wrong context forward makes the sub-agent defend its earlier mistakes. This is the only way back into a finished task: `task_send` refuses it (`task_finished`). Its previous effects may already have landed \u2014 verify before redoing.",
347820
347858
  inputSchema: external_exports.object({
347821
347859
  taskId: external_exports.string().describe("ID of the finished task to continue"),
347822
347860
  instruction: external_exports.string().optional().describe(
347823
- "What this task should do next; required when the task is completed, optional otherwise"
347861
+ "What to do next; required when the task is `completed`, otherwise omit to keep going with the unfinished work"
347824
347862
  )
347825
347863
  }).strict(),
347826
347864
  execute: async ({ taskId, instruction }, { abortSignal }) => {
@@ -347831,12 +347869,10 @@ function createContinueTaskTool(calls) {
347831
347869
  }
347832
347870
  function createSendTaskTool(calls) {
347833
347871
  return tool({
347834
- description: "Send a guidance message to a task that has not finished yet (`task_delegate`): running, or still queued behind the concurrency limit. Use this to steer work already in flight \u2014 supply a missing constraint, correct an assumption, or narrow the scope \u2014 instead of stopping it and delegating again. The message is delivered to that task only \u2014 a task on the built-in engine reads it at its next step boundary; it is not an answer to the task and does not start new work. A task running on an external agent backend that supports mid-turn steering picks it up by polling during that same turn, so it may not be read before the turn ends. A task whose backend has no mid-turn channel is refused: stop it with `task_kill` and continue the same thread with `task_continue`. A queued task accepts it too, but nothing can read it before that task starts: it is read at its first step boundary after it starts, and never if it is cancelled before that. This cannot reach a task that has already completed, failed or been stopped: if the work is finished, use `task_continue` with `instruction` \u2014 it replays that task's archived thread and keeps the same taskId. Do not re-delegate with the previous result pasted in just to continue the same task. Tasks are per-turn: a task delegated in an earlier turn is not visible here (same limit as `task_wait` and `task_list`).",
347872
+ description: "Steer a task that has not finished \u2014 add a constraint, correct an assumption, narrow the scope. Don't stop it and re-delegate. Where it lands: still queued \u2192 nothing reads it before that task starts; it lands at its first step, and never if it is cancelled first. running, built-in engine \u2192 next step boundary. running, external backend with mid-turn steering \u2192 may be polled during the same turn, otherwise refused (`task_kill` + `task_continue`). Already finished \u2192 refused: send the same text as `task_continue`'s `instruction`. Never an answer to the task, never starts new work. Tasks are per-turn.",
347835
347873
  inputSchema: external_exports.object({
347836
347874
  taskId: external_exports.string().describe("ID of the task to steer (running, or still queued)"),
347837
- content: external_exports.string().trim().min(1).describe(
347838
- "The guidance itself, addressed to the agent that is still running (a constraint or correction, not a question). If the task has already finished, send this same text as `task_continue`'s `instruction` instead \u2014 this tool will not start a new round."
347839
- )
347875
+ content: external_exports.string().trim().min(1).describe("The guidance itself \u2014 a constraint or correction, not a question")
347840
347876
  }),
347841
347877
  execute: async ({ taskId, content: content3 }, { abortSignal }) => {
347842
347878
  if (abortSignal?.aborted) throw new DOMException("The operation was aborted", "AbortError");
@@ -347859,7 +347895,7 @@ function createKillTaskTool(calls) {
347859
347895
  }
347860
347896
  function createListTaskTool(calls) {
347861
347897
  return tool({
347862
- description: "List the tasks of the current turn and their status. Use this to inspect work started with `task_delegate`, decide whether to wait, or identify a task to stop. This is an INDEX, not the results: each entry carries the id, a short label, the status and whether it has been collected \u2014 call `task_wait` with the ids to get their results.",
347898
+ description: "List this turn's tasks: id, label, status, collected. An index, not the results \u2014 wait on the ids with `task_wait` to get those.",
347863
347899
  inputSchema: external_exports.object(),
347864
347900
  execute: async (_3, { abortSignal }) => {
347865
347901
  if (abortSignal?.aborted) throw new DOMException("The operation was aborted", "AbortError");
@@ -347869,12 +347905,10 @@ function createListTaskTool(calls) {
347869
347905
  }
347870
347906
  function createWaitTaskTool(calls) {
347871
347907
  return tool({
347872
- description: 'Wait for one or more tasks, then return their results. Use this after starting tasks asynchronously when you are ready to collect the outcomes. If you only need to inspect running tasks without waiting, use `task_list` instead. Task ids are per-turn: an id from an earlier turn is not found, and that item comes back as status "failed" with `reason: "task_not_found"` plus a `hint` \u2014 use `task_list` to list the tasks of this turn. A result `preview` can be a fragment: when `artifact.truncated === true` the rest is only in `artifact.path`, so read it with `file_read` before you answer from it. The top-level `truncatedResults` lists the items you have not really read yet (`artifactPath` missing means no full text exists \u2014 use `task_continue` to ask for a shorter one). The default `mode: "all"` returns only after every requested task has finished \u2014 use it when you need all the results before continuing. Set `mode: "any"` only when you can act usefully on whatever has already finished: it returns as soon as any one task finishes (or when new guidance arrives). An `any` return with `partial: { reason: "settled", pendingTaskIds: [...] }` means those pending tasks are still running, were NOT cancelled, and remain finish blockers \u2014 call `task_wait` again with them to collect. Typical `any` uses: steer the still-running tasks with `task_send` once a sibling result has arrived, or start work that depends on just the finished one. If the user sends new guidance while you are waiting, the wait yields early instead of blocking: the result then carries `interrupted: { reason: "guidance", taskIds: [...] }`, and those taskIds come back with `status: "running"` / `"queued"` and no result \u2014 they are still running and have NOT been collected. Guidance takes precedence over `mode: "any"`. In that case, respond to the new guidance first, then call `task_wait` again with the ids from `interrupted.taskIds` to collect their results.',
347908
+ description: 'Wait for tasks, then return their results. Ids are per-turn: an id from an earlier turn comes back `failed` with `reason: "task_not_found"` \u2014 use `task_list` for this turn\'s ids. A truncated `preview` points at `artifact.path`: read it before answering. `artifactPath` missing means no full text exists \u2014 ask for a shorter result with `task_continue`. `mode: "all"` (default) waits for every task. `mode: "any"` returns on the first settle \u2014 use it only when you can act on that subset: the rest are still running, were not cancelled, and still block finishing, so `task_wait` them again. New user guidance ends the wait instead of blocking: `interrupted.taskIds` are untouched and uncollected \u2014 handle the guidance first, then collect them. Guidance outranks `mode: "any"`.',
347873
347909
  inputSchema: external_exports.object({
347874
347910
  taskIds: external_exports.array(external_exports.string()).min(1).describe("Task IDs to wait for"),
347875
- mode: external_exports.enum(["all", "any"]).optional().describe(
347876
- "Wait strategy. 'all' (default) returns only after every task finishes. 'any' returns as soon as the first task finishes; use it only if you can act on the finished subset. Either way, tasks named in partial.pendingTaskIds / interrupted.taskIds are still running and must be collected with another task_wait."
347877
- )
347911
+ mode: external_exports.enum(["all", "any"]).optional().describe("all waits for every task; any returns on the first settle and leaves the rest running")
347878
347912
  }),
347879
347913
  execute: async ({ taskIds, mode }, { abortSignal }) => {
347880
347914
  if (abortSignal?.aborted) throw new DOMException("The operation was aborted", "AbortError");
@@ -347884,7 +347918,7 @@ function createWaitTaskTool(calls) {
347884
347918
  }
347885
347919
  function createBroadcastTool(calls) {
347886
347920
  return tool({
347887
- description: "Broadcast a question to multiple agents in parallel. All target agents receive the same question at the same time and respond independently. Use this when you want diverse viewpoints, parallel expert input, or a quick team discussion. This call returns immediately: it starts one task per target and reports the task ids. It never waits for the answers. Collect the outcomes with `task_wait(taskIds)` once you are ready \u2014 the same way as tasks started with `task_delegate` \u2014 steer a still-running one with `task_send`, and stop one with `task_kill`. Use `task_list` to inspect them. A target that cannot be started is reported in `rejected[]` while the other targets keep running; an `error` with no tasks means nothing was started at all.",
347921
+ description: "Ask several agents the same question at once; each answers independently. Use it for diverse viewpoints, parallel expert input, or a quick team discussion. It returns immediately \u2014 one task per target, ids reported, never waits for answers. Collect with `task_wait`, steer a running one with `task_send`, stop one with `task_kill`, inspect with `task_list`. A target that could not start lands in `rejected[]` while the others keep running; `error` with no tasks means nothing started at all.",
347888
347922
  inputSchema: external_exports.object({
347889
347923
  question: external_exports.string().describe("Question or topic to broadcast"),
347890
347924
  targetAgentIds: external_exports.array(external_exports.string()).min(1).describe("Target agent IDs (at least one)"),
@@ -347899,12 +347933,12 @@ function createBroadcastTool(calls) {
347899
347933
  function createGoalReviewTool(calls) {
347900
347934
  const validDecisions = ["complete", "needs_more_work", "needs_user_decision"];
347901
347935
  return tool({
347902
- description: 'Submit the structured Goal Review decision after every execution step is settled (completed or abandoned). Call this exactly once in the review phase. The runtime uses this tool result as the control signal. Do not treat completed steps as sufficient proof of completion: compare goal.md, success criteria, actual delivered evidence, tool/task results, and unresolved blockers. The `decision` field must be one of: "complete", "needs_more_work", "needs_user_decision". The `toUser` field is the user-facing text and is required when decision="complete" (final response citing delivered evidence) or decision="needs_user_decision" (clear question for the user). When decision="needs_more_work", first update plan.md and use the `todo` tool to add at least one pending step; provide reasoning and use this even if every step is completed when the original goal is still not truly met. Every abandoned step must be named with its reason in `reasoning`.',
347936
+ description: "Submit the Goal Review verdict exactly once, in the review phase, after every step is settled (completed or abandoned). The runtime takes this result as the control signal. A completed step is not proof the goal is met: compare goal.md, the success criteria, and the actual evidence. complete / needs_user_decision require `toUser` \u2014 the final answer citing evidence, or the question for the user. needs_more_work requires an updated plan.md plus at least one pending `todo` step first. Name every abandoned step and its reason in `reasoning`.",
347903
347937
  inputSchema: external_exports.object({
347904
- decision: external_exports.enum(validDecisions).describe('One of: "complete", "needs_more_work", "needs_user_decision"'),
347938
+ decision: external_exports.enum(validDecisions).describe("Verdict for this review"),
347905
347939
  reasoning: external_exports.string().min(1).describe("Why this decision was made"),
347906
347940
  toUser: external_exports.string().optional().describe(
347907
- 'Required when decision="complete" or "needs_user_decision". User-facing text: final response for complete, question for needs_user_decision.'
347941
+ "Required for complete or needs_user_decision: final answer for complete, question for needs_user_decision"
347908
347942
  )
347909
347943
  }),
347910
347944
  execute: async (params, { abortSignal }) => {
@@ -347959,31 +347993,27 @@ var init_swarm_tools = __esm({
347959
347993
  COORDINATION_TOOL_NAMES.BROADCAST
347960
347994
  ];
347961
347995
  SELF_BUDGETED_SWARM_TOOL_NAMES = [
347962
- "task_wait",
347963
- "task_delegate",
347964
- "task_continue",
347965
- "task_list"
347996
+ COORDINATION_TOOL_NAMES.TASK_WAIT,
347997
+ COORDINATION_TOOL_NAMES.TASK_DELEGATE,
347998
+ COORDINATION_TOOL_NAMES.TASK_CONTINUE,
347999
+ COORDINATION_TOOL_NAMES.TASK_LIST
347966
348000
  // 不含结果:每条仅 id + 60 字符标签 + 状态,且条目数封顶 25
347967
348001
  ];
347968
- TASK_TOOL_DESCRIPTION = "Delegate a task to another agent while keeping responsibility for the overall response. Delegation returns a taskId immediately and never blocks: collect the result later with `task_wait`, steer an in-flight task with `task_send`, and stop one with `task_kill`. You may call task_delegate multiple times in one assistant turn to run several tasks in parallel, then call `task_wait` with all taskIds when ready. Unlike `handoff`, the current agent remains the primary responder. The sub-agent starts from your briefing and cannot see your conversation: every turn it spends re-exploring is time and tokens you paid to discover something twice.";
347969
- TASK_BRIEF_DESCRIPTION = "A briefing, not a document dump. Keep this order: (1) goal \u2014 the verifiable outcome; (2) known facts \u2014 entry points as `path:line` + symbol, plus conclusions you already verified, so the sub-agent does not re-derive them; (3) boundaries \u2014 what NOT to read or touch, and hypotheses already ruled out; (4) verification \u2014 the exact command(s) to run and the result to expect, including any run you already did; (5) deliverable \u2014 the shape of the answer, and which coordinates it must report back for later tasks. Give coordinates, never paste file bodies: pasted text is re-billed on every sub-agent turn, a `path:line` costs about 20 tokens. Hand over only what the sub-agent cannot discover cheaply \u2014 test output you already collected, the worktree/branch in use, dead ends.";
347970
- TASK_CONTEXT_DESCRIPTION = "Facts the sub-agent cannot get from the repository: user constraints, prior decisions, links, IDs, environment quirks. Not a file dump \u2014 file coordinates belong in `task`.";
348002
+ TASK_TOOL_DESCRIPTION = "Delegate work to another agent; you stay the primary responder (unlike `handoff`). Delegation returns a taskId immediately and never blocks \u2014 collect it with `task_wait`, steer it with `task_send`, stop it with `task_kill`. call task_delegate multiple times in one turn to run work in parallel, then `task_wait` all the ids. The sub-agent cannot see this conversation: what it must re-discover, you pay for twice.";
348003
+ TASK_BRIEF_DESCRIPTION = "A briefing, not a document dump. Order: goal (verifiable outcome) \u2192 known facts (`path:line` + symbol, and what you already verified) \u2192 boundaries (what not to touch, ruled-out hypotheses) \u2192 verification (exact commands, expected result) \u2192 deliverable (its shape, and which coordinates to report back). Give coordinates, never file bodies: pasted text is re-billed on every sub-agent turn.";
348004
+ TASK_CONTEXT_DESCRIPTION = "What the repository cannot tell it: user constraints, prior decisions, links, IDs, environment quirks. Not a file dump \u2014 file coordinates belong in `task`.";
347971
348005
  AD_HOC_PROFILE_SCHEMA = external_exports.object({
347972
348006
  name: external_exports.string().describe("Display name of the temporary specialist, shown on the task card"),
347973
348007
  instructions: external_exports.string().describe(
347974
348008
  "Who this specialist is and what it is responsible for; rendered into its system prompt"
347975
348009
  ),
347976
- tools: external_exports.array(external_exports.string()).optional().describe(
347977
- "Tool allow-list, intersected with the caller\u2019s reachable tools \u2014 it can only narrow, never widen"
347978
- ),
347979
- model: external_exports.string().optional().describe("Model override; omit to inherit the session\u2019s model resolution chain"),
347980
- execution: external_exports.enum(["internal", "external"]).optional().describe(
347981
- "Execution backend kind; snapshot it so a continuation cannot switch backends silently"
347982
- )
348010
+ tools: external_exports.array(external_exports.string()).optional().describe("Tool allow-list; can only narrow the caller\u2019s tools, never widen"),
348011
+ model: external_exports.string().optional().describe("Model override; omit to inherit the session model"),
348012
+ execution: external_exports.enum(["internal", "external"]).optional().describe("Backend kind, frozen so a later continuation cannot switch silently")
347983
348013
  }).strict();
347984
348014
  DRAFT_SCHEMA_FIELD = {
347985
348015
  draft: external_exports.boolean().optional().describe(
347986
- "When true, only return the proposed delegation for the user to confirm: no task is created, nothing is queued and nothing appears in the task list. Call again without `draft` once the user confirms."
348016
+ "Return the proposal only: nothing is created, queued, or listed. Call again without `draft` once the user confirms."
347987
348017
  )
347988
348018
  };
347989
348019
  DRAFT_ONLY_NOTE = "Draft only \u2014 no task was created, nothing is queued, and nothing will appear in the task list. Show this proposal to the user (who runs the work, what the task is, what is out of scope), adjust it if they ask, and call this tool again without `draft` once they confirm.";
@@ -349796,7 +349826,6 @@ var init_errors6 = __esm({
349796
349826
  ThreadWriteConflictError: "ThreadWriteConflictError",
349797
349827
  SnapshotUnavailableError: "SnapshotUnavailableError",
349798
349828
  SnapshotMismatchError: "SnapshotMismatchError",
349799
- ThreadContextSurfaceError: "ThreadContextSurfaceError",
349800
349829
  ThreadStateConflictError: "ThreadStateConflictError",
349801
349830
  ThreadModelCandidatesEmptyError: "ThreadModelCandidatesEmptyError",
349802
349831
  ThreadSystemBaselineEmptyError: "ThreadSystemBaselineEmptyError",
@@ -354738,6 +354767,7 @@ var init_model_loop = __esm({
354738
354767
  // packages/kai-thread/src/response-recovery.ts
354739
354768
  function createResponseRecoverySession(options2, hooks = {}) {
354740
354769
  let continuations = 0;
354770
+ const rejectedRetriedSteps = /* @__PURE__ */ new Set();
354741
354771
  const reportRetry = (step, info) => {
354742
354772
  hooks.onRetryScheduled?.({
354743
354773
  stepIndex: step.stepIndex,
@@ -354753,6 +354783,13 @@ function createResponseRecoverySession(options2, hooks = {}) {
354753
354783
  if (response.status === "failed") {
354754
354784
  if (response.error.phase !== "model") return;
354755
354785
  if (isContextOverflow(response.error)) return;
354786
+ if (options2.shouldRetryRejectedRequest?.(response.error.cause) === true && // 不越本步 attempt 池:`maxRetries` 为 0 时(只开续写)本就没有重发的位。
354787
+ step.attempt < options2.maxRetries && !rejectedRetriedSteps.has(step.stepIndex)) {
354788
+ rejectedRetriedSteps.add(step.stepIndex);
354789
+ reportRetry(step, { kind: "rejected", cause: response.error.cause });
354790
+ step.retry(step.request.model);
354791
+ return;
354792
+ }
354756
354793
  const status2 = httpStatusOf(response.error.cause);
354757
354794
  if (!isTransientStatus(status2)) return;
354758
354795
  if (step.attempt >= options2.maxRetries) return;
@@ -355924,9 +355961,13 @@ async function runOnce(options2, input2, tools, providerSystem, commit) {
355924
355961
  });
355925
355962
  } : void 0,
355926
355963
  "response-recovery": recovery !== void 0 && (recovery.maxRetries > 0 || recovery.maxContinuations > 0) ? () => {
355927
- const { maxRetries, maxContinuations, onRetryScheduled } = recovery;
355964
+ const { maxRetries, maxContinuations, onRetryScheduled, shouldRetryRejectedRequest } = recovery;
355928
355965
  return createResponseRecoverySession(
355929
- { maxRetries, maxContinuations },
355966
+ {
355967
+ maxRetries,
355968
+ maxContinuations,
355969
+ ...shouldRetryRejectedRequest === void 0 ? {} : { shouldRetryRejectedRequest }
355970
+ },
355930
355971
  onRetryScheduled === void 0 ? {} : { onRetryScheduled }
355931
355972
  );
355932
355973
  } : void 0
@@ -356380,14 +356421,6 @@ var init_read_thread_todo_ledger = __esm({
356380
356421
  }
356381
356422
  });
356382
356423
 
356383
- // src/main/engine/threads/read-thread-todo-mode.ts
356384
- var init_read_thread_todo_mode = __esm({
356385
- "src/main/engine/threads/read-thread-todo-mode.ts"() {
356386
- "use strict";
356387
- init_events2();
356388
- }
356389
- });
356390
-
356391
356424
  // src/main/engine/threads/read-thread-rotate-reading.ts
356392
356425
  async function readThreadRotateReading(threadId, options2 = {}) {
356393
356426
  const store = openThreadEventLogStore(
@@ -357445,7 +357478,6 @@ var init_threads = __esm({
357445
357478
  init_read_thread_messages();
357446
357479
  init_read_thread_context();
357447
357480
  init_read_thread_todo_ledger();
357448
- init_read_thread_todo_mode();
357449
357481
  init_read_thread_rotate_reading();
357450
357482
  init_Thread();
357451
357483
  init_src2();
@@ -357473,7 +357505,6 @@ var init_engine2 = __esm({
357473
357505
  init_threads();
357474
357506
  init_threads();
357475
357507
  init_threads();
357476
- init_threads();
357477
357508
  init_events2();
357478
357509
  init_events2();
357479
357510
  init_events2();
@@ -363992,21 +364023,8 @@ var init_contracts = __esm({
363992
364023
  });
363993
364024
 
363994
364025
  // src/main/engine/compaction/token-estimator.ts
363995
- function getEncoding() {
363996
- if (!encoding) {
363997
- const { encoding_for_model } = require("tiktoken");
363998
- encoding = encoding_for_model("gpt-4");
363999
- }
364000
- return encoding;
364001
- }
364002
364026
  function estimateTokens2(text8) {
364003
- try {
364004
- const enc = getEncoding();
364005
- const tokens = enc.encode(text8);
364006
- return tokens.length;
364007
- } catch {
364008
- return Math.ceil(text8.length / 4);
364009
- }
364027
+ return Math.ceil(text8.length / 4);
364010
364028
  }
364011
364029
  function estimateMessageTokens(message2) {
364012
364030
  if (typeof message2.content === "string") {
@@ -364029,11 +364047,9 @@ function estimateMessagesTokens2(messages) {
364029
364047
  }
364030
364048
  return total;
364031
364049
  }
364032
- var encoding;
364033
364050
  var init_token_estimator = __esm({
364034
364051
  "src/main/engine/compaction/token-estimator.ts"() {
364035
364052
  "use strict";
364036
- encoding = null;
364037
364053
  }
364038
364054
  });
364039
364055
 
@@ -366701,6 +366717,7 @@ function isRequestLevelHttpStatus(status2) {
366701
366717
  }
366702
366718
  function classifyChannelFailure(error62) {
366703
366719
  if (!error62 || error62.type !== "model_error") return "request";
366720
+ if (isRequestRejectedProviderError(error62.cause ?? error62.message)) return "request";
366704
366721
  const kind = CHANNEL_FAILURE_KIND_BY_REASON[error62.failureReason];
366705
366722
  if (kind === "channel" && isRequestLevelHttpStatus(getHttpStatus(error62))) return "request";
366706
366723
  return kind;
@@ -368286,6 +368303,34 @@ var init_HttpTelemetryClient = __esm({
368286
368303
  };
368287
368304
  if (!await this.send("/feedback", msg)) this.enqueue("/feedback", msg);
368288
368305
  }
368306
+ /**
368307
+ * 读本机线程。读即已读由服务端落水位线,所以这次 GET 同时清掉未读。
368308
+ * 失败一律返回 null:反馈页不能因为遥测不可用而报错。
368309
+ */
368310
+ async fetchFeedbackThread() {
368311
+ if (!this.enabled) return null;
368312
+ const controller = new AbortController();
368313
+ const timer = setTimeout(() => controller.abort(), REQUEST_TIMEOUT);
368314
+ try {
368315
+ const query = new URLSearchParams({ clientId: this.clientId }).toString();
368316
+ const response = await fetch(`${this.endpoint}/feedback/thread?${query}`, {
368317
+ headers: { accept: "application/json" },
368318
+ signal: controller.signal
368319
+ });
368320
+ if (!response.ok) return null;
368321
+ const body = await response.json();
368322
+ return body?.thread ?? null;
368323
+ } catch (error62) {
368324
+ this.reportSendFailure({
368325
+ path: "/feedback/thread",
368326
+ reason: "network",
368327
+ errorName: error62 instanceof Error ? error62.name : "UnknownError"
368328
+ });
368329
+ return null;
368330
+ } finally {
368331
+ clearTimeout(timer);
368332
+ }
368333
+ }
368289
368334
  setEnabled(enabled) {
368290
368335
  this.enabled = enabled;
368291
368336
  }
@@ -368470,6 +368515,9 @@ var init_NoopTelemetryClient = __esm({
368470
368515
  }
368471
368516
  async sendFeedback() {
368472
368517
  }
368518
+ async fetchFeedbackThread() {
368519
+ return null;
368520
+ }
368473
368521
  setEnabled() {
368474
368522
  }
368475
368523
  async flush() {
@@ -381171,7 +381219,13 @@ async function openEngineSessionThread(input2) {
381171
381219
  ...rotateCompaction === void 0 ? {} : { proactiveAction: "rotate-hint", rotateHint: buildContextRotateHint() }
381172
381220
  }
381173
381221
  },
381174
- ...input2.requestRecovery === void 0 ? {} : { recovery: input2.requestRecovery },
381222
+ // 「请求体被拒」的判据只能由宿主给:包不认识网关词表。装配在此处一次,两条装配线都受益。
381223
+ ...input2.requestRecovery === void 0 ? {} : {
381224
+ recovery: {
381225
+ ...input2.requestRecovery,
381226
+ shouldRetryRejectedRequest: input2.requestRecovery.shouldRetryRejectedRequest ?? isRequestRejectedProviderError
381227
+ }
381228
+ },
381175
381229
  createStepDriver,
381176
381230
  ...toolRepair === void 0 ? {} : { toolRepair },
381177
381231
  ...multimodal === void 0 ? {} : { multimodal },
@@ -381321,6 +381375,7 @@ function createEngineSessionModelResolver(input2) {
381321
381375
  var init_engine_session_thread = __esm({
381322
381376
  "src/main/app/session/execution/direct/engine-session-thread.ts"() {
381323
381377
  "use strict";
381378
+ init_model_channel();
381324
381379
  init_settings();
381325
381380
  init_llm2();
381326
381381
  init_engine_model_creation();
@@ -385327,6 +385382,12 @@ function toUserMessage(rawMessage, failureReason2, retryable, sourceModel) {
385327
385382
  if (failureReason2 === "context_overflow") return withSource(rawMessage, sourceModel);
385328
385383
  if (failureReason2 === "rate_limit") return "\u6A21\u578B\u670D\u52A1\u8BF7\u6C42\u7E41\u5FD9\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002";
385329
385384
  if (failureReason2 === "timeout") return "\u6A21\u578B\u670D\u52A1\u54CD\u5E94\u8D85\u65F6\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002";
385385
+ if (failureReason2 === "api_error" && isRequestRejectedMessage(rawMessage)) {
385386
+ return withSource(
385387
+ "\u6A21\u578B\u670D\u52A1\u62D2\u6536\u4E86\u8FD9\u6B21\u8BF7\u6C42\uFF08\u8BF7\u6C42\u5185\u5BB9\u4E0D\u88AB\u63A5\u53D7\uFF09\u3002\u81EA\u52A8\u91CD\u53D1\u4E00\u6B21\u4ECD\u672A\u901A\u8FC7\u2014\u2014\u53EF\u4EE5\u518D\u53D1\u4E00\u6B21\uFF0C\u6216\u6362\u4E2A\u6A21\u578B\u3001\u538B\u7F29\u4E0A\u4E0B\u6587\u518D\u8BD5\u3002",
385388
+ sourceModel
385389
+ );
385390
+ }
385330
385391
  if (failureReason2 === "api_error" && retryable && isUpstreamRequestFailedMessage(rawMessage)) {
385331
385392
  return "\u6A21\u578B\u670D\u52A1\u6682\u65F6\u4E0D\u53EF\u7528\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002";
385332
385393
  }
@@ -385343,6 +385404,7 @@ var init_execute_failure = __esm({
385343
385404
  "src/main/app/session/execution/execute-failure.ts"() {
385344
385405
  "use strict";
385345
385406
  init_llm2();
385407
+ init_model_channel();
385346
385408
  }
385347
385409
  });
385348
385410
 
@@ -387407,7 +387469,7 @@ var init_direct_goal_turn = __esm({
387407
387469
  ...this.input.metadata?.invokedCommandName === void 0 ? {} : { commandName: this.input.metadata.invokedCommandName },
387408
387470
  source: this.input.metadata?.source === "remote" ? "remote" : "desktop",
387409
387471
  extraTools,
387410
- // goal 回合必发 `todo` 台账工具(门禁、注入、收口提示全读台账,见 `session-todo-ledger.md` §2.11)。
387472
+ // goal 回合要带 `todo` 台账(门禁、注入、收口提示全读它,见 `session-todo-ledger.md` §2.11);用户禁用时装配尾部照样删掉,门禁回退 `todo.md`。
387411
387473
  goalMode: true,
387412
387474
  maxSteps: 1,
387413
387475
  // `createGoalReviewStopWhen`)判的都是「最后一步……」,而 `maxSteps: 1` 下最后一步必然就是唯一那步
@@ -389120,6 +389182,7 @@ var init_run_event_reporter = __esm({
389120
389182
  ...buildRunEventBase(ctx),
389121
389183
  error: error62,
389122
389184
  durationMs,
389185
+ trigger: getRunTrigger(ctx.metadata),
389123
389186
  ...buildRunTodoLedgerPatch(ctx)
389124
389187
  });
389125
389188
  }
@@ -389127,6 +389190,7 @@ var init_run_event_reporter = __esm({
389127
389190
  resolveMessageEventBus().emit({
389128
389191
  type: "run.stopped",
389129
389192
  ...buildRunEventBase(ctx),
389193
+ trigger: getRunTrigger(ctx.metadata),
389130
389194
  ...buildRunTodoLedgerPatch(ctx)
389131
389195
  });
389132
389196
  }
@@ -389139,6 +389203,7 @@ var init_run_event_reporter = __esm({
389139
389203
  model: outcome.model,
389140
389204
  fallback: outcome.fallback,
389141
389205
  fallbackTransition: ctx.fallbackTransition,
389206
+ trigger: getRunTrigger(ctx.metadata),
389142
389207
  ...buildRunTodoLedgerPatch(ctx)
389143
389208
  });
389144
389209
  }
@@ -403322,13 +403387,30 @@ function projectPluginThemes(pluginId, manifest, availability) {
403322
403387
  }));
403323
403388
  }
403324
403389
  function inactive(configured, fallbackReason) {
403325
- return { configured, active: false, light: null, dark: null, fallbackReason };
403390
+ return {
403391
+ configured,
403392
+ active: false,
403393
+ light: null,
403394
+ dark: null,
403395
+ fallbackReason,
403396
+ providesAccent: false
403397
+ };
403398
+ }
403399
+ function declaresAccent(...sheets) {
403400
+ return sheets.some((css2) => css2 !== null && /--accent-base\s*:/.test(css2));
403326
403401
  }
403327
403402
  function resolvePluginThemeState(pluginsDir, configured, actualEngine3) {
403328
403403
  const identity = normalizePluginTheme(configured);
403329
403404
  const identityParts = identity === null ? null : parsePluginThemeIdentity(identity);
403330
403405
  if (identity === null || identityParts === null) {
403331
- return { configured: null, active: false, light: null, dark: null, fallbackReason: null };
403406
+ return {
403407
+ configured: null,
403408
+ active: false,
403409
+ light: null,
403410
+ dark: null,
403411
+ fallbackReason: null,
403412
+ providesAccent: false
403413
+ };
403332
403414
  }
403333
403415
  const { pluginId, themeId } = identityParts;
403334
403416
  const discovered = discoverUserPlugins(pluginsDir, actualEngine3);
@@ -403358,7 +403440,8 @@ function resolvePluginThemeState(pluginsDir, configured, actualEngine3) {
403358
403440
  active: true,
403359
403441
  light,
403360
403442
  dark,
403361
- fallbackReason: missingDeclared ? "file-missing" : null
403443
+ fallbackReason: missingDeclared ? "file-missing" : null,
403444
+ providesAccent: declaresAccent(light, dark)
403362
403445
  };
403363
403446
  }
403364
403447
  function resolveConfiguredPluginThemeState(pluginsDir, actualEngine3) {
@@ -403511,7 +403594,7 @@ var require_pend = __commonJS({
403511
403594
  // node_modules/yauzl/fd-slicer.js
403512
403595
  var require_fd_slicer = __commonJS({
403513
403596
  "node_modules/yauzl/fd-slicer.js"(exports2) {
403514
- var fs29 = require("fs");
403597
+ var fs30 = require("fs");
403515
403598
  var util = require("util");
403516
403599
  var stream = require("stream");
403517
403600
  var Readable3 = stream.Readable;
@@ -403531,7 +403614,7 @@ var require_fd_slicer = __commonJS({
403531
403614
  FdSlicer.prototype.read = function(buffer, offset, length, position2, callback) {
403532
403615
  var self2 = this;
403533
403616
  self2.pend.go(function(cb) {
403534
- fs29.read(self2.fd, buffer, offset, length, position2, function(err3, bytesRead, buffer2) {
403617
+ fs30.read(self2.fd, buffer, offset, length, position2, function(err3, bytesRead, buffer2) {
403535
403618
  cb();
403536
403619
  callback(err3, bytesRead, buffer2);
403537
403620
  });
@@ -403548,7 +403631,7 @@ var require_fd_slicer = __commonJS({
403548
403631
  self2.refCount -= 1;
403549
403632
  if (self2.refCount < 0) throw new Error("invalid unref");
403550
403633
  if (self2.refCount > 0) return;
403551
- fs29.close(self2.fd, onCloseDone);
403634
+ fs30.close(self2.fd, onCloseDone);
403552
403635
  function onCloseDone(err3) {
403553
403636
  if (err3) {
403554
403637
  self2.emit("error", err3);
@@ -403580,7 +403663,7 @@ var require_fd_slicer = __commonJS({
403580
403663
  }
403581
403664
  self2.context.pend.go(function(cb) {
403582
403665
  var buffer = Buffer.allocUnsafe(toRead);
403583
- fs29.read(self2.context.fd, buffer, 0, toRead, self2.pos, function(err3, bytesRead) {
403666
+ fs30.read(self2.context.fd, buffer, 0, toRead, self2.pos, function(err3, bytesRead) {
403584
403667
  if (err3) {
403585
403668
  self2.destroy(err3);
403586
403669
  } else if (bytesRead === 0) {
@@ -403940,7 +404023,7 @@ var require_crc32 = __commonJS({
403940
404023
  // node_modules/yauzl/index.js
403941
404024
  var require_yauzl = __commonJS({
403942
404025
  "node_modules/yauzl/index.js"(exports2) {
403943
- var fs29 = require("fs");
404026
+ var fs30 = require("fs");
403944
404027
  var zlib4 = require("zlib");
403945
404028
  var fd_slicer = require_fd_slicer();
403946
404029
  var util = require("util");
@@ -404009,10 +404092,10 @@ var require_yauzl = __commonJS({
404009
404092
  if (options2.validateEntrySizes == null) options2.validateEntrySizes = true;
404010
404093
  if (options2.strictFileNames == null) options2.strictFileNames = false;
404011
404094
  if (callback == null) callback = defaultCallback;
404012
- fs29.open(path34, "r", function(err3, fd2) {
404095
+ fs30.open(path34, "r", function(err3, fd2) {
404013
404096
  if (err3) return callback(err3);
404014
404097
  fromFd(fd2, options2, function(err4, zipfile) {
404015
- if (err4) fs29.close(fd2, defaultCallback);
404098
+ if (err4) fs30.close(fd2, defaultCallback);
404016
404099
  callback(err4, zipfile);
404017
404100
  });
404018
404101
  });
@@ -404029,7 +404112,7 @@ var require_yauzl = __commonJS({
404029
404112
  if (options2.validateEntrySizes == null) options2.validateEntrySizes = true;
404030
404113
  if (options2.strictFileNames == null) options2.strictFileNames = false;
404031
404114
  if (callback == null) callback = defaultCallback;
404032
- fs29.fstat(fd2, function(err3, stats) {
404115
+ fs30.fstat(fd2, function(err3, stats) {
404033
404116
  if (err3) return callback(err3);
404034
404117
  var reader = new fd_slicer.FdSlicer(fd2);
404035
404118
  fromRandomAccessReader(reader, stats.size, options2, callback);
@@ -404645,7 +404728,7 @@ var require_yauzl = __commonJS({
404645
404728
  this.actualByteCount = 0;
404646
404729
  this.expectedByteCount = byteCount;
404647
404730
  }
404648
- AssertByteCountStream.prototype._transform = function(chunk3, encoding2, cb) {
404731
+ AssertByteCountStream.prototype._transform = function(chunk3, encoding, cb) {
404649
404732
  this.actualByteCount += chunk3.length;
404650
404733
  if (this.actualByteCount > this.expectedByteCount) {
404651
404734
  var msg = "too many bytes in the stream. expected " + this.expectedByteCount + ". got at least " + this.actualByteCount;
@@ -404723,7 +404806,7 @@ var require_yauzl = __commonJS({
404723
404806
  var readStream = this.createReadStream({ start: position2, end: position2 + length });
404724
404807
  var writeStream = new Writable();
404725
404808
  var written = 0;
404726
- writeStream._write = function(chunk3, encoding2, cb) {
404809
+ writeStream._write = function(chunk3, encoding, cb) {
404727
404810
  chunk3.copy(buffer, offset + written, 0, chunk3.length);
404728
404811
  written += chunk3.length;
404729
404812
  cb();
@@ -419639,9 +419722,9 @@ function countTotalFromCountLines(lines) {
419639
419722
  let numMatches = 0;
419640
419723
  let numFiles = 0;
419641
419724
  for (const line of lines) {
419642
- const sep19 = line.lastIndexOf(":");
419643
- if (sep19 > 0) {
419644
- const count = Number.parseInt(line.slice(sep19 + 1), 10);
419725
+ const sep20 = line.lastIndexOf(":");
419726
+ if (sep20 > 0) {
419727
+ const count = Number.parseInt(line.slice(sep20 + 1), 10);
419645
419728
  if (!Number.isNaN(count)) {
419646
419729
  numMatches += count;
419647
419730
  numFiles += 1;
@@ -419778,8 +419861,8 @@ function createGrepTool(_scope = {}, _tracker) {
419778
419861
  }
419779
419862
  const entries = await Promise.allSettled(
419780
419863
  normalizedLines.map(async (line) => {
419781
- const sep19 = line.lastIndexOf(":");
419782
- const rawPath = sep19 > 0 ? line.slice(0, sep19) : line;
419864
+ const sep20 = line.lastIndexOf(":");
419865
+ const rawPath = sep20 > 0 ? line.slice(0, sep20) : line;
419783
419866
  const filePath = (0, import_node_path27.isAbsolute)(rawPath) ? rawPath : (0, import_node_path27.resolve)(resolvedPath, rawPath);
419784
419867
  const fileStat = await (0, import_promises79.stat)(filePath);
419785
419868
  return { filePath, mtimeMs: fileStat.mtimeMs ?? 0 };
@@ -421769,10 +421852,10 @@ function compareDocumentPosition(nodeA, nodeB) {
421769
421852
  function uniqueSort(nodes) {
421770
421853
  nodes = nodes.filter((node3, i2, arr) => !arr.includes(node3, i2 + 1));
421771
421854
  nodes.sort((a, b2) => {
421772
- const relative27 = compareDocumentPosition(a, b2);
421773
- if (relative27 & DocumentPosition.PRECEDING) {
421855
+ const relative28 = compareDocumentPosition(a, b2);
421856
+ if (relative28 & DocumentPosition.PRECEDING) {
421774
421857
  return -1;
421775
- } else if (relative27 & DocumentPosition.FOLLOWING) {
421858
+ } else if (relative28 & DocumentPosition.FOLLOWING) {
421776
421859
  return 1;
421777
421860
  }
421778
421861
  return 0;
@@ -435479,7 +435562,7 @@ var require_safer = __commonJS({
435479
435562
  };
435480
435563
  }
435481
435564
  if (!Safer.alloc) {
435482
- Safer.alloc = function(size, fill, encoding2) {
435565
+ Safer.alloc = function(size, fill, encoding) {
435483
435566
  if (typeof size !== "number") {
435484
435567
  throw new TypeError('The "size" argument must be of type number. Received type ' + typeof size);
435485
435568
  }
@@ -435489,8 +435572,8 @@ var require_safer = __commonJS({
435489
435572
  var buf = Buffer2(size);
435490
435573
  if (!fill || fill.length === 0) {
435491
435574
  buf.fill(0);
435492
- } else if (typeof encoding2 === "string") {
435493
- buf.fill(fill, encoding2);
435575
+ } else if (typeof encoding === "string") {
435576
+ buf.fill(fill, encoding);
435494
435577
  } else {
435495
435578
  buf.fill(fill);
435496
435579
  }
@@ -435867,8 +435950,8 @@ var require_utf32 = __commonJS({
435867
435950
  this.initialBufsLen += buf.length;
435868
435951
  if (this.initialBufsLen < 32)
435869
435952
  return "";
435870
- var encoding2 = detectEncoding(this.initialBufs, this.options.defaultEncoding);
435871
- this.decoder = this.iconv.getDecoder(encoding2, this.options);
435953
+ var encoding = detectEncoding(this.initialBufs, this.options.defaultEncoding);
435954
+ this.decoder = this.iconv.getDecoder(encoding, this.options);
435872
435955
  var resStr = "";
435873
435956
  for (var i2 = 0; i2 < this.initialBufs.length; i2++)
435874
435957
  resStr += this.decoder.write(this.initialBufs[i2]);
@@ -435879,8 +435962,8 @@ var require_utf32 = __commonJS({
435879
435962
  };
435880
435963
  Utf32AutoDecoder.prototype.end = function() {
435881
435964
  if (!this.decoder) {
435882
- var encoding2 = detectEncoding(this.initialBufs, this.options.defaultEncoding);
435883
- this.decoder = this.iconv.getDecoder(encoding2, this.options);
435965
+ var encoding = detectEncoding(this.initialBufs, this.options.defaultEncoding);
435966
+ this.decoder = this.iconv.getDecoder(encoding, this.options);
435884
435967
  var resStr = "";
435885
435968
  for (var i2 = 0; i2 < this.initialBufs.length; i2++)
435886
435969
  resStr += this.decoder.write(this.initialBufs[i2]);
@@ -436008,8 +436091,8 @@ var require_utf16 = __commonJS({
436008
436091
  this.initialBufsLen += buf.length;
436009
436092
  if (this.initialBufsLen < 16)
436010
436093
  return "";
436011
- var encoding2 = detectEncoding(this.initialBufs, this.options.defaultEncoding);
436012
- this.decoder = this.iconv.getDecoder(encoding2, this.options);
436094
+ var encoding = detectEncoding(this.initialBufs, this.options.defaultEncoding);
436095
+ this.decoder = this.iconv.getDecoder(encoding, this.options);
436013
436096
  var resStr = "";
436014
436097
  for (var i2 = 0; i2 < this.initialBufs.length; i2++)
436015
436098
  resStr += this.decoder.write(this.initialBufs[i2]);
@@ -436020,8 +436103,8 @@ var require_utf16 = __commonJS({
436020
436103
  };
436021
436104
  Utf16Decoder.prototype.end = function() {
436022
436105
  if (!this.decoder) {
436023
- var encoding2 = detectEncoding(this.initialBufs, this.options.defaultEncoding);
436024
- this.decoder = this.iconv.getDecoder(encoding2, this.options);
436106
+ var encoding = detectEncoding(this.initialBufs, this.options.defaultEncoding);
436107
+ this.decoder = this.iconv.getDecoder(encoding, this.options);
436025
436108
  var resStr = "";
436026
436109
  for (var i2 = 0; i2 < this.initialBufs.length; i2++)
436027
436110
  resStr += this.decoder.write(this.initialBufs[i2]);
@@ -438884,7 +438967,7 @@ var require_streams = __commonJS({
438884
438967
  IconvLiteEncoderStream.prototype = Object.create(Transform.prototype, {
438885
438968
  constructor: { value: IconvLiteEncoderStream }
438886
438969
  });
438887
- IconvLiteEncoderStream.prototype._transform = function(chunk3, encoding2, done) {
438970
+ IconvLiteEncoderStream.prototype._transform = function(chunk3, encoding, done) {
438888
438971
  if (typeof chunk3 != "string")
438889
438972
  return done(new Error("Iconv encoding stream needs strings as its input."));
438890
438973
  try {
@@ -438924,7 +439007,7 @@ var require_streams = __commonJS({
438924
439007
  IconvLiteDecoderStream.prototype = Object.create(Transform.prototype, {
438925
439008
  constructor: { value: IconvLiteDecoderStream }
438926
439009
  });
438927
- IconvLiteDecoderStream.prototype._transform = function(chunk3, encoding2, done) {
439010
+ IconvLiteDecoderStream.prototype._transform = function(chunk3, encoding, done) {
438928
439011
  if (!Buffer2.isBuffer(chunk3) && !(chunk3 instanceof Uint8Array))
438929
439012
  return done(new Error("Iconv decoding stream needs buffers as its input."));
438930
439013
  try {
@@ -438973,14 +439056,14 @@ var require_lib5 = __commonJS({
438973
439056
  iconv2.encodings = null;
438974
439057
  iconv2.defaultCharUnicode = "\uFFFD";
438975
439058
  iconv2.defaultCharSingleByte = "?";
438976
- iconv2.encode = function encode4(str2, encoding2, options2) {
439059
+ iconv2.encode = function encode4(str2, encoding, options2) {
438977
439060
  str2 = "" + (str2 || "");
438978
- var encoder2 = iconv2.getEncoder(encoding2, options2);
439061
+ var encoder2 = iconv2.getEncoder(encoding, options2);
438979
439062
  var res = encoder2.write(str2);
438980
439063
  var trail2 = encoder2.end();
438981
439064
  return trail2 && trail2.length > 0 ? Buffer2.concat([res, trail2]) : res;
438982
439065
  };
438983
- iconv2.decode = function decode4(buf, encoding2, options2) {
439066
+ iconv2.decode = function decode4(buf, encoding, options2) {
438984
439067
  if (typeof buf === "string") {
438985
439068
  if (!iconv2.skipDecodeWarning) {
438986
439069
  console.error("Iconv-lite warning: decode()-ing strings is deprecated. Refer to https://github.com/ashtuchkin/iconv-lite/wiki/Use-Buffers-when-decoding");
@@ -438988,7 +439071,7 @@ var require_lib5 = __commonJS({
438988
439071
  }
438989
439072
  buf = Buffer2.from("" + (buf || ""), "binary");
438990
439073
  }
438991
- var decoder = iconv2.getDecoder(encoding2, options2);
439074
+ var decoder = iconv2.getDecoder(encoding, options2);
438992
439075
  var res = decoder.write(buf);
438993
439076
  var trail2 = decoder.end();
438994
439077
  return trail2 ? res + trail2 : res;
@@ -439004,10 +439087,10 @@ var require_lib5 = __commonJS({
439004
439087
  iconv2.toEncoding = iconv2.encode;
439005
439088
  iconv2.fromEncoding = iconv2.decode;
439006
439089
  iconv2._codecDataCache = {};
439007
- iconv2.getCodec = function getCodec(encoding2) {
439090
+ iconv2.getCodec = function getCodec(encoding) {
439008
439091
  if (!iconv2.encodings)
439009
439092
  iconv2.encodings = require_encodings();
439010
- var enc = iconv2._canonicalizeEncoding(encoding2);
439093
+ var enc = iconv2._canonicalizeEncoding(encoding);
439011
439094
  var codecOptions = {};
439012
439095
  while (true) {
439013
439096
  var codec2 = iconv2._codecDataCache[enc];
@@ -439032,21 +439115,21 @@ var require_lib5 = __commonJS({
439032
439115
  iconv2._codecDataCache[codecOptions.encodingName] = codec2;
439033
439116
  return codec2;
439034
439117
  default:
439035
- throw new Error("Encoding not recognized: '" + encoding2 + "' (searched as: '" + enc + "')");
439118
+ throw new Error("Encoding not recognized: '" + encoding + "' (searched as: '" + enc + "')");
439036
439119
  }
439037
439120
  }
439038
439121
  };
439039
- iconv2._canonicalizeEncoding = function(encoding2) {
439040
- return ("" + encoding2).toLowerCase().replace(/:\d{4}$|[^0-9a-z]/g, "");
439122
+ iconv2._canonicalizeEncoding = function(encoding) {
439123
+ return ("" + encoding).toLowerCase().replace(/:\d{4}$|[^0-9a-z]/g, "");
439041
439124
  };
439042
- iconv2.getEncoder = function getEncoder(encoding2, options2) {
439043
- var codec2 = iconv2.getCodec(encoding2), encoder2 = new codec2.encoder(options2, codec2);
439125
+ iconv2.getEncoder = function getEncoder(encoding, options2) {
439126
+ var codec2 = iconv2.getCodec(encoding), encoder2 = new codec2.encoder(options2, codec2);
439044
439127
  if (codec2.bomAware && options2 && options2.addBOM)
439045
439128
  encoder2 = new bomHandling.PrependBOM(encoder2, options2);
439046
439129
  return encoder2;
439047
439130
  };
439048
- iconv2.getDecoder = function getDecoder2(encoding2, options2) {
439049
- var codec2 = iconv2.getCodec(encoding2), decoder = new codec2.decoder(options2, codec2);
439131
+ iconv2.getDecoder = function getDecoder2(encoding, options2) {
439132
+ var codec2 = iconv2.getCodec(encoding), decoder = new codec2.decoder(options2, codec2);
439050
439133
  if (codec2.bomAware && !(options2 && options2.stripBOM === false))
439051
439134
  decoder = new bomHandling.StripBOM(decoder, options2);
439052
439135
  return decoder;
@@ -439057,11 +439140,11 @@ var require_lib5 = __commonJS({
439057
439140
  var streams = require_streams()(stream_module2);
439058
439141
  iconv2.IconvLiteEncoderStream = streams.IconvLiteEncoderStream;
439059
439142
  iconv2.IconvLiteDecoderStream = streams.IconvLiteDecoderStream;
439060
- iconv2.encodeStream = function encodeStream(encoding2, options2) {
439061
- return new iconv2.IconvLiteEncoderStream(iconv2.getEncoder(encoding2, options2), options2);
439143
+ iconv2.encodeStream = function encodeStream(encoding, options2) {
439144
+ return new iconv2.IconvLiteEncoderStream(iconv2.getEncoder(encoding, options2), options2);
439062
439145
  };
439063
- iconv2.decodeStream = function decodeStream(encoding2, options2) {
439064
- return new iconv2.IconvLiteDecoderStream(iconv2.getDecoder(encoding2, options2), options2);
439146
+ iconv2.decodeStream = function decodeStream(encoding, options2) {
439147
+ return new iconv2.IconvLiteDecoderStream(iconv2.getDecoder(encoding, options2), options2);
439065
439148
  };
439066
439149
  iconv2.supportsStreams = true;
439067
439150
  };
@@ -439363,15 +439446,15 @@ var require_whatwg_encoding = __commonJS({
439363
439446
  return labelsToNames[label] || null;
439364
439447
  };
439365
439448
  exports2.decode = (uint8Array, fallbackEncodingName) => {
439366
- let encoding2 = fallbackEncodingName;
439367
- if (!exports2.isSupported(encoding2)) {
439368
- throw new RangeError(`"${encoding2}" is not a supported encoding name`);
439449
+ let encoding = fallbackEncodingName;
439450
+ if (!exports2.isSupported(encoding)) {
439451
+ throw new RangeError(`"${encoding}" is not a supported encoding name`);
439369
439452
  }
439370
439453
  const bomEncoding = exports2.getBOMEncoding(uint8Array);
439371
439454
  if (bomEncoding !== null) {
439372
- encoding2 = bomEncoding;
439455
+ encoding = bomEncoding;
439373
439456
  }
439374
- if (encoding2 === "x-user-defined") {
439457
+ if (encoding === "x-user-defined") {
439375
439458
  let result = "";
439376
439459
  for (const byte of uint8Array) {
439377
439460
  if (byte <= 127) {
@@ -439382,7 +439465,7 @@ var require_whatwg_encoding = __commonJS({
439382
439465
  }
439383
439466
  return result;
439384
439467
  }
439385
- return iconvLite.decode(uint8Array, encoding2);
439468
+ return iconvLite.decode(uint8Array, encoding);
439386
439469
  };
439387
439470
  exports2.getBOMEncoding = (uint8Array) => {
439388
439471
  if (uint8Array[0] === 254 && uint8Array[1] === 255) {
@@ -445143,7 +445226,7 @@ var require_util3 = __commonJS({
445143
445226
  super();
445144
445227
  this.#zlibOptions = zlibOptions;
445145
445228
  }
445146
- _transform(chunk3, encoding2, callback) {
445229
+ _transform(chunk3, encoding, callback) {
445147
445230
  if (!this._inflateStream) {
445148
445231
  if (chunk3.length === 0) {
445149
445232
  callback();
@@ -445154,7 +445237,7 @@ var require_util3 = __commonJS({
445154
445237
  this._inflateStream.on("end", () => this.push(null));
445155
445238
  this._inflateStream.on("error", (err3) => this.destroy(err3));
445156
445239
  }
445157
- this._inflateStream.write(chunk3, encoding2, callback);
445240
+ this._inflateStream.write(chunk3, encoding, callback);
445158
445241
  }
445159
445242
  _final(callback) {
445160
445243
  if (this._inflateStream) {
@@ -445532,7 +445615,7 @@ var require_formdata_parser = __commonJS({
445532
445615
  }
445533
445616
  position2.position += 2;
445534
445617
  const result = parseMultipartFormDataHeaders(input2, position2);
445535
- let { name: name5, filename, contentType: contentType2, encoding: encoding2 } = result;
445618
+ let { name: name5, filename, contentType: contentType2, encoding } = result;
445536
445619
  position2.position += 2;
445537
445620
  let body;
445538
445621
  {
@@ -445542,7 +445625,7 @@ var require_formdata_parser = __commonJS({
445542
445625
  }
445543
445626
  body = input2.subarray(position2.position, boundaryIndex - 4);
445544
445627
  position2.position += body.length;
445545
- if (encoding2 === "base64") {
445628
+ if (encoding === "base64") {
445546
445629
  body = Buffer.from(body.toString(), "base64");
445547
445630
  }
445548
445631
  }
@@ -445642,13 +445725,13 @@ var require_formdata_parser = __commonJS({
445642
445725
  let name5 = null;
445643
445726
  let filename = null;
445644
445727
  let contentType2 = null;
445645
- let encoding2 = null;
445728
+ let encoding = null;
445646
445729
  while (true) {
445647
445730
  if (input2[position2.position] === 13 && input2[position2.position + 1] === 10) {
445648
445731
  if (name5 === null) {
445649
445732
  throw parsingError("header name is null");
445650
445733
  }
445651
- return { name: name5, filename, contentType: contentType2, encoding: encoding2 };
445734
+ return { name: name5, filename, contentType: contentType2, encoding };
445652
445735
  }
445653
445736
  let headerName = collectASequenceOfBytes(
445654
445737
  (char) => char !== 10 && char !== 13 && char !== 58,
@@ -445718,7 +445801,7 @@ var require_formdata_parser = __commonJS({
445718
445801
  position2
445719
445802
  );
445720
445803
  headerValue2 = removeChars(headerValue2, false, true, (char) => char === 9 || char === 32);
445721
- encoding2 = isomorphicDecode(headerValue2);
445804
+ encoding = isomorphicDecode(headerValue2);
445722
445805
  break;
445723
445806
  }
445724
445807
  default: {
@@ -451239,9 +451322,9 @@ var require_readable = __commonJS({
451239
451322
  * @param {BufferEncoding} encoding
451240
451323
  * @returns {this}
451241
451324
  */
451242
- setEncoding(encoding2) {
451243
- if (Buffer.isEncoding(encoding2)) {
451244
- this._readableState.encoding = encoding2;
451325
+ setEncoding(encoding) {
451326
+ if (Buffer.isEncoding(encoding)) {
451327
+ this._readableState.encoding = encoding;
451245
451328
  }
451246
451329
  return this;
451247
451330
  }
@@ -451313,17 +451396,17 @@ var require_readable = __commonJS({
451313
451396
  while (consume2.stream.read() != null) {
451314
451397
  }
451315
451398
  }
451316
- function chunksDecode(chunks, length, encoding2) {
451399
+ function chunksDecode(chunks, length, encoding) {
451317
451400
  if (chunks.length === 0 || length === 0) {
451318
451401
  return "";
451319
451402
  }
451320
451403
  const buffer = chunks.length === 1 ? chunks[0] : Buffer.concat(chunks, length);
451321
451404
  const bufferLength = buffer.length;
451322
451405
  const start = bufferLength > 2 && buffer[0] === 239 && buffer[1] === 187 && buffer[2] === 191 ? 3 : 0;
451323
- if (!encoding2 || encoding2 === "utf8" || encoding2 === "utf-8") {
451406
+ if (!encoding || encoding === "utf8" || encoding === "utf-8") {
451324
451407
  return buffer.utf8Slice(start, bufferLength);
451325
451408
  } else {
451326
- return buffer.subarray(start, bufferLength).toString(encoding2);
451409
+ return buffer.subarray(start, bufferLength).toString(encoding);
451327
451410
  }
451328
451411
  }
451329
451412
  function chunksConcat(chunks, length) {
@@ -451342,13 +451425,13 @@ var require_readable = __commonJS({
451342
451425
  }
451343
451426
  return buffer;
451344
451427
  }
451345
- function consumeEnd(consume2, encoding2) {
451428
+ function consumeEnd(consume2, encoding) {
451346
451429
  const { type, body, resolve: resolve29, stream, length } = consume2;
451347
451430
  try {
451348
451431
  if (type === "text") {
451349
- resolve29(chunksDecode(body, length, encoding2));
451432
+ resolve29(chunksDecode(body, length, encoding));
451350
451433
  } else if (type === "json") {
451351
- resolve29(JSON.parse(chunksDecode(body, length, encoding2)));
451434
+ resolve29(JSON.parse(chunksDecode(body, length, encoding)));
451352
451435
  } else if (type === "arrayBuffer") {
451353
451436
  resolve29(chunksConcat(body, length).buffer);
451354
451437
  } else if (type === "blob") {
@@ -451867,9 +451950,9 @@ var require_api_pipeline = __commonJS({
451867
451950
  body.resume();
451868
451951
  }
451869
451952
  },
451870
- write: (chunk3, encoding2, callback) => {
451953
+ write: (chunk3, encoding, callback) => {
451871
451954
  const { req } = this;
451872
- if (req.push(chunk3, encoding2) || req._readableState.destroyed) {
451955
+ if (req.push(chunk3, encoding) || req._readableState.destroyed) {
451873
451956
  callback();
451874
451957
  } else {
451875
451958
  req[kResume] = callback;
@@ -456630,9 +456713,9 @@ var require_memory_cache_store = __commonJS({
456630
456713
  const store = this;
456631
456714
  const entry = { ...key, ...val2, body: [], size: 0 };
456632
456715
  return new Writable({
456633
- write(chunk3, encoding2, callback) {
456716
+ write(chunk3, encoding, callback) {
456634
456717
  if (typeof chunk3 === "string") {
456635
- chunk3 = Buffer.from(chunk3, encoding2);
456718
+ chunk3 = Buffer.from(chunk3, encoding);
456636
456719
  }
456637
456720
  entry.size += chunk3.byteLength;
456638
456721
  if (entry.size >= store.#maxEntrySize) {
@@ -457509,13 +457592,13 @@ var require_decompress = __commonJS({
457509
457592
  }
457510
457593
  const decompressors = [];
457511
457594
  for (let i2 = parts.length - 1; i2 >= 0; i2--) {
457512
- const encoding2 = parts[i2].trim();
457513
- if (!encoding2) continue;
457514
- if (!supportedEncodings[encoding2]) {
457595
+ const encoding = parts[i2].trim();
457596
+ if (!encoding) continue;
457597
+ if (!supportedEncodings[encoding]) {
457515
457598
  decompressors.length = 0;
457516
457599
  return decompressors;
457517
457600
  }
457518
- decompressors.push(supportedEncodings[encoding2]());
457601
+ decompressors.push(supportedEncodings[encoding]());
457519
457602
  }
457520
457603
  if (decompressors.length < 2) {
457521
457604
  return decompressors;
@@ -458450,7 +458533,7 @@ var require_sqlite_cache_store = __commonJS({
458450
458533
  const store = this;
458451
458534
  return new Writable({
458452
458535
  decodeStrings: true,
458453
- write(chunk3, encoding2, callback) {
458536
+ write(chunk3, encoding, callback) {
458454
458537
  size += chunk3.byteLength;
458455
458538
  if (size < store.#maxEntrySize) {
458456
458539
  body.push(chunk3);
@@ -471143,9 +471226,9 @@ var require_URL = __commonJS({
471143
471226
  },
471144
471227
  // See: http://tools.ietf.org/html/rfc3986#section-5.2
471145
471228
  // and https://url.spec.whatwg.org/#constructors
471146
- resolve: function(relative27) {
471229
+ resolve: function(relative28) {
471147
471230
  var base = this;
471148
- var r = new URL4(relative27);
471231
+ var r = new URL4(relative28);
471149
471232
  var t = new URL4();
471150
471233
  if (r.scheme !== void 0) {
471151
471234
  t.scheme = r.scheme;
@@ -477027,9 +477110,9 @@ var require_HTMLParser = __commonJS({
477027
477110
  function isHTMLIntegrationPoint(n) {
477028
477111
  if (isA(n, htmlIntegrationPointSet)) return true;
477029
477112
  if (n.namespaceURI === NAMESPACE.MATHML && n.localName === "annotation-xml") {
477030
- var encoding2 = n.getAttribute("encoding");
477031
- if (encoding2) encoding2 = encoding2.toLowerCase();
477032
- if (encoding2 === "text/html" || encoding2 === "application/xhtml+xml")
477113
+ var encoding = n.getAttribute("encoding");
477114
+ if (encoding) encoding = encoding.toLowerCase();
477115
+ if (encoding === "text/html" || encoding === "application/xhtml+xml")
477033
477116
  return true;
477034
477117
  }
477035
477118
  return false;
@@ -483424,14 +483507,14 @@ var require_turndown_cjs = __commonJS({
483424
483507
  } else if (node3.nodeType === 1) {
483425
483508
  replacement = replacementForNode.call(self2, node3);
483426
483509
  }
483427
- return join156(output2, replacement);
483510
+ return join157(output2, replacement);
483428
483511
  }, "");
483429
483512
  }
483430
483513
  function postProcess(output2) {
483431
483514
  var self2 = this;
483432
483515
  this.rules.forEach(function(rule) {
483433
483516
  if (typeof rule.append === "function") {
483434
- output2 = join156(output2, rule.append(self2.options));
483517
+ output2 = join157(output2, rule.append(self2.options));
483435
483518
  }
483436
483519
  });
483437
483520
  return output2.replace(/^[\t\r\n]+/, "").replace(/[\t\r\n\s]+$/, "");
@@ -483443,7 +483526,7 @@ var require_turndown_cjs = __commonJS({
483443
483526
  if (whitespace2.leading || whitespace2.trailing) content3 = content3.trim();
483444
483527
  return whitespace2.leading + rule.replacement(content3, node3, this.options) + whitespace2.trailing;
483445
483528
  }
483446
- function join156(output2, replacement) {
483529
+ function join157(output2, replacement) {
483447
483530
  var s1 = trimTrailingNewlines(output2);
483448
483531
  var s22 = trimLeadingNewlines(replacement);
483449
483532
  var nls = Math.max(output2.length - s1.length, replacement.length - s22.length);
@@ -504435,14 +504518,14 @@ async function encodedMultipartFormRequestOptions(options2, client, encodings, r
504435
504518
  };
504436
504519
  }
504437
504520
  const encoded = [];
504438
- for (const [name5, encoding2] of Object.entries(encodings)) {
504521
+ for (const [name5, encoding] of Object.entries(encodings)) {
504439
504522
  if (!Object.prototype.hasOwnProperty.call(body, name5))
504440
504523
  continue;
504441
504524
  const value = body[name5];
504442
- const data2 = encoding2.json ? JSON.stringify(value) : value;
504525
+ const data2 = encoding.json ? JSON.stringify(value) : value;
504443
504526
  if (typeof data2 !== "string")
504444
504527
  throw new TypeError(`Multipart field ${name5} must encode as a string`);
504445
- encoded.push([name5, makeFile([data2], "", { type: encoding2.content_type })]);
504528
+ encoded.push([name5, makeFile([data2], "", { type: encoding.content_type })]);
504446
504529
  delete body[name5];
504447
504530
  }
504448
504531
  const multipart = await multipartFormRequestOptions({ ...options2, body }, client);
@@ -517325,12 +517408,12 @@ function acceptsGzip(headers) {
517325
517408
  let gzipQuality;
517326
517409
  let wildcardQuality;
517327
517410
  for (const part of joined.split(",")) {
517328
- const [encoding2, ...parameters] = part.trim().toLowerCase().split(";");
517411
+ const [encoding, ...parameters] = part.trim().toLowerCase().split(";");
517329
517412
  const qualityParameter = parameters.find((parameter) => parameter.trim().startsWith("q="));
517330
517413
  const parsedQuality = qualityParameter ? Number(qualityParameter.trim().slice(2)) : 1;
517331
517414
  const quality = Number.isFinite(parsedQuality) ? parsedQuality : 0;
517332
- if (encoding2 === "gzip") gzipQuality = quality;
517333
- else if (encoding2 === "*") wildcardQuality = quality;
517415
+ if (encoding === "gzip") gzipQuality = quality;
517416
+ else if (encoding === "*") wildcardQuality = quality;
517334
517417
  }
517335
517418
  return (gzipQuality ?? wildcardQuality ?? 0) > 0;
517336
517419
  }
@@ -517578,6 +517661,12 @@ function encodeContentDispositionFilename(filename) {
517578
517661
  (character) => `%${character.charCodeAt(0).toString(16).toUpperCase()}`
517579
517662
  );
517580
517663
  }
517664
+ function buildAttachmentContentDisposition(filename) {
517665
+ const safe = sanitizeAttachmentFilename(filename);
517666
+ const asciiSafe = safe.replace(/[^\x20-\x7E]/g, "");
517667
+ if (asciiSafe === safe) return `attachment; filename="${safe}"`;
517668
+ return `attachment; filename="${asciiSafe || "download"}"; filename*=UTF-8''${encodeContentDispositionFilename(safe)}`;
517669
+ }
517581
517670
  function isPathBlacklisted(resolvedPath) {
517582
517671
  const lower = resolvedPath.toLowerCase();
517583
517672
  return BLACKLISTED_PREFIXES.some((prefix) => lower.startsWith(prefix));
@@ -517654,12 +517743,7 @@ async function serveLocalFile(pathname, response, options2 = {}) {
517654
517743
  }
517655
517744
  if (isDownload) {
517656
517745
  const filename = downloadFilename ? sanitizeAttachmentFilename(downloadFilename) : import_node_path39.default.basename(resolvedPath);
517657
- const asciiSafe = filename.replace(/[^\x20-\x7E]/g, "");
517658
- if (asciiSafe === filename) {
517659
- headers["Content-Disposition"] = `attachment; filename="${filename}"`;
517660
- } else {
517661
- headers["Content-Disposition"] = `attachment; filename="${asciiSafe || "download"}"; filename*=UTF-8''${encodeContentDispositionFilename(filename)}`;
517662
- }
517746
+ headers["Content-Disposition"] = buildAttachmentContentDisposition(filename);
517663
517747
  }
517664
517748
  if (previewPpm) {
517665
517749
  if (headOnly) {
@@ -522023,6 +522107,108 @@ var init_http_uploads = __esm({
522023
522107
  }
522024
522108
  });
522025
522109
 
522110
+ // src/main/infra/transport/http-session-event-log.ts
522111
+ function setSessionEventLogExportRemoteService(service2) {
522112
+ remoteService = service2;
522113
+ }
522114
+ function isSessionEventLogExportPath(pathname) {
522115
+ return pathname.startsWith(`${SESSION_EVENT_LOG_EXPORT_PATH}/`);
522116
+ }
522117
+ function sessionEventLogExportSessionId(pathname) {
522118
+ return decodeURIComponent(pathname.slice(SESSION_EVENT_LOG_EXPORT_PATH.length + 1));
522119
+ }
522120
+ function parseOwner(searchParams) {
522121
+ const kind = searchParams.get("ownerKind");
522122
+ const id = searchParams.get("ownerId");
522123
+ if (!id) return null;
522124
+ if (kind === "group") return { kind: "group", groupId: id };
522125
+ if (kind === "agent") return { kind: "agent", agentId: id };
522126
+ return null;
522127
+ }
522128
+ function sendExportError(response, status2, code2) {
522129
+ response.writeHead(status2, {
522130
+ "Cache-Control": "no-store",
522131
+ "Content-Type": "application/json; charset=utf-8",
522132
+ "X-KAi-Error-Code": code2
522133
+ });
522134
+ response.end(JSON.stringify({ ok: false, error: { code: code2 } }));
522135
+ }
522136
+ function statusForError(message2) {
522137
+ if (message2.includes("SESSION_EVENT_LOG_EXPORT_SESSION_NOT_FOUND")) return 404;
522138
+ if (message2.includes("SESSION_EVENT_LOG_EXPORT_OWNER_MISMATCH")) return 403;
522139
+ if (message2.includes("SESSION_EVENT_LOG_EXPORT_INVALID_")) return 400;
522140
+ return 500;
522141
+ }
522142
+ function errorCodeOf2(error62) {
522143
+ const message2 = error62 instanceof Error ? error62.message : String(error62);
522144
+ return message2.split(":")[0]?.trim() || "SESSION_EVENT_LOG_EXPORT_FAILED";
522145
+ }
522146
+ async function writeChunk(response, chunk3) {
522147
+ if (response.write(chunk3)) return;
522148
+ if (response.destroyed) throw new Error("SESSION_EVENT_LOG_EXPORT_CLIENT_CLOSED");
522149
+ await new Promise((resolve29, reject2) => {
522150
+ const cleanup2 = () => {
522151
+ response.off("drain", onDrain);
522152
+ response.off("close", onClose);
522153
+ };
522154
+ const onDrain = () => {
522155
+ cleanup2();
522156
+ resolve29();
522157
+ };
522158
+ const onClose = () => {
522159
+ cleanup2();
522160
+ reject2(new Error("SESSION_EVENT_LOG_EXPORT_CLIENT_CLOSED"));
522161
+ };
522162
+ response.once("drain", onDrain);
522163
+ response.once("close", onClose);
522164
+ });
522165
+ }
522166
+ async function serveSessionEventLogExport(sessionId, searchParams, response) {
522167
+ const owner = parseOwner(searchParams);
522168
+ if (!owner) {
522169
+ sendExportError(response, 400, "SESSION_EVENT_LOG_EXPORT_INVALID_OWNER");
522170
+ return;
522171
+ }
522172
+ const service2 = remoteService;
522173
+ if (!service2) {
522174
+ sendExportError(response, 404, "SESSION_EVENT_LOG_EXPORT_UNAVAILABLE");
522175
+ return;
522176
+ }
522177
+ let resolution;
522178
+ try {
522179
+ resolution = await service2.resolve({ sessionId, owner });
522180
+ } catch (error62) {
522181
+ sendExportError(response, statusForError(errorCodeOf2(error62)), errorCodeOf2(error62));
522182
+ return;
522183
+ }
522184
+ if (resolution.status === "empty") {
522185
+ sendExportError(response, 409, "SESSION_EVENT_LOG_EXPORT_EMPTY");
522186
+ return;
522187
+ }
522188
+ const { descriptor } = resolution;
522189
+ response.writeHead(200, {
522190
+ "Content-Type": "application/zip",
522191
+ "Content-Disposition": buildAttachmentContentDisposition(descriptor.filename),
522192
+ "Cache-Control": "no-store",
522193
+ "X-Content-Type-Options": "nosniff"
522194
+ });
522195
+ try {
522196
+ await service2.stream(descriptor, (chunk3) => writeChunk(response, chunk3));
522197
+ response.end();
522198
+ } catch (error62) {
522199
+ response.destroy(error62 instanceof Error ? error62 : void 0);
522200
+ }
522201
+ }
522202
+ var remoteService;
522203
+ var init_http_session_event_log = __esm({
522204
+ "src/main/infra/transport/http-session-event-log.ts"() {
522205
+ "use strict";
522206
+ init_wire();
522207
+ init_http_local_files();
522208
+ remoteService = null;
522209
+ }
522210
+ });
522211
+
522026
522212
  // src/main/infra/transport/a2a-call-log.ts
522027
522213
  function recordA2aCall(entry) {
522028
522214
  records.push({
@@ -522465,6 +522651,7 @@ var init_http_server = __esm({
522465
522651
  init_plugin_resource_path();
522466
522652
  init_preview_picker_script();
522467
522653
  init_http_uploads();
522654
+ init_http_session_event_log();
522468
522655
  init_http_a2a();
522469
522656
  DEFAULT_PORT2 = 9527;
522470
522657
  DEFAULT_HTTP_BIND_HOST = "0.0.0.0";
@@ -522650,6 +522837,22 @@ var init_http_server = __esm({
522650
522837
  );
522651
522838
  return;
522652
522839
  }
522840
+ if (request.method === "GET" && isSessionEventLogExportPath(url2.pathname)) {
522841
+ const token = url2.searchParams.get("token") ?? getBearerToken2(request);
522842
+ if (!validateToken(token)) {
522843
+ this.sendJson(response, 401, { ok: false, error: "Unauthorized" }, request.headers);
522844
+ return;
522845
+ }
522846
+ let sessionId;
522847
+ try {
522848
+ sessionId = sessionEventLogExportSessionId(url2.pathname);
522849
+ } catch {
522850
+ this.sendJson(response, 400, { ok: false, error: "Bad Request" }, request.headers);
522851
+ return;
522852
+ }
522853
+ await serveSessionEventLogExport(sessionId, url2.searchParams, response);
522854
+ return;
522855
+ }
522653
522856
  if ((request.method === "GET" || request.method === "HEAD") && url2.pathname.startsWith("/api/local/")) {
522654
522857
  const localSegment = url2.pathname.slice("/api/local".length);
522655
522858
  if ((request.method === "GET" || request.method === "HEAD") && localSegment === PREVIEW_PICKER_ASSET_PATH) {
@@ -523072,6 +523275,7 @@ var init_transport2 = __esm({
523072
523275
  init_a2a_runtime();
523073
523276
  init_http_a2a();
523074
523277
  init_http_plugin_resources();
523278
+ init_http_session_event_log();
523075
523279
  init_remote_access_service();
523076
523280
  }
523077
523281
  });
@@ -524462,15 +524666,15 @@ async function QuickJSRaw(moduleArg = {}) {
524462
524666
  throw c;
524463
524667
  }, w2 = import_meta3.url, y = "", z5, A2;
524464
524668
  if (q2) {
524465
- var fs29 = require3("node:fs");
524669
+ var fs30 = require3("node:fs");
524466
524670
  w2.startsWith("file:") && (y = require3("node:path").dirname(require3("node:url").fileURLToPath(w2)) + "/");
524467
524671
  A2 = (a) => {
524468
524672
  a = B2(a) ? new URL(a) : a;
524469
- return fs29.readFileSync(a);
524673
+ return fs30.readFileSync(a);
524470
524674
  };
524471
524675
  z5 = async (a) => {
524472
524676
  a = B2(a) ? new URL(a) : a;
524473
- return fs29.readFileSync(a, void 0);
524677
+ return fs30.readFileSync(a, void 0);
524474
524678
  };
524475
524679
  1 < process.argv.length && (u2 = process.argv[1].replace(/\\/g, "/"));
524476
524680
  process.argv.slice(2);
@@ -531392,10 +531596,10 @@ function Yn(s3, t) {
531392
531596
  function Kn(s3, t) {
531393
531597
  s3.head = new ue(t, void 0, s3.head, s3), s3.tail || (s3.tail = s3.head), s3.length++;
531394
531598
  }
531395
- var import_events16, import_fs122, import_node_events2, import_node_stream4, import_node_string_decoder, import_node_path46, import_node_fs29, import_path250, import_events17, import_assert, import_buffer, Ps, import_zlib, import_node_path47, import_node_path48, import_fs123, import_fs124, import_path251, import_node_path49, import_path252, import_node_fs30, import_node_assert, import_node_crypto19, import_node_fs31, import_node_path50, import_fs125, import_node_fs32, import_node_path51, import_node_fs33, import_promises113, import_node_path52, import_node_path53, import_node_fs34, import_node_path54, zr, Ur, Ds, Wr, Gr, Zr, Q, J, nt, De, qt, Ne, Ns, Ae, As, z4, Mt, g, Qt, Bt, b, N, _2, bi, Ie, L, S, _i, Oi, Is, Ti, Z, xi, Ce, Jt, Rt, C, jt, Yr, Kr, Vr, $r, Fe, Li, Xr, qr, A, Jr, ht, H, te, m, Ni, tt, Ai, ki, vi, ie, ke, Ut, Ht, Ii, Pt, at, U, ot, Y, zt, Ci, j, ee, Fi, ve, gt, Me, bt, _t, Be, et, Wt, jr, Fs, ks, vs, Ms, Bs, tn, se, K, sn, M, rn, zs, nn, Bi, Tt, Gt, Pi, re, Pe, ze, Ue, He, We, Ge, Ze, Ye, Ke, Us, hn, an, Hs, ln, cn, Ws, Gs, Hi, ne, dn, Ui, oe, Ve, un, F, mn, xt, Wi, pn, lt, En, wn, Sn, ct, yn, Rn, gn, Gi, bn, Lt, ft, On, Tn, xn, Ln, f, $e, Dt, Nn, Xi, qi, An, B, Nt, it, Zi, Zs, V, he, dt, Ys, p, st, ut, Yi, At, w, Xe, qe, Ki, Ks, Vs, ae, Vi, Qe, Yt, $2, Je, It, je, ti, $s, In, le, $i, Xs, Cn, rt, mt, vn, Qi, Mn, Bn, Ct, Ji, zn, qs, ce, ei, ji, Un, Hn, ts, Qs, rr, Wn, tr, er, ir, is5, sr, fe, ii, ss, si, rs, ns, os8, hs, pt, ri, as, es, q, de, ni, oi, Gn, hi, ue, pi, nr, li, me, W, pe, Et, Ft, Ee, ai, G, ls, ci, or2, ds, us, fi, di, hr, cs, ui, lr, fs25, wt, kt, Vn, $n, fr, dr, Xn, qn, Qn, Jn, Er, wr, ur, Sr, yr, Rr, jn, to, eo, mr, ms, ps, Ei, io, Es, so, ws, Se, St, no, gr, Ss, br, oo, _r, ys, Or, Vt, Tr, ho, ao, lo, yi, Lr, Dr, _s, Nr, Os, P, Ts, xs, gi, Ar, Ir, Re, Cr, Fr, Rs, yt, O, Ri, kr, $t, gs, bs, Ls, ge, be, _e, Oe, fo, Te, uo, mo, po, vr, Xt, ye, xe, Eo, wo, So, yo, Ro, go, bo, _o, vt, Oo, To;
531599
+ var import_events15, import_fs122, import_node_events2, import_node_stream4, import_node_string_decoder, import_node_path46, import_node_fs29, import_path250, import_events16, import_assert, import_buffer, Ps, import_zlib, import_node_path47, import_node_path48, import_fs123, import_fs124, import_path251, import_node_path49, import_path252, import_node_fs30, import_node_assert, import_node_crypto19, import_node_fs31, import_node_path50, import_fs125, import_node_fs32, import_node_path51, import_node_fs33, import_promises113, import_node_path52, import_node_path53, import_node_fs34, import_node_path54, zr, Ur, Ds, Wr, Gr, Zr, Q, J, nt, De, qt, Ne, Ns, Ae, As, z4, Mt, g, Qt, Bt, b, N, _2, bi, Ie, L, S, _i, Oi, Is, Ti, Z, xi, Ce, Jt, Rt, C, jt, Yr, Kr, Vr, $r, Fe, Li, Xr, qr, A, Jr, ht, H, te, m, Ni, tt, Ai, ki, vi, ie, ke, Ut, Ht, Ii, Pt, at, U, ot, Y, zt, Ci, j, ee, Fi, ve, gt, Me, bt, _t, Be, et, Wt, jr, Fs, ks, vs, Ms, Bs, tn, se, K, sn, M, rn, zs, nn, Bi, Tt, Gt, Pi, re, Pe, ze, Ue, He, We, Ge, Ze, Ye, Ke, Us, hn, an, Hs, ln, cn, Ws, Gs, Hi, ne, dn, Ui, oe, Ve, un, F, mn, xt, Wi, pn, lt, En, wn, Sn, ct, yn, Rn, gn, Gi, bn, Lt, ft, On, Tn, xn, Ln, f, $e, Dt, Nn, Xi, qi, An, B, Nt, it, Zi, Zs, V, he, dt, Ys, p, st, ut, Yi, At, w, Xe, qe, Ki, Ks, Vs, ae, Vi, Qe, Yt, $2, Je, It, je, ti, $s, In, le, $i, Xs, Cn, rt, mt, vn, Qi, Mn, Bn, Ct, Ji, zn, qs, ce, ei, ji, Un, Hn, ts, Qs, rr, Wn, tr, er, ir, is5, sr, fe, ii, ss, si, rs, ns, os8, hs, pt, ri, as, es, q, de, ni, oi, Gn, hi, ue, pi, nr, li, me, W, pe, Et, Ft, Ee, ai, G, ls, ci, or2, ds, us, fi, di, hr, cs, ui, lr, fs25, wt, kt, Vn, $n, fr, dr, Xn, qn, Qn, Jn, Er, wr, ur, Sr, yr, Rr, jn, to, eo, mr, ms, ps, Ei, io, Es, so, ws, Se, St, no, gr, Ss, br, oo, _r, ys, Or, Vt, Tr, ho, ao, lo, yi, Lr, Dr, _s, Nr, Os, P, Ts, xs, gi, Ar, Ir, Re, Cr, Fr, Rs, yt, O, Ri, kr, $t, gs, bs, Ls, ge, be, _e, Oe, fo, Te, uo, mo, po, vr, Xt, ye, xe, Eo, wo, So, yo, Ro, go, bo, _o, vt, Oo, To;
531396
531600
  var init_index_min = __esm({
531397
531601
  "node_modules/tar/dist/esm/index.min.js"() {
531398
- import_events16 = __toESM(require("events"), 1);
531602
+ import_events15 = __toESM(require("events"), 1);
531399
531603
  import_fs122 = __toESM(require("fs"), 1);
531400
531604
  import_node_events2 = require("node:events");
531401
531605
  import_node_stream4 = __toESM(require("node:stream"), 1);
@@ -531403,7 +531607,7 @@ var init_index_min = __esm({
531403
531607
  import_node_path46 = __toESM(require("node:path"), 1);
531404
531608
  import_node_fs29 = __toESM(require("node:fs"), 1);
531405
531609
  import_path250 = require("path");
531406
- import_events17 = require("events");
531610
+ import_events16 = require("events");
531407
531611
  import_assert = __toESM(require("assert"), 1);
531408
531612
  import_buffer = require("buffer");
531409
531613
  Ps = __toESM(require("zlib"), 1);
@@ -531905,7 +532109,7 @@ var init_index_min = __esm({
531905
532109
  }
531906
532110
  }
531907
532111
  };
531908
- et = class extends import_events16.default {
532112
+ et = class extends import_events15.default {
531909
532113
  readable = false;
531910
532114
  writable = true;
531911
532115
  [bt] = false;
@@ -532538,7 +532742,7 @@ var init_index_min = __esm({
532538
532742
  $i = /* @__PURE__ */ Symbol("decompressedBytesRead");
532539
532743
  Xs = /* @__PURE__ */ Symbol("checkDecompressionRatio");
532540
532744
  Cn = () => true;
532541
- rt = class extends import_events17.EventEmitter {
532745
+ rt = class extends import_events16.EventEmitter {
532542
532746
  file;
532543
532747
  strict;
532544
532748
  maxMetaEntrySize;
@@ -538259,6 +538463,8 @@ var init_tool_catalog = __esm({
538259
538463
  [BUILT_IN_TOOL_NAMES.MEMORY_RECALL]: { group: "aux" },
538260
538464
  [BUILT_IN_TOOL_NAMES.MEMORY_REMEMBER]: { group: "aux" },
538261
538465
  [BUILT_IN_TOOL_NAMES.MEMORY_FORGET]: { group: "aux" },
538466
+ // 台账的注入、门禁与续做提示都按本轮装配面判(`session-todo-ledger.md` §2.3):关掉即整条链上没有台账。
538467
+ [BUILT_IN_TOOL_NAMES.TODO]: { group: "aux" },
538262
538468
  // ── 不能关:机制假设它们存在 ──
538263
538469
  [BUILT_IN_TOOL_NAMES.GOAL_REVIEW]: {
538264
538470
  group: "aux",
@@ -538268,10 +538474,6 @@ var init_tool_catalog = __esm({
538268
538474
  group: "aux",
538269
538475
  reason: "goal \u5DE5\u4F5C\u6D41\u7684\u63D0\u524D\u6536\u5C3E\u53E3\uFF0C\u5173\u6389\u7B49\u4E8E\u8BA9\u4E00\u8F6E goal \u65E0\u6CD5\u7ED3\u675F\u3002"
538270
538476
  },
538271
- [BUILT_IN_TOOL_NAMES.TODO]: {
538272
- group: "aux",
538273
- reason: "goal \u56DE\u5408\u7684\u95E8\u7981\u3001\u6CE8\u5165\u4E0E\u6536\u53E3\u63D0\u793A\u5168\u90E8\u8BFB\u8FD9\u4EFD\u53F0\u8D26\uFF1B\u5173\u6389\u5DE5\u5177 = \u8BA9\u95E8\u7981\u7B49\u4E00\u4EFD\u6C38\u8FDC\u4E0D\u4F1A\u88AB\u5199\u7684\u6E05\u5355\u3002"
538274
- },
538275
538477
  [BUILT_IN_TOOL_NAMES.CONTEXT_ROTATE]: {
538276
538478
  group: "aux",
538277
538479
  reason: "\u4E0A\u4E0B\u6587\u8F6E\u8F6C\u662F\u5185\u5EFA\u884C\u4E3A\uFF0C\u6CA1\u6709\u5F00\u5173\uFF082026-11-03 \u88C1\u51B3\uFF1A\u673A\u68B0\u51B3\u7B56\u4E0D\u7559\u5F00\u5173\uFF09\u3002"
@@ -538982,7 +539184,7 @@ function zip(data2, opts, cb) {
538982
539184
  }
538983
539185
  return tAll;
538984
539186
  }
538985
- var import_module, require2, _a11, Worker, isMarkedAsUntransferable, workerAdd, wk, u8, u16, i32, fleb, fdeb, clim, freb, _a11, fl, revfl, _b, fd, revfd, rev, x, i, hMap, flt, i, i, i, i, fdt, i, flm, fdm, shft, slc, ec, err2, wbits, wbits16, hTree, ln2, lc, clen, wfblk, wblk, deo, et2, dflt, crct, crc, dopt, mrg, wcln, ch, cbfs, wrkr, bDflt, pbf, cbify, wbytes, fltn, te2, td, tds, exfl, wzh, wzf, mt2;
539187
+ var import_module, require2, _a11, Worker, isMarkedAsUntransferable, workerAdd, wk, u8, u16, i32, fleb, fdeb, clim, freb, _a11, fl, revfl, _b, fd, revfd, rev, x, i, hMap, flt, i, i, i, i, fdt, i, flm, fdm, shft, slc, ec, err2, wbits, wbits16, hTree, ln2, lc, clen, wfblk, wblk, deo, et2, dflt, crct, crc, dopt, mrg, wcln, ch, cbfs, wrkr, bDflt, pbf, cbify, wbytes, fltn, te2, td, tds, exfl, wzh, wzf, ZipPassThrough, Zip, mt2;
538986
539188
  var init_esm14 = __esm({
538987
539189
  "node_modules/fflate/esm/index.mjs"() {
538988
539190
  import_module = require("module");
@@ -539703,6 +539905,151 @@ var init_esm14 = __esm({
539703
539905
  wbytes(o, b2 + 12, d);
539704
539906
  wbytes(o, b2 + 16, e);
539705
539907
  };
539908
+ ZipPassThrough = /* @__PURE__ */ (function() {
539909
+ function ZipPassThrough2(filename) {
539910
+ this.filename = filename;
539911
+ this.c = crc();
539912
+ this.size = 0;
539913
+ this.compression = 0;
539914
+ }
539915
+ ZipPassThrough2.prototype.process = function(chunk3, final) {
539916
+ this.ondata(null, chunk3, final);
539917
+ };
539918
+ ZipPassThrough2.prototype.push = function(chunk3, final) {
539919
+ if (!this.ondata)
539920
+ err2(5);
539921
+ this.c.p(chunk3);
539922
+ this.size += chunk3.length;
539923
+ if (final)
539924
+ this.crc = this.c.d();
539925
+ this.process(chunk3, final || false);
539926
+ };
539927
+ return ZipPassThrough2;
539928
+ })();
539929
+ Zip = /* @__PURE__ */ (function() {
539930
+ function Zip2(cb) {
539931
+ this.ondata = cb;
539932
+ this.u = [];
539933
+ this.d = 1;
539934
+ }
539935
+ Zip2.prototype.add = function(file2) {
539936
+ var _this = this;
539937
+ if (!this.ondata)
539938
+ err2(5);
539939
+ if (this.d & 2)
539940
+ this.ondata(err2(4 + (this.d & 1) * 8, 0, 1), null, false);
539941
+ else {
539942
+ var f2 = strToU8(file2.filename), fl_1 = f2.length;
539943
+ var com = file2.comment, o = com && strToU8(com);
539944
+ var u2 = fl_1 != file2.filename.length || o && com.length != o.length;
539945
+ var hl_1 = fl_1 + exfl(file2.extra) + 30;
539946
+ if (fl_1 > 65535)
539947
+ this.ondata(err2(11, 0, 1), null, false);
539948
+ var header = new u8(hl_1);
539949
+ wzh(header, 0, file2, f2, u2, -1);
539950
+ var chks_1 = [header];
539951
+ var pAll_1 = function() {
539952
+ for (var _i2 = 0, chks_2 = chks_1; _i2 < chks_2.length; _i2++) {
539953
+ var chk = chks_2[_i2];
539954
+ _this.ondata(null, chk, false);
539955
+ }
539956
+ chks_1 = [];
539957
+ };
539958
+ var tr_1 = this.d;
539959
+ this.d = 0;
539960
+ var ind_1 = this.u.length;
539961
+ var uf_1 = mrg(file2, {
539962
+ f: f2,
539963
+ u: u2,
539964
+ o,
539965
+ t: function() {
539966
+ if (file2.terminate)
539967
+ file2.terminate();
539968
+ },
539969
+ r: function() {
539970
+ pAll_1();
539971
+ if (tr_1) {
539972
+ var nxt = _this.u[ind_1 + 1];
539973
+ if (nxt)
539974
+ nxt.r();
539975
+ else
539976
+ _this.d = 1;
539977
+ }
539978
+ tr_1 = 1;
539979
+ }
539980
+ });
539981
+ var cl_1 = 0;
539982
+ file2.ondata = function(err3, dat, final) {
539983
+ if (err3) {
539984
+ _this.ondata(err3, dat, final);
539985
+ _this.terminate();
539986
+ } else {
539987
+ cl_1 += dat.length;
539988
+ chks_1.push(dat);
539989
+ if (final) {
539990
+ var dd = new u8(16);
539991
+ wbytes(dd, 0, 134695760);
539992
+ wbytes(dd, 4, file2.crc);
539993
+ wbytes(dd, 8, cl_1);
539994
+ wbytes(dd, 12, file2.size);
539995
+ chks_1.push(dd);
539996
+ uf_1.c = cl_1, uf_1.b = hl_1 + cl_1 + 16, uf_1.crc = file2.crc, uf_1.size = file2.size;
539997
+ if (tr_1)
539998
+ uf_1.r();
539999
+ tr_1 = 1;
540000
+ } else if (tr_1)
540001
+ pAll_1();
540002
+ }
540003
+ };
540004
+ this.u.push(uf_1);
540005
+ }
540006
+ };
540007
+ Zip2.prototype.end = function() {
540008
+ var _this = this;
540009
+ if (this.d & 2) {
540010
+ this.ondata(err2(4 + (this.d & 1) * 8, 0, 1), null, true);
540011
+ return;
540012
+ }
540013
+ if (this.d)
540014
+ this.e();
540015
+ else
540016
+ this.u.push({
540017
+ r: function() {
540018
+ if (!(_this.d & 1))
540019
+ return;
540020
+ _this.u.splice(-1, 1);
540021
+ _this.e();
540022
+ },
540023
+ t: function() {
540024
+ }
540025
+ });
540026
+ this.d = 3;
540027
+ };
540028
+ Zip2.prototype.e = function() {
540029
+ var bt2 = 0, l = 0, tl = 0;
540030
+ for (var _i2 = 0, _a12 = this.u; _i2 < _a12.length; _i2++) {
540031
+ var f2 = _a12[_i2];
540032
+ tl += 46 + f2.f.length + exfl(f2.extra) + (f2.o ? f2.o.length : 0);
540033
+ }
540034
+ var out = new u8(tl + 22);
540035
+ for (var _b2 = 0, _c = this.u; _b2 < _c.length; _b2++) {
540036
+ var f2 = _c[_b2];
540037
+ wzh(out, bt2, f2, f2.f, f2.u, -f2.c - 2, l, f2.o);
540038
+ bt2 += 46 + f2.f.length + exfl(f2.extra) + (f2.o ? f2.o.length : 0), l += f2.b;
540039
+ }
540040
+ wzf(out, bt2, this.u.length, tl, l);
540041
+ this.ondata(null, out, true);
540042
+ this.d = 2;
540043
+ };
540044
+ Zip2.prototype.terminate = function() {
540045
+ for (var _i2 = 0, _a12 = this.u; _i2 < _a12.length; _i2++) {
540046
+ var f2 = _a12[_i2];
540047
+ f2.t();
540048
+ }
540049
+ this.d = 2;
540050
+ };
540051
+ return Zip2;
540052
+ })();
539706
540053
  mt2 = typeof queueMicrotask == "function" ? queueMicrotask : typeof setTimeout == "function" ? setTimeout : function(fn2) {
539707
540054
  fn2();
539708
540055
  };
@@ -539949,7 +540296,13 @@ var init_message_block_export = __esm({
539949
540296
  });
539950
540297
 
539951
540298
  // src/main/app/session/read-model/session-event-log-export.ts
539952
- function assertRequest(request) {
540299
+ function sessionEventLogExportDirName(sessionId) {
540300
+ return `kai-session-${sessionId}`;
540301
+ }
540302
+ function sessionEventLogZipFilename(sessionId) {
540303
+ return `${sessionEventLogExportDirName(sessionId)}.zip`;
540304
+ }
540305
+ function assertSessionEventLogExportRequest(request) {
539953
540306
  if (!request || typeof request.sessionId !== "string" || !request.sessionId.trim()) {
539954
540307
  throw new Error("SESSION_EVENT_LOG_EXPORT_INVALID_SESSION");
539955
540308
  }
@@ -539957,6 +540310,9 @@ function assertRequest(request) {
539957
540310
  throw new Error("SESSION_EVENT_LOG_EXPORT_INVALID_OWNER");
539958
540311
  }
539959
540312
  }
540313
+ function sessionLineFactsOfOwner(owner) {
540314
+ return owner.kind === "group" ? { kind: "group", groupId: owner.groupId } : { kind: "agent", agentId: owner.agentId };
540315
+ }
539960
540316
  async function readLineSegmentUsage(dir) {
539961
540317
  let segmentCount = 0;
539962
540318
  let byteSize = 0;
@@ -540012,55 +540368,89 @@ async function resolveSessionLineFacts(sessionId, owner) {
540012
540368
  }
540013
540369
  return { kind: "agent", agentId: owner.agentId };
540014
540370
  }
540015
- async function exportSessionEventLog(request, dependencies) {
540016
- assertRequest(request);
540017
- const facts = await resolveSessionLineFacts(request.sessionId, request.owner);
540018
- const lines = await resolveSessionLines(request.sessionId, facts);
540019
- if (lines.length === 0) return { status: "empty" };
540020
- const targetRoot = await dependencies.selectDirectory();
540021
- if (!targetRoot) return { status: "cancelled" };
540022
- const exportDir = (0, import_node_path55.join)(targetRoot, `kai-session-${request.sessionId}`);
540023
- const exportedLines = [];
540024
- const contextLines = [];
540371
+ async function loadSessionEventLogLines(sessionId, facts) {
540372
+ const lines = await resolveSessionLines(sessionId, facts);
540373
+ const loaded = [];
540025
540374
  for (const line of lines) {
540026
- const directory = (0, import_node_path55.basename)(line.sourceDir);
540027
540375
  const usage = await readLineSegmentUsage(line.sourceDir);
540028
- await dependencies.copyDirectoryTree(line.sourceDir, (0, import_node_path55.join)(exportDir, directory));
540376
+ loaded.push({
540377
+ threadId: line.threadId,
540378
+ directory: (0, import_node_path55.basename)(line.sourceDir),
540379
+ sourceDir: line.sourceDir,
540380
+ ...usage
540381
+ });
540382
+ }
540383
+ return loaded;
540384
+ }
540385
+ async function loadSessionEventLogLinesForOwner(query) {
540386
+ assertSessionEventLogExportRequest(query);
540387
+ const facts = await resolveSessionLineFacts(query.sessionId, query.owner);
540388
+ return loadSessionEventLogLines(query.sessionId, facts);
540389
+ }
540390
+ async function collectSessionEventLogPayload(source2, transferLine) {
540391
+ const exportedAt = (/* @__PURE__ */ new Date()).toISOString();
540392
+ const exportedLines = [];
540393
+ const contextLines = [];
540394
+ for (const line of source2.lines) {
540395
+ await transferLine(line);
540029
540396
  const context = await readLineContext(line.threadId);
540030
540397
  if (context.messages !== void 0) {
540031
- contextLines.push({ threadId: line.threadId, directory, messages: context.messages });
540398
+ contextLines.push({
540399
+ threadId: line.threadId,
540400
+ directory: line.directory,
540401
+ messages: context.messages
540402
+ });
540032
540403
  }
540033
- exportedLines.push({ threadId: line.threadId, directory, ...usage, context: context.outcome });
540034
- }
540035
- const exportedAt = (/* @__PURE__ */ new Date()).toISOString();
540036
- const contextFile = contextLines.length === 0 ? void 0 : SESSION_CONTEXT_FILE;
540037
- if (contextFile !== void 0) {
540038
- const context = {
540039
- sessionId: request.sessionId,
540040
- title: request.title,
540041
- exportedAt,
540042
- lines: contextLines
540043
- };
540044
- await atomicWriteText((0, import_node_path55.join)(exportDir, contextFile), `${JSON.stringify(context, null, 2)}
540045
- `);
540404
+ exportedLines.push({
540405
+ threadId: line.threadId,
540406
+ directory: line.directory,
540407
+ segmentCount: line.segmentCount,
540408
+ byteSize: line.byteSize,
540409
+ context: context.outcome
540410
+ });
540046
540411
  }
540412
+ const contextFile = contextLines.length === 0 ? null : { sessionId: source2.sessionId, title: source2.title, exportedAt, lines: contextLines };
540047
540413
  const manifest = {
540048
- sessionId: request.sessionId,
540049
- title: request.title,
540414
+ sessionId: source2.sessionId,
540415
+ title: source2.title,
540050
540416
  exportedAt,
540051
540417
  lines: exportedLines,
540052
- ...contextFile === void 0 ? {} : { contextFile }
540418
+ ...contextFile === null ? {} : { contextFile: SESSION_CONTEXT_FILE }
540053
540419
  };
540054
- await atomicWriteText(
540055
- (0, import_node_path55.join)(exportDir, SESSION_EVENT_LOG_MANIFEST_FILE),
540056
- `${JSON.stringify(manifest, null, 2)}
540420
+ return {
540421
+ lineCount: exportedLines.length,
540422
+ totalBytes: exportedLines.reduce((sum, line) => sum + line.byteSize, 0),
540423
+ ...contextFile === null ? {} : { contextJson: `${JSON.stringify(contextFile, null, 2)}
540424
+ ` },
540425
+ manifestJson: `${JSON.stringify(manifest, null, 2)}
540057
540426
  `
540427
+ };
540428
+ }
540429
+ async function exportSessionEventLog(request, dependencies) {
540430
+ const lines = await loadSessionEventLogLinesForOwner(request);
540431
+ if (lines.length === 0) return { status: "empty" };
540432
+ const targetRoot = await dependencies.selectDirectory();
540433
+ if (!targetRoot) return { status: "cancelled" };
540434
+ const exportDir = (0, import_node_path55.join)(targetRoot, sessionEventLogExportDirName(request.sessionId));
540435
+ const source2 = {
540436
+ status: "ready",
540437
+ sessionId: request.sessionId,
540438
+ title: request.title,
540439
+ lines
540440
+ };
540441
+ const payload = await collectSessionEventLogPayload(
540442
+ source2,
540443
+ (line) => dependencies.copyDirectoryTree(line.sourceDir, (0, import_node_path55.join)(exportDir, line.directory))
540058
540444
  );
540445
+ if (payload.contextJson !== void 0) {
540446
+ await atomicWriteText((0, import_node_path55.join)(exportDir, SESSION_CONTEXT_FILE), payload.contextJson);
540447
+ }
540448
+ await atomicWriteText((0, import_node_path55.join)(exportDir, SESSION_EVENT_LOG_MANIFEST_FILE), payload.manifestJson);
540059
540449
  return {
540060
540450
  status: "exported",
540061
540451
  directory: exportDir,
540062
- lineCount: exportedLines.length,
540063
- totalBytes: exportedLines.reduce((sum, line) => sum + line.byteSize, 0)
540452
+ lineCount: payload.lineCount,
540453
+ totalBytes: payload.totalBytes
540064
540454
  };
540065
540455
  }
540066
540456
  var import_node_fs35, import_node_path55, SESSION_EVENT_LOG_MANIFEST_FILE, SESSION_CONTEXT_FILE;
@@ -540079,6 +540469,53 @@ var init_session_event_log_export = __esm({
540079
540469
  }
540080
540470
  });
540081
540471
 
540472
+ // src/main/app/session/read-model/session-event-log-remote.ts
540473
+ async function resolveSessionEventLogRemoteExport(query) {
540474
+ const lines = await loadSessionEventLogLinesForOwner(query);
540475
+ if (lines.length === 0) return { status: "empty" };
540476
+ const read = await resolveSessionReadFacts(query.sessionId);
540477
+ if (!read) {
540478
+ throw new Error(`SESSION_EVENT_LOG_EXPORT_SESSION_NOT_FOUND: ${query.sessionId}`);
540479
+ }
540480
+ return {
540481
+ status: "ready",
540482
+ descriptor: {
540483
+ sessionId: query.sessionId,
540484
+ owner: query.owner,
540485
+ title: read.title,
540486
+ filename: sessionEventLogZipFilename(query.sessionId),
540487
+ lineCount: lines.length,
540488
+ totalBytes: lines.reduce((sum, line) => sum + line.byteSize, 0)
540489
+ }
540490
+ };
540491
+ }
540492
+ async function describeSessionEventLogRemoteExport(request) {
540493
+ const resolution = await resolveSessionEventLogRemoteExport({
540494
+ sessionId: request?.sessionId,
540495
+ owner: request?.owner
540496
+ });
540497
+ if (resolution.status === "empty") return { status: "empty" };
540498
+ const { descriptor } = resolution;
540499
+ return {
540500
+ status: "exported",
540501
+ downloadUrl: buildSessionEventLogExportPath({
540502
+ sessionId: descriptor.sessionId,
540503
+ owner: descriptor.owner
540504
+ }),
540505
+ filename: descriptor.filename,
540506
+ lineCount: descriptor.lineCount,
540507
+ totalBytes: descriptor.totalBytes
540508
+ };
540509
+ }
540510
+ var init_session_event_log_remote = __esm({
540511
+ "src/main/app/session/read-model/session-event-log-remote.ts"() {
540512
+ "use strict";
540513
+ init_wire();
540514
+ init_session_line_scan();
540515
+ init_session_event_log_export();
540516
+ }
540517
+ });
540518
+
540082
540519
  // src/main/app/session/lifecycle/session-lifecycle-events.ts
540083
540520
  function emitBestEffort(event) {
540084
540521
  try {
@@ -540947,7 +541384,8 @@ async function handleExportMessageBlocks(request) {
540947
541384
  writeText: atomicWriteText
540948
541385
  });
540949
541386
  }
540950
- async function handleExportSessionEventLog(request) {
541387
+ async function handleExportSessionEventLog(context, request) {
541388
+ if (context.source === "http") return describeSessionEventLogRemoteExport(request);
540951
541389
  const { dialog: dialog3 } = require_electron();
540952
541390
  return exportSessionEventLog(request, {
540953
541391
  selectDirectory: async () => {
@@ -541116,7 +541554,7 @@ function registerSessionHandlers() {
541116
541554
  registerRpc(IPC_CREATE_DIRECTORY_ATTACHMENT, handleCreateDirectoryAttachment);
541117
541555
  registerRpc(IPC_OPEN_ATTACHMENT, handleOpenAttachment);
541118
541556
  registerRpc(IPC_OPEN_CHAT_DATA_DIR, handleOpenChatDataDir);
541119
- registerRpc(IPC_EXPORT_SESSION_EVENT_LOG, handleExportSessionEventLog);
541557
+ registerRpcWithContext(IPC_EXPORT_SESSION_EVENT_LOG, handleExportSessionEventLog);
541120
541558
  registerRpc(IPC_RESOLVE_INLINE_LOCAL_PATH, handleResolveInlineLocalPath);
541121
541559
  registerRecordingHandlers();
541122
541560
  }
@@ -541158,6 +541596,7 @@ var init_session_handlers = __esm({
541158
541596
  init_recording_handlers();
541159
541597
  init_message_block_export();
541160
541598
  init_session_event_log_export();
541599
+ init_session_event_log_remote();
541161
541600
  init_session_todo_ledger_read();
541162
541601
  init_session_lifecycle_events();
541163
541602
  init_surface_view_read();
@@ -542286,8 +542725,8 @@ function isUrlSafe(urlString) {
542286
542725
  }
542287
542726
  }
542288
542727
  function isSubPath3(parentDir, targetPath) {
542289
- const relative27 = import_node_path56.default.relative(parentDir, targetPath);
542290
- return relative27 === "" || !relative27.startsWith("..") && !import_node_path56.default.isAbsolute(relative27);
542728
+ const relative28 = import_node_path56.default.relative(parentDir, targetPath);
542729
+ return relative28 === "" || !relative28.startsWith("..") && !import_node_path56.default.isAbsolute(relative28);
542291
542730
  }
542292
542731
  function isAvatarPath2(parts) {
542293
542732
  return parts.length === 2 && parts[0] === "avatars" && /^(avatar|avatar-\d+)\.png$/.test(parts[1]);
@@ -542977,8 +543416,8 @@ var init_memory_growth_handlers = __esm({
542977
543416
 
542978
543417
  // src/main/entry/electron/main/handlers/app-info-handlers.ts
542979
543418
  function getBundledAppVersion() {
542980
- if ("1.16.1") {
542981
- return "1.16.1";
543419
+ if ("1.16.2") {
543420
+ return "1.16.2";
542982
543421
  }
542983
543422
  return "unknown";
542984
543423
  }
@@ -543170,7 +543609,7 @@ async function handleGetSettings() {
543170
543609
  askQuestion: normalizeAskQuestion(config.get("askQuestion")),
543171
543610
  renderUi: normalizeRenderUi(config.get("renderUi")),
543172
543611
  showFile: normalizeShowFile(config.get("showFile")),
543173
- taskNotifications: config.get("taskNotifications") !== false,
543612
+ taskNotifications: config.get("taskNotifications") === true,
543174
543613
  maxConcurrentSubagents: normalizeMaxConcurrentSubagents(config.get("maxConcurrentSubagents")),
543175
543614
  reasoningHistoryRetention: normalizeReasoningHistory(config.get("reasoningHistoryRetention")),
543176
543615
  autoCheckForUpdates: config.get("autoCheckForUpdates"),
@@ -543218,7 +543657,7 @@ async function handleSaveSettings(settings, deps2 = {}) {
543218
543657
  if ("renderUi" in settings) updates.renderUi = normalizeRenderUi(settings.renderUi);
543219
543658
  if ("showFile" in settings) updates.showFile = normalizeShowFile(settings.showFile);
543220
543659
  if ("taskNotifications" in settings)
543221
- updates.taskNotifications = settings.taskNotifications !== false;
543660
+ updates.taskNotifications = settings.taskNotifications === true;
543222
543661
  if ("maxConcurrentSubagents" in settings) {
543223
543662
  updates.maxConcurrentSubagents = normalizeMaxConcurrentSubagents(
543224
543663
  settings.maxConcurrentSubagents
@@ -544246,7 +544685,7 @@ async function startA2a(options2) {
544246
544685
  name: agent.name,
544247
544686
  description: agent.description ?? `${agent.name} (KAi workspace)`
544248
544687
  },
544249
- version: true ? "1.16.1" : "unknown",
544688
+ version: true ? "1.16.2" : "unknown",
544250
544689
  endpointUrl: options2.endpointUrl,
544251
544690
  streaming: true,
544252
544691
  sendUserMessage: {
@@ -546141,8 +546580,8 @@ function readPackageJson() {
546141
546580
  return cachedPackageJson;
546142
546581
  }
546143
546582
  function resolveAppVersion() {
546144
- if ("1.16.1") {
546145
- return "1.16.1";
546583
+ if ("1.16.2") {
546584
+ return "1.16.2";
546146
546585
  }
546147
546586
  return readPackageJson()?.version ?? "unknown";
546148
546587
  }
@@ -546316,6 +546755,14 @@ var init_MainTelemetryService = __esm({
546316
546755
  logger104.debug("telemetry sendFeedback ignored", err3);
546317
546756
  }
546318
546757
  }
546758
+ async fetchFeedbackThread() {
546759
+ try {
546760
+ return await this.client.fetchFeedbackThread();
546761
+ } catch (err3) {
546762
+ logger104.debug("telemetry fetchFeedbackThread ignored", err3);
546763
+ return null;
546764
+ }
546765
+ }
546319
546766
  setEnabled(enabled) {
546320
546767
  this.enabled = enabled;
546321
546768
  if (!enabled) {
@@ -546363,6 +546810,7 @@ var init_MainTelemetryService = __esm({
546363
546810
  if (!safe) return;
546364
546811
  await this.sendFeedback(safe);
546365
546812
  });
546813
+ registerRpc(IPC_TELEMETRY_FEEDBACK_THREAD, () => this.fetchFeedbackThread());
546366
546814
  registerRpc(IPC_TELEMETRY_SET_ENABLED, (enabled) => {
546367
546815
  if (typeof enabled !== "boolean") return this.isEnabled();
546368
546816
  return this.setEnabled(enabled);
@@ -546695,6 +547143,105 @@ var init_plugin_page_client = __esm({
546695
547143
  }
546696
547144
  });
546697
547145
 
547146
+ // src/main/app/session/read-model/session-event-log-zip.ts
547147
+ function createZipEntryWriter(write) {
547148
+ const pending2 = [];
547149
+ let failure4 = null;
547150
+ const zip2 = new Zip((error62, chunk3) => {
547151
+ if (error62) {
547152
+ failure4 = error62;
547153
+ return;
547154
+ }
547155
+ pending2.push(chunk3);
547156
+ });
547157
+ const flush = async () => {
547158
+ while (pending2.length > 0) await write(pending2.shift());
547159
+ if (failure4) throw failure4;
547160
+ };
547161
+ return {
547162
+ async addText(name5, text8) {
547163
+ const entry = new ZipPassThrough(name5);
547164
+ zip2.add(entry);
547165
+ entry.push(strToU8(text8), true);
547166
+ await flush();
547167
+ },
547168
+ async addFile(name5, absolutePath) {
547169
+ const entry = new ZipPassThrough(name5);
547170
+ zip2.add(entry);
547171
+ for await (const chunk3 of (0, import_node_fs37.createReadStream)(absolutePath)) {
547172
+ entry.push(new Uint8Array(chunk3), false);
547173
+ await flush();
547174
+ }
547175
+ entry.push(new Uint8Array(0), true);
547176
+ await flush();
547177
+ },
547178
+ async end() {
547179
+ zip2.end();
547180
+ await flush();
547181
+ }
547182
+ };
547183
+ }
547184
+ function toArchivePath2(path34) {
547185
+ return path34.split(import_node_path60.sep).join("/");
547186
+ }
547187
+ async function collectFiles(dir) {
547188
+ const files = [];
547189
+ for (const entry of await import_node_fs37.promises.readdir(dir, { withFileTypes: true })) {
547190
+ const absolutePath = (0, import_node_path60.join)(dir, entry.name);
547191
+ if (entry.isDirectory()) {
547192
+ files.push(...await collectFiles(absolutePath));
547193
+ continue;
547194
+ }
547195
+ if (entry.isFile()) files.push(absolutePath);
547196
+ }
547197
+ return files;
547198
+ }
547199
+ async function writeLineDirectory(zip2, line) {
547200
+ for (const absolutePath of await collectFiles(line.sourceDir)) {
547201
+ const archivePath = `${line.directory}/${toArchivePath2((0, import_node_path60.relative)(line.sourceDir, absolutePath))}`;
547202
+ await zip2.addFile(archivePath, absolutePath);
547203
+ }
547204
+ }
547205
+ async function writeSessionEventLogZip(source2, write) {
547206
+ const zip2 = createZipEntryWriter(write);
547207
+ const payload = await collectSessionEventLogPayload(
547208
+ source2,
547209
+ (line) => writeLineDirectory(zip2, line)
547210
+ );
547211
+ if (payload.contextJson !== void 0) {
547212
+ await zip2.addText(SESSION_CONTEXT_FILE, payload.contextJson);
547213
+ }
547214
+ await zip2.addText(SESSION_EVENT_LOG_MANIFEST_FILE, payload.manifestJson);
547215
+ await zip2.end();
547216
+ return { lineCount: payload.lineCount, totalBytes: payload.totalBytes };
547217
+ }
547218
+ async function streamSessionEventLogZip(descriptor, write) {
547219
+ const lines = await loadSessionEventLogLines(
547220
+ descriptor.sessionId,
547221
+ sessionLineFactsOfOwner(descriptor.owner)
547222
+ );
547223
+ if (lines.length === 0) {
547224
+ throw new Error(`SESSION_EVENT_LOG_EXPORT_EMPTY: ${descriptor.sessionId}`);
547225
+ }
547226
+ const source2 = {
547227
+ status: "ready",
547228
+ sessionId: descriptor.sessionId,
547229
+ title: descriptor.title,
547230
+ lines
547231
+ };
547232
+ await writeSessionEventLogZip(source2, write);
547233
+ }
547234
+ var import_node_fs37, import_node_path60;
547235
+ var init_session_event_log_zip = __esm({
547236
+ "src/main/app/session/read-model/session-event-log-zip.ts"() {
547237
+ "use strict";
547238
+ import_node_fs37 = require("node:fs");
547239
+ import_node_path60 = require("node:path");
547240
+ init_esm14();
547241
+ init_session_event_log_export();
547242
+ }
547243
+ });
547244
+
546698
547245
  // src/main/entry/electron/main/plugins/plugin-page-bindings.ts
546699
547246
  function sameOwner(a, b2) {
546700
547247
  return a.kind === b2.kind && a.webContentsId === b2.webContentsId;
@@ -547632,6 +548179,8 @@ function createElectronOverlayWindowPort(options2 = {}) {
547632
548179
  show: false,
547633
548180
  frame: false,
547634
548181
  transparent: true,
548182
+ // 显式给 alpha 零的底:`backgroundColor` 默认是 `#FFF`,Windows 会把这块白真的画出来,整块矩形就露了底。
548183
+ backgroundColor: "#00000000",
547635
548184
  hasShadow: false,
547636
548185
  // 浮层不抢焦点:用户正在别的应用里打字,一只宠物不该把光标夺走(§1.2)。
547637
548186
  focusable: false,
@@ -547641,8 +548190,9 @@ function createElectronOverlayWindowPort(options2 = {}) {
547641
548190
  maximizable: false,
547642
548191
  fullscreenable: false,
547643
548192
  // 压不住(拖动不受影响:位移由外壳自己算,见 docs/specs/plugin-desktop-overlay.md §10)。
547644
- ...process.platform === "darwin" ? { type: "panel" } : {},
547645
- ...process.platform === "win32" ? { thickFrame: false } : {},
548193
+ ...platform3 === "darwin" ? { type: "panel" } : {},
548194
+ // Win11 的系统绘制材质(默认 `auto` 时由系统决定)会在窗口背后铺一层浅色,透明窗口因此露出矩形底:浮层恒不要材质。
548195
+ ...platform3 === "win32" ? { thickFrame: false, backgroundMaterial: "none" } : {},
547646
548196
  webPreferences: {
547647
548197
  preload: (0, import_path270.join)(__dirname, "../preload/overlay.js"),
547648
548198
  partition: OVERLAY_WINDOW_SESSION_PARTITION,
@@ -548488,7 +549038,7 @@ function configureCliUserPlugins() {
548488
549038
  configureDesktopUserPlugins({
548489
549039
  pluginsDir,
548490
549040
  actualEngine: { platform: process.platform, host: "cli" },
548491
- hostScript: resolvePluginHostScript((0, import_node_path60.join)(__dirname, "..", "dist-electron", "main")),
549041
+ hostScript: resolvePluginHostScript((0, import_node_path61.join)(__dirname, "..", "dist-electron", "main")),
548492
549042
  activateEmitter: (payload) => eventBridge.broadcast(IPC_SESSION_ON_PLUGIN_ACTIVATE, payload),
548493
549043
  sessionCapabilities: {
548494
549044
  clearSession: (sessionId) => sendUserMessageUseCase.clearSession(sessionId),
@@ -548535,6 +549085,10 @@ function configureCliUserPlugins() {
548535
549085
  host: "cli"
548536
549086
  })
548537
549087
  });
549088
+ setSessionEventLogExportRemoteService({
549089
+ resolve: resolveSessionEventLogRemoteExport,
549090
+ stream: streamSessionEventLogZip
549091
+ });
548538
549092
  }
548539
549093
  async function startCliApplication(options2) {
548540
549094
  try {
@@ -548608,12 +549162,12 @@ async function stopCliApplicationOnce() {
548608
549162
  await run(cleanup);
548609
549163
  if (firstError !== void 0) throw firstError;
548610
549164
  }
548611
- var import_node_path60, logger106, shutdownPromise, remoteAccessStarted, remoteAccessService;
549165
+ var import_node_path61, logger106, shutdownPromise, remoteAccessStarted, remoteAccessService;
548612
549166
  var init_application_lifecycle = __esm({
548613
549167
  "src/main/entry/cli/application-lifecycle.ts"() {
548614
549168
  "use strict";
548615
549169
  init_composition7();
548616
- import_node_path60 = require("node:path");
549170
+ import_node_path61 = require("node:path");
548617
549171
  init_lifecycle2();
548618
549172
  init_register_shared_rpc_handlers();
548619
549173
  init_model_channel2();
@@ -548636,6 +549190,8 @@ var init_application_lifecycle = __esm({
548636
549190
  init_user_plugin_manager();
548637
549191
  init_plugin3();
548638
549192
  init_plugin_session_tool_injection();
549193
+ init_session_event_log_remote();
549194
+ init_session_event_log_zip();
548639
549195
  init_message_deps();
548640
549196
  init_plugin_page_handlers();
548641
549197
  init_plugin_host_handlers();
@@ -548670,7 +549226,7 @@ function getStartDeps() {
548670
549226
  var DEFAULT_PORT4 = 9527;
548671
549227
  var AGENT_BROWSER_CHECK_TIMEOUT_MS = 1500;
548672
549228
  function readCliVersion() {
548673
- return "1.16.1" ? "1.16.1" : "unknown";
549229
+ return "1.16.2" ? "1.16.2" : "unknown";
548674
549230
  }
548675
549231
  var LOOPBACK_HOSTS = /* @__PURE__ */ new Set(["127.0.0.1", "localhost", "::1"]);
548676
549232
  function readOptionValue(args2, flag) {