mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-11-25 07:31:32 +08:00
* feat(plugins): add timezone config to ScheNotify for all tools (LANG-319) Add a `timezone` plugin config (IANA name, UTC, or an offset such as UTC+8; empty keeps the server's local timezone). get_current_time_str reports the time in it, schedule_notify interprets time_str in it, and !sche / !dsche display reminder times in it. Reminders now store aware instants, so the detached scheduler compares against UTC without reading installation config. Bump to 0.2.7 and add tzdata. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: multica-agent <github@multica.ai> * fix(plugins): deliver ScheNotify reminders under audit-correlating SDKs (LANG-319) The scheduler task was created with a copy of the scheduling invocation's context, which carries the SDK's per-action audit correlation. SDKs that close that correlation when the action returns (langbot-plugin 0.7.21, pinned by Core) then rejected every delivery with "Plugin audit invocation has ended", so no reminder was ever sent. Start the loop from an empty context; it already re-enters the captured invocation. Found during live acceptance; adds a regression test that relays the audit correlation like the real handler. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: multica-agent <github@multica.ai> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: multica-agent <github@multica.ai>
35 lines
1.2 KiB
Python
35 lines
1.2 KiB
Python
# Auto generated by LangBot Plugin SDK.
|
|
# Please refer to https://langbot.app/docs/en/plugin/dev/tutor.html for more details.
|
|
from __future__ import annotations
|
|
|
|
from typing import Any
|
|
|
|
from langbot_plugin.api.definition.components.tool.tool import Tool
|
|
from langbot_plugin.api.entities.builtin.provider import session as provider_session
|
|
|
|
|
|
class GetCurrentTimeStr(Tool):
|
|
"""
|
|
Get the current time as a string.
|
|
This function should be called:
|
|
- When the user directly asks for the current time
|
|
- Before scheduling any notification to ensure accurate time calculation
|
|
"""
|
|
|
|
async def call(self, params: dict[str, Any], session: provider_session.Session, query_id: int) -> str:
|
|
"""
|
|
Get the current time in the configured timezone, formatted as
|
|
``%Y-%m-%d %H:%M:%S (<timezone>)``, e.g.
|
|
``2026-01-01 08:00:00 (Asia/Shanghai, UTC+08:00)``.
|
|
|
|
Args:
|
|
params: Tool parameters (not used)
|
|
session: Current session information
|
|
query_id: Query ID
|
|
|
|
Returns:
|
|
str: Current time string
|
|
"""
|
|
# Current time in the timezone configured for this installation.
|
|
return self.plugin.format_time(self.plugin.current_time())
|