@m1a0rz/agent-identity 0.4.1 → 0.4.3

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 (131) hide show
  1. package/README-cn.md +32 -19
  2. package/README.md +32 -19
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +80 -7
  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 +217 -84
  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 +129 -2
  41. package/dist/src/services/identity-client.d.ts.map +1 -1
  42. package/dist/src/services/identity-client.js +175 -20
  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 +25 -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/dist/src/utils/resolve-identity-endpoint.d.ts +26 -0
  127. package/dist/src/utils/resolve-identity-endpoint.d.ts.map +1 -0
  128. package/dist/src/utils/resolve-identity-endpoint.js +90 -0
  129. package/openclaw.plugin.json +18 -1
  130. package/package.json +11 -3
  131. package/skills/SKILL.md +9 -9
@@ -3,12 +3,7 @@
3
3
  * Returns auth URL when login needed; tools don't have deliveryTarget so callback falls back to sessionKey.
4
4
  */
5
5
  import type { PluginToolContext } from "../types.js";
6
+ import { AnyAgentTool } from "openclaw/plugin-sdk";
6
7
  import type { IdentityActionsDeps } from "../actions/identity-actions.js";
7
- export declare function createIdentityLoginTool(deps: IdentityActionsDeps): (ctx: PluginToolContext) => {
8
- name: string;
9
- label: string;
10
- description: string;
11
- parameters: import("@sinclair/typebox").TObject<{}>;
12
- execute: () => Promise<import("@mariozechner/pi-agent-core").AgentToolResult<unknown>>;
13
- };
8
+ export declare function createIdentityLoginTool(deps: IdentityActionsDeps): (ctx: PluginToolContext) => AnyAgentTool;
14
9
  //# sourceMappingURL=identity-login.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"identity-login.d.ts","sourceRoot":"","sources":["../../../src/tools/identity-login.ts"],"names":[],"mappings":"AAgBA;;;GAGG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAGrD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAI1E,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,mBAAmB,IACvD,KAAK,iBAAiB;;;;;;EAiC/B"}
1
+ {"version":3,"file":"identity-login.d.ts","sourceRoot":"","sources":["../../../src/tools/identity-login.ts"],"names":[],"mappings":"AAgBA;;;GAGG;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,uBAAuB,CAAC,IAAI,EAAE,mBAAmB,IACvD,KAAK,iBAAiB,KAAG,YAAY,CAiC9C"}
@@ -2,12 +2,7 @@
2
2
  * identity_logout: clear session and TIP for the caller's session.
3
3
  */
4
4
  import type { PluginToolContext } from "../types.js";
5
+ import { AnyAgentTool } from "openclaw/plugin-sdk";
5
6
  import type { IdentityActionsDeps } from "../actions/identity-actions.js";
6
- export declare function createIdentityLogoutTool(deps: IdentityActionsDeps): (ctx: PluginToolContext) => {
7
- name: string;
8
- label: string;
9
- description: string;
10
- parameters: import("@sinclair/typebox").TObject<{}>;
11
- execute: () => Promise<import("@mariozechner/pi-agent-core").AgentToolResult<unknown>>;
12
- };
7
+ export declare function createIdentityLogoutTool(deps: IdentityActionsDeps): (ctx: PluginToolContext) => AnyAgentTool;
13
8
  //# sourceMappingURL=identity-logout.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"identity-logout.d.ts","sourceRoot":"","sources":["../../../src/tools/identity-logout.ts"],"names":[],"mappings":"AAgBA;;GAEG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAGrD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAI1E,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,mBAAmB,IACxD,KAAK,iBAAiB;;;;;;EAgB/B"}
1
+ {"version":3,"file":"identity-logout.d.ts","sourceRoot":"","sources":["../../../src/tools/identity-logout.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,wBAAwB,CAAC,IAAI,EAAE,mBAAmB,IACxD,KAAK,iBAAiB,KAAG,YAAY,CAgB9C"}
@@ -2,8 +2,8 @@
2
2
  * identity_risk_check: diagnose risk for a command or tool call without executing.
3
3
  * Use before running exec/write to see if it would require approval.
4
4
  */
5
- import type { PluginToolContext } from "../types.js";
6
- import type { PluginConfig } from "../types.js";
5
+ import type { PluginToolContext, PluginConfig } from "../types.js";
6
+ import { AnyAgentTool } from "openclaw/plugin-sdk";
7
7
  export type IdentityRiskCheckDeps = {
8
8
  pluginConfig: PluginConfig;
9
9
  logger?: {
@@ -11,19 +11,5 @@ export type IdentityRiskCheckDeps = {
11
11
  warn?: (msg: string) => void;
12
12
  };
13
13
  };
14
- export declare function createIdentityRiskCheckTool(deps: IdentityRiskCheckDeps): (_ctx: PluginToolContext) => {
15
- name: string;
16
- label: string;
17
- description: string;
18
- parameters: import("@sinclair/typebox").TObject<{
19
- command: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
20
- toolName: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
21
- params: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TUnknown>>;
22
- }>;
23
- execute: (_toolCallId: string, params: {
24
- command?: string;
25
- toolName?: string;
26
- params?: Record<string, unknown>;
27
- }) => Promise<import("@mariozechner/pi-agent-core").AgentToolResult<unknown>>;
28
- };
14
+ export declare function createIdentityRiskCheckTool(deps: IdentityRiskCheckDeps): (_ctx: PluginToolContext) => AnyAgentTool;
29
15
  //# sourceMappingURL=identity-risk-check.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"identity-risk-check.d.ts","sourceRoot":"","sources":["../../../src/tools/identity-risk-check.ts"],"names":[],"mappings":"AAgBA;;;GAGG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAIrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,MAAM,MAAM,qBAAqB,GAAG;IAClC,YAAY,EAAE,YAAY,CAAC;IAC3B,MAAM,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;QAAC,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAA;KAAE,CAAC;CAC1E,CAAC;AAEF,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,qBAAqB,IAC7D,MAAM,iBAAiB;;;;;;;;;2BAuBd,MAAM,UACX;QAAE,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE;EAuCtF"}
1
+ {"version":3,"file":"identity-risk-check.d.ts","sourceRoot":"","sources":["../../../src/tools/identity-risk-check.ts"],"names":[],"mappings":"AAgBA;;;GAGG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEnE,OAAO,EAAE,YAAY,EAAc,MAAM,qBAAqB,CAAC;AAG/D,MAAM,MAAM,qBAAqB,GAAG;IAClC,YAAY,EAAE,YAAY,CAAC;IAC3B,MAAM,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;QAAC,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAA;KAAE,CAAC;CAC1E,CAAC;AAEF,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,qBAAqB,IAC7D,MAAM,iBAAiB,KAAG,YAAY,CA+D/C"}
@@ -2,15 +2,7 @@
2
2
  * identity_set_binding: bind a credential provider to an env var for tool injection.
3
3
  */
4
4
  import type { PluginToolContext } from "../types.js";
5
+ import { AnyAgentTool } from "openclaw/plugin-sdk";
5
6
  import type { IdentityActionsDeps } from "../actions/identity-actions.js";
6
- export declare function createIdentitySetBindingTool(deps: IdentityActionsDeps): (ctx: PluginToolContext) => {
7
- name: string;
8
- label: string;
9
- description: string;
10
- parameters: import("@sinclair/typebox").TObject<{
11
- provider: import("@sinclair/typebox").TString;
12
- envVar: import("@sinclair/typebox").TString;
13
- }>;
14
- execute: (_toolCallId: any, params: any) => Promise<import("@mariozechner/pi-agent-core").AgentToolResult<unknown>>;
15
- };
7
+ export declare function createIdentitySetBindingTool(deps: IdentityActionsDeps): (ctx: PluginToolContext) => AnyAgentTool;
16
8
  //# sourceMappingURL=identity-set-binding.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"identity-set-binding.d.ts","sourceRoot":"","sources":["../../../src/tools/identity-set-binding.ts"],"names":[],"mappings":"AAgBA;;GAEG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAGrD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAI1E,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,mBAAmB,IAC5D,KAAK,iBAAiB;;;;;;;;;EAwB/B"}
1
+ {"version":3,"file":"identity-set-binding.d.ts","sourceRoot":"","sources":["../../../src/tools/identity-set-binding.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,4BAA4B,CAAC,IAAI,EAAE,mBAAmB,IAC5D,KAAK,iBAAiB,KAAG,YAAY,CAwB9C"}
@@ -2,12 +2,7 @@
2
2
  * identity_status: return login status, credentials, and env bindings for the caller's session.
3
3
  */
4
4
  import type { PluginToolContext } from "../types.js";
5
+ import { AnyAgentTool } from "openclaw/plugin-sdk";
5
6
  import type { IdentityActionsDeps } from "../actions/identity-actions.js";
6
- export declare function createIdentityStatusTool(deps: IdentityActionsDeps): (ctx: PluginToolContext) => {
7
- name: string;
8
- label: string;
9
- description: string;
10
- parameters: import("@sinclair/typebox").TObject<{}>;
11
- execute: () => Promise<import("@mariozechner/pi-agent-core").AgentToolResult<unknown>>;
12
- };
7
+ export declare function createIdentityStatusTool(deps: IdentityActionsDeps): (ctx: PluginToolContext) => AnyAgentTool;
13
8
  //# sourceMappingURL=identity-status.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"identity-status.d.ts","sourceRoot":"","sources":["../../../src/tools/identity-status.ts"],"names":[],"mappings":"AAgBA;;GAEG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAGrD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAI1E,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,mBAAmB,IACxD,KAAK,iBAAiB;;;;;;EAiC/B"}
1
+ {"version":3,"file":"identity-status.d.ts","sourceRoot":"","sources":["../../../src/tools/identity-status.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,wBAAwB,CAAC,IAAI,EAAE,mBAAmB,IACxD,KAAK,iBAAiB,KAAG,YAAY,CAiC9C"}
@@ -2,14 +2,7 @@
2
2
  * identity_unset_binding: remove credential env binding.
3
3
  */
4
4
  import type { PluginToolContext } from "../types.js";
5
+ import { AnyAgentTool } from "openclaw/plugin-sdk";
5
6
  import type { IdentityActionsDeps } from "../actions/identity-actions.js";
6
- export declare function createIdentityUnsetBindingTool(deps: IdentityActionsDeps): (ctx: PluginToolContext) => {
7
- name: string;
8
- label: string;
9
- description: string;
10
- parameters: import("@sinclair/typebox").TObject<{
11
- provider: import("@sinclair/typebox").TString;
12
- }>;
13
- execute: (_toolCallId: any, params: any) => Promise<import("@mariozechner/pi-agent-core").AgentToolResult<unknown>>;
14
- };
7
+ export declare function createIdentityUnsetBindingTool(deps: IdentityActionsDeps): (ctx: PluginToolContext) => AnyAgentTool;
15
8
  //# sourceMappingURL=identity-unset-binding.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"identity-unset-binding.d.ts","sourceRoot":"","sources":["../../../src/tools/identity-unset-binding.ts"],"names":[],"mappings":"AAgBA;;GAEG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAGrD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAI1E,wBAAgB,8BAA8B,CAAC,IAAI,EAAE,mBAAmB,IAC9D,KAAK,iBAAiB;;;;;;;;EAiB/B"}
1
+ {"version":3,"file":"identity-unset-binding.d.ts","sourceRoot":"","sources":["../../../src/tools/identity-unset-binding.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,8BAA8B,CAAC,IAAI,EAAE,mBAAmB,IAC9D,KAAK,iBAAiB,KAAG,YAAY,CAiB9C"}
@@ -2,12 +2,7 @@
2
2
  * identity_whoami: return current session identity (sub, TIP status) for the caller's session.
3
3
  */
4
4
  import type { PluginToolContext } from "../types.js";
5
+ import { AnyAgentTool } from "openclaw/plugin-sdk";
5
6
  import type { IdentityActionsDeps } from "../actions/identity-actions.js";
6
- export declare function createIdentityWhoamiTool(deps: IdentityActionsDeps): (ctx: PluginToolContext) => {
7
- name: string;
8
- label: string;
9
- description: string;
10
- parameters: import("@sinclair/typebox").TObject<{}>;
11
- execute: () => Promise<import("@mariozechner/pi-agent-core").AgentToolResult<unknown>>;
12
- };
7
+ export declare function createIdentityWhoamiTool(deps: IdentityActionsDeps): (ctx: PluginToolContext) => AnyAgentTool;
13
8
  //# sourceMappingURL=identity-whoami.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"identity-whoami.d.ts","sourceRoot":"","sources":["../../../src/tools/identity-whoami.ts"],"names":[],"mappings":"AAgBA;;GAEG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAGrD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAI1E,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,mBAAmB,IACxD,KAAK,iBAAiB;;;;;;EA+B/B"}
1
+ {"version":3,"file":"identity-whoami.d.ts","sourceRoot":"","sources":["../../../src/tools/identity-whoami.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,wBAAwB,CAAC,IAAI,EAAE,mBAAmB,IACxD,KAAK,iBAAiB,KAAG,YAAY,CA+B9C"}
@@ -18,6 +18,12 @@ export type PluginToolContext = {
18
18
  };
19
19
  export type IdentityConfig = {
20
20
  endpoint?: string;
21
+ /**
22
+ * Plain-text region id metadata URL (e.g. http://100.96.0.96/latest/region_id).
23
+ * When `endpoint` is unset, response body builds `https://id.{region}.volcengineapi.com`.
24
+ * Lower priority than `endpoint`.
25
+ */
26
+ regionMetadataUrl?: string;
21
27
  accessKeyId?: string;
22
28
  secretAccessKey?: string;
23
29
  sessionToken?: string;
@@ -33,6 +39,12 @@ export type IdentityConfig = {
33
39
  subagentTipPropagation?: boolean;
34
40
  /** Enable identity.session.put / identity.session.get gateway WS methods for webchat clients. Default: false. */
35
41
  webchatSessionExchange?: boolean;
42
+ /**
43
+ * When true, collapse identity/session/TIP/credential storage to `agent:main:main` for all
44
+ * non-subagent sessions (no per-sender or per-channel-peer isolation). For single-user
45
+ * deployments only. Default: false.
46
+ */
47
+ personalSessionMode?: boolean;
36
48
  };
37
49
  export type UserPoolConfig = {
38
50
  /** Explicit: discovery URL for OIDC. */
@@ -45,6 +57,19 @@ export type UserPoolConfig = {
45
57
  userPoolName?: string;
46
58
  clientName?: string;
47
59
  autoCreate?: boolean;
60
+ /**
61
+ * Identity provider name passed as `identity_provider` in the auth URL.
62
+ * When omitted, the first provider from ListIdentityProviders is used (if available).
63
+ */
64
+ identityProvider?: string;
65
+ /**
66
+ * When true, the OIDC flow goes through the UserPool relay (redirect_relay_uri).
67
+ * The callback handler will detect the relay state format
68
+ * (base64 JSON with request_id/provider_id/request_state) and first forward the
69
+ * authorization code to the UserPool's generic_oauth callback endpoint, then
70
+ * perform the token exchange. The app state is recovered from request_state.
71
+ */
72
+ useRelayCallback?: boolean;
48
73
  };
49
74
  export type AuthzConfig = {
50
75
  /** Run CheckPermission for agents (resource type "agent") before agent starts. Default: false. */
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAgBA;;;GAGG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1D;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,qGAAqG;IACrG,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,eAAe,CAAC,E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AAE,CAAC,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC"}
@@ -116,6 +116,7 @@ export type SessionKeyDeliveryTarget = {
116
116
  /** For feishu per-account sessions (agent:main:feishu:default:direct:ou_xxx). */
117
117
  accountId?: string;
118
118
  };
119
+ export declare function isBuiltinSenderId(senderId: string | undefined | null): boolean;
119
120
  export declare function isSendableChannel(channel: string | undefined | null): boolean;
120
121
  /** Command context shape (subset of PluginCommandContext). */
121
122
  export type CommandContextForDelivery = {
@@ -1 +1 @@
1
- {"version":3,"file":"derive-session-key.d.ts","sourceRoot":"","sources":["../../../src/utils/derive-session-key.ts"],"names":[],"mappings":"AAgBA;;;GAGG;AAEH,yFAAyF;AACzF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,OAAO,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC/B,MAAM,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE;YAAE,EAAE,CAAC,EAAE,MAAM,CAAC;YAAC,OAAO,CAAC,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,CAAC;CAC3D,CAAC;AAEF,KAAK,sBAAsB,GAAG;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,iBAAiB,CAAC;CAC3B,CAAC;AAKF;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAKlE;AAOD;;GAEG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,iBAAiB,GAAG,MAAM,CAE/D;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,MAAM,GAA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,EAAE,yBAAyB,GAAG,MAAM,CAiBvF;AAuGD;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,CAEnF;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,sBAAsB,GAAG,MAAM,GAAG,IAAI,CAiC9E;AAED,MAAM,MAAM,wBAAwB,GAAG;IACrC,OAAO,EAAE,MAAM,CAAC;IAChB,EAAE,EAAE,MAAM,CAAC;IACX,iFAAiF;IACjF,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAsBF,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,OAAO,CAE9E;AAaD,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,OAAO,CAE7E;AAED,8DAA8D;AAC9D,MAAM,MAAM,yBAAyB,GAAG;IACtC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,+BAA+B,CAC7C,GAAG,EAAE,yBAAyB,GAC7B,wBAAwB,GAAG,IAAI,CAmBjC;AAED;;;;GAIG;AACH,wBAAgB,+BAA+B,CAC7C,UAAU,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GACpC,wBAAwB,GAAG,IAAI,CA2DjC"}
@@ -254,9 +254,9 @@ export function deriveSessionKey(params) {
254
254
  const groupPeerId = extractGroupPeerId(ch, from, to);
255
255
  const isGroup = Boolean(groupPeerId);
256
256
  if (isGroup && groupPeerId) {
257
- return `agent:${agentId}:${ch}:group:${groupPeerId.toLowerCase()}`;
257
+ return `agent:${agentId}:${ch}:group:${groupPeerId}`;
258
258
  }
259
- const peerId = (senderId ?? "").trim().toLowerCase();
259
+ const peerId = (senderId ?? "").trim();
260
260
  if (!peerId)
261
261
  return null;
262
262
  if (dmScope === "per-account-channel-peer") {
@@ -271,6 +271,28 @@ export function deriveSessionKey(params) {
271
271
  }
272
272
  return `agent:${agentId}:main`;
273
273
  }
274
+ /**
275
+ * Built-in gateway client IDs that represent the same local operator.
276
+ * When these appear as senderIds, they should share the canonical main
277
+ * session key instead of creating per-sender isolation.
278
+ */
279
+ const BUILTIN_SENDER_IDS = new Set([
280
+ "webchat-ui",
281
+ "openclaw-control-ui",
282
+ "webchat",
283
+ "cli",
284
+ "gateway-client",
285
+ "openclaw-macos",
286
+ "openclaw-ios",
287
+ "openclaw-android",
288
+ "node-host",
289
+ "test",
290
+ "fingerprint",
291
+ "openclaw-probe",
292
+ ]);
293
+ export function isBuiltinSenderId(senderId) {
294
+ return BUILTIN_SENDER_IDS.has((senderId ?? "").trim().toLowerCase());
295
+ }
274
296
  const SENDABLE_CHANNELS = new Set([
275
297
  "telegram",
276
298
  "slack",
@@ -333,9 +355,10 @@ export function parseSessionKeyToDeliveryTarget(sessionKey) {
333
355
  if (!peerId)
334
356
  return null;
335
357
  if (channel === "slack") {
358
+ const lower = peerId.toLowerCase();
336
359
  return {
337
360
  channel,
338
- to: peerId.startsWith("U") || peerId.startsWith("W") ? `user:${peerId}` : peerId,
361
+ to: lower.startsWith("u") || lower.startsWith("w") ? `user:${peerId}` : peerId,
339
362
  };
340
363
  }
341
364
  if (channel === "feishu") {
@@ -362,9 +385,10 @@ export function parseSessionKeyToDeliveryTarget(sessionKey) {
362
385
  return null;
363
386
  const accountId = scope;
364
387
  if (channel === "slack") {
388
+ const lower = peerId.toLowerCase();
365
389
  return {
366
390
  channel,
367
- to: peerId.startsWith("U") || peerId.startsWith("W") ? `user:${peerId}` : peerId,
391
+ to: lower.startsWith("u") || lower.startsWith("w") ? `user:${peerId}` : peerId,
368
392
  accountId,
369
393
  };
370
394
  }
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Resolve Volcengine Identity API base URL.
3
+ * Priority: explicit endpoint > region from regionMetadataUrl -> https://id.{region}.volcengineapi.com > cn-beijing default.
4
+ */
5
+ export declare const DEFAULT_IDENTITY_ENDPOINT = "https://id.cn-beijing.volcengineapi.com";
6
+ /**
7
+ * GET metadata URL; expect plain-text region id (e.g. cn-beijing).
8
+ * Uses total request timeout (similar to curl --max-time 10).
9
+ */
10
+ export declare function fetchRegionIdFromMetadata(metadataUrl: string, options?: {
11
+ totalTimeoutMs?: number;
12
+ }): Promise<string | null>;
13
+ export declare function identityEndpointFromRegion(region: string): string;
14
+ export type ResolveIdentityApiEndpointInput = {
15
+ endpoint?: string;
16
+ regionMetadataUrl?: string;
17
+ };
18
+ /**
19
+ * Resolve Identity control/data plane base URL for signing and requests.
20
+ */
21
+ export declare function resolveIdentityApiEndpoint(input: ResolveIdentityApiEndpointInput): Promise<string>;
22
+ /**
23
+ * Derive Volcengine signing region from Identity endpoint host id.{region}.volcengineapi.com.
24
+ */
25
+ export declare function signingRegionFromIdentityEndpoint(baseUrl: string): string | null;
26
+ //# sourceMappingURL=resolve-identity-endpoint.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve-identity-endpoint.d.ts","sourceRoot":"","sources":["../../../src/utils/resolve-identity-endpoint.ts"],"names":[],"mappings":"AAgBA;;;GAGG;AAEH,eAAO,MAAM,yBAAyB,4CAA4C,CAAC;AAUnF;;;GAGG;AACH,wBAAsB,yBAAyB,CAC7C,WAAW,EAAE,MAAM,EACnB,OAAO,CAAC,EAAE;IAAE,cAAc,CAAC,EAAE,MAAM,CAAA;CAAE,GACpC,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAuBxB;AAED,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEjE;AAED,MAAM,MAAM,+BAA+B,GAAG;IAC5C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF;;GAEG;AACH,wBAAsB,0BAA0B,CAC9C,KAAK,EAAE,+BAA+B,GACrC,OAAO,CAAC,MAAM,CAAC,CAYjB;AAED;;GAEG;AACH,wBAAgB,iCAAiC,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAQhF"}
@@ -0,0 +1,90 @@
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
+ * Resolve Volcengine Identity API base URL.
18
+ * Priority: explicit endpoint > region from regionMetadataUrl -> https://id.{region}.volcengineapi.com > cn-beijing default.
19
+ */
20
+ export const DEFAULT_IDENTITY_ENDPOINT = "https://id.cn-beijing.volcengineapi.com";
21
+ const DEFAULT_TOTAL_TIMEOUT_MS = 10_000;
22
+ /** Region values that must not be used to build an endpoint. */
23
+ function isInvalidRegionId(text) {
24
+ const t = text.trim().toLowerCase();
25
+ return t.length === 0 || t === "unknown";
26
+ }
27
+ /**
28
+ * GET metadata URL; expect plain-text region id (e.g. cn-beijing).
29
+ * Uses total request timeout (similar to curl --max-time 10).
30
+ */
31
+ export async function fetchRegionIdFromMetadata(metadataUrl, options) {
32
+ const url = metadataUrl.trim();
33
+ if (!url)
34
+ return null;
35
+ const totalTimeoutMs = options?.totalTimeoutMs ?? DEFAULT_TOTAL_TIMEOUT_MS;
36
+ const controller = new AbortController();
37
+ const timer = setTimeout(() => controller.abort(), totalTimeoutMs);
38
+ try {
39
+ const res = await fetch(url, {
40
+ signal: controller.signal,
41
+ redirect: "follow",
42
+ });
43
+ if (!res.ok)
44
+ return null;
45
+ const text = (await res.text()).trim();
46
+ if (isInvalidRegionId(text))
47
+ return null;
48
+ if (!/^[a-z0-9-]+$/i.test(text))
49
+ return null;
50
+ return text;
51
+ }
52
+ catch {
53
+ return null;
54
+ }
55
+ finally {
56
+ clearTimeout(timer);
57
+ }
58
+ }
59
+ export function identityEndpointFromRegion(region) {
60
+ return `https://id.${region.trim()}.volcengineapi.com`;
61
+ }
62
+ /**
63
+ * Resolve Identity control/data plane base URL for signing and requests.
64
+ */
65
+ export async function resolveIdentityApiEndpoint(input) {
66
+ const explicit = input.endpoint?.trim();
67
+ if (explicit)
68
+ return explicit;
69
+ const fallback = DEFAULT_IDENTITY_ENDPOINT;
70
+ const metaUrl = input.regionMetadataUrl?.trim();
71
+ if (metaUrl) {
72
+ const region = await fetchRegionIdFromMetadata(metaUrl);
73
+ if (region)
74
+ return identityEndpointFromRegion(region);
75
+ }
76
+ return fallback;
77
+ }
78
+ /**
79
+ * Derive Volcengine signing region from Identity endpoint host id.{region}.volcengineapi.com.
80
+ */
81
+ export function signingRegionFromIdentityEndpoint(baseUrl) {
82
+ try {
83
+ const host = new URL(baseUrl).host;
84
+ const m = /^id\.([a-z0-9-]+)\.volcengineapi\.com$/i.exec(host);
85
+ return m ? m[1] : null;
86
+ }
87
+ catch {
88
+ return null;
89
+ }
90
+ }
@@ -13,7 +13,11 @@
13
13
  "properties": {
14
14
  "endpoint": {
15
15
  "type": "string",
16
- "description": "Identity API endpoint, e.g. https://id.cn-beijing.volcengineapi.com"
16
+ "description": "Identity API endpoint, e.g. https://id.cn-beijing.volcengineapi.com. Highest priority; when set, regionMetadataUrl is ignored for the base URL."
17
+ },
18
+ "regionMetadataUrl": {
19
+ "type": "string",
20
+ "description": "GET this URL for plain-text region id (e.g. http://100.96.0.96/latest/region_id). When endpoint is unset, builds https://id.{region}.volcengineapi.com. Request timeout ~10s; on failure falls back to https://id.cn-beijing.volcengineapi.com"
17
21
  },
18
22
  "accessKeyId": {
19
23
  "type": "string",
@@ -65,6 +69,11 @@
65
69
  "type": "boolean",
66
70
  "default": false,
67
71
  "description": "Enable identity.session.put / identity.session.get gateway WS methods for webchat clients. Allows BFF to inject OIDC id_token into plugin sessions without redirect flow."
72
+ },
73
+ "personalSessionMode": {
74
+ "type": "boolean",
75
+ "default": false,
76
+ "description": "Single-user mode: store TIP, OIDC session, and credentials under agent:main:main only (no per-sender or per-channel-peer keys). Subagent sessions are unchanged. Not for multi-tenant or shared group chats."
68
77
  }
69
78
  }
70
79
  },
@@ -95,6 +104,14 @@
95
104
  "type": "boolean",
96
105
  "default": true,
97
106
  "description": "Create UserPool/Client when not found (dynamic mode)"
107
+ },
108
+ "identityProvider": {
109
+ "type": "string",
110
+ "description": "External identity provider name to use in the OAuth2 authorization URL (identity_provider param). When omitted, the first provider returned by ListIdentityProviders is used automatically."
111
+ },
112
+ "useRelayCallback": {
113
+ "type": "boolean",
114
+ "description": "When true, the OIDC flow goes through the UserPool relay (redirect_relay_uri). The callback handler will detect the relay state format (base64 JSON with request_id/provider_id/request_state) and first forward the authorization code to the UserPool's generic_oauth callback endpoint, then perform the token exchange. The app state is recovered from request_state."
98
115
  }
99
116
  }
100
117
  },
package/package.json CHANGED
@@ -1,12 +1,15 @@
1
1
  {
2
2
  "name": "@m1a0rz/agent-identity",
3
- "version": "0.4.1",
3
+ "version": "0.4.3",
4
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",
8
8
  "scripts": {
9
9
  "build": "tsc",
10
+ "test": "vitest run",
11
+ "test:ci": "vitest run --reporter=verbose",
12
+ "lint": "tsc --noEmit",
10
13
  "prepublishOnly": "npm run build"
11
14
  },
12
15
  "keywords": [
@@ -22,15 +25,20 @@
22
25
  "license": "Apache-2.0",
23
26
  "dependencies": {
24
27
  "@sinclair/typebox": "0.34.48",
25
- "jose": "^5.9.6"
28
+ "jose": "^5.9.6",
29
+ "yaml": "^2.4.0",
30
+ "json5": "^2.2.3"
26
31
  },
27
32
  "devDependencies": {
28
33
  "@types/node": "^22.0.0",
34
+ "openclaw": "^2026.3.13",
29
35
  "typescript": "^5.7.0",
36
+ "vitest": "^4.1.0",
30
37
  "ws": "^8.19.0"
31
38
  },
32
39
  "peerDependencies": {
33
- "openclaw": ">=2026.3.8"
40
+ "openclaw": ">=2026.3.8",
41
+ "@mariozechner/pi-agent-core": "^0.58.0"
34
42
  },
35
43
  "peerDependenciesMeta": {
36
44
  "openclaw": {
package/skills/SKILL.md CHANGED
@@ -74,6 +74,14 @@ When looking for a specific provider (e.g. before `identity_fetch`), prefer pass
74
74
 
75
75
  Returns: `providers`, `storedOnly`, `page`, `hasMore`.
76
76
 
77
+ ### identity_list_roles
78
+
79
+ Lists **STS role credential providers** (not OAuth/API key — use `identity_list_credentials` for those). **Call when:** "role credentials", "STS providers", "IAM role 凭据", "有哪些角色凭据". Requires login session.
80
+
81
+ Optional param: `name` — prefix filter on provider name.
82
+
83
+ Returns: `providers` (each may include `identitySource`). To obtain temporary keys for a provider, use `identity_get_role_credentials` with that provider name.
84
+
77
85
  ### identity_fetch
78
86
 
79
87
  Adds a credential for a provider (OAuth2 or API key). **Call when the user wants to add, get, or configure credentials:**
@@ -142,17 +150,9 @@ Generates config snippets. **Call when:** "如何配置 identity 插件", "帮
142
150
 
143
151
  Returns: `configPath`, `config` (JSON to merge), `instructions`, `nextSteps`.
144
152
 
145
- ### identity_list_tips
146
-
147
- List valid TIP tokens and bindings. No params.
148
-
149
153
  ### identity_approve_tool
150
154
 
151
- | Param | Type | Required | Description |
152
- | ------------- | ------ | -------- | -------------------------------------------------------- |
153
- | `approval_id` | string | Yes | ID from the approval prompt |
154
-
155
- **Agent must NOT call this tool.** This is for human approval only — user runs `/identity approve <id>` or replies "approve" in chat.
155
+ **Do not call this tool as the agent.** High-risk approvals are for humans only. When the user must approve, relay the **approval ID** and timeout from the error; they complete approval via `/identity approve <id>` or the channel workflow your gateway uses — not via this tool from the model.
156
156
 
157
157
  ## Workflow: Adding a Credential
158
158