Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/shinkai-desktop/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export default defineConfig(() => ({
'TAURI_DEBUG',
],

cacheDir: '../../node_modules/.vitest/apps/shinkai-desktop',
build: {
rollupOptions: {
input: {
Expand All @@ -80,7 +81,6 @@ export default defineConfig(() => ({
watch: false,
setupFiles: './src/test-setup.ts',
globals: true,
cache: { dir: '../../node_modules/.vitest/apps/shinkai-desktop' },
environment: 'jsdom',
include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
reporters: ['default'],
Expand Down
5 changes: 0 additions & 5 deletions libs/shinkai-message-ts/src/utils/wasm_helpers.test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
import * as ed from '@noble/ed25519';
import { sha512 } from '@noble/hashes/sha512';
import { Crypto } from '@peculiar/webcrypto';

import { generateEncryptionKeys, generateSignatureKeys } from './wasm_helpers';

// Enable synchronous methods
ed.etc.sha512Sync = (...m) => sha512(ed.etc.concatBytes(...m));

const crypto = new Crypto();
Object.defineProperty(globalThis, 'crypto', {
value: crypto,
Expand Down
2 changes: 1 addition & 1 deletion libs/shinkai-message-ts/src/utils/wasm_helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const generateSignatureKeys = async (): Promise<{
my_identity_sk_string: HexString;
my_identity_pk_string: HexString;
}> => {
const privKey = ed.utils.randomPrivateKey();
const privKey = ed.utils.randomSecretKey();
const pubKey = await ed.getPublicKeyAsync(privKey);

const my_identity_sk_string: string = toHexString(privKey);
Expand Down
1 change: 0 additions & 1 deletion libs/shinkai-message-ts/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ export default defineConfig({
watch: false,
setupFiles: './scripts/setupTests.ts',
globals: true,
cache: { dir: '../../node_modules/.vitest/libs/shinkai-message-ts' },
environment: 'jsdom',
include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
reporters: ['default'],
Expand Down
4 changes: 2 additions & 2 deletions libs/shinkai-node-state/src/forms/auth/quick-connection.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { z } from 'zod';

export const quickConnectFormSchema = z.object({
node_address: z.string().url({
message: 'Node Address must be a valid URL',
node_address: z.url({
error: 'Node Address must be a valid URL',
}),
});

Expand Down
2 changes: 1 addition & 1 deletion libs/shinkai-node-state/src/forms/chat/chat-message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const chatMessageFormSchema = z.object({
key: z.string().min(1),
name: z.string().min(1),
description: z.string().min(1),
args: z.record(z.any()),
args: z.record(z.string(), z.any()),
})
.optional(),
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ export const useAddMcpServer = (
return useMutation({
mutationFn: (input: AddMcpServerInput) => addMcpServer(input),
...options,
onSuccess: async (data, variables, context) => {
onSuccess: async (data, variables, onMutateResult, context) => {
await queryClient.invalidateQueries({
queryKey: [FunctionKeyV2.GET_MCP_SERVERS],
});
if (options?.onSuccess) {
await options.onSuccess(data, variables, context);
await options.onSuccess(data, variables, onMutateResult, context);
}
},
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ export const useAddNetworkTool = (
return useMutation({
mutationFn: addNetworkTool,
...options,
onSuccess: async (data, variables, context) => {
onSuccess: async (...args) => {
await queryClient.invalidateQueries({
queryKey: [FunctionKeyV2.GET_INSTALLED_NETWORK_TOOLS],
});
if (options?.onSuccess) {
await options.onSuccess(data, variables, context);
await options.onSuccess(...args);
}
},
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ export const useCopyFolder = (options?: Options) => {
return useMutation({
mutationFn: copyFolder,
...options,
onSuccess: async (response, variables, context) => {
onSuccess: async (response, variables, onMutateResult, context) => {
await queryClient.invalidateQueries({
queryKey: [FunctionKeyV2.GET_VR_FILES],
});

if (options?.onSuccess) {
options.onSuccess(response, variables, context);
options.onSuccess(response, variables, onMutateResult, context);
}
},
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ export const useCopyFsItem = (options?: Options) => {
return useMutation({
mutationFn: copyFsItem,
...options,
onSuccess: async (response, variables, context) => {
onSuccess: async (response, variables, onMutateResult, context) => {
await queryClient.invalidateQueries({
queryKey: [FunctionKeyV2.GET_VR_FILES],
});

if (options?.onSuccess) {
options.onSuccess(response, variables, context);
options.onSuccess(response, variables, onMutateResult, context);
}
},
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const useCopyToolAssets = (options?: Options) => {
return useMutation({
mutationFn: copyToolAssets,
...options,
onSuccess: async (response, variables, context) => {
onSuccess: async (response, variables, onMutateResult, context) => {
await queryClient.invalidateQueries({
queryKey: [
FunctionKeyV2.GET_ALL_TOOL_ASSETS,
Expand All @@ -42,7 +42,7 @@ export const useCopyToolAssets = (options?: Options) => {
});

if (options?.onSuccess) {
options.onSuccess(response, variables, context);
options.onSuccess(response, variables, onMutateResult, context);
}
},
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ export const useCreateAgent = (options?: Options) => {
return useMutation({
mutationFn: createAgent,
...options,
onSuccess: async (response, variables, context) => {
onSuccess: async (response, variables, onMutateResult, context) => {
await queryClient.invalidateQueries({
queryKey: [FunctionKeyV2.GET_AGENTS],
});

if (options?.onSuccess) {
options.onSuccess(response, variables, context);
options.onSuccess(response, variables, onMutateResult, context);
}
},
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ export const useCreateFolder = (options?: Options) => {
return useMutation({
mutationFn: createFolder,
...options,
onSuccess: async (response, variables, context) => {
onSuccess: async (response, variables, onMutateResult, context) => {
await queryClient.invalidateQueries({
queryKey: [FunctionKeyV2.GET_VR_FILES],
});

if (options?.onSuccess) {
options.onSuccess(response, variables, context);
options.onSuccess(response, variables, onMutateResult, context);
}
},
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const useCreateJob = (options?: Options) => {
return useMutation({
mutationFn: createJob,
...options,
onSuccess: async (response, variables, context) => {
onSuccess: async (response, variables, onMutateResult, context) => {
await queryClient.invalidateQueries({
queryKey: [FunctionKeyV2.GET_INBOXES_WITH_PAGINATION],
});
Expand All @@ -32,7 +32,7 @@ export const useCreateJob = (options?: Options) => {
});

if (options?.onSuccess) {
options.onSuccess(response, variables, context);
options.onSuccess(response, variables, onMutateResult, context);
}
},
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const useCreateLocalWallet = (options?: Options) => {
return useMutation({
mutationFn: createLocalWallet,
...options,
onSuccess: async (response, variables, context) => {
onSuccess: async (response, variables, onMutateResult, context) => {
await queryClient.invalidateQueries({
queryKey: [
FunctionKeyV2.GET_WALLET_LIST,
Expand All @@ -34,7 +34,7 @@ export const useCreateLocalWallet = (options?: Options) => {
],
});
if (options?.onSuccess) {
options.onSuccess(response, variables, context);
options.onSuccess(response, variables, onMutateResult, context);
}
},
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const useCreatePrompt = (options?: Options) => {
return useMutation({
mutationFn: createPrompt,
...options,
onSuccess: async (response, variables, context) => {
onSuccess: async (response, variables, onMutateResult, context) => {
await queryClient.invalidateQueries({
queryKey: [
FunctionKeyV2.GET_LIST_PROMPTS,
Expand All @@ -32,7 +32,7 @@ export const useCreatePrompt = (options?: Options) => {
});

if (options?.onSuccess) {
options.onSuccess(response, variables, context);
options.onSuccess(response, variables, onMutateResult, context);
}
},
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ export const useCreateRecurringTask = (options?: Options) => {
return useMutation({
mutationFn: createRecurringTask,
...options,
onSuccess: async (response, variables, context) => {
onSuccess: async (response, variables, onMutateResult, context) => {
await queryClient.invalidateQueries({
queryKey: [FunctionKeyV2.GET_RECURRING_TASKS],
});

if (options?.onSuccess) {
options.onSuccess(response, variables, context);
options.onSuccess(response, variables, onMutateResult, context);
}
},
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ export const useCreateTool = (options?: Options) => {
return useMutation({
mutationFn: createTool,
...options,
onSuccess: async (response, variables, context) => {
onSuccess: async (response, variables, onMutateResult, context) => {
await queryClient.invalidateQueries({
queryKey: [FunctionKeyV2.GET_LIST_TOOLS],
});

if (options?.onSuccess) {
options.onSuccess(response, variables, context);
options.onSuccess(response, variables, onMutateResult, context);
}
},
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ export const useCreateToolCode = (options?: Options) => {
return useMutation({
mutationFn: createToolCode,
...options,
onSuccess: async (response, variables, context) => {
onSuccess: async (response, variables, onMutateResult, context) => {
await queryClient.invalidateQueries({
queryKey: [
FunctionKeyV2.GET_CHAT_CONVERSATION_PAGINATION,
{ inboxId: response.inbox },
],
});
if (options?.onSuccess) {
options.onSuccess(response, variables, context);
options.onSuccess(response, variables, onMutateResult, context);
}
},
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import { useMutation, type UseMutationOptions } from '@tanstack/react-query';

import { type APIError } from '../../types';
import { type CreateToolMetadataInput, type CreateToolMetadataOutput } from './types';
import {
type CreateToolMetadataInput,
type CreateToolMetadataOutput,
} from './types';
import { createToolMetadata } from '.';

type Options = UseMutationOptions<
Expand All @@ -14,9 +17,9 @@ export const useCreateToolMetadata = (options?: Options) => {
return useMutation({
mutationFn: createToolMetadata,
...options,
onSuccess: (response, variables, context) => {
onSuccess: (response, variables, onMutateResult, context) => {
if (options?.onSuccess) {
options.onSuccess(response, variables, context);
options.onSuccess(response, variables, onMutateResult, context);
}
},
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ export const useDeleteMcpServer = (
return deleted_mcp_server;
},
...options,
onSuccess: async (data, variables, context) => {
onSuccess: async (data, variables, onMutateResult, context) => {
await queryClient.invalidateQueries({
queryKey: [FunctionKeyV2.GET_MCP_SERVERS],
});
if (options?.onSuccess) {
await options.onSuccess(data, variables, context);
await options.onSuccess(data, variables, onMutateResult, context);
}
},
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ export const useDisableAllTools = (options?: Options) => {
return useMutation({
mutationFn: disableAllTools,
...options,
onSuccess: async (response, variables, context) => {
onSuccess: async (response, variables, onMutateResult, context) => {
await queryClient.invalidateQueries({
queryKey: [FunctionKeyV2.GET_LIST_TOOLS],
});
if (options?.onSuccess) {
options.onSuccess(response, variables, context);
options.onSuccess(response, variables, onMutateResult, context);
}
},
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const useDuplicateTool = (options?: Options) => {
return useMutation({
mutationFn: duplicateTool,
...options,
onSuccess: async (response, variables, context) => {
onSuccess: async (response, variables, onMutateResult, context) => {
await queryClient.invalidateQueries({
queryKey: [FunctionKeyV2.GET_LIST_TOOLS],
});
Expand All @@ -47,7 +47,7 @@ export const useDuplicateTool = (options?: Options) => {
});

if (options?.onSuccess) {
options.onSuccess(response, variables, context);
options.onSuccess(response, variables, onMutateResult, context);
}
},
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ export const useEnableAllTools = (options?: Options) => {
return useMutation({
mutationFn: enableAllTools,
...options,
onSuccess: async (response, variables, context) => {
onSuccess: async (response, variables, onMutateResult, context) => {
await queryClient.invalidateQueries({
queryKey: [FunctionKeyV2.GET_LIST_TOOLS],
});
if (options?.onSuccess) {
options.onSuccess(response, variables, context);
options.onSuccess(response, variables, onMutateResult, context);
}
},
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ export const useExportTool = (options?: Options) => {
return useMutation({
mutationFn: exportTool,
...options,
onSuccess: async (response, variables, context) => {
onSuccess: async (response, variables, onMutateResult, context) => {
await queryClient.invalidateQueries({
queryKey: [FunctionKeyV2.GET_LIST_TOOLS],
});
if (options?.onSuccess) {
options.onSuccess(response, variables, context);
options.onSuccess(response, variables, onMutateResult, context);
}
},
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ export const useForkJobMessages = (options?: Options) => {
return useMutation({
mutationFn: forkJobMessages,
...options,
onSuccess: async (response, variables, context) => {
onSuccess: async (response, variables, onMutateResult, context) => {
await queryClient.invalidateQueries({
queryKey: [FunctionKeyV2.GET_INBOXES_WITH_PAGINATION],
});

if (options?.onSuccess) {
options.onSuccess(response, variables, context);
options.onSuccess(response, variables, onMutateResult, context);
}
},
});
Expand Down
Loading
Loading