-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
787c51c
feat(hex): expand API coverage, fix ID trimming, add cursor pagination
waleedlatif1 e1adf54
fix(hex): guard JSON.parse on user-supplied array/object params
waleedlatif1 0b2fbfc
fix(hex): forward empty collection description on update
waleedlatif1 17f59be
fix(hex): close remaining API coverage gaps found via raw OpenAPI spec
waleedlatif1 1d237ee
fix(hex): trim remaining user-suppliable IDs for consistency
waleedlatif1 13a682f
fix(hex): validate parsed JSON is actually an array before iterating
waleedlatif1 d34d447
fix(hex): validate array element types, send explicit ALL trigger filter
waleedlatif1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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.
|
||
|
|
||
| outputs: { | ||
| id: { type: 'string', description: 'Newly created group UUID' }, | ||
| name: { type: 'string', description: 'Group name' }, | ||
| createdAt: { type: 'string', description: 'Creation timestamp' }, | ||
| }, | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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' }, | ||
| }, | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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' }, | ||
| }, | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.