lockbot 3.3.0__tar.gz → 3.3.2__tar.gz
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.
- {lockbot-3.3.0/python/lockbot.egg-info → lockbot-3.3.2}/PKG-INFO +1 -1
- {lockbot-3.3.0 → lockbot-3.3.2}/pyproject.toml +1 -1
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/resource_api/commands.py +17 -9
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/resource_api/notifications.py +12 -3
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/core/base_bot.py +1 -5
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/core/command_result.py +4 -2
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/core/device_bot.py +23 -18
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/core/i18n/en.py +0 -1
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/core/i18n/zh.py +0 -1
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/core/node_bot.py +9 -5
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/core/queue_bot.py +1 -1
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/core/utils.py +3 -2
- {lockbot-3.3.0 → lockbot-3.3.2/python/lockbot.egg-info}/PKG-INFO +1 -1
- {lockbot-3.3.0 → lockbot-3.3.2}/LICENSE +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/MANIFEST.in +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/README.md +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/__init__.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/agent_client/__init__.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/agent_client/handoff.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/__init__.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/__init__.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/admin/__init__.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/admin/router.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/agent_skill/SKILL.md +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/audit/__init__.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/audit/delegation.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/audit/models.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/audit/read_windows.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/audit/router.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/audit/service.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/auth/__init__.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/auth/dependencies.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/auth/models.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/auth/router.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/auth/schemas.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/backup/__init__.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/backup/router.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/backup/scheduler.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/backup/service.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/bot_audit/__init__.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/bot_audit/models.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/bot_audit/router.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/bot_audit/service.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/bots/__init__.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/bots/datasource.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/bots/encryption.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/bots/manager.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/bots/metrics_access.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/bots/metrics_signers.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/bots/migration_preflight.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/bots/models.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/bots/router.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/bots/schemas.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/bots/webhook_handler.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/broadcast/__init__.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/broadcast/models.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/broadcast/router.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/broadcast/service.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/config.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/database.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/deployment.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/feishu/__init__.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/feishu/backup.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/feishu/connectors.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/feishu/display_names.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/feishu/membership.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/feishu/models.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/feishu/proxy_settings.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/feishu/query_panel.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/feishu/router.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/feishu/service.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/feishu/traffic.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/feishu/unbound.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/feishu/ws_process.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/feishu/ws_proxy.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/logs/__init__.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/main.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/managed_paths.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/op_skill/SKILL.md +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/personal_panel/__init__.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/personal_panel/assets/me.html +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/personal_panel/assets/me.js +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/personal_panel/native.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/personal_panel/router.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/personal_panel/sessions.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/personal_panel/setup.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/platform_applications/__init__.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/platform_applications/backup.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/platform_applications/router.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/platform_applications/service.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/rate_limit.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/resource_api/__init__.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/resource_api/activity.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/resource_api/cache_control.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/resource_api/discovery.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/resource_api/errors.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/resource_api/event_log.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/resource_api/ingress.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/resource_api/lease_contract.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/resource_api/lease_history.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/resource_api/lifecycle_feed.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/resource_api/notification_queue.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/resource_api/observability.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/resource_api/op_skill.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/resource_api/operator.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/resource_api/privacy.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/resource_api/resources.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/resource_api/rules.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/resource_api/skill.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/resource_api/snapshot.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/resource_api/sources.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/resource_api/task_categories.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/resource_api/traffic.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/resource_api/usage.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/resource_api/usage_cleanup.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/resource_api/versioning.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/resource_api/view_links.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/resource_api/views.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/resource_auth/__init__.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/resource_auth/authority.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/resource_auth/credentials.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/resource_auth/dependencies.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/resource_auth/http_errors.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/resource_auth/models.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/resource_auth/pending.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/resource_auth/router.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/resource_auth/service.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/service_traffic.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/settings/__init__.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/settings/models.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/settings/router.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/sqlite_paths.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/state_migration.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/state_ownership.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/static.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/core/__init__.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/core/bot_instance.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/core/command_context.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/core/config.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/core/device_usage_alert.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/core/device_usage_utils.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/core/handler.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/core/i18n/__init__.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/core/io.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/core/message_adapter.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/core/msg_utils.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/core/platforms/__init__.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/core/platforms/feishu.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/core/platforms/feishu_events.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/core/platforms/feishu_proxy.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/core/platforms/infoflow.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/core/platforms/registry.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/core/queue_device_bot.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/core/request.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/core/resource_policy.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/core/scheduler.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/metrics/__init__.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/metrics/exporter.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/metrics/gateway.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot.egg-info/SOURCES.txt +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot.egg-info/dependency_links.txt +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot.egg-info/requires.txt +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot.egg-info/top_level.txt +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/setup.cfg +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/tests/test_lease_history_v2_report.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/tests/test_op_history_report.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/tests/test_v2_consumer_http.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/tools/create_super_admin.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/tools/deployment_preflight.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/tools/gen_keys.py +0 -0
- {lockbot-3.3.0 → lockbot-3.3.2}/tools/reset_super_admin_password.py +0 -0
|
@@ -41,6 +41,7 @@ from lockbot.backend.app.resource_api.traffic import credential_budget, resource
|
|
|
41
41
|
from lockbot.backend.app.resource_auth.authority import authority_guard
|
|
42
42
|
from lockbot.backend.app.resource_auth.dependencies import ResourceActor, require_resource_actor, reverify_actor
|
|
43
43
|
from lockbot.core.base_bot import AcquisitionLimitExceeded
|
|
44
|
+
from lockbot.core.command_result import capture_result
|
|
44
45
|
from lockbot.core.handler import (
|
|
45
46
|
BINDING_COMMANDS,
|
|
46
47
|
CommandNotAllowed,
|
|
@@ -322,14 +323,15 @@ def execute_command_via_api(
|
|
|
322
323
|
request.state.agent_event["all_owned_resources"] = text.lower() in {"free", "unlock"}
|
|
323
324
|
try:
|
|
324
325
|
request.state.agent_event["stage"] = "dispatching"
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
326
|
+
with capture_result() as result:
|
|
327
|
+
raw_reply = execute_text_command(
|
|
328
|
+
actor.external_user_id,
|
|
329
|
+
text,
|
|
330
|
+
bot,
|
|
331
|
+
allowed_commands=AGENT_ALLOWED_COMMANDS,
|
|
332
|
+
acquisition_limit=RESOURCE_API_MAX_HELD_PER_IDENTITY,
|
|
333
|
+
source="api",
|
|
334
|
+
)
|
|
333
335
|
except AcquisitionLimitExceeded:
|
|
334
336
|
request.state.agent_event["stage"] = "rejected"
|
|
335
337
|
raise errors.identity_cap_reached(RESOURCE_API_MAX_HELD_PER_IDENTITY) from None
|
|
@@ -382,7 +384,13 @@ def execute_command_via_api(
|
|
|
382
384
|
|
|
383
385
|
# The bot method has released the state lock by now, so this send cannot
|
|
384
386
|
# extend a critical section. Still inside the lease, so a drain waits for it.
|
|
385
|
-
if
|
|
387
|
+
if (
|
|
388
|
+
result.committed
|
|
389
|
+
and result.operation == canonical_command(word)
|
|
390
|
+
and result.affected_resources != ()
|
|
391
|
+
and should_notify(word)
|
|
392
|
+
and bot_row.resource_api_notify_enabled
|
|
393
|
+
):
|
|
386
394
|
notify_group(
|
|
387
395
|
bot,
|
|
388
396
|
bot_id=bot_id,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"""Safe API-operation notices with bounded trailing delivery.
|
|
2
2
|
|
|
3
3
|
The first notice retains synchronous behavior. Later events in the ten-second window
|
|
4
|
-
are sent by a bounded worker even if no further API call arrives.
|
|
5
|
-
|
|
4
|
+
are sent by a bounded worker even if no further API call arrives. The command route
|
|
5
|
+
announces confirmed mutations only. Delivery never replays commands.
|
|
6
6
|
"""
|
|
7
7
|
|
|
8
8
|
from __future__ import annotations
|
|
@@ -132,7 +132,16 @@ def should_notify(command_word):
|
|
|
132
132
|
|
|
133
133
|
|
|
134
134
|
def notify_group(
|
|
135
|
-
bot,
|
|
135
|
+
bot,
|
|
136
|
+
*,
|
|
137
|
+
bot_id,
|
|
138
|
+
command,
|
|
139
|
+
actor_id,
|
|
140
|
+
command_word,
|
|
141
|
+
agent_label=None,
|
|
142
|
+
purpose=None,
|
|
143
|
+
task_category=None,
|
|
144
|
+
target=None,
|
|
136
145
|
):
|
|
137
146
|
"""Return true only for an accepted immediate send; false also includes queued notices.
|
|
138
147
|
|
|
@@ -329,11 +329,7 @@ class BaseLockBot:
|
|
|
329
329
|
prefix = self._get_site_value(f"agent_promotion_text_{lang}")
|
|
330
330
|
if not prefix.strip():
|
|
331
331
|
prefix = t("help.agent_lock_hint", config=self.config, url="")
|
|
332
|
-
|
|
333
|
-
panel_url = self._personal_panel_url()
|
|
334
|
-
if panel_url:
|
|
335
|
-
parts.append((t("help.personal_panel_short", config=self.config), panel_url))
|
|
336
|
-
return parts + ["\n"]
|
|
332
|
+
return [content + "\n\n", (prefix, skill_url), "\n"]
|
|
337
333
|
return content + "\n\n"
|
|
338
334
|
return message + sep + usage
|
|
339
335
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"""Request-local delivery hints, separate from rendered messages and HTTP status.
|
|
2
2
|
|
|
3
3
|
Only committed success paths mark a result. Capture is opt-in at trusted ingress;
|
|
4
|
-
unknown results never suppress
|
|
4
|
+
unknown results never suppress the caller's reply. No command text or user identity is stored.
|
|
5
5
|
"""
|
|
6
6
|
|
|
7
7
|
from contextlib import contextmanager
|
|
@@ -14,6 +14,7 @@ class CommandResult:
|
|
|
14
14
|
operation: str | None = None
|
|
15
15
|
committed: bool = False
|
|
16
16
|
reaction_safe: bool = False
|
|
17
|
+
affected_resources: tuple[str, ...] | None = None
|
|
17
18
|
|
|
18
19
|
|
|
19
20
|
_result = ContextVar("lockbot_delivery_result", default=None)
|
|
@@ -29,10 +30,11 @@ def capture_result():
|
|
|
29
30
|
_result.reset(token)
|
|
30
31
|
|
|
31
32
|
|
|
32
|
-
def completed_reply(reply, operation, *, reaction_safe=True):
|
|
33
|
+
def completed_reply(reply, operation, *, reaction_safe=True, affected_resources=None):
|
|
33
34
|
result = _result.get()
|
|
34
35
|
if result is not None:
|
|
35
36
|
result.operation = operation
|
|
36
37
|
result.committed = True
|
|
37
38
|
result.reaction_safe = reaction_safe
|
|
39
|
+
result.affected_resources = None if affected_resources is None else tuple(affected_resources)
|
|
38
40
|
return reply
|
|
@@ -317,6 +317,17 @@ class DeviceBot(BaseLockBot):
|
|
|
317
317
|
self._save_and_notify()
|
|
318
318
|
return completed_reply(reply, "slock")
|
|
319
319
|
|
|
320
|
+
def _release_owned_devices(self, user_id, node_keys):
|
|
321
|
+
affected = []
|
|
322
|
+
for node_key in node_keys:
|
|
323
|
+
for index, device in enumerate(self.state.bot_state[node_key]):
|
|
324
|
+
if device["status"] != "idle":
|
|
325
|
+
if remove_user_info(device["current_users"], user_id):
|
|
326
|
+
affected.append(f"{node_key}:dev{index}")
|
|
327
|
+
if not device["current_users"]:
|
|
328
|
+
device["status"] = "idle"
|
|
329
|
+
return affected
|
|
330
|
+
|
|
320
331
|
def unlock(self, user_id, command):
|
|
321
332
|
"""
|
|
322
333
|
unlock command
|
|
@@ -326,18 +337,13 @@ class DeviceBot(BaseLockBot):
|
|
|
326
337
|
|
|
327
338
|
if re.match(r"^\s*(unlock|free)\s*$", command):
|
|
328
339
|
with self._state_guard():
|
|
329
|
-
|
|
330
|
-
for device in devices:
|
|
331
|
-
if device["status"] != "idle":
|
|
332
|
-
remove_user_info(device["current_users"], user_id)
|
|
333
|
-
if len(device["current_users"]) == 0:
|
|
334
|
-
device["status"] = "idle"
|
|
340
|
+
affected = self._release_owned_devices(user_id, self.state.bot_state)
|
|
335
341
|
reply = self.adapter.build_reply(self._msg_with_usage("success.resource_released"), [user_id])
|
|
336
342
|
log_to_file(user_id, "unlock", "all", "all", config=self.config)
|
|
337
343
|
self._save_and_notify()
|
|
338
|
-
return completed_reply(reply, "unlock")
|
|
344
|
+
return completed_reply(reply, "unlock", affected_resources=affected)
|
|
339
345
|
|
|
340
|
-
m = re.match(
|
|
346
|
+
m = re.match(rf"^\s*(unlock|free)\s+{self._node_list_pattern}\s*$", command)
|
|
341
347
|
if m:
|
|
342
348
|
node_key_str = m[2]
|
|
343
349
|
if m[3]:
|
|
@@ -357,17 +363,11 @@ class DeviceBot(BaseLockBot):
|
|
|
357
363
|
)
|
|
358
364
|
|
|
359
365
|
with self._state_guard():
|
|
360
|
-
|
|
361
|
-
devices = self.state.bot_state[node_key]
|
|
362
|
-
for device in devices:
|
|
363
|
-
if device["status"] != "idle":
|
|
364
|
-
remove_user_info(device["current_users"], user_id)
|
|
365
|
-
if len(device["current_users"]) == 0:
|
|
366
|
-
device["status"] = "idle"
|
|
366
|
+
affected = self._release_owned_devices(user_id, node_key_list)
|
|
367
367
|
reply = self.adapter.build_reply(self._msg_with_usage("success.resource_released"), [user_id])
|
|
368
|
-
log_to_file(user_id, "unlock",
|
|
368
|
+
log_to_file(user_id, "unlock", node_key_list, "all", config=self.config)
|
|
369
369
|
self._save_and_notify()
|
|
370
|
-
return completed_reply(reply, "unlock")
|
|
370
|
+
return completed_reply(reply, "unlock", affected_resources=affected)
|
|
371
371
|
|
|
372
372
|
# Case 3: Release specific devices requested by the user
|
|
373
373
|
parse_ok, error_reply, node_key_list, dev_ids_list, _ = self.parse_command(user_id, "unlock|free", command)
|
|
@@ -396,7 +396,12 @@ class DeviceBot(BaseLockBot):
|
|
|
396
396
|
)
|
|
397
397
|
log_to_file(user_id, "unlock", node_key_list, dev_ids_list, config=self.config)
|
|
398
398
|
self._save_and_notify()
|
|
399
|
-
|
|
399
|
+
affected = (
|
|
400
|
+
f"{node_key}:dev{dev_id}"
|
|
401
|
+
for node_key, dev_ids in zip(node_key_list, dev_ids_list, strict=True)
|
|
402
|
+
for dev_id in dev_ids
|
|
403
|
+
)
|
|
404
|
+
return completed_reply(reply, "unlock", affected_resources=affected)
|
|
400
405
|
|
|
401
406
|
def kickout(self, user_id, command):
|
|
402
407
|
"""
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"""English (en) message translations for lockbot."""
|
|
2
2
|
|
|
3
3
|
MESSAGES = {
|
|
4
|
-
"help.personal_panel_short": "My resources ",
|
|
5
4
|
"help.personal_panel": "My resources · allocations and reservations ",
|
|
6
5
|
"help.personal_panel_hint": (
|
|
7
6
|
"First visit or a new device: ask your IM-bound Agent to open your resource panel, from a local CLI or server. "
|
|
@@ -237,19 +237,23 @@ class NodeBot(BaseLockBot):
|
|
|
237
237
|
"""
|
|
238
238
|
if re.match(r"^\s*(unlock|free)\s*$", command):
|
|
239
239
|
with self._state_guard():
|
|
240
|
-
|
|
241
|
-
|
|
240
|
+
affected = []
|
|
241
|
+
for node_key, node in self._resource_state().items():
|
|
242
|
+
booking_removed = remove_user_info(node["booking_list"], user_id)
|
|
243
|
+
holding_removed = False
|
|
242
244
|
if node["status"] != "idle":
|
|
243
|
-
remove_user_info(node["current_users"], user_id)
|
|
245
|
+
holding_removed = remove_user_info(node["current_users"], user_id)
|
|
244
246
|
if len(node["current_users"]) == 0:
|
|
245
247
|
node["status"] = "idle"
|
|
248
|
+
if booking_removed or holding_removed:
|
|
249
|
+
affected.append(node_key)
|
|
246
250
|
reply = self.adapter.build_reply(
|
|
247
251
|
self._msg_with_usage("success.resource_released"),
|
|
248
252
|
[user_id],
|
|
249
253
|
)
|
|
250
254
|
log_to_file(user_id, "unlock", "all", config=self.config)
|
|
251
255
|
self._save_and_notify()
|
|
252
|
-
return completed_reply(reply, "unlock")
|
|
256
|
+
return completed_reply(reply, "unlock", affected_resources=affected)
|
|
253
257
|
|
|
254
258
|
parse_ok, error_reply, node_keys, _ = self._parse_resource_command(user_id, "unlock|free", command)
|
|
255
259
|
if not parse_ok:
|
|
@@ -273,7 +277,7 @@ class NodeBot(BaseLockBot):
|
|
|
273
277
|
)
|
|
274
278
|
log_to_file(user_id, "unlock", node_keys, config=self.config)
|
|
275
279
|
self._save_and_notify()
|
|
276
|
-
return completed_reply(reply, "unlock")
|
|
280
|
+
return completed_reply(reply, "unlock", affected_resources=node_keys)
|
|
277
281
|
|
|
278
282
|
def kickout(self, user_id, command):
|
|
279
283
|
"""
|
|
@@ -177,7 +177,7 @@ class QueueBot(NodeBot):
|
|
|
177
177
|
reply = self.adapter.build_reply(self._msg_with_usage("success.booking_added"), [user_id])
|
|
178
178
|
log_to_file(user_id, "lock", node_keys, duration, config=self.config)
|
|
179
179
|
self._save_and_notify()
|
|
180
|
-
return reply
|
|
180
|
+
return completed_reply(reply, "book", reaction_safe=False)
|
|
181
181
|
|
|
182
182
|
def take(self, user_id, command):
|
|
183
183
|
"""
|
|
@@ -39,11 +39,12 @@ def find_user_info(user_info_list, user_id):
|
|
|
39
39
|
|
|
40
40
|
|
|
41
41
|
def remove_user_info(user_info_list, user_id):
|
|
42
|
-
"""Remove a user
|
|
42
|
+
"""Remove a user by user_id and return whether an entry was removed."""
|
|
43
43
|
for i, user_info in enumerate(user_info_list):
|
|
44
44
|
if user_info["user_id"] == user_id:
|
|
45
45
|
user_info_list.pop(i)
|
|
46
|
-
|
|
46
|
+
return True
|
|
47
|
+
return False
|
|
47
48
|
|
|
48
49
|
|
|
49
50
|
def duration_to_seconds(duration, unit):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/platform_applications/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{lockbot-3.3.0 → lockbot-3.3.2}/python/lockbot/backend/app/resource_api/notification_queue.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|