Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 3.8k
feat(hex): expand API coverage, fix ID trimming, add cursor pagination#5372
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
787c51ce1adf540b2fbfc17f59be1d237ee13a682fd34d447File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Uh oh!
There was an error while loading. Please reload this page.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| import type { HexCreateGroupParams, HexCreateGroupResponse } from '@/tools/hex/types' | ||
| import type { ToolConfig } from '@/tools/types' | ||
| export const createGroupTool: ToolConfig<HexCreateGroupParams, HexCreateGroupResponse> = { | ||
| id: 'hex_create_group', | ||
| name: 'Hex Create Group', | ||
| description: 'Create a new group in the Hex workspace, optionally with initial members.', | ||
| version: '1.0.0', | ||
| params: { | ||
| apiKey: { | ||
| type: 'string', | ||
| required: true, | ||
| visibility: 'user-only', | ||
| description: 'Hex API token (Personal or Workspace)', | ||
| }, | ||
| name: { | ||
| type: 'string', | ||
| required: true, | ||
| visibility: 'user-or-llm', | ||
| description: 'Name for the new group', | ||
| }, | ||
| memberUserIds: { | ||
| type: 'json', | ||
| required: false, | ||
| visibility: 'user-or-llm', | ||
| description: | ||
| 'JSON array of user UUIDs to add as initial group members (e.g., ["uuid1", "uuid2"])', | ||
| }, | ||
| }, | ||
| request: { | ||
| url: 'https://app.hex.tech/api/v1/groups', | ||
| method: 'POST', | ||
| headers: (params) => ({ | ||
| Authorization: `Bearer ${params.apiKey}`, | ||
| 'Content-Type': 'application/json', | ||
| }), | ||
| body: (params) => { | ||
| const body: Record<string, unknown> = { name: params.name } | ||
| if (params.memberUserIds) { | ||
| let userIds: unknown | ||
| try { | ||
| userIds = | ||
| typeof params.memberUserIds === 'string' | ||
| ? JSON.parse(params.memberUserIds) | ||
| : params.memberUserIds | ||
| } catch { | ||
| throw new Error('memberUserIds must be a valid JSON array of user UUID strings') | ||
| } | ||
| if (!Array.isArray(userIds) || !userIds.every((id) => typeof id === 'string')) { | ||
| throw new Error('memberUserIds must be a valid JSON array of user UUID strings') | ||
| } | ||
| body.members = { users: userIds.map((id: string) => ({ id: id.trim() })) } | ||
| } | ||
| return body | ||
| }, | ||
| }, | ||
| transformResponse: async (response: Response) => { | ||
| const data = await response.json() | ||
| return { | ||
| success: true, | ||
| output: { | ||
| id: data.id ?? null, | ||
| name: data.name ?? null, | ||
| createdAt: data.createdAt ?? null, | ||
| }, | ||
| } | ||
| }, | ||
waleedlatif1 marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| outputs: { | ||
| id: { type: 'string', description: 'Newly created group UUID' }, | ||
| name: { type: 'string', description: 'Group name' }, | ||
| createdAt: { type: 'string', description: 'Creation timestamp' }, | ||
| }, | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| import type { HexDeactivateUserParams, HexDeactivateUserResponse } from '@/tools/hex/types' | ||
| import type { ToolConfig } from '@/tools/types' | ||
| export const deactivateUserTool: ToolConfig<HexDeactivateUserParams, HexDeactivateUserResponse> = { | ||
| id: 'hex_deactivate_user', | ||
| name: 'Hex Deactivate User', | ||
| description: 'Deactivate a user in the Hex workspace.', | ||
| version: '1.0.0', | ||
| params: { | ||
| apiKey: { | ||
| type: 'string', | ||
| required: true, | ||
| visibility: 'user-only', | ||
| description: 'Hex API token (Personal or Workspace)', | ||
| }, | ||
| userId: { | ||
| type: 'string', | ||
| required: true, | ||
| visibility: 'user-or-llm', | ||
| description: 'The UUID of the user to deactivate', | ||
| }, | ||
| }, | ||
| request: { | ||
| url: (params) => `https://app.hex.tech/api/v1/users/${params.userId.trim()}/deactivate`, | ||
| method: 'POST', | ||
| headers: (params) => ({ | ||
| Authorization: `Bearer ${params.apiKey}`, | ||
| 'Content-Type': 'application/json', | ||
| }), | ||
| }, | ||
| transformResponse: async (response: Response, params) => { | ||
| if (response.status === 204 || response.ok) { | ||
| return { | ||
| success: true, | ||
| output: { | ||
| success: true, | ||
| userId: params?.userId ?? '', | ||
| }, | ||
| } | ||
| } | ||
| const data = await response.json().catch(() => ({})) | ||
| return { | ||
| success: false, | ||
| output: { | ||
| success: false, | ||
| userId: params?.userId ?? '', | ||
| }, | ||
| error: (data as Record<string, string>).message ?? 'Failed to deactivate user', | ||
| } | ||
| }, | ||
| outputs: { | ||
| success: { type: 'boolean', description: 'Whether the user was successfully deactivated' }, | ||
| userId: { type: 'string', description: 'User UUID that was deactivated' }, | ||
| }, | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| import type { HexDeleteGroupParams, HexDeleteGroupResponse } from '@/tools/hex/types' | ||
| import type { ToolConfig } from '@/tools/types' | ||
| export const deleteGroupTool: ToolConfig<HexDeleteGroupParams, HexDeleteGroupResponse> = { | ||
| id: 'hex_delete_group', | ||
| name: 'Hex Delete Group', | ||
| description: 'Delete a group from the Hex workspace.', | ||
| version: '1.0.0', | ||
| params: { | ||
| apiKey: { | ||
| type: 'string', | ||
| required: true, | ||
| visibility: 'user-only', | ||
| description: 'Hex API token (Personal or Workspace)', | ||
| }, | ||
| groupId: { | ||
| type: 'string', | ||
| required: true, | ||
| visibility: 'user-or-llm', | ||
| description: 'The UUID of the group to delete', | ||
| }, | ||
| }, | ||
| request: { | ||
| url: (params) => `https://app.hex.tech/api/v1/groups/${params.groupId.trim()}`, | ||
| method: 'DELETE', | ||
| headers: (params) => ({ | ||
| Authorization: `Bearer ${params.apiKey}`, | ||
| 'Content-Type': 'application/json', | ||
| }), | ||
| }, | ||
| transformResponse: async (response: Response, params) => { | ||
| if (response.status === 204 || response.ok) { | ||
| return { | ||
| success: true, | ||
| output: { | ||
| success: true, | ||
| groupId: params?.groupId ?? '', | ||
| }, | ||
| } | ||
| } | ||
| const data = await response.json().catch(() => ({})) | ||
| return { | ||
| success: false, | ||
| output: { | ||
| success: false, | ||
| groupId: params?.groupId ?? '', | ||
| }, | ||
| error: (data as Record<string, string>).message ?? 'Failed to delete group', | ||
| } | ||
| }, | ||
| outputs: { | ||
| success: { type: 'boolean', description: 'Whether the group was successfully deleted' }, | ||
| groupId: { type: 'string', description: 'Group UUID that was deleted' }, | ||
| }, | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.