@portaidentity/sdk 1.7.3 → 1.8.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 (116) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/README.md +70 -41
  3. package/dist/agent.d.ts +15 -1
  4. package/dist/agent.d.ts.map +1 -1
  5. package/dist/agent.js +473 -69
  6. package/dist/agent.js.map +1 -1
  7. package/dist/auth/cli-auth.d.ts +45 -71
  8. package/dist/auth/cli-auth.d.ts.map +1 -1
  9. package/dist/auth/cli-auth.js +208 -144
  10. package/dist/auth/cli-auth.js.map +1 -1
  11. package/dist/auth/index.d.ts +1 -1
  12. package/dist/auth/index.d.ts.map +1 -1
  13. package/dist/domains/applications.d.ts +22 -3
  14. package/dist/domains/applications.d.ts.map +1 -1
  15. package/dist/domains/applications.js +90 -20
  16. package/dist/domains/applications.js.map +1 -1
  17. package/dist/domains/branding.d.ts +47 -16
  18. package/dist/domains/branding.d.ts.map +1 -1
  19. package/dist/domains/branding.js +28 -5
  20. package/dist/domains/branding.js.map +1 -1
  21. package/dist/domains/clients.d.ts +23 -6
  22. package/dist/domains/clients.d.ts.map +1 -1
  23. package/dist/domains/clients.js +121 -21
  24. package/dist/domains/clients.js.map +1 -1
  25. package/dist/domains/config.d.ts +20 -3
  26. package/dist/domains/config.d.ts.map +1 -1
  27. package/dist/domains/config.js +30 -3
  28. package/dist/domains/config.js.map +1 -1
  29. package/dist/domains/custom-claims.d.ts +2 -1
  30. package/dist/domains/custom-claims.d.ts.map +1 -1
  31. package/dist/domains/custom-claims.js +2 -2
  32. package/dist/domains/custom-claims.js.map +1 -1
  33. package/dist/domains/exports.d.ts +6 -1
  34. package/dist/domains/exports.d.ts.map +1 -1
  35. package/dist/domains/exports.js +27 -1
  36. package/dist/domains/exports.js.map +1 -1
  37. package/dist/domains/helpers.d.ts +31 -0
  38. package/dist/domains/helpers.d.ts.map +1 -1
  39. package/dist/domains/helpers.js +72 -1
  40. package/dist/domains/helpers.js.map +1 -1
  41. package/dist/domains/imports.d.ts +8 -7
  42. package/dist/domains/imports.d.ts.map +1 -1
  43. package/dist/domains/imports.js +158 -14
  44. package/dist/domains/imports.js.map +1 -1
  45. package/dist/domains/index.d.ts +1 -1
  46. package/dist/domains/index.d.ts.map +1 -1
  47. package/dist/domains/organizations.d.ts +2 -9
  48. package/dist/domains/organizations.d.ts.map +1 -1
  49. package/dist/domains/organizations.js +2 -13
  50. package/dist/domains/organizations.js.map +1 -1
  51. package/dist/domains/permissions.d.ts +22 -4
  52. package/dist/domains/permissions.d.ts.map +1 -1
  53. package/dist/domains/permissions.js +47 -13
  54. package/dist/domains/permissions.js.map +1 -1
  55. package/dist/domains/roles.d.ts +26 -16
  56. package/dist/domains/roles.d.ts.map +1 -1
  57. package/dist/domains/roles.js +61 -31
  58. package/dist/domains/roles.js.map +1 -1
  59. package/dist/domains/user-roles.d.ts +9 -4
  60. package/dist/domains/user-roles.d.ts.map +1 -1
  61. package/dist/domains/user-roles.js +32 -6
  62. package/dist/domains/user-roles.js.map +1 -1
  63. package/dist/domains/users.d.ts +31 -26
  64. package/dist/domains/users.d.ts.map +1 -1
  65. package/dist/domains/users.js +56 -46
  66. package/dist/domains/users.js.map +1 -1
  67. package/dist/errors/index.d.ts +2 -0
  68. package/dist/errors/index.d.ts.map +1 -1
  69. package/dist/errors/index.js +18 -1
  70. package/dist/errors/index.js.map +1 -1
  71. package/dist/index.d.ts +1 -1
  72. package/dist/index.d.ts.map +1 -1
  73. package/dist/index.js.map +1 -1
  74. package/dist/node.d.ts +1 -1
  75. package/dist/node.d.ts.map +1 -1
  76. package/dist/pagination/index.d.ts +5 -1
  77. package/dist/pagination/index.d.ts.map +1 -1
  78. package/dist/pagination/index.js +2 -2
  79. package/dist/pagination/index.js.map +1 -1
  80. package/dist/types/applications.d.ts +27 -6
  81. package/dist/types/applications.d.ts.map +1 -1
  82. package/dist/types/branding.d.ts +38 -11
  83. package/dist/types/branding.d.ts.map +1 -1
  84. package/dist/types/branding.js +0 -5
  85. package/dist/types/branding.js.map +1 -1
  86. package/dist/types/bulk.d.ts +2 -4
  87. package/dist/types/bulk.d.ts.map +1 -1
  88. package/dist/types/clients.d.ts +98 -13
  89. package/dist/types/clients.d.ts.map +1 -1
  90. package/dist/types/common.d.ts +26 -3
  91. package/dist/types/common.d.ts.map +1 -1
  92. package/dist/types/config.d.ts +57 -21
  93. package/dist/types/config.d.ts.map +1 -1
  94. package/dist/types/config.js +1 -8
  95. package/dist/types/config.js.map +1 -1
  96. package/dist/types/exports.d.ts +17 -0
  97. package/dist/types/exports.d.ts.map +1 -1
  98. package/dist/types/imports.d.ts +388 -84
  99. package/dist/types/imports.d.ts.map +1 -1
  100. package/dist/types/imports.js +1 -7
  101. package/dist/types/imports.js.map +1 -1
  102. package/dist/types/index.d.ts +14 -14
  103. package/dist/types/index.d.ts.map +1 -1
  104. package/dist/types/organizations.d.ts +5 -9
  105. package/dist/types/organizations.d.ts.map +1 -1
  106. package/dist/types/permissions.d.ts +21 -6
  107. package/dist/types/permissions.d.ts.map +1 -1
  108. package/dist/types/roles.d.ts +3 -1
  109. package/dist/types/roles.d.ts.map +1 -1
  110. package/dist/types/user-roles.d.ts +4 -10
  111. package/dist/types/user-roles.d.ts.map +1 -1
  112. package/dist/types/users.d.ts +102 -15
  113. package/dist/types/users.d.ts.map +1 -1
  114. package/dist/version.d.ts +1 -1
  115. package/dist/version.js +1 -1
  116. package/package.json +3 -2
package/dist/agent.js CHANGED
@@ -17,6 +17,9 @@ const OPT_STR = (name, desc) => param(name, 'string', desc, false);
17
17
  const OPT_NUM = (name, desc) => param(name, 'number', desc, false);
18
18
  const OPT_OBJ = (name, desc) => param(name, 'object', desc, false);
19
19
  const OBJ = (name, desc) => param(name, 'object', desc, true);
20
+ const ARRAY = (name, desc) => param(name, 'array', desc, true);
21
+ /** Fixed failure text that cannot copy infrastructure or secret details into agent output. */
22
+ const SAFE_TOOL_ERROR = 'Tool execution failed.';
20
23
  // Standard list params
21
24
  const LIST_PARAMS = [
22
25
  OPT_NUM('page', 'Page number'),
@@ -30,86 +33,485 @@ const LIST_PARAMS = [
30
33
  // ---------------------------------------------------------------------------
31
34
  const TOOL_DEFINITIONS = [
32
35
  // Organizations
33
- { name: 'organizations.list', description: 'List organizations with pagination', parameters: [...LIST_PARAMS], returns: 'PaginatedResponse<Organization>' },
34
- { name: 'organizations.get', description: 'Get an organization by ID or slug', parameters: [ID('idOrSlug', 'Organization ID or slug')], returns: '{ data: Organization, etag: string | null }' },
35
- { name: 'organizations.create', description: 'Create a new organization', parameters: [OBJ('input', 'CreateOrganizationInput')], returns: 'Organization' },
36
- { name: 'organizations.update', description: 'Update an organization', parameters: [ID('idOrSlug', 'Organization ID or slug'), OBJ('input', 'UpdateOrganizationInput'), OPT_STR('etag', 'ETag for concurrency')], returns: 'Organization' },
37
- { name: 'organizations.suspend', description: 'Suspend an organization', parameters: [ID('idOrSlug', 'Organization ID or slug')], returns: 'void' },
38
- { name: 'organizations.activate', description: 'Activate an organization', parameters: [ID('idOrSlug', 'Organization ID or slug')], returns: 'void' },
39
- { name: 'organizations.archive', description: 'Archive an organization', parameters: [ID('idOrSlug', 'Organization ID or slug')], returns: 'void' },
40
- { name: 'organizations.destroy', description: 'Permanently delete an organization', parameters: [ID('idOrSlug', 'Organization ID or slug')], returns: 'DestroyResult' },
36
+ {
37
+ name: 'organizations.list',
38
+ description: 'List organizations with pagination',
39
+ parameters: [...LIST_PARAMS],
40
+ returns: 'PaginatedResponse<Organization>',
41
+ },
42
+ {
43
+ name: 'organizations.get',
44
+ description: 'Get an organization by ID or slug',
45
+ parameters: [ID('idOrSlug', 'Organization ID or slug')],
46
+ returns: '{ data: Organization, etag: string | null }',
47
+ },
48
+ {
49
+ name: 'organizations.create',
50
+ description: 'Create a new organization',
51
+ parameters: [OBJ('input', 'CreateOrganizationInput')],
52
+ returns: 'Organization',
53
+ },
54
+ {
55
+ name: 'organizations.update',
56
+ description: 'Update an organization',
57
+ parameters: [
58
+ ID('idOrSlug', 'Organization ID or slug'),
59
+ OBJ('input', 'UpdateOrganizationInput'),
60
+ OPT_STR('etag', 'ETag for concurrency'),
61
+ ],
62
+ returns: 'Organization',
63
+ },
64
+ {
65
+ name: 'organizations.suspend',
66
+ description: 'Suspend an organization',
67
+ parameters: [ID('idOrSlug', 'Organization ID or slug')],
68
+ returns: 'void',
69
+ },
70
+ {
71
+ name: 'organizations.activate',
72
+ description: 'Activate an organization',
73
+ parameters: [ID('idOrSlug', 'Organization ID or slug')],
74
+ returns: 'void',
75
+ },
76
+ {
77
+ name: 'organizations.delete',
78
+ description: 'Permanently delete an organization and its owned data',
79
+ parameters: [ID('idOrSlug', 'Organization ID or slug')],
80
+ returns: 'void',
81
+ },
41
82
  // Applications
42
- { name: 'applications.list', description: 'List applications', parameters: [...LIST_PARAMS], returns: 'PaginatedResponse<Application>' },
43
- { name: 'applications.get', description: 'Get an application by ID or slug', parameters: [ID('idOrSlug', 'Application ID or slug')], returns: '{ data: Application, etag: string | null }' },
44
- { name: 'applications.create', description: 'Create a new application', parameters: [OBJ('input', 'CreateApplicationInput')], returns: 'Application' },
45
- { name: 'applications.update', description: 'Update an application', parameters: [ID('idOrSlug', 'Application ID or slug'), OBJ('input', 'UpdateApplicationInput'), OPT_STR('etag', 'ETag')], returns: 'Application' },
83
+ {
84
+ name: 'applications.list',
85
+ description: 'List applications',
86
+ parameters: [...LIST_PARAMS],
87
+ returns: 'PaginatedResponse<Application>',
88
+ },
89
+ {
90
+ name: 'applications.get',
91
+ description: 'Get an application by ID or slug',
92
+ parameters: [ID('idOrSlug', 'Application ID or slug')],
93
+ returns: '{ data: Application, etag: string | null }',
94
+ },
95
+ {
96
+ name: 'applications.create',
97
+ description: 'Create a new application',
98
+ parameters: [OBJ('input', 'CreateApplicationInput')],
99
+ returns: 'Application',
100
+ },
101
+ {
102
+ name: 'applications.update',
103
+ description: 'Update an application',
104
+ parameters: [
105
+ ID('idOrSlug', 'Application ID or slug'),
106
+ OBJ('input', 'UpdateApplicationInput'),
107
+ OPT_STR('etag', 'ETag'),
108
+ ],
109
+ returns: 'Application',
110
+ },
111
+ {
112
+ name: 'applications.delete',
113
+ description: 'Permanently delete a deployment-global application',
114
+ parameters: [ID('id', 'Application ID')],
115
+ returns: 'void',
116
+ },
117
+ {
118
+ name: 'applications.deleteModule',
119
+ description: 'Permanently delete an application module',
120
+ parameters: [ID('appId', 'Application ID'), ID('moduleId', 'Module ID')],
121
+ returns: 'void',
122
+ },
46
123
  // Clients
47
- { name: 'clients.list', description: 'List clients', parameters: [...LIST_PARAMS], returns: 'PaginatedResponse<Client>' },
48
- { name: 'clients.get', description: 'Get a client by ID', parameters: [ID('idOrClientId', 'Client ID or clientId')], returns: '{ data: Client, etag: string | null }' },
49
- { name: 'clients.create', description: 'Create a new client', parameters: [OBJ('input', 'CreateClientInput')], returns: 'Client' },
50
- { name: 'clients.update', description: 'Update a client', parameters: [ID('idOrClientId', 'Client ID'), OBJ('input', 'UpdateClientInput'), OPT_STR('etag', 'ETag')], returns: 'Client' },
51
- { name: 'clients.generateSecret', description: 'Generate a new secret for a client', parameters: [ID('clientId', 'Client ID'), OPT_OBJ('input', 'GenerateSecretInput')], returns: 'GeneratedSecret' },
124
+ {
125
+ name: 'clients.list',
126
+ description: 'List clients',
127
+ parameters: [...LIST_PARAMS],
128
+ returns: 'PaginatedResponse<Client>',
129
+ },
130
+ {
131
+ name: 'clients.get',
132
+ description: 'Get a client by ID',
133
+ parameters: [ID('idOrClientId', 'Client ID or clientId')],
134
+ returns: '{ data: Client, etag: string | null }',
135
+ },
136
+ {
137
+ name: 'clients.create',
138
+ description: 'Create a new client',
139
+ parameters: [OBJ('input', 'CreateClientInput')],
140
+ returns: 'Client',
141
+ },
142
+ {
143
+ name: 'clients.update',
144
+ description: 'Update a client',
145
+ parameters: [
146
+ ID('idOrClientId', 'Client ID'),
147
+ OBJ('input', 'UpdateClientInput'),
148
+ OPT_STR('etag', 'ETag'),
149
+ ],
150
+ returns: 'Client',
151
+ },
152
+ {
153
+ name: 'clients.delete',
154
+ description: 'Permanently delete a client and its credentials',
155
+ parameters: [ID('id', 'Client ID')],
156
+ returns: 'void',
157
+ },
158
+ {
159
+ name: 'clients.generateSecret',
160
+ description: 'Generate a new secret for a client',
161
+ parameters: [ID('clientId', 'Client ID'), OPT_OBJ('input', 'GenerateSecretInput')],
162
+ returns: 'GeneratedSecret',
163
+ },
164
+ {
165
+ name: 'clients.revokeSecret',
166
+ description: 'Permanently delete one client secret',
167
+ parameters: [ID('clientId', 'Client ID'), ID('secretId', 'Secret ID')],
168
+ returns: 'void',
169
+ },
52
170
  // Users
53
- { name: 'users.list', description: 'List users in an organization', parameters: [ID('orgId', 'Organization ID'), ...LIST_PARAMS], returns: 'PaginatedResponse<User>' },
54
- { name: 'users.get', description: 'Get a user by ID', parameters: [ID('orgId', 'Organization ID'), ID('userId', 'User ID')], returns: '{ data: User, etag: string | null }' },
55
- { name: 'users.create', description: 'Create a new user', parameters: [OBJ('input', 'CreateUserInput')], returns: 'User' },
56
- { name: 'users.invite', description: 'Invite a user', parameters: [OBJ('input', 'InviteUserInput')], returns: 'User' },
57
- { name: 'users.invitePreview', description: 'Preview the invitation email without sending', parameters: [OBJ('input', 'InviteUserInput')], returns: 'InvitePreviewResult' },
58
- { name: 'users.suspend', description: 'Suspend a user', parameters: [ID('orgId', 'Organization ID'), ID('userId', 'User ID')], returns: 'void' },
59
- { name: 'users.unsuspend', description: 'Unsuspend a user (suspended → active)', parameters: [ID('orgId', 'Organization ID'), ID('userId', 'User ID')], returns: 'void' },
60
- { name: 'users.deactivate', description: 'Deactivate a user (active → inactive)', parameters: [ID('orgId', 'Organization ID'), ID('userId', 'User ID')], returns: 'void' },
61
- { name: 'users.reactivate', description: 'Reactivate a user (inactive → active)', parameters: [ID('orgId', 'Organization ID'), ID('userId', 'User ID')], returns: 'void' },
62
- { name: 'users.lock', description: 'Lock a user account', parameters: [ID('orgId', 'Organization ID'), ID('userId', 'User ID')], returns: 'void' },
63
- { name: 'users.unlock', description: 'Unlock a user account', parameters: [ID('orgId', 'Organization ID'), ID('userId', 'User ID')], returns: 'void' },
64
- { name: 'users.clearPassword', description: 'Clear a user password (make passwordless)', parameters: [ID('orgId', 'Organization ID'), ID('userId', 'User ID')], returns: 'void' },
65
- { name: 'users.verifyEmail', description: 'Mark a user email as verified', parameters: [ID('orgId', 'Organization ID'), ID('userId', 'User ID')], returns: 'void' },
66
- { name: 'users.exportData', description: 'GDPR data export for a user', parameters: [ID('orgId', 'Organization ID'), ID('userId', 'User ID')], returns: 'UserExportData' },
67
- { name: 'users.purge', description: 'GDPR data purge for a user (irreversible)', parameters: [ID('orgId', 'Organization ID'), ID('userId', 'User ID')], returns: 'UserPurgeResult' },
171
+ {
172
+ name: 'users.list',
173
+ description: 'List users in an organization',
174
+ parameters: [ID('orgId', 'Organization ID'), OPT_OBJ('params', 'UserListParams')],
175
+ returns: 'PaginatedResponse<User>',
176
+ },
177
+ {
178
+ name: 'users.get',
179
+ description: 'Get a user by ID',
180
+ parameters: [ID('orgId', 'Organization ID'), ID('userId', 'User ID')],
181
+ returns: '{ data: User, etag: string | null }',
182
+ },
183
+ {
184
+ name: 'users.create',
185
+ description: 'Create a new user',
186
+ parameters: [OBJ('input', 'CreateUserInput')],
187
+ returns: 'User',
188
+ },
189
+ {
190
+ name: 'users.invite',
191
+ description: 'Invite a user',
192
+ parameters: [OBJ('input', 'InviteUserInput')],
193
+ returns: 'InviteUserResult',
194
+ },
195
+ {
196
+ name: 'users.invitePreview',
197
+ description: 'Preview the invitation email without sending',
198
+ parameters: [OBJ('input', 'InviteUserInput')],
199
+ returns: 'InvitePreviewResult',
200
+ },
201
+ {
202
+ name: 'users.deactivate',
203
+ description: 'Deactivate a user (active → inactive)',
204
+ parameters: [ID('orgId', 'Organization ID'), ID('userId', 'User ID')],
205
+ returns: 'void',
206
+ },
207
+ {
208
+ name: 'users.activate',
209
+ description: 'Activate a user (inactive → active)',
210
+ parameters: [ID('orgId', 'Organization ID'), ID('userId', 'User ID')],
211
+ returns: 'void',
212
+ },
213
+ {
214
+ name: 'users.clearPassword',
215
+ description: 'Clear a user password (make passwordless)',
216
+ parameters: [ID('orgId', 'Organization ID'), ID('userId', 'User ID')],
217
+ returns: 'void',
218
+ },
219
+ {
220
+ name: 'users.verifyEmail',
221
+ description: 'Mark a user email as verified',
222
+ parameters: [ID('orgId', 'Organization ID'), ID('userId', 'User ID')],
223
+ returns: 'void',
224
+ },
225
+ {
226
+ name: 'users.exportData',
227
+ description: 'GDPR data export for a user',
228
+ parameters: [ID('orgId', 'Organization ID'), ID('userId', 'User ID')],
229
+ returns: 'UserExportData',
230
+ },
231
+ {
232
+ name: 'users.delete',
233
+ description: 'Permanently delete a user and owned identity data',
234
+ parameters: [ID('orgId', 'Organization ID'), ID('userId', 'User ID')],
235
+ returns: 'void',
236
+ },
237
+ {
238
+ name: 'users.getHistory',
239
+ description: 'Get user change history',
240
+ parameters: [ID('orgId', 'Organization ID'), ID('userId', 'User ID')],
241
+ returns: 'HistoryResult',
242
+ },
68
243
  // Roles
69
- { name: 'roles.list', description: 'List roles for an application', parameters: [ID('appId', 'Application ID'), ...LIST_PARAMS], returns: 'PaginatedResponse<Role>' },
70
- { name: 'roles.get', description: 'Get a role by ID', parameters: [ID('appId', 'Application ID'), ID('roleId', 'Role ID')], returns: 'Role' },
71
- { name: 'roles.listPermissions', description: 'List permissions assigned to a role', parameters: [ID('appId', 'Application ID'), ID('roleId', 'Role ID')], returns: 'Permission[]' },
72
- { name: 'roles.create', description: 'Create a role', parameters: [ID('appId', 'Application ID'), OBJ('input', 'CreateRoleInput')], returns: 'Role' },
244
+ {
245
+ name: 'roles.list',
246
+ description: 'List roles for an application',
247
+ parameters: [ID('appId', 'Application ID')],
248
+ returns: 'Role[]',
249
+ },
250
+ {
251
+ name: 'roles.get',
252
+ description: 'Get a role by ID',
253
+ parameters: [ID('appId', 'Application ID'), ID('roleId', 'Role ID')],
254
+ returns: 'Role',
255
+ },
256
+ {
257
+ name: 'roles.listPermissions',
258
+ description: 'List permissions assigned to a role',
259
+ parameters: [ID('appId', 'Application ID'), ID('roleId', 'Role ID')],
260
+ returns: 'Permission[]',
261
+ },
262
+ {
263
+ name: 'roles.create',
264
+ description: 'Create a role',
265
+ parameters: [ID('appId', 'Application ID'), OBJ('input', 'CreateRoleInput')],
266
+ returns: 'Role',
267
+ },
268
+ {
269
+ name: 'roles.delete',
270
+ description: 'Permanently delete a role',
271
+ parameters: [ID('appId', 'Application ID'), ID('roleId', 'Role ID')],
272
+ returns: '{ reauthenticationRequired: boolean }',
273
+ },
73
274
  // Permissions
74
- { name: 'permissions.list', description: 'List permissions for an application', parameters: [ID('appId', 'Application ID'), ...LIST_PARAMS], returns: 'PaginatedResponse<Permission>' },
75
- { name: 'permissions.create', description: 'Create a permission', parameters: [ID('appId', 'Application ID'), OBJ('input', 'CreatePermissionInput')], returns: 'Permission' },
275
+ {
276
+ name: 'permissions.list',
277
+ description: 'List permissions for an application',
278
+ parameters: [ID('appId', 'Application ID'), OPT_OBJ('params', '{ moduleId?: string }')],
279
+ returns: 'Permission[]',
280
+ },
281
+ {
282
+ name: 'permissions.create',
283
+ description: 'Create a permission',
284
+ parameters: [ID('appId', 'Application ID'), OBJ('input', 'CreatePermissionInput')],
285
+ returns: 'Permission',
286
+ },
287
+ {
288
+ name: 'permissions.update',
289
+ description: 'Update permission metadata',
290
+ parameters: [
291
+ ID('appId', 'Application ID'),
292
+ ID('permissionId', 'Permission ID'),
293
+ OBJ('input', 'UpdatePermissionInput'),
294
+ ],
295
+ returns: 'Permission',
296
+ },
297
+ {
298
+ name: 'permissions.delete',
299
+ description: 'Permanently delete a permission',
300
+ parameters: [ID('appId', 'Application ID'), ID('permissionId', 'Permission ID')],
301
+ returns: '{ reauthenticationRequired: boolean }',
302
+ },
76
303
  // User Roles
77
- { name: 'userRoles.list', description: 'List role assignments for a user', parameters: [ID('orgId', 'Organization ID'), ID('userId', 'User ID')], returns: 'UserRoleAssignment[]' },
78
- { name: 'userRoles.assign', description: 'Assign a role to a user', parameters: [ID('orgId', 'Organization ID'), ID('userId', 'User ID'), ID('roleId', 'Role ID')], returns: 'void' },
79
- { name: 'userRoles.remove', description: 'Remove a role from a user', parameters: [ID('orgId', 'Organization ID'), ID('userId', 'User ID'), ID('roleId', 'Role ID')], returns: 'void' },
304
+ {
305
+ name: 'userRoles.list',
306
+ description: 'List roles assigned to a user',
307
+ parameters: [ID('orgId', 'Organization ID'), ID('userId', 'User ID')],
308
+ returns: 'Role[]',
309
+ },
310
+ {
311
+ name: 'userRoles.assign',
312
+ description: 'Assign roles to a user',
313
+ parameters: [
314
+ ID('orgId', 'Organization ID'),
315
+ ID('userId', 'User ID'),
316
+ ARRAY('roleIds', 'Role ID array'),
317
+ ],
318
+ returns: 'void',
319
+ },
320
+ {
321
+ name: 'userRoles.remove',
322
+ description: 'Remove roles from a user',
323
+ parameters: [
324
+ ID('orgId', 'Organization ID'),
325
+ ID('userId', 'User ID'),
326
+ ARRAY('roleIds', 'Role ID array'),
327
+ ],
328
+ returns: '{ reauthenticationRequired: boolean }',
329
+ },
80
330
  // Custom Claims
81
- { name: 'customClaims.list', description: 'List claim definitions for an application', parameters: [ID('appId', 'Application ID'), ...LIST_PARAMS], returns: 'PaginatedResponse<ClaimDefinition>' },
82
- { name: 'customClaims.create', description: 'Create a claim definition', parameters: [ID('appId', 'Application ID'), OBJ('input', 'CreateClaimDefinitionInput')], returns: 'ClaimDefinition' },
331
+ {
332
+ name: 'customClaims.list',
333
+ description: 'List claim definitions for an application',
334
+ parameters: [ID('appId', 'Application ID'), ...LIST_PARAMS],
335
+ returns: 'PaginatedResponse<ClaimDefinition>',
336
+ },
337
+ {
338
+ name: 'customClaims.create',
339
+ description: 'Create a claim definition',
340
+ parameters: [ID('appId', 'Application ID'), OBJ('input', 'CreateClaimDefinitionInput')],
341
+ returns: 'ClaimDefinition',
342
+ },
343
+ {
344
+ name: 'customClaims.delete',
345
+ description: 'Permanently delete a claim definition',
346
+ parameters: [ID('appId', 'Application ID'), ID('claimId', 'Claim definition ID')],
347
+ returns: 'void',
348
+ },
83
349
  // Config
84
- { name: 'config.list', description: 'List all system configuration entries', parameters: [], returns: 'ConfigEntry[]' },
85
- { name: 'config.get', description: 'Get a config entry', parameters: [ID('key', 'Configuration key')], returns: 'ConfigEntry' },
86
- { name: 'config.set', description: 'Set a config entry value', parameters: [ID('key', 'Configuration key'), ID('value', 'New value')], returns: 'ConfigEntry' },
350
+ {
351
+ name: 'config.list',
352
+ description: 'List all system configuration entries',
353
+ parameters: [],
354
+ returns: 'ConfigEntry[]',
355
+ },
356
+ {
357
+ name: 'config.get',
358
+ description: 'Get a config entry',
359
+ parameters: [ID('key', 'Configuration key')],
360
+ returns: 'ConfigEntry',
361
+ },
362
+ {
363
+ name: 'config.set',
364
+ description: 'Set a config entry value',
365
+ parameters: [
366
+ ID('key', 'Configuration catalog key'),
367
+ param('value', 'number|string', 'Native integer number or supported locale string'),
368
+ ],
369
+ returns: 'ConfigUpdateResult',
370
+ },
87
371
  // Keys
88
372
  { name: 'keys.list', description: 'List signing keys', parameters: [], returns: 'SigningKey[]' },
89
- { name: 'keys.generate', description: 'Generate a new signing key', parameters: [], returns: 'SigningKey' },
90
- { name: 'keys.rotate', description: 'Rotate signing keys', parameters: [], returns: 'SigningKey' },
373
+ {
374
+ name: 'keys.generate',
375
+ description: 'Generate a new signing key',
376
+ parameters: [],
377
+ returns: 'SigningKey',
378
+ },
379
+ {
380
+ name: 'keys.rotate',
381
+ description: 'Rotate signing keys',
382
+ parameters: [],
383
+ returns: 'SigningKey',
384
+ },
91
385
  // Audit
92
- { name: 'audit.list', description: 'List audit log entries', parameters: [OPT_NUM('limit', 'Max results (default 50, max 500)'), OPT_STR('event', 'Filter by event_type'), OPT_STR('org', 'Filter by organization_id'), OPT_STR('user', 'Filter by user_id'), OPT_STR('since', 'Filter events after ISO 8601 date')], returns: '{ data: AuditEntry[], total: number }' },
386
+ {
387
+ name: 'audit.list',
388
+ description: 'List audit log entries',
389
+ parameters: [
390
+ OPT_NUM('limit', 'Max results (default 50, max 500)'),
391
+ OPT_STR('event', 'Filter by event_type'),
392
+ OPT_STR('org', 'Filter by organization_id'),
393
+ OPT_STR('user', 'Filter by user_id'),
394
+ OPT_STR('since', 'Filter events after ISO 8601 date'),
395
+ ],
396
+ returns: '{ data: AuditEntry[], total: number }',
397
+ },
93
398
  // Stats
94
- { name: 'stats.get', description: 'Get system-wide dashboard statistics', parameters: [], returns: 'DashboardStats' },
95
- { name: 'stats.getOrganizationStats', description: 'Get per-organization dashboard statistics', parameters: [ID('orgId', 'Organization ID')], returns: 'OrgStats' },
399
+ {
400
+ name: 'stats.get',
401
+ description: 'Get system-wide dashboard statistics',
402
+ parameters: [],
403
+ returns: 'DashboardStats',
404
+ },
405
+ {
406
+ name: 'stats.getOrganizationStats',
407
+ description: 'Get per-organization dashboard statistics',
408
+ parameters: [ID('orgId', 'Organization ID')],
409
+ returns: 'OrgStats',
410
+ },
96
411
  // Sessions
97
- { name: 'sessions.list', description: 'List active sessions', parameters: [OPT_NUM('page', 'Page'), OPT_NUM('pageSize', 'Page size'), OPT_STR('userId', 'Filter by user')], returns: 'PaginatedResponse<AdminSession>' },
98
- { name: 'sessions.revoke', description: 'Revoke a session', parameters: [ID('sessionId', 'Session ID')], returns: 'void' },
99
- { name: 'sessions.revokeForUser', description: 'Revoke all sessions for a user', parameters: [ID('userId', 'User ID')], returns: 'RevokeUserSessionsResult' },
412
+ {
413
+ name: 'sessions.list',
414
+ description: 'List active sessions',
415
+ parameters: [
416
+ OPT_NUM('page', 'Page'),
417
+ OPT_NUM('pageSize', 'Page size'),
418
+ OPT_STR('userId', 'Filter by user'),
419
+ ],
420
+ returns: 'PaginatedResponse<AdminSession>',
421
+ },
422
+ {
423
+ name: 'sessions.revoke',
424
+ description: 'Revoke a session',
425
+ parameters: [ID('sessionId', 'Session ID')],
426
+ returns: 'void',
427
+ },
428
+ {
429
+ name: 'sessions.revokeForUser',
430
+ description: 'Revoke all sessions for a user',
431
+ parameters: [ID('userId', 'User ID')],
432
+ returns: 'RevokeUserSessionsResult',
433
+ },
100
434
  // Bulk
101
- { name: 'bulk.organizationStatus', description: 'Bulk status change for organizations', parameters: [OBJ('input', 'BulkOrgStatusInput: { ids, action, reason? }')], returns: 'BulkOperationResult' },
102
- { name: 'bulk.userStatus', description: 'Bulk status change for users', parameters: [OBJ('input', 'BulkUserStatusInput: { ids, action, reason?, organizationId }')], returns: 'BulkOperationResult' },
435
+ {
436
+ name: 'bulk.organizationStatus',
437
+ description: 'Bulk status change for organizations',
438
+ parameters: [OBJ('input', 'BulkOrgStatusInput: { ids, action, reason? }')],
439
+ returns: 'BulkOperationResult',
440
+ },
441
+ {
442
+ name: 'bulk.userStatus',
443
+ description: 'Bulk status change for users',
444
+ parameters: [OBJ('input', 'BulkUserStatusInput: { ids, action, organizationId }')],
445
+ returns: 'BulkOperationResult',
446
+ },
103
447
  // Two-Factor
104
- { name: 'twoFactor.getStatus', description: 'Get 2FA status for a user', parameters: [ID('orgId', 'Organization ID'), ID('userId', 'User ID')], returns: 'TwoFactorStatus' },
105
- { name: 'twoFactor.disable', description: 'Disable 2FA for a user', parameters: [ID('orgId', 'Organization ID'), ID('userId', 'User ID')], returns: 'void' },
106
- { name: 'twoFactor.reset', description: 'Reset 2FA for a user (force re-enrollment)', parameters: [ID('orgId', 'Organization ID'), ID('userId', 'User ID')], returns: 'void' },
107
- { name: 'twoFactor.regenerateRecoveryCodes', description: 'Regenerate a user 2FA recovery codes', parameters: [ID('orgId', 'Organization ID'), ID('userId', 'User ID')], returns: 'RegenerateRecoveryCodesResult' },
108
- { name: 'twoFactor.getPolicy', description: 'Get the org 2FA policy', parameters: [ID('orgId', 'Organization ID')], returns: 'TwoFactorPolicyResult' },
109
- { name: 'twoFactor.setPolicy', description: 'Set the org 2FA policy', parameters: [ID('orgId', 'Organization ID'), ID('policy', '2FA policy (optional|required_email|required_totp|required_any)')], returns: 'TwoFactorPolicyResult' },
110
- { name: 'twoFactor.getSummary', description: 'Get the org 2FA enrollment summary', parameters: [ID('orgId', 'Organization ID')], returns: 'TwoFactorSummary' },
111
- // Imports
112
- { name: 'imports.provision', description: 'Import/provision data declaratively', parameters: [OBJ('manifest', 'ImportManifest')], returns: 'ImportResult' },
448
+ {
449
+ name: 'twoFactor.getStatus',
450
+ description: 'Get 2FA status for a user',
451
+ parameters: [ID('orgId', 'Organization ID'), ID('userId', 'User ID')],
452
+ returns: 'TwoFactorStatus',
453
+ },
454
+ {
455
+ name: 'twoFactor.disable',
456
+ description: 'Disable 2FA for a user',
457
+ parameters: [ID('orgId', 'Organization ID'), ID('userId', 'User ID')],
458
+ returns: 'void',
459
+ },
460
+ {
461
+ name: 'twoFactor.reset',
462
+ description: 'Reset 2FA for a user (force re-enrollment)',
463
+ parameters: [ID('orgId', 'Organization ID'), ID('userId', 'User ID')],
464
+ returns: 'void',
465
+ },
466
+ {
467
+ name: 'twoFactor.regenerateRecoveryCodes',
468
+ description: 'Regenerate a user 2FA recovery codes',
469
+ parameters: [ID('orgId', 'Organization ID'), ID('userId', 'User ID')],
470
+ returns: 'RegenerateRecoveryCodesResult',
471
+ },
472
+ {
473
+ name: 'twoFactor.getPolicy',
474
+ description: 'Get the org 2FA policy',
475
+ parameters: [ID('orgId', 'Organization ID')],
476
+ returns: 'TwoFactorPolicyResult',
477
+ },
478
+ {
479
+ name: 'twoFactor.setPolicy',
480
+ description: 'Set the org 2FA policy',
481
+ parameters: [
482
+ ID('orgId', 'Organization ID'),
483
+ ID('policy', '2FA policy (optional|required_email|required_totp|required_any)'),
484
+ ],
485
+ returns: 'TwoFactorPolicyResult',
486
+ },
487
+ {
488
+ name: 'twoFactor.getSummary',
489
+ description: 'Get the org 2FA enrollment summary',
490
+ parameters: [ID('orgId', 'Organization ID')],
491
+ returns: 'TwoFactorSummary',
492
+ },
493
+ // Portability
494
+ {
495
+ name: 'exports.manifest',
496
+ description: 'Export a selective portability manifest',
497
+ parameters: [OBJ('request', 'ExportManifestRequest')],
498
+ returns: 'ExportManifestResponse',
499
+ },
500
+ {
501
+ name: 'imports.preview',
502
+ description: 'Preview a portability manifest without mutation',
503
+ parameters: [OBJ('manifest', 'PortabilityManifest')],
504
+ returns: 'PortabilityResult',
505
+ },
506
+ {
507
+ name: 'imports.apply',
508
+ description: 'Apply a portability manifest',
509
+ parameters: [
510
+ OBJ('manifest', 'PortabilityManifest'),
511
+ param('mode', 'string', 'Existing-record policy', true, ['keep-existing', 'update-existing']),
512
+ ],
513
+ returns: 'PortabilityResult',
514
+ },
113
515
  ];
114
516
  // ---------------------------------------------------------------------------
115
517
  // Public API
@@ -133,7 +535,10 @@ export async function executeTool(client, toolName, args) {
133
535
  try {
134
536
  const [domain, method] = toolName.split('.');
135
537
  if (!domain || !method) {
136
- return { success: false, error: `Invalid tool name: ${toolName}. Expected format: domain.method` };
538
+ return {
539
+ success: false,
540
+ error: `Invalid tool name: ${toolName}. Expected format: domain.method`,
541
+ };
137
542
  }
138
543
  // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
139
544
  const domainObj = client[domain];
@@ -155,9 +560,8 @@ export async function executeTool(client, toolName, args) {
155
560
  const result = await fn.call(domainObj, ...callArgs);
156
561
  return { success: true, data: result };
157
562
  }
158
- catch (err) {
159
- const message = err instanceof Error ? err.message : String(err);
160
- return { success: false, error: message };
563
+ catch {
564
+ return { success: false, error: SAFE_TOOL_ERROR };
161
565
  }
162
566
  }
163
567
  //# sourceMappingURL=agent.js.map