From 061d19169d8bdb99f135c9241a77d6974a6b70b9 Mon Sep 17 00:00:00 2001 From: Marc McIntosh Date: Wed, 28 May 2025 19:08:45 +0200 Subject: [PATCH 001/144] wip: use urql outside of react --- refact-agent/gui/generated/documents.ts | 9 +++ refact-agent/gui/generated/graphql/gql.ts | 6 ++ refact-agent/gui/generated/graphql/graphql.ts | 11 ++- refact-agent/gui/package-lock.json | 72 ++++++++++++++--- refact-agent/gui/package.json | 16 ++-- refact-agent/gui/src/hooks/index.ts | 1 + .../gui/src/hooks/useThreadPageSub.ts | 25 ++++++ .../services/graphql/createAppAsyncThunk.ts | 6 ++ .../gui/src/services/graphql/createClient.ts | 79 +++++++++++++++++++ .../gui/src/services/graphql/graphqlThunks.ts | 60 ++++++++++++++ .../gui/src/services/graphql/history.graphql | 19 +++++ refact-agent/gui/urqlProvider.tsx | 3 +- 12 files changed, 285 insertions(+), 22 deletions(-) create mode 100644 refact-agent/gui/src/hooks/useThreadPageSub.ts create mode 100644 refact-agent/gui/src/services/graphql/createAppAsyncThunk.ts create mode 100644 refact-agent/gui/src/services/graphql/createClient.ts create mode 100644 refact-agent/gui/src/services/graphql/graphqlThunks.ts create mode 100644 refact-agent/gui/src/services/graphql/history.graphql diff --git a/refact-agent/gui/generated/documents.ts b/refact-agent/gui/generated/documents.ts index e1bc44c02..a651516f6 100644 --- a/refact-agent/gui/generated/documents.ts +++ b/refact-agent/gui/generated/documents.ts @@ -541,10 +541,19 @@ export type NavTreeWantWorkspacesQueryVariables = Exact<{ [key: string]: never; export type NavTreeWantWorkspacesQuery = { __typename?: 'Query', login: Array<{ __typename?: 'FWorkspace', ws_id: string, ws_owner_fuser_id: string, ws_root_group_id: string, root_group_name: string }> }; +export type ThreadsPageSubsSubscriptionVariables = Exact<{ + located_fgroup_id: Scalars['String']['input']; + limit: Scalars['Int']['input']; +}>; + + +export type ThreadsPageSubsSubscription = { __typename?: 'Subscription', threads_in_group: { __typename?: 'FThreadSubs', news_action: string, news_payload_id: string, news_payload?: { __typename?: 'FThreadOutput', owner_fuser_id: string, owner_shared: boolean, ft_id: string, ft_title: string, ft_error: string, ft_updated_ts: number, ft_locked_by: string, ft_need_assistant: number, ft_need_tool_calls: number, ft_anything_new: boolean, ft_archived_ts: number } | null } }; + export const CreateGroupDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"CreateGroup"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"fgroup_name"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"fgroup_parent_id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"group_create"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"fgroup_name"},"value":{"kind":"Variable","name":{"kind":"Name","value":"fgroup_name"}}},{"kind":"ObjectField","name":{"kind":"Name","value":"fgroup_parent_id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"fgroup_parent_id"}}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"fgroup_id"}},{"kind":"Field","name":{"kind":"Name","value":"fgroup_name"}},{"kind":"Field","name":{"kind":"Name","value":"ws_id"}},{"kind":"Field","name":{"kind":"Name","value":"fgroup_parent_id"}},{"kind":"Field","name":{"kind":"Name","value":"fgroup_created_ts"}}]}}]}}]} as unknown as DocumentNode; export const NavTreeSubsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"subscription","name":{"kind":"Name","value":"NavTreeSubs"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"ws_id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"tree_subscription"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"ws_id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"ws_id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"treeupd_action"}},{"kind":"Field","name":{"kind":"Name","value":"treeupd_id"}},{"kind":"Field","name":{"kind":"Name","value":"treeupd_path"}},{"kind":"Field","name":{"kind":"Name","value":"treeupd_type"}},{"kind":"Field","name":{"kind":"Name","value":"treeupd_title"}}]}}]}}]} as unknown as DocumentNode; export const NavTreeWantWorkspacesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"NavTreeWantWorkspaces"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"login"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"ws_id"}},{"kind":"Field","name":{"kind":"Name","value":"ws_owner_fuser_id"}},{"kind":"Field","name":{"kind":"Name","value":"ws_root_group_id"}},{"kind":"Field","name":{"kind":"Name","value":"root_group_name"}}]}}]}}]} as unknown as DocumentNode; +export const ThreadsPageSubsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"subscription","name":{"kind":"Name","value":"ThreadsPageSubs"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"located_fgroup_id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"limit"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Int"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"threads_in_group"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"located_fgroup_id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"located_fgroup_id"}}},{"kind":"Argument","name":{"kind":"Name","value":"limit"},"value":{"kind":"Variable","name":{"kind":"Name","value":"limit"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"news_action"}},{"kind":"Field","name":{"kind":"Name","value":"news_payload_id"}},{"kind":"Field","name":{"kind":"Name","value":"news_payload"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"owner_fuser_id"}},{"kind":"Field","name":{"kind":"Name","value":"owner_shared"}},{"kind":"Field","name":{"kind":"Name","value":"ft_id"}},{"kind":"Field","name":{"kind":"Name","value":"ft_title"}},{"kind":"Field","name":{"kind":"Name","value":"ft_error"}},{"kind":"Field","name":{"kind":"Name","value":"ft_updated_ts"}},{"kind":"Field","name":{"kind":"Name","value":"ft_locked_by"}},{"kind":"Field","name":{"kind":"Name","value":"ft_need_assistant"}},{"kind":"Field","name":{"kind":"Name","value":"ft_need_tool_calls"}},{"kind":"Field","name":{"kind":"Name","value":"ft_anything_new"}},{"kind":"Field","name":{"kind":"Name","value":"ft_archived_ts"}}]}}]}}]}}]} as unknown as DocumentNode; type Properties = Required<{ [K in keyof T]: z.ZodType; diff --git a/refact-agent/gui/generated/graphql/gql.ts b/refact-agent/gui/generated/graphql/gql.ts index 4b8702625..55cebd0d5 100644 --- a/refact-agent/gui/generated/graphql/gql.ts +++ b/refact-agent/gui/generated/graphql/gql.ts @@ -17,11 +17,13 @@ type Documents = { "mutation CreateGroup($fgroup_name: String!, $fgroup_parent_id: String!) {\n group_create(\n input: {fgroup_name: $fgroup_name, fgroup_parent_id: $fgroup_parent_id}\n ) {\n fgroup_id\n fgroup_name\n ws_id\n fgroup_parent_id\n fgroup_created_ts\n }\n}": typeof types.CreateGroupDocument, "subscription NavTreeSubs($ws_id: String!) {\n tree_subscription(ws_id: $ws_id) {\n treeupd_action\n treeupd_id\n treeupd_path\n treeupd_type\n treeupd_title\n }\n}": typeof types.NavTreeSubsDocument, "query NavTreeWantWorkspaces {\n login {\n ws_id\n ws_owner_fuser_id\n ws_root_group_id\n root_group_name\n }\n}": typeof types.NavTreeWantWorkspacesDocument, + "subscription ThreadsPageSubs($located_fgroup_id: String!, $limit: Int!) {\n threads_in_group(located_fgroup_id: $located_fgroup_id, limit: $limit) {\n news_action\n news_payload_id\n news_payload {\n owner_fuser_id\n owner_shared\n ft_id\n ft_title\n ft_error\n ft_updated_ts\n ft_locked_by\n ft_need_assistant\n ft_need_tool_calls\n ft_anything_new\n ft_archived_ts\n }\n }\n}": typeof types.ThreadsPageSubsDocument, }; const documents: Documents = { "mutation CreateGroup($fgroup_name: String!, $fgroup_parent_id: String!) {\n group_create(\n input: {fgroup_name: $fgroup_name, fgroup_parent_id: $fgroup_parent_id}\n ) {\n fgroup_id\n fgroup_name\n ws_id\n fgroup_parent_id\n fgroup_created_ts\n }\n}": types.CreateGroupDocument, "subscription NavTreeSubs($ws_id: String!) {\n tree_subscription(ws_id: $ws_id) {\n treeupd_action\n treeupd_id\n treeupd_path\n treeupd_type\n treeupd_title\n }\n}": types.NavTreeSubsDocument, "query NavTreeWantWorkspaces {\n login {\n ws_id\n ws_owner_fuser_id\n ws_root_group_id\n root_group_name\n }\n}": types.NavTreeWantWorkspacesDocument, + "subscription ThreadsPageSubs($located_fgroup_id: String!, $limit: Int!) {\n threads_in_group(located_fgroup_id: $located_fgroup_id, limit: $limit) {\n news_action\n news_payload_id\n news_payload {\n owner_fuser_id\n owner_shared\n ft_id\n ft_title\n ft_error\n ft_updated_ts\n ft_locked_by\n ft_need_assistant\n ft_need_tool_calls\n ft_anything_new\n ft_archived_ts\n }\n }\n}": types.ThreadsPageSubsDocument, }; /** @@ -50,6 +52,10 @@ export function graphql(source: "subscription NavTreeSubs($ws_id: String!) {\n * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ export function graphql(source: "query NavTreeWantWorkspaces {\n login {\n ws_id\n ws_owner_fuser_id\n ws_root_group_id\n root_group_name\n }\n}"): (typeof documents)["query NavTreeWantWorkspaces {\n login {\n ws_id\n ws_owner_fuser_id\n ws_root_group_id\n root_group_name\n }\n}"]; +/** + * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ +export function graphql(source: "subscription ThreadsPageSubs($located_fgroup_id: String!, $limit: Int!) {\n threads_in_group(located_fgroup_id: $located_fgroup_id, limit: $limit) {\n news_action\n news_payload_id\n news_payload {\n owner_fuser_id\n owner_shared\n ft_id\n ft_title\n ft_error\n ft_updated_ts\n ft_locked_by\n ft_need_assistant\n ft_need_tool_calls\n ft_anything_new\n ft_archived_ts\n }\n }\n}"): (typeof documents)["subscription ThreadsPageSubs($located_fgroup_id: String!, $limit: Int!) {\n threads_in_group(located_fgroup_id: $located_fgroup_id, limit: $limit) {\n news_action\n news_payload_id\n news_payload {\n owner_fuser_id\n owner_shared\n ft_id\n ft_title\n ft_error\n ft_updated_ts\n ft_locked_by\n ft_need_assistant\n ft_need_tool_calls\n ft_anything_new\n ft_archived_ts\n }\n }\n}"]; export function graphql(source: string) { return (documents as any)[source] ?? {}; diff --git a/refact-agent/gui/generated/graphql/graphql.ts b/refact-agent/gui/generated/graphql/graphql.ts index 94aa38c8a..9d1d8244b 100644 --- a/refact-agent/gui/generated/graphql/graphql.ts +++ b/refact-agent/gui/generated/graphql/graphql.ts @@ -542,7 +542,16 @@ export type NavTreeWantWorkspacesQueryVariables = Exact<{ [key: string]: never; export type NavTreeWantWorkspacesQuery = { __typename?: 'Query', login: Array<{ __typename?: 'FWorkspace', ws_id: string, ws_owner_fuser_id: string, ws_root_group_id: string, root_group_name: string }> }; +export type ThreadsPageSubsSubscriptionVariables = Exact<{ + located_fgroup_id: Scalars['String']['input']; + limit: Scalars['Int']['input']; +}>; + + +export type ThreadsPageSubsSubscription = { __typename?: 'Subscription', threads_in_group: { __typename?: 'FThreadSubs', news_action: string, news_payload_id: string, news_payload?: { __typename?: 'FThreadOutput', owner_fuser_id: string, owner_shared: boolean, ft_id: string, ft_title: string, ft_error: string, ft_updated_ts: number, ft_locked_by: string, ft_need_assistant: number, ft_need_tool_calls: number, ft_anything_new: boolean, ft_archived_ts: number } | null } }; + export const CreateGroupDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"CreateGroup"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"fgroup_name"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"fgroup_parent_id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"group_create"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"fgroup_name"},"value":{"kind":"Variable","name":{"kind":"Name","value":"fgroup_name"}}},{"kind":"ObjectField","name":{"kind":"Name","value":"fgroup_parent_id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"fgroup_parent_id"}}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"fgroup_id"}},{"kind":"Field","name":{"kind":"Name","value":"fgroup_name"}},{"kind":"Field","name":{"kind":"Name","value":"ws_id"}},{"kind":"Field","name":{"kind":"Name","value":"fgroup_parent_id"}},{"kind":"Field","name":{"kind":"Name","value":"fgroup_created_ts"}}]}}]}}]} as unknown as DocumentNode; export const NavTreeSubsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"subscription","name":{"kind":"Name","value":"NavTreeSubs"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"ws_id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"tree_subscription"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"ws_id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"ws_id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"treeupd_action"}},{"kind":"Field","name":{"kind":"Name","value":"treeupd_id"}},{"kind":"Field","name":{"kind":"Name","value":"treeupd_path"}},{"kind":"Field","name":{"kind":"Name","value":"treeupd_type"}},{"kind":"Field","name":{"kind":"Name","value":"treeupd_title"}}]}}]}}]} as unknown as DocumentNode; -export const NavTreeWantWorkspacesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"NavTreeWantWorkspaces"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"login"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"ws_id"}},{"kind":"Field","name":{"kind":"Name","value":"ws_owner_fuser_id"}},{"kind":"Field","name":{"kind":"Name","value":"ws_root_group_id"}},{"kind":"Field","name":{"kind":"Name","value":"root_group_name"}}]}}]}}]} as unknown as DocumentNode; \ No newline at end of file +export const NavTreeWantWorkspacesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"NavTreeWantWorkspaces"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"login"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"ws_id"}},{"kind":"Field","name":{"kind":"Name","value":"ws_owner_fuser_id"}},{"kind":"Field","name":{"kind":"Name","value":"ws_root_group_id"}},{"kind":"Field","name":{"kind":"Name","value":"root_group_name"}}]}}]}}]} as unknown as DocumentNode; +export const ThreadsPageSubsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"subscription","name":{"kind":"Name","value":"ThreadsPageSubs"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"located_fgroup_id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"limit"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Int"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"threads_in_group"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"located_fgroup_id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"located_fgroup_id"}}},{"kind":"Argument","name":{"kind":"Name","value":"limit"},"value":{"kind":"Variable","name":{"kind":"Name","value":"limit"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"news_action"}},{"kind":"Field","name":{"kind":"Name","value":"news_payload_id"}},{"kind":"Field","name":{"kind":"Name","value":"news_payload"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"owner_fuser_id"}},{"kind":"Field","name":{"kind":"Name","value":"owner_shared"}},{"kind":"Field","name":{"kind":"Name","value":"ft_id"}},{"kind":"Field","name":{"kind":"Name","value":"ft_title"}},{"kind":"Field","name":{"kind":"Name","value":"ft_error"}},{"kind":"Field","name":{"kind":"Name","value":"ft_updated_ts"}},{"kind":"Field","name":{"kind":"Name","value":"ft_locked_by"}},{"kind":"Field","name":{"kind":"Name","value":"ft_need_assistant"}},{"kind":"Field","name":{"kind":"Name","value":"ft_need_tool_calls"}},{"kind":"Field","name":{"kind":"Name","value":"ft_anything_new"}},{"kind":"Field","name":{"kind":"Name","value":"ft_archived_ts"}}]}}]}}]}}]} as unknown as DocumentNode; \ No newline at end of file diff --git a/refact-agent/gui/package-lock.json b/refact-agent/gui/package-lock.json index cfbb17007..633a9c088 100644 --- a/refact-agent/gui/package-lock.json +++ b/refact-agent/gui/package-lock.json @@ -10,16 +10,11 @@ "hasInstallScript": true, "license": "BSD-3-Clause", "dependencies": { - "@parcel/watcher": "^2.5.1", "@reduxjs/toolkit": "^2.2.7", "@tanstack/react-table": "^8.20.6", "@types/react": "^18.2.43", "debug": "^4.3.7", - "graphql": "^16.11.0", - "react-arborist": "^3.4.3", - "react-redux": "^9.1.2", - "urql": "^4.2.2", - "zod": "^3.25.20" + "react-redux": "^9.1.2" }, "devDependencies": { "@0no-co/graphqlsp": "^1.12.16", @@ -28,6 +23,7 @@ "@graphql-codegen/schema-ast": "^4.1.0", "@graphql-codegen/typed-document-node": "^5.1.1", "@graphql-codegen/typescript-operations": "^4.6.1", + "@parcel/watcher": "^2.5.1", "@radix-ui/react-accordion": "^1.2.2", "@radix-ui/react-collapsible": "^1.0.3", "@radix-ui/react-icons": "^1.3.0", @@ -56,6 +52,7 @@ "@types/wicg-file-system-access": "^2023.10.4", "@typescript-eslint/eslint-plugin": "^6.14.0", "@typescript-eslint/parser": "^6.14.0", + "@urql/core": "^5.1.1", "@vitejs/plugin-react-swc": "^3.5.0", "@vitest/coverage-v8": "^3.1.3", "@vitest/ui": "^3.1.3", @@ -69,7 +66,9 @@ "eslint-plugin-react-hooks": "^4.6.0", "eslint-plugin-react-refresh": "^0.4.5", "eslint-plugin-storybook": "^0.6.15", + "graphql": "^16.11.0", "graphql-codegen-typescript-validation-schema": "^0.17.1", + "graphql-ws": "^6.0.5", "happy-dom": "^17.4.6", "husky": ">=6", "js-cookie": "^3.0.5", @@ -82,6 +81,7 @@ "patch-package": "^8.0.0", "prettier": "3.1.1", "react": "^18.2.0", + "react-arborist": "^3.4.3", "react-dom": "^18.2.0", "react-dropzone": "^14.2.10", "react-markdown": "^9.0.1", @@ -95,19 +95,22 @@ "textarea-caret": "^3.1.0", "typescript": "^5.8.3", "typescript-plugin-css-modules": "^5.0.2", + "urql": "^4.2.2", "usehooks-ts": "^2.14.0", "uuid": "^9.0.1", "vite": "^5.0.8", "vite-plugin-dts": "^3.7.0", "vite-plugin-eslint": "^1.8.1", "vitest": "^3.1.3", - "vitest-matchmedia-mock": "^1.0.3" + "vitest-matchmedia-mock": "^1.0.3", + "zod": "^3.25.20" } }, "node_modules/@0no-co/graphql.web": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@0no-co/graphql.web/-/graphql.web-1.1.2.tgz", "integrity": "sha512-N2NGsU5FLBhT8NZ+3l2YrzZSHITjNXNuDhC4iDiikv0IujaJ0Xc6xIxQZ/Ek3Cb+rgPjnLHYyJm11tInuJn+cw==", + "dev": true, "license": "MIT", "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0" @@ -2150,6 +2153,7 @@ "version": "7.27.1", "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.27.1.tgz", "integrity": "sha512-1x3D2xEk2fRo3PAhwQwu5UubzgiVWSXTBfWpVd2Mx2AzRqJuDJCsgaDVZ7HB5iGzDW1Hl1sWN2mFyKjmR9uAog==", + "dev": true, "license": "MIT", "engines": { "node": ">=6.9.0" @@ -4846,6 +4850,7 @@ "version": "2.5.1", "resolved": "https://registry.npmjs.org/@parcel/watcher/-/watcher-2.5.1.tgz", "integrity": "sha512-dfUnCxiN9H4ap84DvD2ubjw+3vUNpstxa0TneY/Paat8a3R4uQZDLSvWjmznAY/DoahqTHl9V46HF/Zs3F29pg==", + "dev": true, "hasInstallScript": true, "license": "MIT", "dependencies": { @@ -4884,6 +4889,7 @@ "cpu": [ "arm64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -4904,6 +4910,7 @@ "cpu": [ "arm64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -4924,6 +4931,7 @@ "cpu": [ "x64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -4944,6 +4952,7 @@ "cpu": [ "x64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -4964,6 +4973,7 @@ "cpu": [ "arm" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -4984,6 +4994,7 @@ "cpu": [ "arm" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -5004,6 +5015,7 @@ "cpu": [ "arm64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -5024,6 +5036,7 @@ "cpu": [ "arm64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -5044,6 +5057,7 @@ "cpu": [ "x64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -5064,6 +5078,7 @@ "cpu": [ "x64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -5084,6 +5099,7 @@ "cpu": [ "arm64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -5104,6 +5120,7 @@ "cpu": [ "ia32" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -5124,6 +5141,7 @@ "cpu": [ "x64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -5141,6 +5159,7 @@ "version": "1.0.3", "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz", "integrity": "sha512-pGjwhsmsp4kL2RTz08wcOlGN83otlqHeD/Z5T8GXZB+/YcpQ/dgo+lbU8ZsGxV0HIvqqxo9l7mqYwyYMD9bKDg==", + "dev": true, "license": "Apache-2.0", "bin": { "detect-libc": "bin/detect-libc.js" @@ -7647,18 +7666,21 @@ "version": "4.0.1", "resolved": "https://registry.npmjs.org/@react-dnd/asap/-/asap-4.0.1.tgz", "integrity": "sha512-kLy0PJDDwvwwTXxqTFNAAllPHD73AycE9ypWeln/IguoGBEbvFcPDbCV03G52bEcC5E+YgupBE0VzHGdC8SIXg==", + "dev": true, "license": "MIT" }, "node_modules/@react-dnd/invariant": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/@react-dnd/invariant/-/invariant-2.0.0.tgz", "integrity": "sha512-xL4RCQBCBDJ+GRwKTFhGUW8GXa4yoDfJrPbLblc3U09ciS+9ZJXJ3Qrcs/x2IODOdIE5kQxvMmE2UKyqUictUw==", + "dev": true, "license": "MIT" }, "node_modules/@react-dnd/shallowequal": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/@react-dnd/shallowequal/-/shallowequal-2.0.0.tgz", "integrity": "sha512-Pc/AFTdwZwEKJxFJvlxrSmGe/di+aAOBn60sremrpLo6VI/6cmiUYNNwlI5KNYttg7uypzA3ILPMPgxB2GYZEg==", + "dev": true, "license": "MIT" }, "node_modules/@reduxjs/toolkit": { @@ -11030,7 +11052,7 @@ "version": "3.3.5", "resolved": "https://registry.npmjs.org/@types/hoist-non-react-statics/-/hoist-non-react-statics-3.3.5.tgz", "integrity": "sha512-SbcrWzkKBw2cdwRTwQAswfpB9g9LJWfjtUeW/jvNwbhC8cpmmNYVePa+ncbUe0rGTQ7G3Ff6mYUN2VMfLVr+Sg==", - "devOptional": true, + "dev": true, "dependencies": { "@types/react": "*", "hoist-non-react-statics": "^3.3.0" @@ -11158,7 +11180,7 @@ "version": "20.14.13", "resolved": "https://registry.npmjs.org/@types/node/-/node-20.14.13.tgz", "integrity": "sha512-+bHoGiZb8UiQ0+WEtmph2IWQCjIqg8MDZMAV+ppRRhUZnquF5mQkP/9vpSwJClEiSM/C7fZZExPzfU0vJTyp8w==", - "devOptional": true, + "dev": true, "dependencies": { "undici-types": "~5.26.4" } @@ -11671,6 +11693,7 @@ "version": "5.1.1", "resolved": "https://registry.npmjs.org/@urql/core/-/core-5.1.1.tgz", "integrity": "sha512-aGh024z5v2oINGD/In6rAtVKTm4VmQ2TxKQBAtk2ZSME5dunZFcjltw4p5ENQg+5CBhZ3FHMzl0Oa+rwqiWqlg==", + "dev": true, "license": "MIT", "dependencies": { "@0no-co/graphql.web": "^1.0.5", @@ -12889,6 +12912,7 @@ "version": "3.0.3", "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "dev": true, "dependencies": { "fill-range": "^7.1.1" }, @@ -14490,6 +14514,7 @@ "version": "14.0.1", "resolved": "https://registry.npmjs.org/dnd-core/-/dnd-core-14.0.1.tgz", "integrity": "sha512-+PVS2VPTgKFPYWo3vAFEA8WPbTf7/xo43TifH9G8S1KqnrQu0o77A3unrF5yOugy4mIz7K5wAVFHUcha7wsz6A==", + "dev": true, "license": "MIT", "dependencies": { "@react-dnd/asap": "^4.0.0", @@ -14501,6 +14526,7 @@ "version": "4.2.1", "resolved": "https://registry.npmjs.org/redux/-/redux-4.2.1.tgz", "integrity": "sha512-LAUYz4lc+Do8/g7aeRa8JkyDErK6ekstQaqWQrNRW//MY1TvCEpMtpTWvlQ+FPbWCx+Xixu/6SHt5N0HR+SB4w==", + "dev": true, "license": "MIT", "dependencies": { "@babel/runtime": "^7.9.2" @@ -15731,7 +15757,8 @@ "node_modules/fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", - "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true }, "node_modules/fast-glob": { "version": "3.3.2", @@ -15980,6 +16007,7 @@ "version": "7.1.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "dev": true, "dependencies": { "to-regex-range": "^5.0.1" }, @@ -16674,6 +16702,7 @@ "version": "16.11.0", "resolved": "https://registry.npmjs.org/graphql/-/graphql-16.11.0.tgz", "integrity": "sha512-mS1lbMsxgQj6hge1XZ6p7GPhbrtFwUFYi3wRzXAC/FmYnyXMTvvI3td3rjmQ2u8ewXueaSvRPWaEcgVVOT9Jnw==", + "dev": true, "license": "MIT", "engines": { "node": "^12.22.0 || ^14.16.0 || ^16.0.0 || >=17.0.0" @@ -17326,6 +17355,7 @@ "version": "3.3.2", "resolved": "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz", "integrity": "sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw==", + "dev": true, "dependencies": { "react-is": "^16.7.0" } @@ -17333,7 +17363,8 @@ "node_modules/hoist-non-react-statics/node_modules/react-is": { "version": "16.13.1", "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", - "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==" + "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==", + "dev": true }, "node_modules/hosted-git-info": { "version": "2.8.9", @@ -18016,6 +18047,7 @@ "version": "2.1.1", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, "engines": { "node": ">=0.10.0" } @@ -18063,6 +18095,7 @@ "version": "4.0.3", "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, "dependencies": { "is-extglob": "^2.1.1" }, @@ -18155,6 +18188,7 @@ "version": "7.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, "engines": { "node": ">=0.12.0" } @@ -20431,6 +20465,7 @@ "version": "5.2.1", "resolved": "https://registry.npmjs.org/memoize-one/-/memoize-one-5.2.1.tgz", "integrity": "sha512-zYiwtZUcYyXKo/np96AGZAckk+FWWsUdJ3cHGGmld7+AhvcWmQyGCYUh1hc4Q/pkOhb65dQR/pqCyK0cOaHz4Q==", + "dev": true, "license": "MIT" }, "node_modules/memoizerific": { @@ -21076,6 +21111,7 @@ "version": "4.0.5", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", + "dev": true, "dependencies": { "braces": "^3.0.2", "picomatch": "^2.3.1" @@ -21481,7 +21517,8 @@ "node_modules/node-addon-api": { "version": "7.1.1", "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-7.1.1.tgz", - "integrity": "sha512-5m3bsyrjFWE1xf7nz7YXdN4udnVtXK6/Yfgn5qnahL6bCkf2yKt4k3nuTKAtT4r3IG8JNR2ncsIMdZuAzJjHQQ==" + "integrity": "sha512-5m3bsyrjFWE1xf7nz7YXdN4udnVtXK6/Yfgn5qnahL6bCkf2yKt4k3nuTKAtT4r3IG8JNR2ncsIMdZuAzJjHQQ==", + "dev": true }, "node_modules/node-dir": { "version": "0.1.17", @@ -22512,6 +22549,7 @@ "version": "2.3.1", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, "engines": { "node": ">=8.6" }, @@ -23203,6 +23241,7 @@ "version": "3.4.3", "resolved": "https://registry.npmjs.org/react-arborist/-/react-arborist-3.4.3.tgz", "integrity": "sha512-yFnq1nIQhT2uJY4TZVz2tgAiBb9lxSyvF4vC3S8POCK8xLzjGIxVv3/4dmYquQJ7AHxaZZArRGHiHKsEewKdTQ==", + "dev": true, "license": "MIT", "dependencies": { "react-dnd": "^14.0.3", @@ -23245,6 +23284,7 @@ "version": "14.0.5", "resolved": "https://registry.npmjs.org/react-dnd/-/react-dnd-14.0.5.tgz", "integrity": "sha512-9i1jSgbyVw0ELlEVt/NkCUkxy1hmhJOkePoCH713u75vzHGyXhPDm28oLfc2NMSBjZRM1Y+wRjHXJT3sPrTy+A==", + "dev": true, "license": "MIT", "dependencies": { "@react-dnd/invariant": "^2.0.0", @@ -23275,6 +23315,7 @@ "version": "14.1.0", "resolved": "https://registry.npmjs.org/react-dnd-html5-backend/-/react-dnd-html5-backend-14.1.0.tgz", "integrity": "sha512-6ONeqEC3XKVf4eVmMTe0oPds+c5B9Foyj8p/ZKLb7kL2qh9COYxiBHv3szd6gztqi/efkmriywLUVlPotqoJyw==", + "dev": true, "license": "MIT", "dependencies": { "dnd-core": "14.0.1" @@ -23575,6 +23616,7 @@ "version": "1.8.11", "resolved": "https://registry.npmjs.org/react-window/-/react-window-1.8.11.tgz", "integrity": "sha512-+SRbUVT2scadgFSWx+R1P754xHPEqvcfSfVX10QYg6POOz+WNgkN48pS+BtZNIMGiL1HYrSEiCkwsMS15QogEQ==", + "dev": true, "license": "MIT", "dependencies": { "@babel/runtime": "^7.0.0", @@ -25862,6 +25904,7 @@ "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, "dependencies": { "is-number": "^7.0.0" }, @@ -26265,7 +26308,7 @@ "version": "5.26.5", "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", - "devOptional": true + "dev": true }, "node_modules/unicode-canonical-property-names-ecmascript": { "version": "2.0.0", @@ -26675,6 +26718,7 @@ "version": "4.2.2", "resolved": "https://registry.npmjs.org/urql/-/urql-4.2.2.tgz", "integrity": "sha512-3GgqNa6iF7bC4hY/ImJKN4REQILcSU9VKcKL8gfELZM8mM5BnLH1BsCc8kBdnVGD1LIFOs4W3O2idNHhON1r0w==", + "dev": true, "license": "MIT", "dependencies": { "@urql/core": "^5.1.1", @@ -28369,6 +28413,7 @@ "version": "6.3.5", "resolved": "https://registry.npmjs.org/wonka/-/wonka-6.3.5.tgz", "integrity": "sha512-SSil+ecw6B4/Dm7Pf2sAshKQ5hWFvfyGlfPbEd6A14dOH6VDjrmbY86u6nZvy9omGwwIPFR8V41+of1EezgoUw==", + "dev": true, "license": "MIT" }, "node_modules/wordwrap": { @@ -28703,6 +28748,7 @@ "version": "3.25.20", "resolved": "https://registry.npmjs.org/zod/-/zod-3.25.20.tgz", "integrity": "sha512-z03fqpTMDF1G02VLKUMt6vyACE7rNWkh3gpXVHgPTw28NPtDFRGvcpTtPwn2kMKtQ0idtYJUTxchytmnqYswcw==", + "dev": true, "license": "MIT", "funding": { "url": "https://github.com/sponsors/colinhacks" diff --git a/refact-agent/gui/package.json b/refact-agent/gui/package.json index f1e387b0a..9c1f46a24 100644 --- a/refact-agent/gui/package.json +++ b/refact-agent/gui/package.json @@ -51,16 +51,11 @@ "generate:graphql:watch": "graphql-codegen --watch" }, "dependencies": { - "@parcel/watcher": "^2.5.1", "@reduxjs/toolkit": "^2.2.7", "@tanstack/react-table": "^8.20.6", "@types/react": "^18.2.43", "debug": "^4.3.7", - "graphql": "^16.11.0", - "react-arborist": "^3.4.3", - "react-redux": "^9.1.2", - "urql": "^4.2.2", - "zod": "^3.25.20" + "react-redux": "^9.1.2" }, "devDependencies": { "@0no-co/graphqlsp": "^1.12.16", @@ -69,6 +64,7 @@ "@graphql-codegen/schema-ast": "^4.1.0", "@graphql-codegen/typed-document-node": "^5.1.1", "@graphql-codegen/typescript-operations": "^4.6.1", + "@parcel/watcher": "^2.5.1", "@radix-ui/react-accordion": "^1.2.2", "@radix-ui/react-collapsible": "^1.0.3", "@radix-ui/react-icons": "^1.3.0", @@ -97,6 +93,7 @@ "@types/wicg-file-system-access": "^2023.10.4", "@typescript-eslint/eslint-plugin": "^6.14.0", "@typescript-eslint/parser": "^6.14.0", + "@urql/core": "^5.1.1", "@vitejs/plugin-react-swc": "^3.5.0", "@vitest/coverage-v8": "^3.1.3", "@vitest/ui": "^3.1.3", @@ -110,7 +107,9 @@ "eslint-plugin-react-hooks": "^4.6.0", "eslint-plugin-react-refresh": "^0.4.5", "eslint-plugin-storybook": "^0.6.15", + "graphql": "^16.11.0", "graphql-codegen-typescript-validation-schema": "^0.17.1", + "graphql-ws": "^6.0.5", "happy-dom": "^17.4.6", "husky": ">=6", "js-cookie": "^3.0.5", @@ -123,6 +122,7 @@ "patch-package": "^8.0.0", "prettier": "3.1.1", "react": "^18.2.0", + "react-arborist": "^3.4.3", "react-dom": "^18.2.0", "react-dropzone": "^14.2.10", "react-markdown": "^9.0.1", @@ -137,12 +137,14 @@ "typescript": "^5.8.3", "typescript-plugin-css-modules": "^5.0.2", "usehooks-ts": "^2.14.0", + "urql": "^4.2.2", "uuid": "^9.0.1", "vite": "^5.0.8", "vite-plugin-dts": "^3.7.0", "vite-plugin-eslint": "^1.8.1", "vitest": "^3.1.3", - "vitest-matchmedia-mock": "^1.0.3" + "vitest-matchmedia-mock": "^1.0.3", + "zod": "^3.25.20" }, "lint-staged": { "*.{ts,tsx}": [ diff --git a/refact-agent/gui/src/hooks/index.ts b/refact-agent/gui/src/hooks/index.ts index 025c865ce..2da0702b6 100644 --- a/refact-agent/gui/src/hooks/index.ts +++ b/refact-agent/gui/src/hooks/index.ts @@ -38,3 +38,4 @@ export * from "./useCompressionStop"; export * from "./useEventBusForApp"; export * from "./useTotalCostForChat"; export * from "./useCheckpoints"; +export * from "./useThreadPageSub"; diff --git a/refact-agent/gui/src/hooks/useThreadPageSub.ts b/refact-agent/gui/src/hooks/useThreadPageSub.ts new file mode 100644 index 000000000..9ee988bda --- /dev/null +++ b/refact-agent/gui/src/hooks/useThreadPageSub.ts @@ -0,0 +1,25 @@ +import { useEffect } from "react"; +import { useAppDispatch } from "./useAppDispatch"; +import { useAppSelector } from "./useAppSelector"; +import { threadsPageSub } from "../services/graphql/graphqlThunks"; +import { selectActiveGroup } from "../features/Teams/teamsSlice"; + +export function useThreadPageSub() { + const dispatch = useAppDispatch(); + + const activeProject = useAppSelector(selectActiveGroup); + + useEffect(() => { + if (activeProject === null) return; + const thunk = dispatch( + threadsPageSub({ + located_fgroup_id: activeProject.id, + limit: 10, + }), + ); + + return () => { + thunk.abort("unmounted"); + }; + }, [activeProject, dispatch]); +} diff --git a/refact-agent/gui/src/services/graphql/createAppAsyncThunk.ts b/refact-agent/gui/src/services/graphql/createAppAsyncThunk.ts new file mode 100644 index 000000000..47cded8ab --- /dev/null +++ b/refact-agent/gui/src/services/graphql/createAppAsyncThunk.ts @@ -0,0 +1,6 @@ +import { createAsyncThunk } from "@reduxjs/toolkit"; +import { AppDispatch, RootState } from "../../app/store"; +export const createAppAsyncThunk = createAsyncThunk.withTypes<{ + state: RootState; + dispatch: AppDispatch; +}>(); diff --git a/refact-agent/gui/src/services/graphql/createClient.ts b/refact-agent/gui/src/services/graphql/createClient.ts new file mode 100644 index 000000000..cd1889936 --- /dev/null +++ b/refact-agent/gui/src/services/graphql/createClient.ts @@ -0,0 +1,79 @@ +import { + createClient, + debugExchange, + cacheExchange, + fetchExchange, + subscriptionExchange, +} from "@urql/core"; +import { createClient as createWSClient } from "graphql-ws"; +import { query } from "happy-dom/lib/PropertySymbol.js"; +import { WebSocket } from "ws"; +export { type Client } from "@urql/core"; + +const THREE_MINUTES = 3 * 60 * 1000; + +export const createGraphqlClient = (apiKey: string, signal: AbortSignal) => { + // const apiKey = "sk_alice_123456"; + // const baseUrl = "localhost:8008/v1/graphql"; + console.log("creating client"); + const baseUrl = "test-teams-v1.smallcloud.ai/v1/graphql"; + + // TODO: should be secure by default + const protocol = window.location.protocol === "https:" ? "https" : "http"; + const wsProtocol = window.location.protocol === "https:" ? "wss" : "ws"; + + const wsClient = createWSClient({ + url: `${wsProtocol}://${baseUrl}`, + connectionParams: { apikey: apiKey }, + webSocketImpl: WebSocket, + retryAttempts: 5, + }); + + signal.addEventListener("abort", () => { + console.log("aborting wsClient"); + void wsClient.dispose(); + }); + + const urqlClient = createClient({ + url: `${protocol}://${baseUrl}`, + exchanges: [ + // TODO: only enable this during development + debugExchange, + // cacheExchange, + subscriptionExchange({ + forwardSubscription: (operation) => ({ + subscribe: (sink) => { + const payload = { ...operation, query: operation.query ?? "" }; + const dispose = wsClient.subscribe(payload, sink); + return { unsubscribe: dispose }; + }, + // subscribe: (sink) => ({ + // unsubscribe: wsClient.subscribe( + // { + // ...operation, + // query: + // typeof operation.query === "string" + // ? operation.query + // : (() => { + // throw new Error( + // "Subscription operation.query in undefined", + // ); + // })(), + // }, + // sink, + // ), + // }), + }), + }), + fetchExchange, + ], + fetchOptions: () => ({ + signal: signal, + headers: { + Authorization: `Bearer ${apiKey}`, + }, + }), + }); + + return urqlClient; +}; diff --git a/refact-agent/gui/src/services/graphql/graphqlThunks.ts b/refact-agent/gui/src/services/graphql/graphqlThunks.ts new file mode 100644 index 000000000..726464fb2 --- /dev/null +++ b/refact-agent/gui/src/services/graphql/graphqlThunks.ts @@ -0,0 +1,60 @@ +import { createGraphqlClient } from "./createClient"; +import { createAppAsyncThunk } from "./createAppAsyncThunk"; + +import { + ThreadsPageSubsDocument, + ThreadsPageSubsSubscription, + ThreadsPageSubsSubscriptionVariables, +} from "../../../generated/documents"; + +const THREE_MINUTES = 3 * 60 * 1000; +export const threadsPageSub = createAppAsyncThunk< + unknown, + ThreadsPageSubsSubscriptionVariables +>("graphql/threadsPageSub", (args, thunkAPI) => { + const state = thunkAPI.getState(); + const apiKey = state.config.apiKey ?? ""; + + // TODO: make this reusable in other subscriptions + const client = createGraphqlClient(apiKey, thunkAPI.signal); + const query = client.subscription< + ThreadsPageSubsSubscription, + ThreadsPageSubsSubscriptionVariables + >(ThreadsPageSubsDocument, args); + + const handleResult: Parameters[0] = (result) => { + console.log(result); + if (result.data) { + // ...update history slice + } else if (result.error) { + // ... handle error + } + }; + + let subscription = query.subscribe(handleResult); + + let paused = false; + let timeout: number | null | NodeJS.Timeout = null; + + function maybeClearTimeout() { + if (timeout !== null) { + clearTimeout(timeout); + timeout = null; + } + } + + const handleVisibilityChange = () => { + if (document.hidden && !paused) { + maybeClearTimeout(); + timeout = setTimeout(() => { + paused = true; + subscription.unsubscribe(); + }, THREE_MINUTES); + } else if (!document.hidden && paused) { + paused = false; + maybeClearTimeout(); + subscription = query.subscribe(handleResult); + } + }; + document.addEventListener("visibilitychange", handleVisibilityChange); +}); diff --git a/refact-agent/gui/src/services/graphql/history.graphql b/refact-agent/gui/src/services/graphql/history.graphql new file mode 100644 index 000000000..23a595269 --- /dev/null +++ b/refact-agent/gui/src/services/graphql/history.graphql @@ -0,0 +1,19 @@ +subscription ThreadsPageSubs($located_fgroup_id: String!, $limit: Int!) { + threads_in_group(located_fgroup_id: $located_fgroup_id, limit: $limit) { + news_action + news_payload_id + news_payload { + owner_fuser_id + owner_shared + ft_id + ft_title + ft_error + ft_updated_ts + ft_locked_by + ft_need_assistant + ft_need_tool_calls + ft_anything_new + ft_archived_ts + } + } +} diff --git a/refact-agent/gui/urqlProvider.tsx b/refact-agent/gui/urqlProvider.tsx index 0456bebe9..354cb9f51 100644 --- a/refact-agent/gui/urqlProvider.tsx +++ b/refact-agent/gui/urqlProvider.tsx @@ -37,7 +37,8 @@ export const UrqlProvider: React.FC<{ children: React.ReactNode }> = ({ createClient({ url: `${protocol}://${baseUrl}`, exchanges: [ - debugExchange, + // TODO: only enable this during development + // debugExchange, cacheExchange, subscriptionExchange({ forwardSubscription: (operation) => ({ From f17dd021a979aa1f56b5018631d3472156b8f308 Mon Sep 17 00:00:00 2001 From: Marc McIntosh Date: Thu, 29 May 2025 13:51:58 +0200 Subject: [PATCH 002/144] wio: getting the thread data from local server --- .../gui/src/components/Sidebar/Sidebar.tsx | 4 ++++ .../gui/src/services/graphql/createClient.ts | 14 +++++++------- refact-agent/gui/urqlProvider.tsx | 10 ++++++---- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/refact-agent/gui/src/components/Sidebar/Sidebar.tsx b/refact-agent/gui/src/components/Sidebar/Sidebar.tsx index 7e0149634..28bb08aa1 100644 --- a/refact-agent/gui/src/components/Sidebar/Sidebar.tsx +++ b/refact-agent/gui/src/components/Sidebar/Sidebar.tsx @@ -16,6 +16,7 @@ import { getErrorMessage, clearError } from "../../features/Errors/errorsSlice"; import classNames from "classnames"; import { selectHost } from "../../features/Config/configSlice"; import styles from "./Sidebar.module.css"; +import { useThreadPageSub } from "../../hooks"; export type SidebarProps = { takingNotes: boolean; @@ -36,6 +37,9 @@ export const Sidebar: React.FC = ({ takingNotes, style }) => { const globalError = useAppSelector(getErrorMessage); const maybeSelectedTeamsGroup = useAppSelector(selectActiveGroup); const currentHost = useAppSelector(selectHost); + + // TODO: checking graphql works; + useThreadPageSub(); const history = useAppSelector((app) => app.history, { // TODO: selector issue here devModeChecks: { stabilityCheck: "never" }, diff --git a/refact-agent/gui/src/services/graphql/createClient.ts b/refact-agent/gui/src/services/graphql/createClient.ts index cd1889936..6da44b7bf 100644 --- a/refact-agent/gui/src/services/graphql/createClient.ts +++ b/refact-agent/gui/src/services/graphql/createClient.ts @@ -12,11 +12,11 @@ export { type Client } from "@urql/core"; const THREE_MINUTES = 3 * 60 * 1000; -export const createGraphqlClient = (apiKey: string, signal: AbortSignal) => { - // const apiKey = "sk_alice_123456"; - // const baseUrl = "localhost:8008/v1/graphql"; - console.log("creating client"); - const baseUrl = "test-teams-v1.smallcloud.ai/v1/graphql"; +export const createGraphqlClient = (_apiKey: string, signal: AbortSignal) => { + const apiKey = "sk_alice_123456"; + const baseUrl = "localhost:8008/v1/graphql"; + // console.log("creating client"); + // const baseUrl = "test-teams-v1.smallcloud.ai/v1/graphql"; // TODO: should be secure by default const protocol = window.location.protocol === "https:" ? "https" : "http"; @@ -30,7 +30,7 @@ export const createGraphqlClient = (apiKey: string, signal: AbortSignal) => { }); signal.addEventListener("abort", () => { - console.log("aborting wsClient"); + // console.log("aborting wsClient"); void wsClient.dispose(); }); @@ -38,7 +38,7 @@ export const createGraphqlClient = (apiKey: string, signal: AbortSignal) => { url: `${protocol}://${baseUrl}`, exchanges: [ // TODO: only enable this during development - debugExchange, + // debugExchange, // cacheExchange, subscriptionExchange({ forwardSubscription: (operation) => ({ diff --git a/refact-agent/gui/urqlProvider.tsx b/refact-agent/gui/urqlProvider.tsx index 354cb9f51..38e4e749f 100644 --- a/refact-agent/gui/urqlProvider.tsx +++ b/refact-agent/gui/urqlProvider.tsx @@ -15,11 +15,13 @@ import { selectConfig } from "./src/features/Config/configSlice"; export const UrqlProvider: React.FC<{ children: React.ReactNode }> = ({ children, }) => { - const apiKey = useAppSelector(selectConfig).apiKey; - const baseUrl = "test-teams-v1.smallcloud.ai/v1/graphql"; + // const apiKey = useAppSelector(selectConfig).apiKey; + // const baseUrl = "test-teams-v1.smallcloud.ai/v1/graphql"; + const baseUrl = "localhost:8008/v1/graphql"; + const apiKey = "sk_alice_123456"; - const protocol = "https"; - const wsProtocol = "wss"; + const protocol = "http"; + const wsProtocol = "ws"; const wsClient = useMemo( () => From 2fbde86e01f7cb6bb24567c3640f3542389c1083 Mon Sep 17 00:00:00 2001 From: Marc McIntosh Date: Fri, 30 May 2025 17:31:06 +0200 Subject: [PATCH 003/144] wip: render threads.. --- refact-agent/gui/generated/documents.ts | 80 +++++-- refact-agent/gui/generated/graphql/gql.ts | 12 +- refact-agent/gui/generated/graphql/graphql.ts | 61 ++++-- refact-agent/gui/generated/schema.graphql | 47 +++- refact-agent/gui/src/app/store.ts | 2 + .../gui/src/components/Buttons/CardButton.tsx | 22 ++ .../gui/src/components/Buttons/index.tsx | 1 + .../GroupTree/NavTreeWantWorkspaces.graphql | 13 +- .../gui/src/components/Sidebar/Sidebar.tsx | 12 +- .../src/features/ThreadList/ThreadList.tsx | 205 ++++++++++++++++++ .../gui/src/features/ThreadList/index.ts | 1 + .../features/ThreadList/threadListSlice.ts | 102 +++++++++ .../gui/src/services/graphql/graphqlThunks.ts | 12 +- .../gui/src/services/graphql/history.graphql | 4 + 14 files changed, 510 insertions(+), 64 deletions(-) create mode 100644 refact-agent/gui/src/components/Buttons/CardButton.tsx create mode 100644 refact-agent/gui/src/features/ThreadList/ThreadList.tsx create mode 100644 refact-agent/gui/src/features/ThreadList/index.ts create mode 100644 refact-agent/gui/src/features/ThreadList/threadListSlice.ts diff --git a/refact-agent/gui/generated/documents.ts b/refact-agent/gui/generated/documents.ts index a651516f6..bf42dfa23 100644 --- a/refact-agent/gui/generated/documents.ts +++ b/refact-agent/gui/generated/documents.ts @@ -17,6 +17,12 @@ export type Scalars = { JSON: { input: any; output: any; } }; +export type BasicStuffResult = { + __typename?: 'BasicStuffResult'; + fuser_id: Scalars['String']['output']; + workspaces: Array; +}; + export type FExpertInput = { fexp_allow_tools: Scalars['String']['input']; fexp_block_tools: Scalars['String']['input']; @@ -26,7 +32,7 @@ export type FExpertInput = { fexp_ver_major: Scalars['Int']['input']; fexp_ver_minor: Scalars['Int']['input']; located_fgroup_id: Scalars['String']['input']; - owner_fuser_id: Scalars['String']['input']; + owner_fuser_id?: InputMaybe; owner_shared: Scalars['Boolean']['input']; }; @@ -40,7 +46,7 @@ export type FExpertOutput = { fexp_ver_major: Scalars['Int']['output']; fexp_ver_minor: Scalars['Int']['output']; located_fgroup_id: Scalars['String']['output']; - owner_fuser_id: Scalars['String']['output']; + owner_fuser_id?: Maybe; owner_shared: Scalars['Boolean']['output']; }; @@ -58,7 +64,7 @@ export type FExpertSubs = { }; export type FExternalDataSourceInput = { - eds_json: Scalars['JSON']['input']; + eds_json: Scalars['String']['input']; eds_name: Scalars['String']['input']; eds_type: Scalars['String']['input']; located_fgroup_id: Scalars['String']['input']; @@ -80,7 +86,7 @@ export type FExternalDataSourceOutput = { }; export type FExternalDataSourcePatch = { - eds_json?: InputMaybe; + eds_json: Scalars['String']['input']; eds_last_successful_scan_ts?: InputMaybe; eds_name?: InputMaybe; eds_scan_status?: InputMaybe; @@ -97,6 +103,7 @@ export type FExternalDataSourceSubs = { }; export type FKnowledgeItemInput = { + iknow_is_core?: Scalars['Boolean']['input']; iknow_memory: Scalars['String']['input']; iknow_tags?: Array; located_fgroup_id: Scalars['String']['input']; @@ -107,6 +114,7 @@ export type FKnowledgeItemOutput = { __typename?: 'FKnowledgeItemOutput'; iknow_created_ts: Scalars['Float']['output']; iknow_id: Scalars['String']['output']; + iknow_is_core: Scalars['Boolean']['output']; iknow_memory: Scalars['String']['output']; iknow_modified_ts: Scalars['Float']['output']; iknow_stat_correct: Scalars['Int']['output']; @@ -119,6 +127,7 @@ export type FKnowledgeItemOutput = { }; export type FKnowledgeItemPatch = { + iknow_is_core?: InputMaybe; iknow_memory?: InputMaybe; iknow_tags?: InputMaybe>; located_fgroup_id?: InputMaybe; @@ -133,6 +142,13 @@ export type FKnowledgeItemSubs = { news_ws_id: Scalars['String']['output']; }; +export type FPluginOutput = { + __typename?: 'FPluginOutput'; + plugin_name: Scalars['String']['output']; + plugin_setup_page: Scalars['String']['output']; + plugin_version: Scalars['String']['output']; +}; + export type FThreadDelta = { __typename?: 'FThreadDelta'; ftm_content: Scalars['JSON']['output']; @@ -141,6 +157,7 @@ export type FThreadDelta = { export type FThreadInput = { ft_belongs_to_fce_id?: InputMaybe; + ft_error?: InputMaybe; ft_fexp_name: Scalars['String']['input']; ft_fexp_ver_major: Scalars['Int']['input']; ft_fexp_ver_minor: Scalars['Int']['input']; @@ -149,6 +166,7 @@ export type FThreadInput = { ft_n?: Scalars['Int']['input']; ft_temperature?: Scalars['Float']['input']; ft_title: Scalars['String']['input']; + ft_toolset?: InputMaybe; located_fgroup_id: Scalars['String']['input']; owner_shared: Scalars['Boolean']['input']; }; @@ -156,12 +174,14 @@ export type FThreadInput = { export type FThreadMessage = { __typename?: 'FThreadMessage'; ftm_alt: Scalars['Int']['output']; + ftm_app_specific?: Maybe; ftm_belongs_to_ft_id: Scalars['String']['output']; ftm_call_id: Scalars['String']['output']; - ftm_content: Scalars['JSON']['output']; + ftm_content?: Maybe; ftm_created_ts: Scalars['Float']['output']; ftm_num: Scalars['Int']['output']; ftm_prev_alt: Scalars['Int']['output']; + ftm_provenance: Scalars['JSON']['output']; ftm_role: Scalars['String']['output']; ftm_tool_calls?: Maybe; ftm_usage?: Maybe; @@ -169,15 +189,16 @@ export type FThreadMessage = { export type FThreadMessageInput = { ftm_alt: Scalars['Int']['input']; + ftm_app_specific?: InputMaybe; ftm_belongs_to_ft_id: Scalars['String']['input']; ftm_call_id: Scalars['String']['input']; - ftm_content: Scalars['String']['input']; + ftm_content?: InputMaybe; ftm_num: Scalars['Int']['input']; ftm_prev_alt: Scalars['Int']['input']; ftm_provenance: Scalars['String']['input']; ftm_role: Scalars['String']['input']; - ftm_tool_calls: Scalars['String']['input']; - ftm_usage: Scalars['String']['input']; + ftm_tool_calls?: InputMaybe; + ftm_usage?: InputMaybe; }; export type FThreadMessageSubs = { @@ -203,6 +224,8 @@ export type FThreadMultipleMessagesInput = { export type FThreadOutput = { __typename?: 'FThreadOutput'; ft_anything_new: Scalars['Boolean']['output']; + ft_app_capture: Scalars['String']['output']; + ft_app_specific?: Maybe; ft_archived_ts: Scalars['Float']['output']; ft_belongs_to_fce_id?: Maybe; ft_created_ts: Scalars['Float']['output']; @@ -219,7 +242,7 @@ export type FThreadOutput = { ft_need_tool_calls: Scalars['Int']['output']; ft_temperature: Scalars['Float']['output']; ft_title: Scalars['String']['output']; - ft_toolset: Scalars['String']['output']; + ft_toolset: Scalars['JSON']['output']; ft_updated_ts: Scalars['Float']['output']; located_fgroup_id: Scalars['String']['output']; owner_fuser_id: Scalars['String']['output']; @@ -228,6 +251,8 @@ export type FThreadOutput = { export type FThreadPatch = { ft_anything_new?: InputMaybe; + ft_app_capture?: InputMaybe; + ft_app_specific?: InputMaybe; ft_archived_ts?: InputMaybe; ft_belongs_to_fce_id?: InputMaybe; ft_error?: InputMaybe; @@ -420,9 +445,11 @@ export type Query = { expert_list: Array; external_data_source_list: Array; knowledge_item_list: Array; - login: Array; + plugins_installed: Array; + query_basic_stuff: BasicStuffResult; thread_list: Array; thread_messages_list: Array; + threads_list_by_ft_app_capture: Array; }; @@ -463,6 +490,12 @@ export type QueryThread_Messages_ListArgs = { ftm_alt?: InputMaybe; }; + +export type QueryThreads_List_By_Ft_App_CaptureArgs = { + ft_app_capture: Scalars['String']['input']; + ws_id: Scalars['String']['input']; +}; + export type Subscription = { __typename?: 'Subscription'; comprehensive_thread_subs: FThreadMessageSubs; @@ -539,7 +572,7 @@ export type NavTreeSubsSubscription = { __typename?: 'Subscription', tree_subscr export type NavTreeWantWorkspacesQueryVariables = Exact<{ [key: string]: never; }>; -export type NavTreeWantWorkspacesQuery = { __typename?: 'Query', login: Array<{ __typename?: 'FWorkspace', ws_id: string, ws_owner_fuser_id: string, ws_root_group_id: string, root_group_name: string }> }; +export type NavTreeWantWorkspacesQuery = { __typename?: 'Query', query_basic_stuff: { __typename?: 'BasicStuffResult', fuser_id: string, workspaces: Array<{ __typename?: 'FWorkspace', ws_id: string, ws_owner_fuser_id: string, ws_root_group_id: string, root_group_name: string }> } }; export type ThreadsPageSubsSubscriptionVariables = Exact<{ located_fgroup_id: Scalars['String']['input']; @@ -547,13 +580,13 @@ export type ThreadsPageSubsSubscriptionVariables = Exact<{ }>; -export type ThreadsPageSubsSubscription = { __typename?: 'Subscription', threads_in_group: { __typename?: 'FThreadSubs', news_action: string, news_payload_id: string, news_payload?: { __typename?: 'FThreadOutput', owner_fuser_id: string, owner_shared: boolean, ft_id: string, ft_title: string, ft_error: string, ft_updated_ts: number, ft_locked_by: string, ft_need_assistant: number, ft_need_tool_calls: number, ft_anything_new: boolean, ft_archived_ts: number } | null } }; +export type ThreadsPageSubsSubscription = { __typename?: 'Subscription', threads_in_group: { __typename?: 'FThreadSubs', news_action: string, news_payload_id: string, news_payload?: { __typename?: 'FThreadOutput', owner_fuser_id: string, owner_shared: boolean, ft_id: string, ft_title: string, ft_error: string, ft_updated_ts: number, ft_locked_by: string, ft_need_assistant: number, ft_need_tool_calls: number, ft_anything_new: boolean, ft_archived_ts: number, ft_created_ts: number, ft_n: number } | null } }; export const CreateGroupDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"CreateGroup"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"fgroup_name"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"fgroup_parent_id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"group_create"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"fgroup_name"},"value":{"kind":"Variable","name":{"kind":"Name","value":"fgroup_name"}}},{"kind":"ObjectField","name":{"kind":"Name","value":"fgroup_parent_id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"fgroup_parent_id"}}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"fgroup_id"}},{"kind":"Field","name":{"kind":"Name","value":"fgroup_name"}},{"kind":"Field","name":{"kind":"Name","value":"ws_id"}},{"kind":"Field","name":{"kind":"Name","value":"fgroup_parent_id"}},{"kind":"Field","name":{"kind":"Name","value":"fgroup_created_ts"}}]}}]}}]} as unknown as DocumentNode; export const NavTreeSubsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"subscription","name":{"kind":"Name","value":"NavTreeSubs"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"ws_id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"tree_subscription"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"ws_id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"ws_id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"treeupd_action"}},{"kind":"Field","name":{"kind":"Name","value":"treeupd_id"}},{"kind":"Field","name":{"kind":"Name","value":"treeupd_path"}},{"kind":"Field","name":{"kind":"Name","value":"treeupd_type"}},{"kind":"Field","name":{"kind":"Name","value":"treeupd_title"}}]}}]}}]} as unknown as DocumentNode; -export const NavTreeWantWorkspacesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"NavTreeWantWorkspaces"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"login"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"ws_id"}},{"kind":"Field","name":{"kind":"Name","value":"ws_owner_fuser_id"}},{"kind":"Field","name":{"kind":"Name","value":"ws_root_group_id"}},{"kind":"Field","name":{"kind":"Name","value":"root_group_name"}}]}}]}}]} as unknown as DocumentNode; -export const ThreadsPageSubsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"subscription","name":{"kind":"Name","value":"ThreadsPageSubs"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"located_fgroup_id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"limit"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Int"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"threads_in_group"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"located_fgroup_id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"located_fgroup_id"}}},{"kind":"Argument","name":{"kind":"Name","value":"limit"},"value":{"kind":"Variable","name":{"kind":"Name","value":"limit"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"news_action"}},{"kind":"Field","name":{"kind":"Name","value":"news_payload_id"}},{"kind":"Field","name":{"kind":"Name","value":"news_payload"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"owner_fuser_id"}},{"kind":"Field","name":{"kind":"Name","value":"owner_shared"}},{"kind":"Field","name":{"kind":"Name","value":"ft_id"}},{"kind":"Field","name":{"kind":"Name","value":"ft_title"}},{"kind":"Field","name":{"kind":"Name","value":"ft_error"}},{"kind":"Field","name":{"kind":"Name","value":"ft_updated_ts"}},{"kind":"Field","name":{"kind":"Name","value":"ft_locked_by"}},{"kind":"Field","name":{"kind":"Name","value":"ft_need_assistant"}},{"kind":"Field","name":{"kind":"Name","value":"ft_need_tool_calls"}},{"kind":"Field","name":{"kind":"Name","value":"ft_anything_new"}},{"kind":"Field","name":{"kind":"Name","value":"ft_archived_ts"}}]}}]}}]}}]} as unknown as DocumentNode; +export const NavTreeWantWorkspacesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"NavTreeWantWorkspaces"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"query_basic_stuff"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"fuser_id"}},{"kind":"Field","name":{"kind":"Name","value":"workspaces"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"ws_id"}},{"kind":"Field","name":{"kind":"Name","value":"ws_owner_fuser_id"}},{"kind":"Field","name":{"kind":"Name","value":"ws_root_group_id"}},{"kind":"Field","name":{"kind":"Name","value":"root_group_name"}}]}}]}}]}}]} as unknown as DocumentNode; +export const ThreadsPageSubsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"subscription","name":{"kind":"Name","value":"ThreadsPageSubs"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"located_fgroup_id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"limit"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Int"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"threads_in_group"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"located_fgroup_id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"located_fgroup_id"}}},{"kind":"Argument","name":{"kind":"Name","value":"limit"},"value":{"kind":"Variable","name":{"kind":"Name","value":"limit"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"news_action"}},{"kind":"Field","name":{"kind":"Name","value":"news_payload_id"}},{"kind":"Field","name":{"kind":"Name","value":"news_payload"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"owner_fuser_id"}},{"kind":"Field","name":{"kind":"Name","value":"owner_shared"}},{"kind":"Field","name":{"kind":"Name","value":"ft_id"}},{"kind":"Field","name":{"kind":"Name","value":"ft_title"}},{"kind":"Field","name":{"kind":"Name","value":"ft_error"}},{"kind":"Field","name":{"kind":"Name","value":"ft_updated_ts"}},{"kind":"Field","name":{"kind":"Name","value":"ft_locked_by"}},{"kind":"Field","name":{"kind":"Name","value":"ft_need_assistant"}},{"kind":"Field","name":{"kind":"Name","value":"ft_need_tool_calls"}},{"kind":"Field","name":{"kind":"Name","value":"ft_anything_new"}},{"kind":"Field","name":{"kind":"Name","value":"ft_archived_ts"}},{"kind":"Field","name":{"kind":"Name","value":"ft_created_ts"}},{"kind":"Field","name":{"kind":"Name","value":"ft_n"}}]}}]}}]}}]} as unknown as DocumentNode; type Properties = Required<{ [K in keyof T]: z.ZodType; @@ -575,7 +608,7 @@ export function FExpertInputSchema(): z.ZodObject> { fexp_ver_major: z.number(), fexp_ver_minor: z.number(), located_fgroup_id: z.string(), - owner_fuser_id: z.string(), + owner_fuser_id: z.string().nullish(), owner_shared: z.boolean() }) } @@ -589,7 +622,7 @@ export function FExpertPatchSchema(): z.ZodObject> { export function FExternalDataSourceInputSchema(): z.ZodObject> { return z.object({ - eds_json: definedNonNullAnySchema, + eds_json: z.string(), eds_name: z.string(), eds_type: z.string(), located_fgroup_id: z.string() @@ -598,7 +631,7 @@ export function FExternalDataSourceInputSchema(): z.ZodObject> { return z.object({ - eds_json: definedNonNullAnySchema.nullish(), + eds_json: z.string(), eds_last_successful_scan_ts: z.number().nullish(), eds_name: z.string().nullish(), eds_scan_status: z.string().nullish(), @@ -610,6 +643,7 @@ export function FExternalDataSourcePatchSchema(): z.ZodObject> { return z.object({ + iknow_is_core: z.boolean().default(false), iknow_memory: z.string(), iknow_tags: z.array(z.string()), located_fgroup_id: z.string(), @@ -619,6 +653,7 @@ export function FKnowledgeItemInputSchema(): z.ZodObject> { return z.object({ + iknow_is_core: z.boolean().nullish(), iknow_memory: z.string().nullish(), iknow_tags: z.array(z.string()).nullish(), located_fgroup_id: z.string().nullish(), @@ -629,6 +664,7 @@ export function FKnowledgeItemPatchSchema(): z.ZodObject> { return z.object({ ft_belongs_to_fce_id: z.string().nullish(), + ft_error: z.string().nullish(), ft_fexp_name: z.string(), ft_fexp_ver_major: z.number(), ft_fexp_ver_minor: z.number(), @@ -637,6 +673,7 @@ export function FThreadInputSchema(): z.ZodObject> { ft_n: z.number().default(1), ft_temperature: z.number().default(0), ft_title: z.string(), + ft_toolset: z.string().nullish(), located_fgroup_id: z.string(), owner_shared: z.boolean() }) @@ -645,15 +682,16 @@ export function FThreadInputSchema(): z.ZodObject> { export function FThreadMessageInputSchema(): z.ZodObject> { return z.object({ ftm_alt: z.number(), + ftm_app_specific: z.string().default("null").nullish(), ftm_belongs_to_ft_id: z.string(), ftm_call_id: z.string(), - ftm_content: z.string(), + ftm_content: z.string().default("null").nullish(), ftm_num: z.number(), ftm_prev_alt: z.number(), ftm_provenance: z.string(), ftm_role: z.string(), - ftm_tool_calls: z.string(), - ftm_usage: z.string() + ftm_tool_calls: z.string().default("null").nullish(), + ftm_usage: z.string().default("null").nullish() }) } @@ -667,6 +705,8 @@ export function FThreadMultipleMessagesInputSchema(): z.ZodObject> { return z.object({ ft_anything_new: z.boolean().nullish(), + ft_app_capture: z.string().nullish(), + ft_app_specific: z.string().nullish(), ft_archived_ts: z.number().nullish(), ft_belongs_to_fce_id: z.string().nullish(), ft_error: z.string().nullish(), diff --git a/refact-agent/gui/generated/graphql/gql.ts b/refact-agent/gui/generated/graphql/gql.ts index 55cebd0d5..241d8875c 100644 --- a/refact-agent/gui/generated/graphql/gql.ts +++ b/refact-agent/gui/generated/graphql/gql.ts @@ -16,14 +16,14 @@ import type { TypedDocumentNode as DocumentNode } from '@graphql-typed-document- type Documents = { "mutation CreateGroup($fgroup_name: String!, $fgroup_parent_id: String!) {\n group_create(\n input: {fgroup_name: $fgroup_name, fgroup_parent_id: $fgroup_parent_id}\n ) {\n fgroup_id\n fgroup_name\n ws_id\n fgroup_parent_id\n fgroup_created_ts\n }\n}": typeof types.CreateGroupDocument, "subscription NavTreeSubs($ws_id: String!) {\n tree_subscription(ws_id: $ws_id) {\n treeupd_action\n treeupd_id\n treeupd_path\n treeupd_type\n treeupd_title\n }\n}": typeof types.NavTreeSubsDocument, - "query NavTreeWantWorkspaces {\n login {\n ws_id\n ws_owner_fuser_id\n ws_root_group_id\n root_group_name\n }\n}": typeof types.NavTreeWantWorkspacesDocument, - "subscription ThreadsPageSubs($located_fgroup_id: String!, $limit: Int!) {\n threads_in_group(located_fgroup_id: $located_fgroup_id, limit: $limit) {\n news_action\n news_payload_id\n news_payload {\n owner_fuser_id\n owner_shared\n ft_id\n ft_title\n ft_error\n ft_updated_ts\n ft_locked_by\n ft_need_assistant\n ft_need_tool_calls\n ft_anything_new\n ft_archived_ts\n }\n }\n}": typeof types.ThreadsPageSubsDocument, + "query NavTreeWantWorkspaces {\n query_basic_stuff {\n fuser_id\n workspaces {\n ws_id\n ws_owner_fuser_id\n ws_root_group_id\n root_group_name\n }\n }\n}": typeof types.NavTreeWantWorkspacesDocument, + "subscription ThreadsPageSubs($located_fgroup_id: String!, $limit: Int!) {\n threads_in_group(located_fgroup_id: $located_fgroup_id, limit: $limit) {\n news_action\n news_payload_id\n news_payload {\n owner_fuser_id\n owner_shared\n ft_id\n ft_title\n ft_error\n ft_updated_ts\n ft_locked_by\n ft_need_assistant\n ft_need_tool_calls\n ft_anything_new\n ft_archived_ts\n ft_created_ts\n ft_n\n }\n }\n}": typeof types.ThreadsPageSubsDocument, }; const documents: Documents = { "mutation CreateGroup($fgroup_name: String!, $fgroup_parent_id: String!) {\n group_create(\n input: {fgroup_name: $fgroup_name, fgroup_parent_id: $fgroup_parent_id}\n ) {\n fgroup_id\n fgroup_name\n ws_id\n fgroup_parent_id\n fgroup_created_ts\n }\n}": types.CreateGroupDocument, "subscription NavTreeSubs($ws_id: String!) {\n tree_subscription(ws_id: $ws_id) {\n treeupd_action\n treeupd_id\n treeupd_path\n treeupd_type\n treeupd_title\n }\n}": types.NavTreeSubsDocument, - "query NavTreeWantWorkspaces {\n login {\n ws_id\n ws_owner_fuser_id\n ws_root_group_id\n root_group_name\n }\n}": types.NavTreeWantWorkspacesDocument, - "subscription ThreadsPageSubs($located_fgroup_id: String!, $limit: Int!) {\n threads_in_group(located_fgroup_id: $located_fgroup_id, limit: $limit) {\n news_action\n news_payload_id\n news_payload {\n owner_fuser_id\n owner_shared\n ft_id\n ft_title\n ft_error\n ft_updated_ts\n ft_locked_by\n ft_need_assistant\n ft_need_tool_calls\n ft_anything_new\n ft_archived_ts\n }\n }\n}": types.ThreadsPageSubsDocument, + "query NavTreeWantWorkspaces {\n query_basic_stuff {\n fuser_id\n workspaces {\n ws_id\n ws_owner_fuser_id\n ws_root_group_id\n root_group_name\n }\n }\n}": types.NavTreeWantWorkspacesDocument, + "subscription ThreadsPageSubs($located_fgroup_id: String!, $limit: Int!) {\n threads_in_group(located_fgroup_id: $located_fgroup_id, limit: $limit) {\n news_action\n news_payload_id\n news_payload {\n owner_fuser_id\n owner_shared\n ft_id\n ft_title\n ft_error\n ft_updated_ts\n ft_locked_by\n ft_need_assistant\n ft_need_tool_calls\n ft_anything_new\n ft_archived_ts\n ft_created_ts\n ft_n\n }\n }\n}": types.ThreadsPageSubsDocument, }; /** @@ -51,11 +51,11 @@ export function graphql(source: "subscription NavTreeSubs($ws_id: String!) {\n /** * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ -export function graphql(source: "query NavTreeWantWorkspaces {\n login {\n ws_id\n ws_owner_fuser_id\n ws_root_group_id\n root_group_name\n }\n}"): (typeof documents)["query NavTreeWantWorkspaces {\n login {\n ws_id\n ws_owner_fuser_id\n ws_root_group_id\n root_group_name\n }\n}"]; +export function graphql(source: "query NavTreeWantWorkspaces {\n query_basic_stuff {\n fuser_id\n workspaces {\n ws_id\n ws_owner_fuser_id\n ws_root_group_id\n root_group_name\n }\n }\n}"): (typeof documents)["query NavTreeWantWorkspaces {\n query_basic_stuff {\n fuser_id\n workspaces {\n ws_id\n ws_owner_fuser_id\n ws_root_group_id\n root_group_name\n }\n }\n}"]; /** * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ -export function graphql(source: "subscription ThreadsPageSubs($located_fgroup_id: String!, $limit: Int!) {\n threads_in_group(located_fgroup_id: $located_fgroup_id, limit: $limit) {\n news_action\n news_payload_id\n news_payload {\n owner_fuser_id\n owner_shared\n ft_id\n ft_title\n ft_error\n ft_updated_ts\n ft_locked_by\n ft_need_assistant\n ft_need_tool_calls\n ft_anything_new\n ft_archived_ts\n }\n }\n}"): (typeof documents)["subscription ThreadsPageSubs($located_fgroup_id: String!, $limit: Int!) {\n threads_in_group(located_fgroup_id: $located_fgroup_id, limit: $limit) {\n news_action\n news_payload_id\n news_payload {\n owner_fuser_id\n owner_shared\n ft_id\n ft_title\n ft_error\n ft_updated_ts\n ft_locked_by\n ft_need_assistant\n ft_need_tool_calls\n ft_anything_new\n ft_archived_ts\n }\n }\n}"]; +export function graphql(source: "subscription ThreadsPageSubs($located_fgroup_id: String!, $limit: Int!) {\n threads_in_group(located_fgroup_id: $located_fgroup_id, limit: $limit) {\n news_action\n news_payload_id\n news_payload {\n owner_fuser_id\n owner_shared\n ft_id\n ft_title\n ft_error\n ft_updated_ts\n ft_locked_by\n ft_need_assistant\n ft_need_tool_calls\n ft_anything_new\n ft_archived_ts\n ft_created_ts\n ft_n\n }\n }\n}"): (typeof documents)["subscription ThreadsPageSubs($located_fgroup_id: String!, $limit: Int!) {\n threads_in_group(located_fgroup_id: $located_fgroup_id, limit: $limit) {\n news_action\n news_payload_id\n news_payload {\n owner_fuser_id\n owner_shared\n ft_id\n ft_title\n ft_error\n ft_updated_ts\n ft_locked_by\n ft_need_assistant\n ft_need_tool_calls\n ft_anything_new\n ft_archived_ts\n ft_created_ts\n ft_n\n }\n }\n}"]; export function graphql(source: string) { return (documents as any)[source] ?? {}; diff --git a/refact-agent/gui/generated/graphql/graphql.ts b/refact-agent/gui/generated/graphql/graphql.ts index 9d1d8244b..b01f873a1 100644 --- a/refact-agent/gui/generated/graphql/graphql.ts +++ b/refact-agent/gui/generated/graphql/graphql.ts @@ -18,6 +18,12 @@ export type Scalars = { JSON: { input: any; output: any; } }; +export type BasicStuffResult = { + __typename?: 'BasicStuffResult'; + fuser_id: Scalars['String']['output']; + workspaces: Array; +}; + export type FExpertInput = { fexp_allow_tools: Scalars['String']['input']; fexp_block_tools: Scalars['String']['input']; @@ -27,7 +33,7 @@ export type FExpertInput = { fexp_ver_major: Scalars['Int']['input']; fexp_ver_minor: Scalars['Int']['input']; located_fgroup_id: Scalars['String']['input']; - owner_fuser_id: Scalars['String']['input']; + owner_fuser_id?: InputMaybe; owner_shared: Scalars['Boolean']['input']; }; @@ -41,7 +47,7 @@ export type FExpertOutput = { fexp_ver_major: Scalars['Int']['output']; fexp_ver_minor: Scalars['Int']['output']; located_fgroup_id: Scalars['String']['output']; - owner_fuser_id: Scalars['String']['output']; + owner_fuser_id?: Maybe; owner_shared: Scalars['Boolean']['output']; }; @@ -59,7 +65,7 @@ export type FExpertSubs = { }; export type FExternalDataSourceInput = { - eds_json: Scalars['JSON']['input']; + eds_json: Scalars['String']['input']; eds_name: Scalars['String']['input']; eds_type: Scalars['String']['input']; located_fgroup_id: Scalars['String']['input']; @@ -81,7 +87,7 @@ export type FExternalDataSourceOutput = { }; export type FExternalDataSourcePatch = { - eds_json?: InputMaybe; + eds_json: Scalars['String']['input']; eds_last_successful_scan_ts?: InputMaybe; eds_name?: InputMaybe; eds_scan_status?: InputMaybe; @@ -98,6 +104,7 @@ export type FExternalDataSourceSubs = { }; export type FKnowledgeItemInput = { + iknow_is_core?: Scalars['Boolean']['input']; iknow_memory: Scalars['String']['input']; iknow_tags?: Array; located_fgroup_id: Scalars['String']['input']; @@ -108,6 +115,7 @@ export type FKnowledgeItemOutput = { __typename?: 'FKnowledgeItemOutput'; iknow_created_ts: Scalars['Float']['output']; iknow_id: Scalars['String']['output']; + iknow_is_core: Scalars['Boolean']['output']; iknow_memory: Scalars['String']['output']; iknow_modified_ts: Scalars['Float']['output']; iknow_stat_correct: Scalars['Int']['output']; @@ -120,6 +128,7 @@ export type FKnowledgeItemOutput = { }; export type FKnowledgeItemPatch = { + iknow_is_core?: InputMaybe; iknow_memory?: InputMaybe; iknow_tags?: InputMaybe>; located_fgroup_id?: InputMaybe; @@ -134,6 +143,13 @@ export type FKnowledgeItemSubs = { news_ws_id: Scalars['String']['output']; }; +export type FPluginOutput = { + __typename?: 'FPluginOutput'; + plugin_name: Scalars['String']['output']; + plugin_setup_page: Scalars['String']['output']; + plugin_version: Scalars['String']['output']; +}; + export type FThreadDelta = { __typename?: 'FThreadDelta'; ftm_content: Scalars['JSON']['output']; @@ -142,6 +158,7 @@ export type FThreadDelta = { export type FThreadInput = { ft_belongs_to_fce_id?: InputMaybe; + ft_error?: InputMaybe; ft_fexp_name: Scalars['String']['input']; ft_fexp_ver_major: Scalars['Int']['input']; ft_fexp_ver_minor: Scalars['Int']['input']; @@ -150,6 +167,7 @@ export type FThreadInput = { ft_n?: Scalars['Int']['input']; ft_temperature?: Scalars['Float']['input']; ft_title: Scalars['String']['input']; + ft_toolset?: InputMaybe; located_fgroup_id: Scalars['String']['input']; owner_shared: Scalars['Boolean']['input']; }; @@ -157,12 +175,14 @@ export type FThreadInput = { export type FThreadMessage = { __typename?: 'FThreadMessage'; ftm_alt: Scalars['Int']['output']; + ftm_app_specific?: Maybe; ftm_belongs_to_ft_id: Scalars['String']['output']; ftm_call_id: Scalars['String']['output']; - ftm_content: Scalars['JSON']['output']; + ftm_content?: Maybe; ftm_created_ts: Scalars['Float']['output']; ftm_num: Scalars['Int']['output']; ftm_prev_alt: Scalars['Int']['output']; + ftm_provenance: Scalars['JSON']['output']; ftm_role: Scalars['String']['output']; ftm_tool_calls?: Maybe; ftm_usage?: Maybe; @@ -170,15 +190,16 @@ export type FThreadMessage = { export type FThreadMessageInput = { ftm_alt: Scalars['Int']['input']; + ftm_app_specific?: InputMaybe; ftm_belongs_to_ft_id: Scalars['String']['input']; ftm_call_id: Scalars['String']['input']; - ftm_content: Scalars['String']['input']; + ftm_content?: InputMaybe; ftm_num: Scalars['Int']['input']; ftm_prev_alt: Scalars['Int']['input']; ftm_provenance: Scalars['String']['input']; ftm_role: Scalars['String']['input']; - ftm_tool_calls: Scalars['String']['input']; - ftm_usage: Scalars['String']['input']; + ftm_tool_calls?: InputMaybe; + ftm_usage?: InputMaybe; }; export type FThreadMessageSubs = { @@ -204,6 +225,8 @@ export type FThreadMultipleMessagesInput = { export type FThreadOutput = { __typename?: 'FThreadOutput'; ft_anything_new: Scalars['Boolean']['output']; + ft_app_capture: Scalars['String']['output']; + ft_app_specific?: Maybe; ft_archived_ts: Scalars['Float']['output']; ft_belongs_to_fce_id?: Maybe; ft_created_ts: Scalars['Float']['output']; @@ -220,7 +243,7 @@ export type FThreadOutput = { ft_need_tool_calls: Scalars['Int']['output']; ft_temperature: Scalars['Float']['output']; ft_title: Scalars['String']['output']; - ft_toolset: Scalars['String']['output']; + ft_toolset: Scalars['JSON']['output']; ft_updated_ts: Scalars['Float']['output']; located_fgroup_id: Scalars['String']['output']; owner_fuser_id: Scalars['String']['output']; @@ -229,6 +252,8 @@ export type FThreadOutput = { export type FThreadPatch = { ft_anything_new?: InputMaybe; + ft_app_capture?: InputMaybe; + ft_app_specific?: InputMaybe; ft_archived_ts?: InputMaybe; ft_belongs_to_fce_id?: InputMaybe; ft_error?: InputMaybe; @@ -421,9 +446,11 @@ export type Query = { expert_list: Array; external_data_source_list: Array; knowledge_item_list: Array; - login: Array; + plugins_installed: Array; + query_basic_stuff: BasicStuffResult; thread_list: Array; thread_messages_list: Array; + threads_list_by_ft_app_capture: Array; }; @@ -464,6 +491,12 @@ export type QueryThread_Messages_ListArgs = { ftm_alt?: InputMaybe; }; + +export type QueryThreads_List_By_Ft_App_CaptureArgs = { + ft_app_capture: Scalars['String']['input']; + ws_id: Scalars['String']['input']; +}; + export type Subscription = { __typename?: 'Subscription'; comprehensive_thread_subs: FThreadMessageSubs; @@ -540,7 +573,7 @@ export type NavTreeSubsSubscription = { __typename?: 'Subscription', tree_subscr export type NavTreeWantWorkspacesQueryVariables = Exact<{ [key: string]: never; }>; -export type NavTreeWantWorkspacesQuery = { __typename?: 'Query', login: Array<{ __typename?: 'FWorkspace', ws_id: string, ws_owner_fuser_id: string, ws_root_group_id: string, root_group_name: string }> }; +export type NavTreeWantWorkspacesQuery = { __typename?: 'Query', query_basic_stuff: { __typename?: 'BasicStuffResult', fuser_id: string, workspaces: Array<{ __typename?: 'FWorkspace', ws_id: string, ws_owner_fuser_id: string, ws_root_group_id: string, root_group_name: string }> } }; export type ThreadsPageSubsSubscriptionVariables = Exact<{ located_fgroup_id: Scalars['String']['input']; @@ -548,10 +581,10 @@ export type ThreadsPageSubsSubscriptionVariables = Exact<{ }>; -export type ThreadsPageSubsSubscription = { __typename?: 'Subscription', threads_in_group: { __typename?: 'FThreadSubs', news_action: string, news_payload_id: string, news_payload?: { __typename?: 'FThreadOutput', owner_fuser_id: string, owner_shared: boolean, ft_id: string, ft_title: string, ft_error: string, ft_updated_ts: number, ft_locked_by: string, ft_need_assistant: number, ft_need_tool_calls: number, ft_anything_new: boolean, ft_archived_ts: number } | null } }; +export type ThreadsPageSubsSubscription = { __typename?: 'Subscription', threads_in_group: { __typename?: 'FThreadSubs', news_action: string, news_payload_id: string, news_payload?: { __typename?: 'FThreadOutput', owner_fuser_id: string, owner_shared: boolean, ft_id: string, ft_title: string, ft_error: string, ft_updated_ts: number, ft_locked_by: string, ft_need_assistant: number, ft_need_tool_calls: number, ft_anything_new: boolean, ft_archived_ts: number, ft_created_ts: number, ft_n: number } | null } }; export const CreateGroupDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"CreateGroup"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"fgroup_name"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"fgroup_parent_id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"group_create"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"fgroup_name"},"value":{"kind":"Variable","name":{"kind":"Name","value":"fgroup_name"}}},{"kind":"ObjectField","name":{"kind":"Name","value":"fgroup_parent_id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"fgroup_parent_id"}}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"fgroup_id"}},{"kind":"Field","name":{"kind":"Name","value":"fgroup_name"}},{"kind":"Field","name":{"kind":"Name","value":"ws_id"}},{"kind":"Field","name":{"kind":"Name","value":"fgroup_parent_id"}},{"kind":"Field","name":{"kind":"Name","value":"fgroup_created_ts"}}]}}]}}]} as unknown as DocumentNode; export const NavTreeSubsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"subscription","name":{"kind":"Name","value":"NavTreeSubs"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"ws_id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"tree_subscription"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"ws_id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"ws_id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"treeupd_action"}},{"kind":"Field","name":{"kind":"Name","value":"treeupd_id"}},{"kind":"Field","name":{"kind":"Name","value":"treeupd_path"}},{"kind":"Field","name":{"kind":"Name","value":"treeupd_type"}},{"kind":"Field","name":{"kind":"Name","value":"treeupd_title"}}]}}]}}]} as unknown as DocumentNode; -export const NavTreeWantWorkspacesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"NavTreeWantWorkspaces"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"login"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"ws_id"}},{"kind":"Field","name":{"kind":"Name","value":"ws_owner_fuser_id"}},{"kind":"Field","name":{"kind":"Name","value":"ws_root_group_id"}},{"kind":"Field","name":{"kind":"Name","value":"root_group_name"}}]}}]}}]} as unknown as DocumentNode; -export const ThreadsPageSubsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"subscription","name":{"kind":"Name","value":"ThreadsPageSubs"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"located_fgroup_id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"limit"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Int"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"threads_in_group"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"located_fgroup_id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"located_fgroup_id"}}},{"kind":"Argument","name":{"kind":"Name","value":"limit"},"value":{"kind":"Variable","name":{"kind":"Name","value":"limit"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"news_action"}},{"kind":"Field","name":{"kind":"Name","value":"news_payload_id"}},{"kind":"Field","name":{"kind":"Name","value":"news_payload"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"owner_fuser_id"}},{"kind":"Field","name":{"kind":"Name","value":"owner_shared"}},{"kind":"Field","name":{"kind":"Name","value":"ft_id"}},{"kind":"Field","name":{"kind":"Name","value":"ft_title"}},{"kind":"Field","name":{"kind":"Name","value":"ft_error"}},{"kind":"Field","name":{"kind":"Name","value":"ft_updated_ts"}},{"kind":"Field","name":{"kind":"Name","value":"ft_locked_by"}},{"kind":"Field","name":{"kind":"Name","value":"ft_need_assistant"}},{"kind":"Field","name":{"kind":"Name","value":"ft_need_tool_calls"}},{"kind":"Field","name":{"kind":"Name","value":"ft_anything_new"}},{"kind":"Field","name":{"kind":"Name","value":"ft_archived_ts"}}]}}]}}]}}]} as unknown as DocumentNode; \ No newline at end of file +export const NavTreeWantWorkspacesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"NavTreeWantWorkspaces"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"query_basic_stuff"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"fuser_id"}},{"kind":"Field","name":{"kind":"Name","value":"workspaces"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"ws_id"}},{"kind":"Field","name":{"kind":"Name","value":"ws_owner_fuser_id"}},{"kind":"Field","name":{"kind":"Name","value":"ws_root_group_id"}},{"kind":"Field","name":{"kind":"Name","value":"root_group_name"}}]}}]}}]}}]} as unknown as DocumentNode; +export const ThreadsPageSubsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"subscription","name":{"kind":"Name","value":"ThreadsPageSubs"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"located_fgroup_id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"limit"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Int"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"threads_in_group"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"located_fgroup_id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"located_fgroup_id"}}},{"kind":"Argument","name":{"kind":"Name","value":"limit"},"value":{"kind":"Variable","name":{"kind":"Name","value":"limit"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"news_action"}},{"kind":"Field","name":{"kind":"Name","value":"news_payload_id"}},{"kind":"Field","name":{"kind":"Name","value":"news_payload"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"owner_fuser_id"}},{"kind":"Field","name":{"kind":"Name","value":"owner_shared"}},{"kind":"Field","name":{"kind":"Name","value":"ft_id"}},{"kind":"Field","name":{"kind":"Name","value":"ft_title"}},{"kind":"Field","name":{"kind":"Name","value":"ft_error"}},{"kind":"Field","name":{"kind":"Name","value":"ft_updated_ts"}},{"kind":"Field","name":{"kind":"Name","value":"ft_locked_by"}},{"kind":"Field","name":{"kind":"Name","value":"ft_need_assistant"}},{"kind":"Field","name":{"kind":"Name","value":"ft_need_tool_calls"}},{"kind":"Field","name":{"kind":"Name","value":"ft_anything_new"}},{"kind":"Field","name":{"kind":"Name","value":"ft_archived_ts"}},{"kind":"Field","name":{"kind":"Name","value":"ft_created_ts"}},{"kind":"Field","name":{"kind":"Name","value":"ft_n"}}]}}]}}]}}]} as unknown as DocumentNode; \ No newline at end of file diff --git a/refact-agent/gui/generated/schema.graphql b/refact-agent/gui/generated/schema.graphql index 125cbcd2b..8d1522ce7 100644 --- a/refact-agent/gui/generated/schema.graphql +++ b/refact-agent/gui/generated/schema.graphql @@ -4,6 +4,11 @@ schema { subscription: Subscription } +type BasicStuffResult { + fuser_id: String! + workspaces: [FWorkspace!]! +} + input FExpertInput { fexp_allow_tools: String! fexp_block_tools: String! @@ -13,7 +18,7 @@ input FExpertInput { fexp_ver_major: Int! fexp_ver_minor: Int! located_fgroup_id: String! - owner_fuser_id: String! + owner_fuser_id: String owner_shared: Boolean! } @@ -26,7 +31,7 @@ type FExpertOutput { fexp_ver_major: Int! fexp_ver_minor: Int! located_fgroup_id: String! - owner_fuser_id: String! + owner_fuser_id: String owner_shared: Boolean! } @@ -43,7 +48,7 @@ type FExpertSubs { } input FExternalDataSourceInput { - eds_json: JSON! + eds_json: String! eds_name: String! eds_type: String! located_fgroup_id: String! @@ -64,7 +69,7 @@ type FExternalDataSourceOutput { } input FExternalDataSourcePatch { - eds_json: JSON = null + eds_json: String! eds_last_successful_scan_ts: Float = null eds_name: String = null eds_scan_status: String = null @@ -80,6 +85,7 @@ type FExternalDataSourceSubs { } input FKnowledgeItemInput { + iknow_is_core: Boolean! = false iknow_memory: String! iknow_tags: [String!]! = [] located_fgroup_id: String! @@ -89,6 +95,7 @@ input FKnowledgeItemInput { type FKnowledgeItemOutput { iknow_created_ts: Float! iknow_id: String! + iknow_is_core: Boolean! iknow_memory: String! iknow_modified_ts: Float! iknow_stat_correct: Int! @@ -101,6 +108,7 @@ type FKnowledgeItemOutput { } input FKnowledgeItemPatch { + iknow_is_core: Boolean = null iknow_memory: String = null iknow_tags: [String!] = null located_fgroup_id: String = null @@ -114,13 +122,20 @@ type FKnowledgeItemSubs { news_ws_id: String! } +type FPluginOutput { + plugin_name: String! + plugin_setup_page: String! + plugin_version: String! +} + type FThreadDelta { ftm_content: JSON! ftm_role: String! } input FThreadInput { - ft_belongs_to_fce_id: String + ft_belongs_to_fce_id: String = null + ft_error: String = null ft_fexp_name: String! ft_fexp_ver_major: Int! ft_fexp_ver_minor: Int! @@ -129,18 +144,21 @@ input FThreadInput { ft_n: Int! = 1 ft_temperature: Float! = 0 ft_title: String! + ft_toolset: String = null located_fgroup_id: String! owner_shared: Boolean! } type FThreadMessage { ftm_alt: Int! + ftm_app_specific: JSON ftm_belongs_to_ft_id: String! ftm_call_id: String! - ftm_content: JSON! + ftm_content: JSON ftm_created_ts: Float! ftm_num: Int! ftm_prev_alt: Int! + ftm_provenance: JSON! ftm_role: String! ftm_tool_calls: JSON ftm_usage: JSON @@ -148,15 +166,16 @@ type FThreadMessage { input FThreadMessageInput { ftm_alt: Int! + ftm_app_specific: String = "null" ftm_belongs_to_ft_id: String! ftm_call_id: String! - ftm_content: String! + ftm_content: String = "null" ftm_num: Int! ftm_prev_alt: Int! ftm_provenance: String! ftm_role: String! - ftm_tool_calls: String! - ftm_usage: String! + ftm_tool_calls: String = "null" + ftm_usage: String = "null" } type FThreadMessageSubs { @@ -179,6 +198,8 @@ input FThreadMultipleMessagesInput { type FThreadOutput { ft_anything_new: Boolean! + ft_app_capture: String! + ft_app_specific: JSON ft_archived_ts: Float! ft_belongs_to_fce_id: String ft_created_ts: Float! @@ -195,7 +216,7 @@ type FThreadOutput { ft_need_tool_calls: Int! ft_temperature: Float! ft_title: String! - ft_toolset: String! + ft_toolset: JSON! ft_updated_ts: Float! located_fgroup_id: String! owner_fuser_id: String! @@ -204,6 +225,8 @@ type FThreadOutput { input FThreadPatch { ft_anything_new: Boolean = null + ft_app_capture: String = null + ft_app_specific: String = null ft_archived_ts: Float = null ft_belongs_to_fce_id: String = null ft_error: String = null @@ -281,9 +304,11 @@ type Query { expert_list(limit: Int!, located_fgroup_id: String!, skip: Int!, sort_by: String! = ""): [FExpertOutput!]! external_data_source_list(limit: Int!, located_fgroup_id: String!, skip: Int!, sort_by: String! = ""): [FExternalDataSourceOutput!]! knowledge_item_list(limit: Int!, located_fgroup_id: String!, skip: Int!, sort_by: String! = ""): [FKnowledgeItemOutput!]! - login: [FWorkspace!]! + plugins_installed: [FPluginOutput!]! + query_basic_stuff: BasicStuffResult! thread_list(limit: Int!, located_fgroup_id: String!, skip: Int!, sort_by: String! = ""): [FThreadOutput!]! thread_messages_list(ft_id: String!, ftm_alt: Int = null): [FThreadMessage!]! + threads_list_by_ft_app_capture(ft_app_capture: String!, ws_id: String!): [FThreadOutput!]! } type Subscription { diff --git a/refact-agent/gui/src/app/store.ts b/refact-agent/gui/src/app/store.ts index b9a4ee02c..82bf265d3 100644 --- a/refact-agent/gui/src/app/store.ts +++ b/refact-agent/gui/src/app/store.ts @@ -55,6 +55,7 @@ import { checkpointsSlice } from "../features/Checkpoints/checkpointsSlice"; import { checkpointsApi } from "../services/refact/checkpoints"; import { patchesAndDiffsTrackerSlice } from "../features/PatchesAndDiffsTracker/patchesAndDiffsTrackerSlice"; import { coinBallanceSlice } from "../features/CoinBalance"; +import { threadListSlice } from "../features/ThreadList"; const tipOfTheDayPersistConfig = { key: "totd", @@ -110,6 +111,7 @@ const rootReducer = combineSlices( checkpointsSlice, patchesAndDiffsTrackerSlice, coinBallanceSlice, + threadListSlice, ); const rootPersistConfig = { diff --git a/refact-agent/gui/src/components/Buttons/CardButton.tsx b/refact-agent/gui/src/components/Buttons/CardButton.tsx new file mode 100644 index 000000000..b7415f2e5 --- /dev/null +++ b/refact-agent/gui/src/components/Buttons/CardButton.tsx @@ -0,0 +1,22 @@ +import React from "react"; +import { Card } from "@radix-ui/themes"; + +export type CardButtonProps = React.JSX.IntrinsicElements["button"]; + +export const CardButton: React.FC = (props) => { + return ( + +