@agentapprove/openclaw 0.1.4 → 0.1.5
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/dist/index.js +16 -19
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -331,7 +331,7 @@ function loadConfig(openclawConfig, logger) {
|
|
|
331
331
|
failBehavior,
|
|
332
332
|
privacyTier,
|
|
333
333
|
debug,
|
|
334
|
-
hookVersion: "1.1.
|
|
334
|
+
hookVersion: "1.1.2",
|
|
335
335
|
agentName,
|
|
336
336
|
e2eEnabled,
|
|
337
337
|
e2eUserKey,
|
|
@@ -588,10 +588,7 @@ var gatewaySessionId = randomBytes2(12).toString("hex");
|
|
|
588
588
|
var DEDUP_WINDOW_MS = 1200;
|
|
589
589
|
var DEDUP_MAX_SIZE = 300;
|
|
590
590
|
var recentCompletions = /* @__PURE__ */ new Map();
|
|
591
|
-
function resolveConversationId(
|
|
592
|
-
for (const id of candidates) {
|
|
593
|
-
if (id && id.trim()) return id;
|
|
594
|
-
}
|
|
591
|
+
function resolveConversationId() {
|
|
595
592
|
return gatewaySessionId;
|
|
596
593
|
}
|
|
597
594
|
function isDuplicateCompletion(toolName, params) {
|
|
@@ -718,7 +715,7 @@ function register(api) {
|
|
|
718
715
|
debugLog(`Plugin loaded, API: ${config.apiUrl}, agent: ${config.agentName}`);
|
|
719
716
|
}
|
|
720
717
|
api.on("before_tool_call", async (event, ctx) => {
|
|
721
|
-
const conversationId = resolveConversationId(
|
|
718
|
+
const conversationId = resolveConversationId();
|
|
722
719
|
const { toolType, displayName } = classifyTool(event.toolName, event.params);
|
|
723
720
|
const command = extractCommand(event.toolName, event.params);
|
|
724
721
|
const request = {
|
|
@@ -758,7 +755,7 @@ function register(api) {
|
|
|
758
755
|
}
|
|
759
756
|
});
|
|
760
757
|
api.on("after_tool_call", async (event, ctx) => {
|
|
761
|
-
const conversationId = resolveConversationId(
|
|
758
|
+
const conversationId = resolveConversationId();
|
|
762
759
|
if (isDuplicateCompletion(event.toolName, event.params)) {
|
|
763
760
|
if (config.debug) {
|
|
764
761
|
debugLog(`Skipping duplicate tool_complete for "${event.toolName}"`);
|
|
@@ -783,7 +780,7 @@ function register(api) {
|
|
|
783
780
|
}, config, pluginFilePath);
|
|
784
781
|
});
|
|
785
782
|
api.on("session_start", async (event, ctx) => {
|
|
786
|
-
const conversationId = resolveConversationId(
|
|
783
|
+
const conversationId = resolveConversationId();
|
|
787
784
|
if (config.debug) {
|
|
788
785
|
debugLog(`Session started: ${event.sessionId}${event.resumedFrom ? ` (resumed from ${event.resumedFrom})` : ""}`);
|
|
789
786
|
}
|
|
@@ -797,7 +794,7 @@ function register(api) {
|
|
|
797
794
|
}, config, pluginFilePath);
|
|
798
795
|
});
|
|
799
796
|
api.on("session_end", async (event, ctx) => {
|
|
800
|
-
const conversationId = resolveConversationId(
|
|
797
|
+
const conversationId = resolveConversationId();
|
|
801
798
|
if (config.debug) {
|
|
802
799
|
debugLog(`Session ended: ${event.sessionId} (${event.messageCount} messages, ${event.durationMs ?? "?"}ms)`);
|
|
803
800
|
}
|
|
@@ -813,7 +810,7 @@ function register(api) {
|
|
|
813
810
|
}, config, pluginFilePath);
|
|
814
811
|
});
|
|
815
812
|
api.on("llm_input", async (event, ctx) => {
|
|
816
|
-
const conversationId = resolveConversationId(
|
|
813
|
+
const conversationId = resolveConversationId();
|
|
817
814
|
if (config.debug) {
|
|
818
815
|
debugLog(`LLM input: model=${event.model}, prompt length=${event.prompt?.length ?? 0}`);
|
|
819
816
|
}
|
|
@@ -830,7 +827,7 @@ function register(api) {
|
|
|
830
827
|
}, config, pluginFilePath);
|
|
831
828
|
});
|
|
832
829
|
api.on("llm_output", async (event, ctx) => {
|
|
833
|
-
const conversationId = resolveConversationId(
|
|
830
|
+
const conversationId = resolveConversationId();
|
|
834
831
|
const responseText = event.assistantTexts?.join("\n") || "";
|
|
835
832
|
const textLength = responseText.length;
|
|
836
833
|
if (config.debug) {
|
|
@@ -850,7 +847,7 @@ function register(api) {
|
|
|
850
847
|
}, config, pluginFilePath);
|
|
851
848
|
});
|
|
852
849
|
api.on("agent_end", async (event, ctx) => {
|
|
853
|
-
const conversationId = resolveConversationId(
|
|
850
|
+
const conversationId = resolveConversationId();
|
|
854
851
|
if (config.debug) {
|
|
855
852
|
debugLog(`Agent ended: success=${event.success}${event.durationMs ? `, duration=${event.durationMs}ms` : ""}${event.error ? `, error=${event.error}` : ""}`);
|
|
856
853
|
}
|
|
@@ -867,7 +864,7 @@ function register(api) {
|
|
|
867
864
|
}, config, pluginFilePath);
|
|
868
865
|
});
|
|
869
866
|
api.on("before_compaction", async (event, ctx) => {
|
|
870
|
-
const conversationId = resolveConversationId(
|
|
867
|
+
const conversationId = resolveConversationId();
|
|
871
868
|
if (config.debug) {
|
|
872
869
|
debugLog(`Context compaction: ${event.messageCount} messages${event.tokenCount ? `, ${event.tokenCount} tokens` : ""}`);
|
|
873
870
|
}
|
|
@@ -882,7 +879,7 @@ function register(api) {
|
|
|
882
879
|
}, config, pluginFilePath);
|
|
883
880
|
});
|
|
884
881
|
api.on("subagent_spawned", async (event, ctx) => {
|
|
885
|
-
const conversationId = resolveConversationId(
|
|
882
|
+
const conversationId = resolveConversationId();
|
|
886
883
|
if (config.debug) {
|
|
887
884
|
debugLog(`Subagent spawned: ${event.agentId} (${event.mode}${event.label ? `, label=${event.label}` : ""})`);
|
|
888
885
|
}
|
|
@@ -899,7 +896,7 @@ function register(api) {
|
|
|
899
896
|
}, config, pluginFilePath);
|
|
900
897
|
});
|
|
901
898
|
api.on("subagent_ended", async (event, ctx) => {
|
|
902
|
-
const conversationId = resolveConversationId(
|
|
899
|
+
const conversationId = resolveConversationId();
|
|
903
900
|
if (config.debug) {
|
|
904
901
|
debugLog(`Subagent ended: ${event.targetKind} reason=${event.reason}${event.outcome ? `, outcome=${event.outcome}` : ""}`);
|
|
905
902
|
}
|
|
@@ -932,8 +929,8 @@ function register(api) {
|
|
|
932
929
|
eventType: eventTypeMap[event.action] || "command_event",
|
|
933
930
|
agent: config.agentName,
|
|
934
931
|
hookType: "command_event",
|
|
935
|
-
sessionId: resolveConversationId(
|
|
936
|
-
conversationId: resolveConversationId(
|
|
932
|
+
sessionId: resolveConversationId(),
|
|
933
|
+
conversationId: resolveConversationId(),
|
|
937
934
|
timestamp: event.timestamp.toISOString()
|
|
938
935
|
}, config, pluginFilePath);
|
|
939
936
|
},
|
|
@@ -955,8 +952,8 @@ function register(api) {
|
|
|
955
952
|
eventType: isInbound ? "user_prompt" : "response",
|
|
956
953
|
agent: config.agentName,
|
|
957
954
|
hookType: "session_event",
|
|
958
|
-
sessionId: resolveConversationId(
|
|
959
|
-
conversationId: resolveConversationId(
|
|
955
|
+
sessionId: resolveConversationId(),
|
|
956
|
+
conversationId: resolveConversationId(),
|
|
960
957
|
timestamp: event.timestamp.toISOString(),
|
|
961
958
|
cwd: channelLabel
|
|
962
959
|
};
|
package/openclaw.plugin.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"id": "openclaw",
|
|
3
3
|
"name": "Agent Approve",
|
|
4
4
|
"description": "Mobile approval for AI agent tool execution. Approve or deny tool calls from your iPhone and Apple Watch.",
|
|
5
|
-
"version": "0.1.
|
|
5
|
+
"version": "0.1.5",
|
|
6
6
|
"homepage": "https://agentapprove.com",
|
|
7
7
|
"configSchema": {
|
|
8
8
|
"type": "object",
|
package/package.json
CHANGED