@cyberdyne-systems/agent-safety 2026.3.13 → 2026.3.14
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.
- package/index.ts +15 -4
- package/package.json +1 -1
package/index.ts
CHANGED
|
@@ -46,6 +46,14 @@ export default function register(api: OpenClawPluginApi) {
|
|
|
46
46
|
const telegramApproval = pluginConfig.telegramApproval ?? false;
|
|
47
47
|
const telegramOwnerId = pluginConfig.telegramOwnerId;
|
|
48
48
|
|
|
49
|
+
// Update owner's UID to match Telegram owner ID if configured
|
|
50
|
+
if (telegramOwnerId) {
|
|
51
|
+
const owner = store.getOwner();
|
|
52
|
+
if (owner && owner.uid !== telegramOwnerId) {
|
|
53
|
+
store.update(owner.id, { uid: telegramOwnerId });
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
49
57
|
// Register the agent-facing safety tool
|
|
50
58
|
api.registerTool(
|
|
51
59
|
((_ctx) => {
|
|
@@ -64,10 +72,13 @@ export default function register(api: OpenClawPluginApi) {
|
|
|
64
72
|
if (toolName === "agent_safety") return;
|
|
65
73
|
|
|
66
74
|
const actionCategory = toolNameToCategory(toolName);
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
75
|
+
const senderId = ctx.requesterSenderId ?? undefined;
|
|
76
|
+
// If sender matches configured Telegram owner ID, treat as owner
|
|
77
|
+
const senderIsOwner =
|
|
78
|
+
((ctx as Record<string, unknown>).senderIsOwner as boolean | undefined) ||
|
|
79
|
+
(telegramOwnerId && senderId === telegramOwnerId) ||
|
|
80
|
+
undefined;
|
|
81
|
+
const requester = store.resolveRequester(senderId, senderIsOwner || undefined);
|
|
71
82
|
const owner = store.getOwner();
|
|
72
83
|
const stakeholders = store.list();
|
|
73
84
|
|
package/package.json
CHANGED