We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 9c3494f + 18cf13e commit 197f32aCopy full SHA for 197f32a
1 file changed
16-专题组队学习/02-OpenClaw家庭物资助手/tuntunclaw/workflow_hooks.py
@@ -0,0 +1,26 @@
1
+"""Workflow hooks between inventory checks and OpenClaw actions."""
2
+
3
+from __future__ import annotations
4
5
+from dataclasses import dataclass
6
7
+from inventory import InventoryItem, find_low_stock_items
8
9
10
+@dataclass(frozen=True)
11
+class RefillTask:
12
+ item_name: str
13
+ location: str
14
+ reason: str
15
16
17
+def plan_refill_tasks(items: list[InventoryItem]) -> list[RefillTask]:
18
+ """Create task descriptions for items that need a refill."""
19
+ return [
20
+ RefillTask(
21
+ item_name=item.name,
22
+ location=item.location or "unknown",
23
+ reason=f"{item.quantity} <= {item.low_stock_threshold}",
24
+ )
25
+ for item in find_low_stock_items(items)
26
+ ]
0 commit comments