@m1a0rz/agent-identity 0.2.0 → 0.2.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 (120) hide show
  1. package/LICENSE +201 -0
  2. package/README-cn.md +42 -32
  3. package/README.md +42 -32
  4. package/dist/index.d.ts.map +1 -1
  5. package/dist/index.js +17 -9
  6. package/dist/src/actions/identity-actions.d.ts.map +1 -1
  7. package/dist/src/actions/identity-actions.js +14 -3
  8. package/dist/src/commands/identity-commands.d.ts.map +1 -1
  9. package/dist/src/commands/identity-commands.js +14 -3
  10. package/dist/src/hooks/before-agent-start.d.ts.map +1 -1
  11. package/dist/src/hooks/before-agent-start.js +14 -5
  12. package/dist/src/hooks/before-tool-call.d.ts.map +1 -1
  13. package/dist/src/hooks/before-tool-call.js +13 -6
  14. package/dist/src/hooks/llm-input.d.ts +0 -5
  15. package/dist/src/hooks/llm-input.d.ts.map +1 -1
  16. package/dist/src/hooks/llm-input.js +15 -0
  17. package/dist/src/hooks/sessions-send-propagation.d.ts.map +1 -1
  18. package/dist/src/hooks/sessions-send-propagation.js +13 -5
  19. package/dist/src/hooks/sessions-spawn-propagation.d.ts.map +1 -1
  20. package/dist/src/hooks/sessions-spawn-propagation.js +13 -6
  21. package/dist/src/hooks/subagent-ended-cleanup.d.ts +0 -6
  22. package/dist/src/hooks/subagent-ended-cleanup.d.ts.map +1 -1
  23. package/dist/src/hooks/subagent-ended-cleanup.js +15 -0
  24. package/dist/src/risk/classify-risk.d.ts.map +1 -1
  25. package/dist/src/risk/classify-risk.js +14 -3
  26. package/dist/src/risk/diagnose-risk.d.ts.map +1 -1
  27. package/dist/src/risk/diagnose-risk.js +14 -3
  28. package/dist/src/risk/llm-risk-check.d.ts.map +1 -1
  29. package/dist/src/risk/llm-risk-check.js +14 -4
  30. package/dist/src/risk/low-risk-tools.d.ts +0 -3
  31. package/dist/src/risk/low-risk-tools.d.ts.map +1 -1
  32. package/dist/src/risk/low-risk-tools.js +15 -0
  33. package/dist/src/routes/oidc-login.d.ts.map +1 -1
  34. package/dist/src/routes/oidc-login.js +12 -5
  35. package/dist/src/services/identity-client.d.ts.map +1 -1
  36. package/dist/src/services/identity-client.js +13 -8
  37. package/dist/src/services/identity-credentials.d.ts +0 -8
  38. package/dist/src/services/identity-credentials.d.ts.map +1 -1
  39. package/dist/src/services/identity-credentials.js +15 -0
  40. package/dist/src/services/identity-service.d.ts.map +1 -1
  41. package/dist/src/services/identity-service.js +14 -3
  42. package/dist/src/services/oidc-client.d.ts.map +1 -1
  43. package/dist/src/services/oidc-client.js +13 -6
  44. package/dist/src/services/send-notification-feishu.d.ts.map +1 -1
  45. package/dist/src/services/send-notification-feishu.js +14 -4
  46. package/dist/src/services/session-refresh.d.ts +0 -4
  47. package/dist/src/services/session-refresh.d.ts.map +1 -1
  48. package/dist/src/services/session-refresh.js +15 -0
  49. package/dist/src/services/tip-acquisition.d.ts.map +1 -1
  50. package/dist/src/services/tip-acquisition.js +14 -3
  51. package/dist/src/services/tip-propagation.d.ts.map +1 -1
  52. package/dist/src/services/tip-propagation.js +14 -2
  53. package/dist/src/services/tip-with-refresh.d.ts.map +1 -1
  54. package/dist/src/services/tip-with-refresh.js +14 -4
  55. package/dist/src/store/credential-env-bindings.d.ts +0 -5
  56. package/dist/src/store/credential-env-bindings.d.ts.map +1 -1
  57. package/dist/src/store/credential-env-bindings.js +15 -0
  58. package/dist/src/store/credential-store.d.ts.map +1 -1
  59. package/dist/src/store/credential-store.js +14 -3
  60. package/dist/src/store/oidc-state-store.d.ts.map +1 -1
  61. package/dist/src/store/oidc-state-store.js +14 -3
  62. package/dist/src/store/session-store.d.ts +0 -5
  63. package/dist/src/store/session-store.d.ts.map +1 -1
  64. package/dist/src/store/session-store.js +15 -0
  65. package/dist/src/store/skill-path-store.d.ts +0 -5
  66. package/dist/src/store/skill-path-store.d.ts.map +1 -1
  67. package/dist/src/store/skill-path-store.js +15 -0
  68. package/dist/src/store/tip-store.d.ts +0 -6
  69. package/dist/src/store/tip-store.d.ts.map +1 -1
  70. package/dist/src/store/tip-store.js +15 -0
  71. package/dist/src/store/tool-approval-store.d.ts +0 -4
  72. package/dist/src/store/tool-approval-store.d.ts.map +1 -1
  73. package/dist/src/store/tool-approval-store.js +15 -0
  74. package/dist/src/tools/identity-approve-tool.d.ts.map +1 -1
  75. package/dist/src/tools/identity-approve-tool.js +14 -3
  76. package/dist/src/tools/identity-config-suggest.d.ts +113 -0
  77. package/dist/src/tools/identity-config-suggest.d.ts.map +1 -0
  78. package/dist/src/tools/identity-config-suggest.js +182 -0
  79. package/dist/src/tools/identity-config.d.ts.map +1 -1
  80. package/dist/src/tools/identity-config.js +14 -2
  81. package/dist/src/tools/identity-fetch.d.ts.map +1 -1
  82. package/dist/src/tools/identity-fetch.js +14 -4
  83. package/dist/src/tools/identity-list-credentials.d.ts.map +1 -1
  84. package/dist/src/tools/identity-list-credentials.js +14 -2
  85. package/dist/src/tools/identity-list-risk-patterns.d.ts.map +1 -1
  86. package/dist/src/tools/identity-list-risk-patterns.js +14 -3
  87. package/dist/src/tools/identity-list-tips.d.ts.map +1 -1
  88. package/dist/src/tools/identity-list-tips.js +14 -2
  89. package/dist/src/tools/identity-login.d.ts.map +1 -1
  90. package/dist/src/tools/identity-login.js +14 -3
  91. package/dist/src/tools/identity-logout.d.ts.map +1 -1
  92. package/dist/src/tools/identity-logout.js +14 -2
  93. package/dist/src/tools/identity-risk-check.d.ts.map +1 -1
  94. package/dist/src/tools/identity-risk-check.js +14 -3
  95. package/dist/src/tools/identity-set-binding.d.ts.map +1 -1
  96. package/dist/src/tools/identity-set-binding.js +14 -2
  97. package/dist/src/tools/identity-status.d.ts.map +1 -1
  98. package/dist/src/tools/identity-status.js +14 -2
  99. package/dist/src/tools/identity-unset-binding.d.ts.map +1 -1
  100. package/dist/src/tools/identity-unset-binding.js +14 -2
  101. package/dist/src/tools/identity-whoami.d.ts.map +1 -1
  102. package/dist/src/tools/identity-whoami.js +14 -2
  103. package/dist/src/types.d.ts.map +1 -1
  104. package/dist/src/types.js +14 -3
  105. package/dist/src/utils/approval-channel.d.ts +0 -4
  106. package/dist/src/utils/approval-channel.d.ts.map +1 -1
  107. package/dist/src/utils/approval-channel.js +15 -0
  108. package/dist/src/utils/auth.d.ts.map +1 -1
  109. package/dist/src/utils/auth.js +13 -4
  110. package/dist/src/utils/derive-session-key.d.ts.map +1 -1
  111. package/dist/src/utils/derive-session-key.js +14 -3
  112. package/dist/src/utils/logger.d.ts.map +1 -1
  113. package/dist/src/utils/logger.js +15 -0
  114. package/dist/src/utils/parse-available-skills.d.ts.map +1 -1
  115. package/dist/src/utils/parse-available-skills.js +15 -0
  116. package/dist/src/utils/token-errors.d.ts.map +1 -1
  117. package/dist/src/utils/token-errors.js +15 -0
  118. package/openclaw.plugin.json +1 -1
  119. package/package.json +2 -2
  120. package/skills/SKILL.md +18 -2
@@ -1,6 +1,17 @@
1
- /**
2
- * Derive sessionKey and agentId from command context.
3
- * Logic aligned with OpenClaw routing buildAgentPeerSessionKey.
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.
4
15
  */
5
16
  const DEFAULT_AGENT_ID = "main";
6
17
  const DEFAULT_ACCOUNT_ID = "default";
@@ -1 +1 @@
1
- {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../src/utils/logger.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,eAAO,MAAM,UAAU,oBAAoB,CAAC;AAE5C,MAAM,MA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,CAE5E;AAED,wBAAgB,OAAO,CAAC,MAAM,EAAE,YAAY,GAAG,SAAS,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,CAE3E;AAED,wBAAgB,OAAO,CAAC,MAAM,EAAE,YAAY,GAAG,SAAS,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,CAE3E;AAED,wBAAgB,QAAQ,CAAC,MAAM,EAAE,YAAY,GAAG,SAAS,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,CAE5E"}
@@ -1,3 +1,18 @@
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
+ */
1
16
  /**
2
17
  * Unified logging for agent-identity plugin.
3
18
  * Prefix: agent-identity:
@@ -1 +1 @@
1
- {"version":3,"file":"parse-available-skills.d.ts","sourceRoot":"","sources":["../../../src/utils/parse-available-skills.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,wBAAgB,oBAAoB,CAAC,YAAY,EAAE,MAAM,GAAG,SAAS,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAc1F"}
1
+ {"version":3,"file":"parse-available-skills.d.ts","sourceRoot":"","sources":["../../../src/utils/parse-available-skills.ts"],"names":[],"mappings":"AAgBA;;;GAGG;AAEH,wBAAgB,oBAAoB,CAAC,YAAY,EAAE,MAAM,GAAG,SAAS,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAc1F"}
@@ -1,3 +1,18 @@
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
+ */
1
16
  /**
2
17
  * Parse <available_skills> from system prompt to build path -> skill name mapping.
3
18
  * Format: <available_skills><skill><name>...</name><location>...</location></skill></available_skills>
@@ -1 +1 @@
1
- {"version":3,"file":"token-errors.d.ts","sourceRoot":"","sources":["../../../src/utils/token-errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAGzD"}
1
+ {"version":3,"file":"token-errors.d.ts","sourceRoot":"","sources":["../../../src/utils/token-errors.ts"],"names":[],"mappings":"AAgBA;;GAEG;AAEH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAGzD"}
@@ -1,3 +1,18 @@
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
+ */
1
16
  /**
2
17
  * Shared token error detection for refresh flows.
3
18
  */
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "id": "agent-identity",
3
3
  "name": "Agent Identity",
4
- "description": "UserPool (用户池) login, TIP token (工作负载令牌 GetWorkloadAccessTokenForJWT), credential 3LO (凭据托管), session management. Integrates with Volcengine 智能体身份和权限管理平台. Credentials from config, env, or file; STS AssumeRole supported.",
4
+ "description": "UserPool (用户池) login, TIP token (工作负载令牌 GetWorkloadAccessTokenForJWT), credential 3LO (凭据托管), session management, optional tool/skill permission control (CheckPermission) and risk approval. Integrates with Volcengine 智能体身份和权限管理平台. Credentials from config, env, or file; STS AssumeRole supported.",
5
5
  "skills": ["./skills"],
6
6
  "configSchema": {
7
7
  "type": "object",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@m1a0rz/agent-identity",
3
- "version": "0.2.0",
4
- "description": "Agent Identity: UserPool (用户池) login, TIP token (工作负载令牌), credential hosting (凭据托管 OAuth2/API key), optional tool risk approval. Integrates with Volcengine 智能体身份和权限管理平台.",
3
+ "version": "0.2.2",
4
+ "description": "Agent Identity: UserPool (用户池) login, TIP token (工作负载令牌), credential hosting (凭据托管 OAuth2/API key), optional tool/skill permission control (CheckPermission) and risk approval. Integrates with Volcengine 智能体身份和权限管理平台.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
package/skills/SKILL.md CHANGED
@@ -1,8 +1,8 @@
1
1
  ---
2
2
  name: identity
3
3
  description: |
4
- UserPool login, TIP token, credential hosting, and tool risk approval. Activate when user needs to check identity (whoami/status), log in, list/add credentials, manage env bindings, or diagnose/approve risky tool calls.
5
- Also activates for: 用户说登录、查身份、获取凭据、添加/配置API密钥、绑定环境变量、审批工具调用、风险检查.
4
+ UserPool login, TIP token, credential hosting, and tool risk approval. Activate when user needs to check identity (whoami/status), log in, list/add credentials, manage env bindings, configure the plugin, or diagnose/approve risky tool calls.
5
+ Also activates for: 用户说登录、查身份、获取凭据、添加/配置API密钥、绑定环境变量、配置插件、审批工具调用、风险检查.
6
6
  metadata:
7
7
  {
8
8
  "openclaw":
@@ -53,6 +53,7 @@ Use the agent-identity plugin for UserPool OIDC login (入站授权), TIP token
53
53
  | `identity_list_credentials` | `page?` | List providers and credentials (paginated) |
54
54
  | `identity_list_tips` | — | List valid TIP tokens and bindings |
55
55
  | `identity_config` | — | Show plugin config (secrets redacted) |
56
+ | `identity_config_suggest` | `intent?`, `lang?` | Generate config snippets for openclaw.json |
56
57
  | `identity_fetch` | `provider`, `flow?`, `redirectUrl?`, `scopes?` | Add credential |
57
58
  | `identity_set_binding` | `provider`, `envVar` | Bind provider → env var for tool injection |
58
59
  | `identity_unset_binding` | `provider` | Remove env binding |
@@ -204,6 +205,21 @@ Returns built-in dangerous command patterns and sensitive paths. No params. Use
204
205
  {}
205
206
  ```
206
207
 
208
+ ### identity_config_suggest
209
+
210
+ Generates config snippets for the agent-identity plugin. **Call when:** user asks to configure identity, login, authz, risk approval, or "如何配置 identity 插件", "帮我配置登录", "怎么开启权限检查".
211
+
212
+ | Param | Type | Required | Description |
213
+ | ------- | ------ | -------- | --------------------------------------------------------------------------- |
214
+ | `intent`| string | No | `identity` (AK/SK), `userpool` (OIDC login), `authz` (permission/approval), `llm_risk` (LLM re-eval), `full` (all). Default: full |
215
+ | `lang` | string | No | `en` or `zh` for instructions. Default: en |
216
+
217
+ Returns: `configPath`, `config` (JSON to merge), `instructions`, `nextSteps`. When `intent` is `identity` or `full`, also returns `identityDefaults` (env vars, credential resolution order, config defaults, credential file format). User must manually add to openclaw.json and restart gateway.
218
+
219
+ ```json
220
+ { "intent": "userpool", "lang": "zh" }
221
+ ```
222
+
207
223
  ## Workflow: Adding a Credential
208
224
 
209
225
  1. **Check login**: `identity_whoami` (brief) or `identity_status` (full). If not logged in, use `identity_login` first (user opens auth URL).