@m1a0rz/agent-identity 0.4.6 → 0.5.0

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.
Files changed (107) hide show
  1. package/README-cn.md +70 -9
  2. package/README.md +70 -9
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +79 -25
  5. package/dist/src/actions/identity-actions.d.ts.map +1 -1
  6. package/dist/src/actions/identity-actions.js +2 -2
  7. package/dist/src/commands/identity-commands.d.ts.map +1 -1
  8. package/dist/src/commands/identity-commands.js +1 -37
  9. package/dist/src/hooks/before-agent-start.d.ts +11 -3
  10. package/dist/src/hooks/before-agent-start.d.ts.map +1 -1
  11. package/dist/src/hooks/before-agent-start.js +12 -11
  12. package/dist/src/hooks/before-dispatch.d.ts +71 -0
  13. package/dist/src/hooks/before-dispatch.d.ts.map +1 -0
  14. package/dist/src/hooks/before-dispatch.js +148 -0
  15. package/dist/src/hooks/before-tool-call.d.ts +7 -2
  16. package/dist/src/hooks/before-tool-call.d.ts.map +1 -1
  17. package/dist/src/hooks/before-tool-call.js +19 -45
  18. package/dist/src/hooks/llm-input.d.ts.map +1 -1
  19. package/dist/src/hooks/llm-input.js +0 -3
  20. package/dist/src/local-server/handlers.d.ts +44 -0
  21. package/dist/src/local-server/handlers.d.ts.map +1 -0
  22. package/dist/src/local-server/handlers.js +207 -0
  23. package/dist/src/local-server/identity-socket.d.ts +18 -0
  24. package/dist/src/local-server/identity-socket.d.ts.map +1 -0
  25. package/dist/src/local-server/identity-socket.js +198 -0
  26. package/dist/src/local-server/peer-check.d.ts +58 -0
  27. package/dist/src/local-server/peer-check.d.ts.map +1 -0
  28. package/dist/src/local-server/peer-check.js +206 -0
  29. package/dist/src/local-server/peercred-linux.d.ts +30 -0
  30. package/dist/src/local-server/peercred-linux.d.ts.map +1 -0
  31. package/dist/src/local-server/peercred-linux.js +69 -0
  32. package/dist/src/risk/llm-risk-check.d.ts +0 -5
  33. package/dist/src/risk/llm-risk-check.d.ts.map +1 -1
  34. package/dist/src/risk/llm-risk-check.js +10 -1
  35. package/dist/src/risk/low-risk-tools.d.ts.map +1 -1
  36. package/dist/src/risk/low-risk-tools.js +0 -1
  37. package/dist/src/store/dispatch-feature-flag.d.ts +7 -0
  38. package/dist/src/store/dispatch-feature-flag.d.ts.map +1 -0
  39. package/dist/src/store/dispatch-feature-flag.js +36 -0
  40. package/dist/src/tools/identity-config-suggest.d.ts +1 -1
  41. package/dist/src/tools/identity-config-suggest.d.ts.map +1 -1
  42. package/dist/src/tools/identity-config-suggest.js +1 -1
  43. package/dist/src/tools/identity-config.d.ts +1 -1
  44. package/dist/src/tools/identity-config.d.ts.map +1 -1
  45. package/dist/src/tools/identity-config.js +1 -1
  46. package/dist/src/tools/identity-fetch.d.ts +1 -1
  47. package/dist/src/tools/identity-fetch.d.ts.map +1 -1
  48. package/dist/src/tools/identity-fetch.js +1 -2
  49. package/dist/src/tools/identity-get-role-credentials.d.ts +1 -1
  50. package/dist/src/tools/identity-get-role-credentials.d.ts.map +1 -1
  51. package/dist/src/tools/identity-get-role-credentials.js +1 -1
  52. package/dist/src/tools/identity-get-session-token.d.ts +1 -1
  53. package/dist/src/tools/identity-get-session-token.d.ts.map +1 -1
  54. package/dist/src/tools/identity-get-session-token.js +1 -1
  55. package/dist/src/tools/identity-get-tip-token.d.ts +1 -1
  56. package/dist/src/tools/identity-get-tip-token.d.ts.map +1 -1
  57. package/dist/src/tools/identity-get-tip-token.js +1 -1
  58. package/dist/src/tools/identity-list-credentials.d.ts +1 -1
  59. package/dist/src/tools/identity-list-credentials.d.ts.map +1 -1
  60. package/dist/src/tools/identity-list-credentials.js +1 -1
  61. package/dist/src/tools/identity-list-risk-patterns.d.ts +1 -1
  62. package/dist/src/tools/identity-list-risk-patterns.d.ts.map +1 -1
  63. package/dist/src/tools/identity-list-risk-patterns.js +1 -1
  64. package/dist/src/tools/identity-list-roles.d.ts +1 -1
  65. package/dist/src/tools/identity-list-roles.d.ts.map +1 -1
  66. package/dist/src/tools/identity-list-roles.js +1 -1
  67. package/dist/src/tools/identity-list-tips.d.ts +1 -1
  68. package/dist/src/tools/identity-list-tips.d.ts.map +1 -1
  69. package/dist/src/tools/identity-list-tips.js +1 -1
  70. package/dist/src/tools/identity-login.d.ts +1 -1
  71. package/dist/src/tools/identity-login.d.ts.map +1 -1
  72. package/dist/src/tools/identity-login.js +1 -1
  73. package/dist/src/tools/identity-logout.d.ts +1 -1
  74. package/dist/src/tools/identity-logout.d.ts.map +1 -1
  75. package/dist/src/tools/identity-logout.js +1 -1
  76. package/dist/src/tools/identity-risk-check.d.ts +1 -1
  77. package/dist/src/tools/identity-risk-check.d.ts.map +1 -1
  78. package/dist/src/tools/identity-risk-check.js +1 -1
  79. package/dist/src/tools/identity-set-binding.d.ts +1 -1
  80. package/dist/src/tools/identity-set-binding.d.ts.map +1 -1
  81. package/dist/src/tools/identity-set-binding.js +1 -1
  82. package/dist/src/tools/identity-status.d.ts +1 -1
  83. package/dist/src/tools/identity-status.d.ts.map +1 -1
  84. package/dist/src/tools/identity-status.js +1 -1
  85. package/dist/src/tools/identity-unset-binding.d.ts +1 -1
  86. package/dist/src/tools/identity-unset-binding.d.ts.map +1 -1
  87. package/dist/src/tools/identity-unset-binding.js +1 -1
  88. package/dist/src/tools/identity-whoami.d.ts +1 -1
  89. package/dist/src/tools/identity-whoami.d.ts.map +1 -1
  90. package/dist/src/tools/identity-whoami.js +1 -1
  91. package/dist/src/types.d.ts +22 -0
  92. package/dist/src/types.d.ts.map +1 -1
  93. package/dist/src/utils/tool-result.d.ts +26 -0
  94. package/dist/src/utils/tool-result.d.ts.map +1 -0
  95. package/dist/src/utils/tool-result.js +40 -0
  96. package/openclaw.plugin.json +15 -0
  97. package/package.json +9 -6
  98. package/skills/SKILL.md +3 -8
  99. package/dist/src/store/tool-approval-store.d.ts +0 -40
  100. package/dist/src/store/tool-approval-store.d.ts.map +0 -1
  101. package/dist/src/store/tool-approval-store.js +0 -162
  102. package/dist/src/tools/identity-approve-tool.d.ts +0 -15
  103. package/dist/src/tools/identity-approve-tool.d.ts.map +0 -1
  104. package/dist/src/tools/identity-approve-tool.js +0 -50
  105. package/dist/src/utils/approval-channel.d.ts +0 -7
  106. package/dist/src/utils/approval-channel.d.ts.map +0 -1
  107. package/dist/src/utils/approval-channel.js +0 -28
@@ -0,0 +1,206 @@
1
+ /*
2
+ * Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd. and/or its affiliates.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ /**
17
+ * Peer process identification for the local UDS identity server (Linux-only).
18
+ *
19
+ * Resolution strategy:
20
+ *
21
+ * SO_PEERCRED (zero-cost, race-free):
22
+ * getsockopt(fd, SOL_SOCKET, SO_PEERCRED) returns { pid, uid, gid } directly
23
+ * from the kernel. No process spawn, no race conditions.
24
+ * Requires a native binding registered via registerPeerCredProvider().
25
+ *
26
+ * /proc filesystem (zero-spawn process info):
27
+ * /proc/<pid>/exe → full executable path (readlink)
28
+ * /proc/<pid>/comm → kernel comm field (process name, max 16 chars)
29
+ * /proc/<pid>/status → UID/GID
30
+ * Used to resolve process details after PID is obtained from SO_PEERCRED.
31
+ *
32
+ * When SO_PEERCRED is not available (no native provider registered), behavior
33
+ * is controlled by the failOpen flag:
34
+ * - failOpen=true → allow with warning (default, socket 0600 still protects)
35
+ * - failOpen=false → reject
36
+ *
37
+ * Security model:
38
+ * - Socket 0600 ensures same-UID at the filesystem level.
39
+ * - SO_PEERCRED adds process-level granularity via an allowlist.
40
+ * - Default allowlist: curl, wget, httpie, python, node, bun, deno.
41
+ * - Operator can extend via identity.localServerAllowlist config.
42
+ */
43
+ import { readlinkSync, readFileSync } from "node:fs";
44
+ import path from "node:path";
45
+ let peerLogger = {};
46
+ export function setPeerCheckLogger(logger) {
47
+ peerLogger = logger;
48
+ }
49
+ const DEFAULT_ALLOWLIST = [
50
+ "curl",
51
+ "wget",
52
+ "http", // httpie
53
+ "xh", // xh (httpie-compatible)
54
+ "python",
55
+ "python3",
56
+ "node",
57
+ "bun",
58
+ "deno",
59
+ "java",
60
+ "go",
61
+ ];
62
+ // ─── Tier 1: SO_PEERCRED via pluggable native binding ────────────────
63
+ let peerCredProvider = null;
64
+ /**
65
+ * Register a native SO_PEERCRED provider. Call this at startup if a native
66
+ * binding (N-API addon, koffi FFI, etc.) is available.
67
+ *
68
+ * Example with a hypothetical native addon:
69
+ * import { getPeerCred } from "./peercred.node";
70
+ * registerPeerCredProvider(getPeerCred);
71
+ *
72
+ * The provider receives the connected socket fd and must return
73
+ * { pid, uid, gid } or null on failure.
74
+ */
75
+ export function registerPeerCredProvider(fn) {
76
+ peerCredProvider = fn;
77
+ }
78
+ /** True when a native SO_PEERCRED provider is registered. */
79
+ export function hasPeerCredProvider() {
80
+ return peerCredProvider !== null;
81
+ }
82
+ /**
83
+ * Get peer credentials from a connected Unix socket fd via SO_PEERCRED.
84
+ * Returns null when no native provider is registered or the call fails.
85
+ */
86
+ function getPeerCredentials(socketFd) {
87
+ if (!peerCredProvider || socketFd < 0)
88
+ return null;
89
+ try {
90
+ return peerCredProvider(socketFd);
91
+ }
92
+ catch {
93
+ return null;
94
+ }
95
+ }
96
+ // ─── Tier 2: /proc filesystem (Linux) ────────────────────────────────
97
+ function readProcExe(pid) {
98
+ try {
99
+ return readlinkSync(`/proc/${pid}/exe`);
100
+ }
101
+ catch {
102
+ return null;
103
+ }
104
+ }
105
+ function readProcComm(pid) {
106
+ try {
107
+ return readFileSync(`/proc/${pid}/comm`, "utf-8").trim() || null;
108
+ }
109
+ catch {
110
+ return null;
111
+ }
112
+ }
113
+ function readProcIds(pid) {
114
+ try {
115
+ const status = readFileSync(`/proc/${pid}/status`, "utf-8");
116
+ let uid = -1;
117
+ let gid = -1;
118
+ for (const line of status.split("\n")) {
119
+ // Format: "Uid:\treal\teffective\tsaved\tfs"
120
+ if (line.startsWith("Uid:")) {
121
+ uid = parseInt(line.split("\t")[1], 10);
122
+ }
123
+ else if (line.startsWith("Gid:")) {
124
+ gid = parseInt(line.split("\t")[1], 10);
125
+ }
126
+ if (uid >= 0 && gid >= 0)
127
+ break;
128
+ }
129
+ return { uid, gid };
130
+ }
131
+ catch {
132
+ return null;
133
+ }
134
+ }
135
+ function buildPeerInfo(pid, cred) {
136
+ const comm = readProcComm(pid) ?? "unknown";
137
+ const exe = readProcExe(pid) ?? comm;
138
+ const ids = cred ?? readProcIds(pid);
139
+ return {
140
+ pid,
141
+ uid: ids?.uid ?? -1,
142
+ gid: ids?.gid ?? -1,
143
+ processName: comm,
144
+ processPath: exe,
145
+ };
146
+ }
147
+ // ─── Allowlist check ─────────────────────────────────────────────────
148
+ /**
149
+ * Check whether a peer process is in the allowlist.
150
+ *
151
+ * Matching rules (any match = allowed):
152
+ * 1. Exact basename match: "curl" matches /usr/bin/curl
153
+ * 2. Full path match: "/usr/bin/curl" matches exactly
154
+ * 3. Glob suffix: "python*" matches python3, python3.11
155
+ */
156
+ export function isProcessAllowed(peer, customAllowlist = []) {
157
+ const list = [...DEFAULT_ALLOWLIST, ...customAllowlist];
158
+ const baseName = path.basename(peer.processPath || peer.processName);
159
+ for (const pattern of list) {
160
+ if (pattern.includes("/") && peer.processPath === pattern)
161
+ return true;
162
+ if (pattern.endsWith("*") && baseName.startsWith(pattern.slice(0, -1)))
163
+ return true;
164
+ if (pattern === baseName)
165
+ return true;
166
+ }
167
+ return false;
168
+ }
169
+ // ─── Main entry ──────────────────────────────────────────────────────
170
+ /**
171
+ * Resolve and validate the peer process for a UDS connection.
172
+ *
173
+ * @param customAllowlist Extra process names/paths to allow.
174
+ * @param failOpen If true, allow when SO_PEERCRED is unavailable
175
+ * (socket 0600 still provides UID-level protection).
176
+ * @param socketFd The accepted connection socket's fd (for SO_PEERCRED).
177
+ */
178
+ export function checkPeer(customAllowlist, failOpen, socketFd = -1) {
179
+ peerLogger.debug?.(`peer-check: fd=${socketFd} hasPeerCredProvider=${peerCredProvider !== null} failOpen=${failOpen}`);
180
+ const cred = getPeerCredentials(socketFd);
181
+ if (cred && cred.pid > 0) {
182
+ peerLogger.debug?.(`peer-check: SO_PEERCRED ok pid=${cred.pid} uid=${cred.uid} gid=${cred.gid}`);
183
+ const peer = buildPeerInfo(cred.pid, cred);
184
+ peerLogger.debug?.(`peer-check: resolved process name=${peer.processName} path=${peer.processPath} uid=${peer.uid} gid=${peer.gid}`);
185
+ if (isProcessAllowed(peer, customAllowlist)) {
186
+ peerLogger.debug?.(`peer-check: ALLOWED ${peer.processName} (pid=${peer.pid})`);
187
+ return { allowed: true, peer };
188
+ }
189
+ const reason = `process_not_allowed: ${peer.processName} (pid=${peer.pid}, path=${peer.processPath})`;
190
+ peerLogger.warn?.(`peer-check: REJECTED ${reason}`);
191
+ return { allowed: false, reason, peer };
192
+ }
193
+ if (cred) {
194
+ peerLogger.debug?.(`peer-check: SO_PEERCRED returned pid=${cred.pid} (invalid), falling back`);
195
+ }
196
+ else {
197
+ peerLogger.debug?.(`peer-check: SO_PEERCRED unavailable (no provider or fd=${socketFd}), falling back`);
198
+ }
199
+ if (failOpen) {
200
+ peerLogger.debug?.("peer-check: ALLOWED (fail-open, peer unresolvable — socket 0600 provides baseline)");
201
+ return { allowed: true, peer: null };
202
+ }
203
+ const reason = "peer_unresolvable: no SO_PEERCRED provider registered";
204
+ peerLogger.warn?.(`peer-check: REJECTED ${reason}`);
205
+ return { allowed: false, reason };
206
+ }
@@ -0,0 +1,30 @@
1
+ /**
2
+ * SO_PEERCRED implementation for Linux via koffi FFI.
3
+ *
4
+ * Calls getsockopt(fd, SOL_SOCKET, SO_PEERCRED, &ucred, &len) to retrieve
5
+ * the peer process PID, UID, and GID from a connected Unix domain socket.
6
+ *
7
+ * koffi is an optionalDependency — if unavailable (non-Linux, missing binary,
8
+ * exotic platform), this module returns null and the caller falls back to
9
+ * fail-open behavior.
10
+ *
11
+ * Prebuilt binaries included by koffi:
12
+ * Linux x86_64 (glibc/musl), Linux arm64 (glibc/musl),
13
+ * macOS x86_64/arm64, Windows x86_64/arm64, FreeBSD, OpenBSD.
14
+ * SO_PEERCRED itself is Linux-only; on other OSes this module is a no-op.
15
+ */
16
+ import type { GetPeerCredFn } from "./peer-check.js";
17
+ /**
18
+ * Try to build a SO_PEERCRED provider using koffi.
19
+ * Returns the provider function on success, null on failure.
20
+ *
21
+ * Failure reasons (all silent, expected on non-Linux):
22
+ * - koffi not installed (optionalDependency skipped)
23
+ * - koffi binary missing for this platform
24
+ * - Not Linux (SO_PEERCRED is Linux-specific)
25
+ */
26
+ export declare function tryBuildPeerCredProvider(logger?: {
27
+ debug?: (msg: string) => void;
28
+ warn?: (msg: string) => void;
29
+ }): GetPeerCredFn | null;
30
+ //# sourceMappingURL=peercred-linux.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"peercred-linux.d.ts","sourceRoot":"","sources":["../../../src/local-server/peercred-linux.ts"],"names":[],"mappings":"AAgBA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAmB,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAMtE;;;;;;;;GAQG;AACH,wBAAgB,wBAAwB,CACtC,MAAM,CAAC,EAAE;IAAE,KAAK,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAAC,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAA;CAAE,GACvE,aAAa,GAAG,IAAI,CA4CtB"}
@@ -0,0 +1,69 @@
1
+ /*
2
+ * Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd. and/or its affiliates.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ // Linux constants for getsockopt(fd, SOL_SOCKET, SO_PEERCRED, ...)
17
+ const SOL_SOCKET = 1;
18
+ const SO_PEERCRED = 17;
19
+ /**
20
+ * Try to build a SO_PEERCRED provider using koffi.
21
+ * Returns the provider function on success, null on failure.
22
+ *
23
+ * Failure reasons (all silent, expected on non-Linux):
24
+ * - koffi not installed (optionalDependency skipped)
25
+ * - koffi binary missing for this platform
26
+ * - Not Linux (SO_PEERCRED is Linux-specific)
27
+ */
28
+ export function tryBuildPeerCredProvider(logger) {
29
+ if (process.platform !== "linux") {
30
+ logger?.debug?.("peercred-linux: skipped (platform=" + process.platform + ", SO_PEERCRED is Linux-only)");
31
+ return null;
32
+ }
33
+ try {
34
+ // Dynamic require so the module is only loaded on Linux when available.
35
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
36
+ const koffi = require("koffi");
37
+ const lib = koffi.load("libc.so.6");
38
+ const ucred = koffi.struct("ucred", {
39
+ pid: "int",
40
+ uid: "unsigned int",
41
+ gid: "unsigned int",
42
+ });
43
+ // int getsockopt(int sockfd, int level, int optname, void *optval, socklen_t *optlen)
44
+ const getsockopt = lib.func("int getsockopt(int, int, int, _Out_ ucred *, _Inout_ unsigned int *)");
45
+ logger?.debug?.("peercred-linux: koffi loaded, getsockopt bound to libc.so.6");
46
+ return (fd) => {
47
+ if (fd < 0)
48
+ return null;
49
+ try {
50
+ const cred = {};
51
+ const optlen = [12]; // sizeof(struct ucred) = 3 × int32 = 12
52
+ const ret = getsockopt(fd, SOL_SOCKET, SO_PEERCRED, cred, optlen);
53
+ if (ret !== 0) {
54
+ logger?.debug?.(`peercred-linux: getsockopt returned ${ret} for fd=${fd}`);
55
+ return null;
56
+ }
57
+ return { pid: cred.pid, uid: cred.uid, gid: cred.gid };
58
+ }
59
+ catch (err) {
60
+ logger?.warn?.(`peercred-linux: getsockopt threw for fd=${fd}: ${String(err)}`);
61
+ return null;
62
+ }
63
+ };
64
+ }
65
+ catch (err) {
66
+ logger?.debug?.(`peercred-linux: koffi unavailable (${String(err).slice(0, 80)}), SO_PEERCRED disabled`);
67
+ return null;
68
+ }
69
+ }
@@ -1,8 +1,3 @@
1
- /**
2
- * LLM-based risk classification for tool calls.
3
- * Supports Ollama and OpenAI-compatible providers. No core OpenClaw changes.
4
- * Reference: GuardSpine plugin (ollamaGenerate, runCouncilReview).
5
- */
6
1
  import type { RiskLevel } from "./classify-risk.js";
7
2
  export type LlmRiskCheckConfig = {
8
3
  endpoint: string;
@@ -1 +1 @@
1
- {"version":3,"file":"llm-risk-check.d.ts","sourceRoot":"","sources":["../../../src/risk/llm-risk-check.ts"],"names":[],"mappings":"AAgBA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAmDpD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,QAAQ,GAAG,oBAAoB,CAAC;IACtC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kDAAkD;IAClD,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AA0CF,MAAM,MAAM,aAAa,GAAG;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAyJjE;;GAEG;AACH,wBAAsB,eAAe,CACnC,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,MAAM,EAAE,kBAAkB,EAC1B,MAAM,CAAC,EAAE;IAAE,KAAK,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAAC,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAA;CAAE,GACvE,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CAiE/B"}
1
+ {"version":3,"file":"llm-risk-check.d.ts","sourceRoot":"","sources":["../../../src/risk/llm-risk-check.ts"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAuDpD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,QAAQ,GAAG,oBAAoB,CAAC;IACtC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kDAAkD;IAClD,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AA0CF,MAAM,MAAM,aAAa,GAAG;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAyJjE;;GAEG;AACH,wBAAsB,eAAe,CACnC,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,MAAM,EAAE,kBAAkB,EAC1B,MAAM,CAAC,EAAE;IAAE,KAAK,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAAC,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAA;CAAE,GACvE,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CAiE/B"}
@@ -13,8 +13,17 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { hashToolParams } from "../store/tool-approval-store.js";
16
+ /**
17
+ * LLM-based risk classification for tool calls.
18
+ * Supports Ollama and OpenAI-compatible providers. No core OpenClaw changes.
19
+ * Reference: GuardSpine plugin (ollamaGenerate, runCouncilReview).
20
+ */
21
+ import { createHash } from "node:crypto";
17
22
  import { logDebug, logWarn } from "../utils/logger.js";
23
+ function hashToolParams(toolName, params) {
24
+ const payload = `${toolName}:${JSON.stringify(params)}`;
25
+ return createHash("sha256").update(payload, "utf-8").digest("hex");
26
+ }
18
27
  /** Max chars for params JSON; critical fields (command, path) get smarter truncation. */
19
28
  const PARAMS_MAX_CHARS = 800;
20
29
  const CACHE_TTL_MS_DEFAULT = 300_000; // 5 min
@@ -1 +1 @@
1
- {"version":3,"file":"low-risk-tools.d.ts","sourceRoot":"","sources":["../../../src/risk/low-risk-tools.ts"],"names":[],"mappings":"AAmCA,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,EAAE,GAAG,OAAO,CAQhF"}
1
+ {"version":3,"file":"low-risk-tools.d.ts","sourceRoot":"","sources":["../../../src/risk/low-risk-tools.ts"],"names":[],"mappings":"AAkCA,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,EAAE,GAAG,OAAO,CAQhF"}
@@ -23,7 +23,6 @@ const LOW_RISK_TOOL_NAMES = new Set([
23
23
  "identity_list_tips",
24
24
  "identity_list_credentials",
25
25
  "identity_config",
26
- "identity_approve_tool",
27
26
  "identity_risk_check",
28
27
  "identity_list_risk_patterns",
29
28
  "web_search",
@@ -0,0 +1,7 @@
1
+ /** Mark before_dispatch as active (called by the handler on first invocation). */
2
+ export declare function markBeforeDispatchActive(): void;
3
+ /** Whether before_dispatch has been invoked at least once by the runtime. */
4
+ export declare function isBeforeDispatchActive(): boolean;
5
+ /** Reset flag (for tests). */
6
+ export declare function resetBeforeDispatchFlag(): void;
7
+ //# sourceMappingURL=dispatch-feature-flag.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dispatch-feature-flag.d.ts","sourceRoot":"","sources":["../../../src/store/dispatch-feature-flag.ts"],"names":[],"mappings":"AA2BA,kFAAkF;AAClF,wBAAgB,wBAAwB,IAAI,IAAI,CAE/C;AAED,6EAA6E;AAC7E,wBAAgB,sBAAsB,IAAI,OAAO,CAEhD;AAED,8BAA8B;AAC9B,wBAAgB,uBAAuB,IAAI,IAAI,CAE9C"}
@@ -0,0 +1,36 @@
1
+ /*
2
+ * Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd. and/or its affiliates.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ /**
17
+ * Feature flag: tracks whether the openclaw runtime actually invokes
18
+ * before_dispatch. Older openclaw versions register the handler but
19
+ * never call it; in that case before_agent_start must handle auth.
20
+ *
21
+ * The flag is set to true the first time before_dispatch fires.
22
+ * before_agent_start checks it to decide whether to skip auth logic.
23
+ */
24
+ let active = false;
25
+ /** Mark before_dispatch as active (called by the handler on first invocation). */
26
+ export function markBeforeDispatchActive() {
27
+ active = true;
28
+ }
29
+ /** Whether before_dispatch has been invoked at least once by the runtime. */
30
+ export function isBeforeDispatchActive() {
31
+ return active;
32
+ }
33
+ /** Reset flag (for tests). */
34
+ export function resetBeforeDispatchFlag() {
35
+ active = false;
36
+ }
@@ -1,4 +1,4 @@
1
- import { AnyAgentTool } from "openclaw/plugin-sdk";
1
+ import type { AnyAgentTool } from "openclaw/plugin-sdk";
2
2
  declare const INTENTS: {
3
3
  readonly identity: {
4
4
  readonly label: "Identity API (AK/SK, endpoint)";
@@ -1 +1 @@
1
- {"version":3,"file":"identity-config-suggest.d.ts","sourceRoot":"","sources":["../../../src/tools/identity-config-suggest.ts"],"names":[],"mappings":"AAuBA,OAAO,EAAE,YAAY,EAAc,MAAM,qBAAqB,CAAC;AAiC/D,QAAA,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgGH,CAAC;AAEX,MAAM,MAAM,mBAAmB,GAAG,MAAM,OAAO,OAAO,CAAC;AAEvD,wBAAgB,+BAA+B,UAClC,YAAY,CA+CxB"}
1
+ {"version":3,"file":"identity-config-suggest.d.ts","sourceRoot":"","sources":["../../../src/tools/identity-config-suggest.ts"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAkCxD,QAAA,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgGH,CAAC;AAEX,MAAM,MAAM,mBAAmB,GAAG,MAAM,OAAO,OAAO,CAAC;AAEvD,wBAAgB,+BAA+B,UAClC,YAAY,CA+CxB"}
@@ -19,7 +19,7 @@
19
19
  * Does not modify config; returns JSON and instructions for manual edit.
20
20
  */
21
21
  import { Type } from "@sinclair/typebox";
22
- import { jsonResult } from "openclaw/plugin-sdk";
22
+ import { jsonResult } from "../utils/tool-result.js";
23
23
  const CONFIG_PATH = "plugins.entries.agent-identity.config";
24
24
  /** Identity credential defaults and resolution order. Included when intent is identity or full. */
25
25
  const IDENTITY_DEFAULTS = {
@@ -2,7 +2,7 @@
2
2
  * identity_config: show identity plugin configuration (redacted).
3
3
  */
4
4
  import type { PluginToolContext } from "../types.js";
5
- import { AnyAgentTool } from "openclaw/plugin-sdk";
5
+ import type { AnyAgentTool } from "openclaw/plugin-sdk";
6
6
  import type { IdentityActionsDeps } from "../actions/identity-actions.js";
7
7
  export declare function createIdentityConfigTool(deps: IdentityActionsDeps): (_ctx: PluginToolContext) => AnyAgentTool;
8
8
  //# sourceMappingURL=identity-config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"identity-config.d.ts","sourceRoot":"","sources":["../../../src/tools/identity-config.ts"],"names":[],"mappings":"AAgBA;;GAEG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD,OAAO,EAAE,YAAY,EAAc,MAAM,qBAAqB,CAAC;AAC/D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAG1E,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,mBAAmB,IACxD,MAAM,iBAAiB,KAAG,YAAY,CAU/C"}
1
+ {"version":3,"file":"identity-config.d.ts","sourceRoot":"","sources":["../../../src/tools/identity-config.ts"],"names":[],"mappings":"AAgBA;;GAEG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAG1E,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,mBAAmB,IACxD,MAAM,iBAAiB,KAAG,YAAY,CAU/C"}
@@ -14,7 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import { Type } from "@sinclair/typebox";
17
- import { jsonResult } from "openclaw/plugin-sdk";
17
+ import { jsonResult } from "../utils/tool-result.js";
18
18
  import { runConfig } from "../actions/identity-actions.js";
19
19
  export function createIdentityConfigTool(deps) {
20
20
  return (_ctx) => ({
@@ -4,7 +4,7 @@
4
4
  * When returnValue is true and fetch succeeds, returns the credential value for same-turn automation.
5
5
  */
6
6
  import type { PluginToolContext } from "../types.js";
7
- import { AnyAgentTool } from "openclaw/plugin-sdk";
7
+ import type { AnyAgentTool } from "openclaw/plugin-sdk";
8
8
  import type { IdentityActionsDeps } from "../actions/identity-actions.js";
9
9
  export declare function createIdentityFetchTool(deps: IdentityActionsDeps): (ctx: PluginToolContext) => AnyAgentTool;
10
10
  //# sourceMappingURL=identity-fetch.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"identity-fetch.d.ts","sourceRoot":"","sources":["../../../src/tools/identity-fetch.ts"],"names":[],"mappings":"AAgBA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD,OAAO,EAAE,YAAY,EAAsB,MAAM,qBAAqB,CAAC;AAEvE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAO1E,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,mBAAmB,IACvD,KAAK,iBAAiB,KAAG,YAAY,CA8D9C"}
1
+ {"version":3,"file":"identity-fetch.d.ts","sourceRoot":"","sources":["../../../src/tools/identity-fetch.ts"],"names":[],"mappings":"AAgBA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAO1E,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,mBAAmB,IACvD,KAAK,iBAAiB,KAAG,YAAY,CA8D9C"}
@@ -14,8 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import { Type } from "@sinclair/typebox";
17
- import { optionalStringEnum } from "openclaw/plugin-sdk";
18
- import { jsonResult } from "openclaw/plugin-sdk";
17
+ import { jsonResult, optionalStringEnum } from "../utils/tool-result.js";
19
18
  import { runFetch } from "../actions/identity-actions.js";
20
19
  import { getCredential, resolveCredentialValue } from "../store/credential-store.js";
21
20
  import { resolveEffectiveSessionKey } from "../store/sender-session-store.js";
@@ -4,7 +4,7 @@
4
4
  * then use them for downstream API requests.
5
5
  */
6
6
  import type { PluginToolContext } from "../types.js";
7
- import { AnyAgentTool } from "openclaw/plugin-sdk";
7
+ import type { AnyAgentTool } from "openclaw/plugin-sdk";
8
8
  import type { IdentityActionsDeps } from "../actions/identity-actions.js";
9
9
  export declare function createIdentityGetRoleCredentialsTool(deps: IdentityActionsDeps): (ctx: PluginToolContext) => AnyAgentTool;
10
10
  //# sourceMappingURL=identity-get-role-credentials.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"identity-get-role-credentials.d.ts","sourceRoot":"","sources":["../../../src/tools/identity-get-role-credentials.ts"],"names":[],"mappings":"AAgBA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD,OAAO,EAAE,YAAY,EAAc,MAAM,qBAAqB,CAAC;AAC/D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAI1E,wBAAgB,oCAAoC,CAAC,IAAI,EAAE,mBAAmB,IACpE,KAAK,iBAAiB,KAAG,YAAY,CAsC9C"}
1
+ {"version":3,"file":"identity-get-role-credentials.d.ts","sourceRoot":"","sources":["../../../src/tools/identity-get-role-credentials.ts"],"names":[],"mappings":"AAgBA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAI1E,wBAAgB,oCAAoC,CAAC,IAAI,EAAE,mBAAmB,IACpE,KAAK,iBAAiB,KAAG,YAAY,CAsC9C"}
@@ -14,7 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import { Type } from "@sinclair/typebox";
17
- import { jsonResult } from "openclaw/plugin-sdk";
17
+ import { jsonResult } from "../utils/tool-result.js";
18
18
  import { runGetRoleCredentials } from "../actions/identity-actions.js";
19
19
  import { resolveEffectiveSessionKey } from "../store/sender-session-store.js";
20
20
  export function createIdentityGetRoleCredentialsTool(deps) {
@@ -2,7 +2,7 @@
2
2
  * identity_get_session_token: obtain the OIDC id_token (session / user token) for the current session.
3
3
  */
4
4
  import type { PluginToolContext } from "../types.js";
5
- import { AnyAgentTool } from "openclaw/plugin-sdk";
5
+ import type { AnyAgentTool } from "openclaw/plugin-sdk";
6
6
  import type { IdentityActionsDeps } from "../actions/identity-actions.js";
7
7
  export declare function createIdentityGetSessionTokenTool(deps: IdentityActionsDeps): (ctx: PluginToolContext) => AnyAgentTool;
8
8
  //# sourceMappingURL=identity-get-session-token.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"identity-get-session-token.d.ts","sourceRoot":"","sources":["../../../src/tools/identity-get-session-token.ts"],"names":[],"mappings":"AAgBA;;GAEG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD,OAAO,EAAE,YAAY,EAAc,MAAM,qBAAqB,CAAC;AAC/D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAI1E,wBAAgB,iCAAiC,CAAC,IAAI,EAAE,mBAAmB,IACjE,KAAK,iBAAiB,KAAG,YAAY,CA0B9C"}
1
+ {"version":3,"file":"identity-get-session-token.d.ts","sourceRoot":"","sources":["../../../src/tools/identity-get-session-token.ts"],"names":[],"mappings":"AAgBA;;GAEG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAI1E,wBAAgB,iCAAiC,CAAC,IAAI,EAAE,mBAAmB,IACjE,KAAK,iBAAiB,KAAG,YAAY,CA0B9C"}
@@ -14,7 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import { Type } from "@sinclair/typebox";
17
- import { jsonResult } from "openclaw/plugin-sdk";
17
+ import { jsonResult } from "../utils/tool-result.js";
18
18
  import { runGetSessionToken } from "../actions/identity-actions.js";
19
19
  import { resolveEffectiveSessionKey } from "../store/sender-session-store.js";
20
20
  export function createIdentityGetSessionTokenTool(deps) {
@@ -2,7 +2,7 @@
2
2
  * identity_get_tip_token: obtain the workload TIP JWT for the current session.
3
3
  */
4
4
  import type { PluginToolContext } from "../types.js";
5
- import { AnyAgentTool } from "openclaw/plugin-sdk";
5
+ import type { AnyAgentTool } from "openclaw/plugin-sdk";
6
6
  import type { IdentityActionsDeps } from "../actions/identity-actions.js";
7
7
  export declare function createIdentityGetTipTokenTool(deps: IdentityActionsDeps): (ctx: PluginToolContext) => AnyAgentTool;
8
8
  //# sourceMappingURL=identity-get-tip-token.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"identity-get-tip-token.d.ts","sourceRoot":"","sources":["../../../src/tools/identity-get-tip-token.ts"],"names":[],"mappings":"AAgBA;;GAEG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD,OAAO,EAAE,YAAY,EAAc,MAAM,qBAAqB,CAAC;AAC/D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAI1E,wBAAgB,6BAA6B,CAAC,IAAI,EAAE,mBAAmB,IAC7D,KAAK,iBAAiB,KAAG,YAAY,CA0B9C"}
1
+ {"version":3,"file":"identity-get-tip-token.d.ts","sourceRoot":"","sources":["../../../src/tools/identity-get-tip-token.ts"],"names":[],"mappings":"AAgBA;;GAEG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAI1E,wBAAgB,6BAA6B,CAAC,IAAI,EAAE,mBAAmB,IAC7D,KAAK,iBAAiB,KAAG,YAAY,CA0B9C"}
@@ -14,7 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import { Type } from "@sinclair/typebox";
17
- import { jsonResult } from "openclaw/plugin-sdk";
17
+ import { jsonResult } from "../utils/tool-result.js";
18
18
  import { runGetTipToken } from "../actions/identity-actions.js";
19
19
  import { resolveEffectiveSessionKey } from "../store/sender-session-store.js";
20
20
  export function createIdentityGetTipTokenTool(deps) {
@@ -2,7 +2,7 @@
2
2
  * identity_list_credentials: list credential providers and stored credentials (paginated).
3
3
  */
4
4
  import type { PluginToolContext } from "../types.js";
5
- import { AnyAgentTool } from "openclaw/plugin-sdk";
5
+ import type { AnyAgentTool } from "openclaw/plugin-sdk";
6
6
  import type { IdentityActionsDeps } from "../actions/identity-actions.js";
7
7
  export declare function createIdentityListCredentialsTool(deps: IdentityActionsDeps): (ctx: PluginToolContext) => AnyAgentTool;
8
8
  //# sourceMappingURL=identity-list-credentials.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"identity-list-credentials.d.ts","sourceRoot":"","sources":["../../../src/tools/identity-list-credentials.ts"],"names":[],"mappings":"AAgBA;;GAEG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD,OAAO,EAAE,YAAY,EAAc,MAAM,qBAAqB,CAAC;AAC/D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAI1E,wBAAgB,iCAAiC,CAAC,IAAI,EAAE,mBAAmB,IACjE,KAAK,iBAAiB,KAAG,YAAY,CA0B9C"}
1
+ {"version":3,"file":"identity-list-credentials.d.ts","sourceRoot":"","sources":["../../../src/tools/identity-list-credentials.ts"],"names":[],"mappings":"AAgBA;;GAEG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAI1E,wBAAgB,iCAAiC,CAAC,IAAI,EAAE,mBAAmB,IACjE,KAAK,iBAAiB,KAAG,YAAY,CA0B9C"}
@@ -14,7 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import { Type } from "@sinclair/typebox";
17
- import { jsonResult } from "openclaw/plugin-sdk";
17
+ import { jsonResult } from "../utils/tool-result.js";
18
18
  import { runListCredentials } from "../actions/identity-actions.js";
19
19
  import { resolveEffectiveSessionKey } from "../store/sender-session-store.js";
20
20
  export function createIdentityListCredentialsTool(deps) {
@@ -3,6 +3,6 @@
3
3
  * Use to understand what the plugin considers high-risk before running commands.
4
4
  */
5
5
  import type { PluginToolContext } from "../types.js";
6
- import { AnyAgentTool } from "openclaw/plugin-sdk";
6
+ import type { AnyAgentTool } from "openclaw/plugin-sdk";
7
7
  export declare function createIdentityListRiskPatternsTool(): (_ctx: PluginToolContext) => AnyAgentTool;
8
8
  //# sourceMappingURL=identity-list-risk-patterns.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"identity-list-risk-patterns.d.ts","sourceRoot":"","sources":["../../../src/tools/identity-list-risk-patterns.ts"],"names":[],"mappings":"AAgBA;;;GAGG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD,OAAO,EAAE,YAAY,EAAc,MAAM,qBAAqB,CAAC;AAG/D,wBAAgB,kCAAkC,KACxC,MAAM,iBAAiB,KAAG,YAAY,CAe/C"}
1
+ {"version":3,"file":"identity-list-risk-patterns.d.ts","sourceRoot":"","sources":["../../../src/tools/identity-list-risk-patterns.ts"],"names":[],"mappings":"AAgBA;;;GAGG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAIxD,wBAAgB,kCAAkC,KACxC,MAAM,iBAAiB,KAAG,YAAY,CAe/C"}
@@ -14,7 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import { Type } from "@sinclair/typebox";
17
- import { jsonResult } from "openclaw/plugin-sdk";
17
+ import { jsonResult } from "../utils/tool-result.js";
18
18
  import { getRiskPatterns } from "../risk/classify-risk.js";
19
19
  export function createIdentityListRiskPatternsTool() {
20
20
  return (_ctx) => ({
@@ -2,7 +2,7 @@
2
2
  * identity_list_roles: list role credential providers (STS).
3
3
  */
4
4
  import type { PluginToolContext } from "../types.js";
5
- import { AnyAgentTool } from "openclaw/plugin-sdk";
5
+ import type { AnyAgentTool } from "openclaw/plugin-sdk";
6
6
  import type { IdentityActionsDeps } from "../actions/identity-actions.js";
7
7
  export declare function createIdentityListRolesTool(deps: IdentityActionsDeps): (ctx: PluginToolContext) => AnyAgentTool;
8
8
  //# sourceMappingURL=identity-list-roles.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"identity-list-roles.d.ts","sourceRoot":"","sources":["../../../src/tools/identity-list-roles.ts"],"names":[],"mappings":"AAgBA;;GAEG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD,OAAO,EAAE,YAAY,EAAc,MAAM,qBAAqB,CAAC;AAC/D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAI1E,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,mBAAmB,IAC3D,KAAK,iBAAiB,KAAG,YAAY,CAsB9C"}
1
+ {"version":3,"file":"identity-list-roles.d.ts","sourceRoot":"","sources":["../../../src/tools/identity-list-roles.ts"],"names":[],"mappings":"AAgBA;;GAEG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAI1E,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,mBAAmB,IAC3D,KAAK,iBAAiB,KAAG,YAAY,CAsB9C"}