@m1a0rz/agent-identity 0.4.1 → 0.4.2

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 (127) hide show
  1. package/README-cn.md +4 -3
  2. package/README.md +4 -3
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +77 -6
  5. package/dist/scripts/demo-get-session.d.ts +15 -0
  6. package/dist/scripts/demo-get-session.d.ts.map +1 -0
  7. package/dist/scripts/demo-get-session.js +58 -0
  8. package/dist/src/actions/identity-actions.d.ts +74 -8
  9. package/dist/src/actions/identity-actions.d.ts.map +1 -1
  10. package/dist/src/actions/identity-actions.js +209 -83
  11. package/dist/src/commands/identity-commands.d.ts.map +1 -1
  12. package/dist/src/commands/identity-commands.js +139 -11
  13. package/dist/src/gateway/identity-session-methods.d.ts +2 -2
  14. package/dist/src/gateway/identity-session-methods.d.ts.map +1 -1
  15. package/dist/src/gateway/identity-session-methods.js +9 -5
  16. package/dist/src/hooks/after-tool-call.d.ts.map +1 -1
  17. package/dist/src/hooks/after-tool-call.js +12 -0
  18. package/dist/src/hooks/before-agent-start.d.ts +2 -0
  19. package/dist/src/hooks/before-agent-start.d.ts.map +1 -1
  20. package/dist/src/hooks/before-agent-start.js +33 -6
  21. package/dist/src/hooks/before-tool-call.d.ts +1 -0
  22. package/dist/src/hooks/before-tool-call.d.ts.map +1 -1
  23. package/dist/src/hooks/before-tool-call.js +29 -5
  24. package/dist/src/hooks/llm-input.d.ts.map +1 -1
  25. package/dist/src/hooks/llm-input.js +32 -4
  26. package/dist/src/hooks/sessions-send-propagation.d.ts.map +1 -1
  27. package/dist/src/hooks/sessions-send-propagation.js +1 -0
  28. package/dist/src/hooks/sessions-spawn-propagation.d.ts.map +1 -1
  29. package/dist/src/hooks/sessions-spawn-propagation.js +1 -0
  30. package/dist/src/hooks/tool-result-persist.d.ts +20 -0
  31. package/dist/src/hooks/tool-result-persist.d.ts.map +1 -0
  32. package/dist/src/hooks/tool-result-persist.js +50 -0
  33. package/dist/src/preflight/plugin-preflight.d.ts +55 -0
  34. package/dist/src/preflight/plugin-preflight.d.ts.map +1 -0
  35. package/dist/src/preflight/plugin-preflight.js +226 -0
  36. package/dist/src/preflight/plugin-state.d.ts +18 -0
  37. package/dist/src/preflight/plugin-state.d.ts.map +1 -0
  38. package/dist/src/preflight/plugin-state.js +19 -0
  39. package/dist/src/routes/oidc-login.js +2 -2
  40. package/dist/src/services/identity-client.d.ts +106 -1
  41. package/dist/src/services/identity-client.d.ts.map +1 -1
  42. package/dist/src/services/identity-client.js +123 -1
  43. package/dist/src/services/identity-credentials.d.ts +1 -1
  44. package/dist/src/services/identity-credentials.d.ts.map +1 -1
  45. package/dist/src/services/identity-credentials.js +32 -16
  46. package/dist/src/services/oidc-client.d.ts +12 -1
  47. package/dist/src/services/oidc-client.d.ts.map +1 -1
  48. package/dist/src/services/oidc-client.js +20 -3
  49. package/dist/src/services/session-refresh.d.ts +10 -0
  50. package/dist/src/services/session-refresh.d.ts.map +1 -1
  51. package/dist/src/services/session-refresh.js +29 -5
  52. package/dist/src/services/skill-contract-metadata.d.ts +35 -0
  53. package/dist/src/services/skill-contract-metadata.d.ts.map +1 -0
  54. package/dist/src/services/skill-contract-metadata.js +145 -0
  55. package/dist/src/services/skill-contract-renderer.d.ts +14 -0
  56. package/dist/src/services/skill-contract-renderer.d.ts.map +1 -0
  57. package/dist/src/services/skill-contract-renderer.js +120 -0
  58. package/dist/src/services/tip-propagation.d.ts +2 -0
  59. package/dist/src/services/tip-propagation.d.ts.map +1 -1
  60. package/dist/src/services/tip-propagation.js +4 -3
  61. package/dist/src/services/tip-with-refresh.d.ts +1 -1
  62. package/dist/src/services/tip-with-refresh.d.ts.map +1 -1
  63. package/dist/src/services/tip-with-refresh.js +24 -39
  64. package/dist/src/store/credential-store.d.ts +6 -1
  65. package/dist/src/store/credential-store.d.ts.map +1 -1
  66. package/dist/src/store/credential-store.js +3 -0
  67. package/dist/src/store/oidc-state-store.d.ts +3 -3
  68. package/dist/src/store/oidc-state-store.d.ts.map +1 -1
  69. package/dist/src/store/oidc-state-store.js +2 -2
  70. package/dist/src/store/sender-session-store.d.ts +8 -0
  71. package/dist/src/store/sender-session-store.d.ts.map +1 -1
  72. package/dist/src/store/sender-session-store.js +34 -1
  73. package/dist/src/store/skill-contract-store.d.ts +19 -0
  74. package/dist/src/store/skill-contract-store.d.ts.map +1 -0
  75. package/dist/src/store/skill-contract-store.js +65 -0
  76. package/dist/src/store/skill-path-store.d.ts +5 -0
  77. package/dist/src/store/skill-path-store.d.ts.map +1 -1
  78. package/dist/src/store/skill-path-store.js +13 -1
  79. package/dist/src/tools/identity-approve-tool.d.ts +2 -11
  80. package/dist/src/tools/identity-approve-tool.d.ts.map +1 -1
  81. package/dist/src/tools/identity-config-suggest.d.ts +2 -13
  82. package/dist/src/tools/identity-config-suggest.d.ts.map +1 -1
  83. package/dist/src/tools/identity-config.d.ts +2 -7
  84. package/dist/src/tools/identity-config.d.ts.map +1 -1
  85. package/dist/src/tools/identity-fetch.d.ts +2 -13
  86. package/dist/src/tools/identity-fetch.d.ts.map +1 -1
  87. package/dist/src/tools/identity-fetch.js +3 -3
  88. package/dist/src/tools/identity-get-role-credentials.d.ts +10 -0
  89. package/dist/src/tools/identity-get-role-credentials.d.ts.map +1 -0
  90. package/dist/src/tools/identity-get-role-credentials.js +56 -0
  91. package/dist/src/tools/identity-get-session-token.d.ts +8 -0
  92. package/dist/src/tools/identity-get-session-token.d.ts.map +1 -0
  93. package/dist/src/tools/identity-get-session-token.js +46 -0
  94. package/dist/src/tools/identity-get-tip-token.d.ts +8 -0
  95. package/dist/src/tools/identity-get-tip-token.d.ts.map +1 -0
  96. package/dist/src/tools/identity-get-tip-token.js +46 -0
  97. package/dist/src/tools/identity-list-credentials.d.ts +2 -11
  98. package/dist/src/tools/identity-list-credentials.d.ts.map +1 -1
  99. package/dist/src/tools/identity-list-credentials.js +4 -3
  100. package/dist/src/tools/identity-list-risk-patterns.d.ts +2 -7
  101. package/dist/src/tools/identity-list-risk-patterns.d.ts.map +1 -1
  102. package/dist/src/tools/identity-list-roles.d.ts +8 -0
  103. package/dist/src/tools/identity-list-roles.d.ts.map +1 -0
  104. package/dist/src/tools/identity-list-roles.js +43 -0
  105. package/dist/src/tools/identity-list-tips.d.ts +2 -7
  106. package/dist/src/tools/identity-list-tips.d.ts.map +1 -1
  107. package/dist/src/tools/identity-login.d.ts +2 -7
  108. package/dist/src/tools/identity-login.d.ts.map +1 -1
  109. package/dist/src/tools/identity-logout.d.ts +2 -7
  110. package/dist/src/tools/identity-logout.d.ts.map +1 -1
  111. package/dist/src/tools/identity-risk-check.d.ts +3 -17
  112. package/dist/src/tools/identity-risk-check.d.ts.map +1 -1
  113. package/dist/src/tools/identity-set-binding.d.ts +2 -10
  114. package/dist/src/tools/identity-set-binding.d.ts.map +1 -1
  115. package/dist/src/tools/identity-status.d.ts +2 -7
  116. package/dist/src/tools/identity-status.d.ts.map +1 -1
  117. package/dist/src/tools/identity-unset-binding.d.ts +2 -9
  118. package/dist/src/tools/identity-unset-binding.d.ts.map +1 -1
  119. package/dist/src/tools/identity-whoami.d.ts +2 -7
  120. package/dist/src/tools/identity-whoami.d.ts.map +1 -1
  121. package/dist/src/types.d.ts +19 -0
  122. package/dist/src/types.d.ts.map +1 -1
  123. package/dist/src/utils/derive-session-key.d.ts +1 -0
  124. package/dist/src/utils/derive-session-key.d.ts.map +1 -1
  125. package/dist/src/utils/derive-session-key.js +28 -4
  126. package/openclaw.plugin.json +13 -0
  127. package/package.json +11 -3
package/README-cn.md CHANGED
@@ -195,6 +195,7 @@ openclaw plugins install --link .
195
195
  | `sessionToken` | string | 否 | STS 临时会话令牌(或 `VOLCENGINE_SESSION_TOKEN`) |
196
196
  | `subagentTipPropagation` | boolean | 否 | 将 TIP 和 session 传播到子 agent。默认 false |
197
197
  | `webchatSessionExchange` | boolean | 否 | 启用 `identity.session.put` / `identity.session.get` gateway WS 方法供 webchat 客户端使用。默认 false |
198
+ | `personalSessionMode` | boolean | 否 | 个人/单用户模式:TIP、OIDC session、凭据仅存储在 `agent:main:main`(不做按发送者或 per-channel-peer 隔离)。子 agent 会话不变。默认 false;多租户或群聊共享场景勿开启。 |
198
199
 
199
200
  \* AK/SK 至少通过 `accessKeyId`+`secretAccessKey`、环境变量、`credentialsMetadataUrl`+`roleTrn` 或 `credentialsFile` 之一提供。
200
201
 
@@ -243,8 +244,8 @@ TIP token 通过 `GetWorkloadAccessTokenForJWT` 获取。工作负载行为:
243
244
 
244
245
  | 方法 | 参数 | 响应 | 描述 |
245
246
  | --- | --- | --- | --- |
246
- | `identity.session.put` | `{ sessionKey, idToken, senderId?, channel? }` | `{ sub, expiresAt, effectiveSessionKey, hasTip }` | 将 OIDC id_token 注入到插件 session。通过 `buildEffectiveSessionKey` 解析实际存储 key(与 hooks/commands 相同的隔离逻辑)。 |
247
- | `identity.session.get` | `{ sessionKey, senderId?, channel? }` | `{ userToken, sub, expiresAt, effectiveSessionKey }` | 获取指定 session 已存储的 user token |
247
+ | `identity.session.put` | `{ sessionKey, idToken, refreshToken?, senderId?, channel? }` | `{ sub, expiresAt, effectiveSessionKey, hasTip }` | 将 OIDC id_token 注入到插件 session;可选传入 `refreshToken`(加密存储),用于静默续期。通过 `buildEffectiveSessionKey` 解析实际存储 key(与 hooks/commands 相同的隔离逻辑)。 |
248
+ | `identity.session.get` | `{ sessionKey, senderId?, channel? }` | `{ userToken, sub, expiresAt, effectiveSessionKey, hasRefreshToken }` | 获取指定 session 已存储的 user token。`hasRefreshToken` 表示是否存有 refresh token;响应中不会返回 refresh token 明文。 |
248
249
 
249
250
  - `senderId` 默认值为 `"openclaw-control-ui"`。对于 main session,实际存储 key 为 `agent:main:main:user:<senderId>`。
250
251
  - `channel` 可选;当 session 来源于可发送消息的渠道(feishu、telegram 等)时传入,可启用 per-channel-peer key 提升。
@@ -264,7 +265,7 @@ TIP token 通过 `GetWorkloadAccessTokenForJWT` 获取。工作负载行为:
264
265
  **典型流程(BFF → webchat → plugin):**
265
266
 
266
267
  1. BFF 完成 3LO 登录并获取用户的 OIDC `id_token`
267
- 2. Webchat 客户端调用 `identity.session.put`,传入 session key 和 `id_token`
268
+ 2. Webchat 客户端调用 `identity.session.put`,传入 session key 和 `id_token`(若需静默续期,可一并传入 token 响应中的 `refresh_token` 作为 `refreshToken`)
268
269
  3. 插件校验 token,存储 session,并获取 TIP
269
270
  4. 后续该 session 中的 agent 运行拥有有效身份——无需手动登录
270
271
 
package/README.md CHANGED
@@ -195,6 +195,7 @@ Add to `openclaw.json` under `plugins.entries.agent-identity.config`:
195
195
  | `sessionToken` | string | No | STS session token (or `VOLCENGINE_SESSION_TOKEN`) |
196
196
  | `subagentTipPropagation` | boolean | No | Propagate TIP and session to subagents. Default false |
197
197
  | `webchatSessionExchange` | boolean | No | Enable `identity.session.put` / `identity.session.get` gateway WS methods for webchat clients. Default false |
198
+ | `personalSessionMode` | boolean | No | Single-user mode: TIP, OIDC session, and credentials are stored only under `agent:main:main` (no per-sender or per-channel-peer keys). Subagent sessions unchanged. Default false — do not enable for multi-tenant or shared groups. |
198
199
 
199
200
  \* AK/SK must be provided via `accessKeyId`+`secretAccessKey`, environment variables, `credentialsMetadataUrl`+`roleTrn`, or `credentialsFile`.
200
201
 
@@ -243,8 +244,8 @@ When `identity.webchatSessionExchange` is `true`, the plugin registers two gatew
243
244
 
244
245
  | Method | Params | Response | Description |
245
246
  | --- | --- | --- | --- |
246
- | `identity.session.put` | `{ sessionKey, idToken, senderId?, channel? }` | `{ sub, expiresAt, effectiveSessionKey, hasTip }` | Inject an OIDC id_token into a plugin session. Resolves effective storage key via `buildEffectiveSessionKey` (same sender isolation as hooks/commands). |
247
- | `identity.session.get` | `{ sessionKey, senderId?, channel? }` | `{ userToken, sub, expiresAt, effectiveSessionKey }` | Retrieve the stored user token for a session. |
247
+ | `identity.session.put` | `{ sessionKey, idToken, refreshToken?, senderId?, channel? }` | `{ sub, expiresAt, effectiveSessionKey, hasTip }` | Inject an OIDC id_token into a plugin session; optional `refreshToken` is stored encrypted for silent token renewal. Resolves effective storage key via `buildEffectiveSessionKey` (same sender isolation as hooks/commands). |
248
+ | `identity.session.get` | `{ sessionKey, senderId?, channel? }` | `{ userToken, sub, expiresAt, effectiveSessionKey, hasRefreshToken }` | Retrieve the stored user token for a session. `hasRefreshToken` indicates whether a refresh token is stored; the refresh token value is never returned. |
248
249
 
249
250
  - `senderId` defaults to `"openclaw-control-ui"`. The effective storage key is `agent:main:main:user:<senderId>` for main sessions.
250
251
  - `channel` is optional; when the session originates from a sendable channel (feishu, telegram, etc.), pass it to enable per-channel-peer key promotion.
@@ -264,7 +265,7 @@ Both methods are **restricted to webchat WS connections only** (`isWebchatConnec
264
265
  **Typical flow (BFF → webchat → plugin):**
265
266
 
266
267
  1. BFF completes 3LO login and obtains an OIDC `id_token` for the user
267
- 2. Webchat client calls `identity.session.put` with the session key and `id_token`
268
+ 2. Webchat client calls `identity.session.put` with the session key and `id_token` (optionally `refreshToken` from the token response if silent renewal is desired)
268
269
  3. Plugin verifies the token, stores the session, and acquires TIP
269
270
  4. Subsequent agent runs in that session have a valid identity — no manual login needed
270
271
 
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAgBA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AA0E7D,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,GAAG,EAAE,iBAAiB,QAyatD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAgBA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAkF7D,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,GAAG,EAAE,iBAAiB,QA8etD"}
package/dist/index.js CHANGED
@@ -13,15 +13,18 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
+ import { runPluginPreflight } from "./src/preflight/plugin-preflight.js";
17
+ import { pluginState } from "./src/preflight/plugin-state.js";
16
18
  import { createIdentityCommand, createIdCommand } from "./src/commands/identity-commands.js";
17
19
  import { createBeforeAgentStartHandler } from "./src/hooks/before-agent-start.js";
18
20
  import { createLlmInputHandler } from "./src/hooks/llm-input.js";
19
21
  import { createSessionsSendPropagationHandler } from "./src/hooks/sessions-send-propagation.js";
20
22
  import { createSessionsSpawnPropagationHandler } from "./src/hooks/sessions-spawn-propagation.js";
21
23
  import { createSubagentEndedCleanupHandler } from "./src/hooks/subagent-ended-cleanup.js";
22
- import { setSender, clearSender } from "./src/store/sender-session-store.js";
24
+ import { setSender, clearSender, setPersonalSessionMode } from "./src/store/sender-session-store.js";
23
25
  import { deriveSessionKey, needsSenderIsolation, } from "./src/utils/derive-session-key.js";
24
26
  import { createBeforeToolCallHandler } from "./src/hooks/before-tool-call.js";
27
+ import { createToolResultPersistHandler } from "./src/hooks/tool-result-persist.js";
25
28
  import { createAfterToolCallHandler } from "./src/hooks/after-tool-call.js";
26
29
  import * as skillPathStore from "./src/store/skill-path-store.js";
27
30
  import { createOIDCCallbackHandler, createOIDCCallbackHandlerLazy, } from "./src/routes/oidc-login.js";
@@ -34,7 +37,11 @@ import { createIdentityConfigSuggestTool } from "./src/tools/identity-config-sug
34
37
  import { createIdentityListRiskPatternsTool } from "./src/tools/identity-list-risk-patterns.js";
35
38
  import { createIdentityRiskCheckTool } from "./src/tools/identity-risk-check.js";
36
39
  import { createIdentityFetchTool } from "./src/tools/identity-fetch.js";
40
+ import { createIdentityGetRoleCredentialsTool } from "./src/tools/identity-get-role-credentials.js";
41
+ import { createIdentityGetTipTokenTool } from "./src/tools/identity-get-tip-token.js";
42
+ import { createIdentityGetSessionTokenTool } from "./src/tools/identity-get-session-token.js";
37
43
  import { createIdentityListCredentialsTool } from "./src/tools/identity-list-credentials.js";
44
+ import { createIdentityListRolesTool } from "./src/tools/identity-list-roles.js";
38
45
  import { createIdentityListTipsTool } from "./src/tools/identity-list-tips.js";
39
46
  import { createIdentityLoginTool } from "./src/tools/identity-login.js";
40
47
  import { createIdentityLogoutTool } from "./src/tools/identity-logout.js";
@@ -70,6 +77,10 @@ export default function register(api) {
70
77
  const storeDir = api.resolvePath(PLUGIN_STORE_DIR);
71
78
  initEncryptionKey(storeDir);
72
79
  const identityCfg = pluginConfig.identity;
80
+ setPersonalSessionMode(identityCfg?.personalSessionMode === true);
81
+ if (identityCfg?.personalSessionMode) {
82
+ logInfo(api.logger, "identity.personalSessionMode: non-subagent TIP/session/credentials use agent:main:main only");
83
+ }
73
84
  const hasIdentity = hasAnyIdentityConfig(identityCfg);
74
85
  const userpool = pluginConfig.userpool;
75
86
  const identityClient = hasIdentity
@@ -96,6 +107,9 @@ export default function register(api) {
96
107
  getResourceApiKey: async () => {
97
108
  throw new Error("Identity not configured.");
98
109
  },
110
+ getUserCredential: async () => {
111
+ throw new Error("Identity not configured.");
112
+ },
99
113
  checkPermission: async () => {
100
114
  throw new Error("Identity not configured.");
101
115
  },
@@ -106,9 +120,24 @@ export default function register(api) {
106
120
  PageNumber: 1,
107
121
  PageSize: 20,
108
122
  }),
123
+ listRoleCredentialProviders: async () => ({
124
+ RoleCredentialProviders: [],
125
+ TotalCount: 0,
126
+ PageNumber: 1,
127
+ PageSize: 20,
128
+ }),
129
+ getRoleCredentials: async () => {
130
+ throw new Error("Identity not configured.");
131
+ },
109
132
  getUserPool: async () => {
110
133
  throw new Error("Identity not configured.");
111
134
  },
135
+ listIdentityProviders: async () => ({
136
+ pageNumber: 1,
137
+ pageSize: 10,
138
+ totalCount: 0,
139
+ data: [],
140
+ }),
112
141
  listUserPools: async () => ({
113
142
  pageNumber: 1,
114
143
  pageSize: 10,
@@ -278,23 +307,29 @@ export default function register(api) {
278
307
  getOidcConfigForRefresh: getOidcConfigForRefresh ?? undefined,
279
308
  configWorkloadName: identityCfg?.workloadName,
280
309
  identityClient: hasIdentity ? identityClient : undefined,
310
+ workloadPoolName: identityCfg?.workloadPoolName ?? "default",
311
+ userPoolName: userpool?.userPoolName,
281
312
  logger: api.logger,
282
313
  pluginConfig,
283
314
  sendCredentialMessage: sendToSession,
284
315
  };
285
316
  api.registerCommand(createIdentityCommand(identityCommandsDeps));
286
317
  api.registerCommand(createIdCommand(identityCommandsDeps));
287
- logInfo(api.logger, "commands /identity, /id (login, status, logout, list-tips, list-credentials, fetch, set, unset); HTTP callback /identity/oauth/callback (credential OAuth uses Identity callback)");
318
+ logInfo(api.logger, "commands /identity, /id (login, status, logout, list, list-roles, list-tips, fetch, set, unset); HTTP callback /identity/oauth/callback (credential OAuth uses Identity callback)");
288
319
  // Tools (share deps with commands). Optional = only included when agent allowlist explicitly adds them.
289
320
  api.registerTool(createIdentityWhoamiTool(identityCommandsDeps), { optional: false });
290
321
  api.registerTool(createIdentityLogoutTool(identityCommandsDeps), { optional: false });
291
322
  api.registerTool(createIdentityStatusTool(identityCommandsDeps), { optional: false });
292
323
  api.registerTool(createIdentityLoginTool(identityCommandsDeps), { optional: false });
293
324
  api.registerTool(createIdentityListCredentialsTool(identityCommandsDeps), { optional: false });
325
+ api.registerTool(createIdentityListRolesTool(identityCommandsDeps), { optional: false });
294
326
  api.registerTool(createIdentityListTipsTool(identityCommandsDeps), { optional: false });
295
327
  api.registerTool(createIdentityConfigTool(identityCommandsDeps), { optional: false });
296
328
  api.registerTool(createIdentityConfigSuggestTool(), { optional: false });
297
329
  api.registerTool(createIdentityFetchTool(identityCommandsDeps), { optional: false });
330
+ api.registerTool(createIdentityGetRoleCredentialsTool(identityCommandsDeps), { optional: false });
331
+ api.registerTool(createIdentityGetTipTokenTool(identityCommandsDeps), { optional: false });
332
+ api.registerTool(createIdentityGetSessionTokenTool(identityCommandsDeps), { optional: false });
298
333
  api.registerTool(createIdentitySetBindingTool(identityCommandsDeps), { optional: true });
299
334
  api.registerTool(createIdentityUnsetBindingTool(identityCommandsDeps), { optional: true });
300
335
  api.registerTool(createIdentityRiskCheckTool({ pluginConfig, logger: api.logger }), { optional: true });
@@ -391,12 +426,12 @@ export default function register(api) {
391
426
  logger: api.logger,
392
427
  }));
393
428
  if (skillReadCheck) {
394
- api.on("session_end", (_event, ctx) => {
395
- if (ctx.sessionId)
396
- skillPathStore.clearSessionById(ctx.sessionId);
429
+ api.on("session_end", (event) => {
430
+ if (event.sessionId)
431
+ skillPathStore.clearSessionById(event.sessionId);
397
432
  });
398
433
  }
399
- // before_tool_call: authz, credential injection, group sender context
434
+ // before_tool_call: authz, credential injection, group sender context, contract injection
400
435
  api.on("before_tool_call", createBeforeToolCallHandler({
401
436
  storeDir,
402
437
  identityClient: hasIdentity ? identityClient : undefined,
@@ -408,9 +443,11 @@ export default function register(api) {
408
443
  identityService: hasIdentity ? identityService : undefined,
409
444
  getOidcConfigForRefresh: getOidcConfigForRefresh ?? undefined,
410
445
  configWorkloadName: identityCfg?.workloadName,
446
+ workspaceDir: api.resolvePath?.(".") ?? undefined,
411
447
  }));
412
448
  // Companion after_tool_call: restore env snapshot set by credential injection
413
449
  api.on("after_tool_call", createAfterToolCallHandler({ logger: api.logger }));
450
+ api.on("tool_result_persist", createToolResultPersistHandler({ logger: api.logger }));
414
451
  // Gateway WS methods: webchat session exchange (inject / retrieve user token)
415
452
  if (identityCfg?.webchatSessionExchange && hasIdentity) {
416
453
  const sessionMethodDeps = {
@@ -424,4 +461,38 @@ export default function register(api) {
424
461
  api.registerGatewayMethod("identity.session.get", createSessionGetHandler(sessionMethodDeps));
425
462
  logInfo(api.logger, "gateway methods: identity.session.put, identity.session.get (webchat session exchange)");
426
463
  }
464
+ // Preflight: run async after register() returns so startup is never blocked.
465
+ // On any failure, set pluginState.degraded so hooks skip all interception.
466
+ const authzEnabled = !!(authz?.agentCheck || authz?.toolCheck || authz?.requireRiskApproval);
467
+ runPluginPreflight({
468
+ identityClient,
469
+ identityService,
470
+ hasIdentity,
471
+ credentialConfig: identityCfg
472
+ ? {
473
+ accessKeyId: identityCfg.accessKeyId,
474
+ secretAccessKey: identityCfg.secretAccessKey,
475
+ sessionToken: identityCfg.sessionToken,
476
+ credentialsFile: identityCfg.credentialsFile,
477
+ credentialsMetadataUrl: identityCfg.credentialsMetadataUrl,
478
+ roleTrn: identityCfg.roleTrn,
479
+ }
480
+ : undefined,
481
+ userpool: dynamicOidcEnabled
482
+ ? { mode: "dynamic", userPoolName: userpool?.userPoolName }
483
+ : explicitOidcEnabled
484
+ ? { mode: "explicit", discoveryUrl: userpool?.discoveryUrl }
485
+ : undefined,
486
+ workloadPoolName: identityCfg?.workloadPoolName,
487
+ authzEnabled,
488
+ namespaceName: authz?.namespaceName ?? "default",
489
+ logger: api.logger,
490
+ }).then((result) => {
491
+ if (!result.ok) {
492
+ pluginState.degraded = true;
493
+ pluginState.failures = result.failures;
494
+ }
495
+ }).catch((err) => {
496
+ logWarn(api.logger, `[identity] preflight threw unexpectedly: ${String(err)}`);
497
+ });
427
498
  }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Demo: read local sessions.json (with field-level decryption), resolve one sessionKey, print userToken.
3
+ *
4
+ * Same path as the plugin: initEncryptionKey(storeDir) then getSession(storeDir, sessionKey).
5
+ *
6
+ * Usage (after `pnpm build`):
7
+ * node dist/scripts/demo-get-session.js <sessionKey>
8
+ * node dist/scripts/demo-get-session.js <storeDir> <sessionKey>
9
+ * pnpm demo:get-session -- <sessionKey>
10
+ *
11
+ * Flags:
12
+ * --print-token Print full userToken (default: only prefix + length)
13
+ */
14
+ export {};
15
+ //# sourceMappingURL=demo-get-session.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"demo-get-session.d.ts","sourceRoot":"","sources":["../../scripts/demo-get-session.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG"}
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Demo: read local sessions.json (with field-level decryption), resolve one sessionKey, print userToken.
3
+ *
4
+ * Same path as the plugin: initEncryptionKey(storeDir) then getSession(storeDir, sessionKey).
5
+ *
6
+ * Usage (after `pnpm build`):
7
+ * node dist/scripts/demo-get-session.js <sessionKey>
8
+ * node dist/scripts/demo-get-session.js <storeDir> <sessionKey>
9
+ * pnpm demo:get-session -- <sessionKey>
10
+ *
11
+ * Flags:
12
+ * --print-token Print full userToken (default: only prefix + length)
13
+ */
14
+ import path from "node:path";
15
+ import os from "node:os";
16
+ import { initEncryptionKey } from "../src/store/encryption.js";
17
+ import { getSession } from "../src/store/session-store.js";
18
+ function usage() {
19
+ console.error(`Usage: demo-get-session [--print-token] <sessionKey>
20
+ demo-get-session [--print-token] <storeDir> <sessionKey>
21
+
22
+ storeDir defaults to ~/.openclaw/plugins/identity`);
23
+ process.exit(1);
24
+ }
25
+ async function main() {
26
+ const printToken = process.argv.includes("--print-token");
27
+ const args = process.argv.slice(2).filter((a) => a !== "--print-token");
28
+ if (args.length < 1 || args.length > 2)
29
+ usage();
30
+ const storeDir = args.length === 2
31
+ ? path.resolve(args[0])
32
+ : path.join(os.homedir(), ".openclaw", "plugins", "identity");
33
+ const sessionKey = args.length === 2 ? args[1] : args[0];
34
+ initEncryptionKey(storeDir);
35
+ const session = await getSession(storeDir, sessionKey);
36
+ if (!session) {
37
+ console.log(JSON.stringify({ ok: false, reason: "no session or expired", storeDir, sessionKey }, null, 2));
38
+ process.exit(2);
39
+ }
40
+ const tokenPreview = printToken
41
+ ? session.userToken
42
+ : `${session.userToken.slice(0, 12)}… (${session.userToken.length} chars)`;
43
+ console.log(JSON.stringify({
44
+ ok: true,
45
+ storeDir,
46
+ sessionKey,
47
+ sub: session.sub,
48
+ loginAt: session.loginAt,
49
+ expiresAt: session.expiresAt ?? null,
50
+ hasRefreshToken: Boolean(session.refreshToken),
51
+ claims: session.claims ?? null,
52
+ userToken: tokenPreview,
53
+ }, null, 2));
54
+ }
55
+ main().catch((err) => {
56
+ console.error(err);
57
+ process.exit(1);
58
+ });
@@ -15,6 +15,10 @@ export type OIDCConfigForCommand = {
15
15
  clientSecret?: string;
16
16
  scope?: string;
17
17
  callbackUrl: string;
18
+ /** UserPool UID (available when resolved dynamically via resolveOIDCConfig). */
19
+ poolUid?: string;
20
+ /** First identity provider cached at config resolve time. */
21
+ identityProvider?: string;
18
22
  };
19
23
  export type IdentityActionsLogger = {
20
24
  info?: (msg: string) => void;
@@ -28,11 +32,13 @@ export type IdentityActionsDeps = {
28
32
  getOidcConfigForRefresh?: () => Promise<OIDCConfigForRefresh>;
29
33
  configWorkloadName?: string;
30
34
  identityClient?: IdentityClientInterface;
35
+ workloadPoolName?: string;
36
+ userPoolName?: string;
31
37
  logger?: IdentityActionsLogger;
32
38
  pluginConfig?: PluginConfig;
33
39
  sendCredentialMessage?: (targetOrSessionKey: SessionKeyDeliveryTarget | string, text: string) => Promise<void>;
34
40
  };
35
- export type FetchFlow = "oauth2-user" | "oauth2-m2m" | "apikey";
41
+ export type FetchFlow = "oauth2-user" | "oauth2-m2m" | "apikey" | "user";
36
42
  export type StatusResult = {
37
43
  loggedIn: boolean;
38
44
  sub: string | null;
@@ -69,14 +75,15 @@ export type LogoutResult = {
69
75
  ok: boolean;
70
76
  };
71
77
  export declare function runLogout(deps: IdentityActionsDeps, sessionKey: string): Promise<LogoutResult>;
78
+ export type ProviderRow = {
79
+ name: string;
80
+ type: string;
81
+ flow?: string;
82
+ status: string;
83
+ binding?: string;
84
+ };
72
85
  export type ListCredentialsResult = {
73
- providers: Array<{
74
- name: string;
75
- type: string;
76
- flow?: string;
77
- status: string;
78
- binding?: string;
79
- }>;
86
+ providers: ProviderRow[];
80
87
  storedOnly: Array<{
81
88
  name: string;
82
89
  status: string;
@@ -89,8 +96,21 @@ export type ListCredentialsResult = {
89
96
  export type ListCredentialsFilter = {
90
97
  name?: string;
91
98
  flow?: string;
99
+ type?: string;
92
100
  };
93
101
  export declare function runListCredentials(deps: IdentityActionsDeps, sessionKey: string, page?: number, filter?: ListCredentialsFilter): Promise<ListCredentialsResult>;
102
+ export type RoleProviderRow = {
103
+ name: string;
104
+ identitySource?: string;
105
+ };
106
+ export type ListRoleCredentialsResult = {
107
+ providers: RoleProviderRow[];
108
+ page: number;
109
+ hasMore: boolean;
110
+ };
111
+ export declare function runListRoleCredentials(deps: IdentityActionsDeps, sessionKey: string, filter?: {
112
+ name?: string;
113
+ }): Promise<ListRoleCredentialsResult>;
94
114
  export type ListTipsResult = {
95
115
  tips: Array<{
96
116
  sessionKey: string;
@@ -148,4 +168,50 @@ export type UnsetBindingResult = {
148
168
  export declare function runUnsetBinding(deps: IdentityActionsDeps, sessionKey: string, params: {
149
169
  provider: string;
150
170
  }): Promise<UnsetBindingResult>;
171
+ export type GetRoleCredentialsActionResult = {
172
+ kind: "success";
173
+ credentials: {
174
+ AccessKeyId: string;
175
+ SecretAccessKey: string;
176
+ SessionToken: string;
177
+ Expiration?: string;
178
+ };
179
+ } | {
180
+ kind: "error";
181
+ message: string;
182
+ };
183
+ export declare function runGetRoleCredentials(deps: IdentityActionsDeps, sessionKey: string, params: {
184
+ providerName: string;
185
+ useTip?: boolean;
186
+ config?: import("openclaw/plugin-sdk").OpenClawConfig;
187
+ }): Promise<GetRoleCredentialsActionResult>;
188
+ export type GetTipTokenResult = {
189
+ kind: "success";
190
+ tipToken: string;
191
+ sub: string;
192
+ issuedAt: number;
193
+ expiresAt: number;
194
+ } | {
195
+ kind: "error";
196
+ message: string;
197
+ };
198
+ /**
199
+ * Return the current TIP JWT for the session (refresh/obtain via user token if needed).
200
+ */
201
+ export declare function runGetTipToken(deps: IdentityActionsDeps, sessionKey: string, config?: OpenClawConfig): Promise<GetTipTokenResult>;
202
+ export type GetSessionTokenResult = {
203
+ kind: "success";
204
+ /** OIDC id_token stored for the session. */
205
+ sessionIdToken: string;
206
+ sub: string;
207
+ loginAt: number;
208
+ expiresAt?: number;
209
+ } | {
210
+ kind: "error";
211
+ message: string;
212
+ };
213
+ /**
214
+ * Return the OIDC id_token (user / session identity token) for the session.
215
+ */
216
+ export declare function runGetSessionToken(deps: IdentityActionsDeps, sessionKey: string): Promise<GetSessionTokenResult>;
151
217
  //# sourceMappingURL=identity-actions.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"identity-actions.d.ts","sourceRoot":"","sources":["../../../src/actions/identity-actions.ts"],"names":[],"mappings":"AAgBA;;;GAGG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAC9E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAgB/E,OAAO,EAKL,KAAK,eAAe,EACrB,MAAM,8BAA8B,CAAC;AAUtC,MAAM,MAAM,oBAAoB,GAAG;IACjC,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7B,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7B,KAAK,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CAC/B,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,eAAe,CAAC;IACjC,aAAa,EAAE,MAAM,OAAO,CAAC,oBAAoB,CAAC,CAAC;IACnD,uBAAuB,CAAC,EAAE,MAAM,OAAO,CAAC,oBAAoB,CA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