@ixo/common 1.1.0 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +1 -1
- package/CHANGELOG.md +0 -6
- package/README.md +1 -6
- package/dist/ai/nodes/generic-chat/generic-chat.node.d.ts +4 -4
- package/dist/ai/nodes/generic-chat/generic-chat.node.d.ts.map +1 -1
- package/dist/ai/nodes/generic-chat/generic-chat.node.js +1 -1
- package/dist/ai/nodes/generic-chat/generic-chat.node.js.map +1 -1
- package/dist/ai/semantic-router-factory/create-semantic-router.d.ts +2 -2
- package/dist/ai/semantic-router-factory/create-semantic-router.d.ts.map +1 -1
- package/dist/ai/semantic-router-factory/create-semantic-router.js.map +1 -1
- package/dist/ai/tools/action-caller.d.ts +3 -3
- package/dist/ai/tools/action-caller.d.ts.map +1 -1
- package/dist/ai/tools/ask-ixo-guru/ask-ixo-guru.d.ts.map +1 -1
- package/dist/ai/tools/ask-ixo-guru/ask-ixo-guru.js.map +1 -1
- package/dist/ai/tools/browser-tool-caller.d.ts +3 -3
- package/dist/ai/tools/browser-tool-caller.d.ts.map +1 -1
- package/dist/ai/tools/frontend-tool-caller.d.ts +2 -2
- package/dist/ai/tools/frontend-tool-caller.d.ts.map +1 -1
- package/dist/ai/tools/frontend-tool-caller.js +2 -1
- package/dist/ai/tools/frontend-tool-caller.js.map +1 -1
- package/dist/ai/tools/log-action-to-matrix.d.ts +2 -2
- package/dist/ai/tools/log-action-to-matrix.d.ts.map +1 -1
- package/dist/ai/tools/log-action-to-matrix.js.map +1 -1
- package/dist/ai/tools/parser-action-tool.d.ts +2 -2
- package/dist/ai/tools/parser-action-tool.d.ts.map +1 -1
- package/dist/ai/tools/parser-action-tool.js +5 -5
- package/dist/ai/tools/parser-action-tool.js.map +1 -1
- package/dist/ai/tools/parser-browser-tool.d.ts +2 -2
- package/dist/ai/tools/parser-browser-tool.d.ts.map +1 -1
- package/dist/ai/tools/parser-browser-tool.js +1 -1
- package/dist/ai/tools/parser-browser-tool.js.map +1 -1
- package/dist/ai/tools/scrape-web-page.d.ts +1 -1
- package/dist/ai/tools/scrape-web-page.d.ts.map +1 -1
- package/dist/ai/utils/doc-splitter.js.map +1 -1
- package/dist/ai/utils/generate-questions-from-chunks.d.ts +1 -1
- package/dist/ai/utils/generate-questions-from-chunks.d.ts.map +1 -1
- package/dist/ai/utils/json-to-yaml.js.map +1 -1
- package/dist/ai/utils/load-file.js +1 -1
- package/dist/ai/utils/load-file.js.map +1 -1
- package/dist/ai/utils/transformGraphStateMessageToListMessageResponse.d.ts.map +1 -1
- package/dist/ai/utils/transformGraphStateMessageToListMessageResponse.js +5 -3
- package/dist/ai/utils/transformGraphStateMessageToListMessageResponse.js.map +1 -1
- package/dist/ai/utils/verify-matrix-openId-token.d.ts.map +1 -1
- package/dist/ai/utils/verify-matrix-openId-token.js +2 -2
- package/dist/ai/utils/verify-matrix-openId-token.js.map +1 -1
- package/dist/services/env/env.service.d.ts.map +1 -1
- package/dist/services/env/env.service.js.map +1 -1
- package/dist/services/session-manager/session-manager.service.d.ts +2 -2
- package/dist/services/session-manager/session-manager.service.d.ts.map +1 -1
- package/dist/services/session-manager/session-manager.service.js +3 -2
- package/dist/services/session-manager/session-manager.service.js.map +1 -1
- package/package.json +7 -11
- package/src/ai/index.ts +1 -1
- package/src/ai/models/openai.test.ts +7 -8
- package/src/ai/nodes/generic-chat/generic-chat.node.ts +7 -4
- package/src/ai/nodes/generic-chat/index.ts +1 -1
- package/src/ai/nodes/index.ts +1 -1
- package/src/ai/semantic-router-factory/create-semantic-router.test.ts +8 -5
- package/src/ai/semantic-router-factory/create-semantic-router.ts +8 -5
- package/src/ai/tools/action-caller.ts +3 -3
- package/src/ai/tools/ask-ixo-guru/ask-ixo-guru.ts +6 -4
- package/src/ai/tools/browser-tool-caller.ts +3 -3
- package/src/ai/tools/frontend-tool-caller.ts +11 -6
- package/src/ai/tools/log-action-to-matrix.ts +2 -3
- package/src/ai/tools/parser-action-tool.ts +8 -8
- package/src/ai/tools/parser-browser-tool.ts +4 -4
- package/src/ai/tools/retriever-tool/retriever-tool.test.ts +30 -23
- package/src/ai/tools/scrape-web-page.ts +1 -1
- package/src/ai/utils/__tests__/doc-relevance-checker.test.ts +5 -3
- package/src/ai/utils/__tests__/json-to-yaml.test.ts +1 -1
- package/src/ai/utils/doc-splitter.ts +1 -1
- package/src/ai/utils/generate-questions-from-chunks.ts +1 -1
- package/src/ai/utils/json-to-yaml.ts +1 -1
- package/src/ai/utils/load-file.ts +1 -1
- package/src/ai/utils/transformGraphStateMessageToListMessageResponse.ts +8 -4
- package/src/ai/utils/verify-matrix-openId-token.ts +9 -6
- package/src/services/env/env-service.test.ts +1 -1
- package/src/services/env/env.service.ts +0 -1
- package/src/services/session-manager/session-manager.service.ts +6 -4
- package/src/utils/index.ts +1 -1
- package/tsconfig.json +8 -2
- package/tsconfig.tsbuildinfo +1 -1
- package/vitest.config.ts +2 -0
- package/.eslintrc.js +0 -9
- package/.prettierignore +0 -3
- package/.prettierrc.cjs +0 -4
- package/dist/ai/models/openai.test.d.ts +0 -2
- package/dist/ai/models/openai.test.d.ts.map +0 -1
- package/dist/ai/models/openai.test.js +0 -58
- package/dist/ai/models/openai.test.js.map +0 -1
- package/dist/ai/semantic-router-factory/create-semantic-router.test.d.ts +0 -2
- package/dist/ai/semantic-router-factory/create-semantic-router.test.d.ts.map +0 -1
- package/dist/ai/semantic-router-factory/create-semantic-router.test.js +0 -68
- package/dist/ai/semantic-router-factory/create-semantic-router.test.js.map +0 -1
- package/dist/ai/tools/retriever-tool/retriever-tool.test.d.ts +0 -2
- package/dist/ai/tools/retriever-tool/retriever-tool.test.d.ts.map +0 -1
- package/dist/ai/tools/retriever-tool/retriever-tool.test.js +0 -119
- package/dist/ai/tools/retriever-tool/retriever-tool.test.js.map +0 -1
- package/dist/ai/utils/__tests__/chunk-arr.test.d.ts +0 -2
- package/dist/ai/utils/__tests__/chunk-arr.test.d.ts.map +0 -1
- package/dist/ai/utils/__tests__/chunk-arr.test.js +0 -37
- package/dist/ai/utils/__tests__/chunk-arr.test.js.map +0 -1
- package/dist/ai/utils/__tests__/doc-relevance-checker.test.d.ts +0 -2
- package/dist/ai/utils/__tests__/doc-relevance-checker.test.d.ts.map +0 -1
- package/dist/ai/utils/__tests__/doc-relevance-checker.test.js +0 -80
- package/dist/ai/utils/__tests__/doc-relevance-checker.test.js.map +0 -1
- package/dist/ai/utils/__tests__/doc-splitter.test.d.ts +0 -2
- package/dist/ai/utils/__tests__/doc-splitter.test.d.ts.map +0 -1
- package/dist/ai/utils/__tests__/doc-splitter.test.js +0 -35
- package/dist/ai/utils/__tests__/doc-splitter.test.js.map +0 -1
- package/dist/ai/utils/__tests__/filter-similarity-search-results.test.d.ts +0 -2
- package/dist/ai/utils/__tests__/filter-similarity-search-results.test.d.ts.map +0 -1
- package/dist/ai/utils/__tests__/filter-similarity-search-results.test.js +0 -47
- package/dist/ai/utils/__tests__/filter-similarity-search-results.test.js.map +0 -1
- package/dist/ai/utils/__tests__/json-to-yaml.test.d.ts +0 -2
- package/dist/ai/utils/__tests__/json-to-yaml.test.d.ts.map +0 -1
- package/dist/ai/utils/__tests__/json-to-yaml.test.js +0 -63
- package/dist/ai/utils/__tests__/json-to-yaml.test.js.map +0 -1
- package/dist/ai/utils/__tests__/stringify-docs.test.d.ts +0 -2
- package/dist/ai/utils/__tests__/stringify-docs.test.d.ts.map +0 -1
- package/dist/ai/utils/__tests__/stringify-docs.test.js +0 -54
- package/dist/ai/utils/__tests__/stringify-docs.test.js.map +0 -1
- package/dist/services/env/env-service.test.d.ts +0 -2
- package/dist/services/env/env-service.test.d.ts.map +0 -1
- package/dist/services/env/env-service.test.js +0 -99
- package/dist/services/env/env-service.test.js.map +0 -1
- package/jest.config.js +0 -6
|
@@ -7,7 +7,7 @@ export const jsonToYaml = <T extends object>(
|
|
|
7
7
|
const isArray = Array.isArray(json);
|
|
8
8
|
|
|
9
9
|
if (isArray) {
|
|
10
|
-
return (json as unknown as
|
|
10
|
+
return (json as unknown as unknown[])
|
|
11
11
|
.map((item) => {
|
|
12
12
|
if (item !== null && typeof item === 'object') {
|
|
13
13
|
// Recursively process nested objects/arrays with increased indentation
|
|
@@ -162,7 +162,7 @@ const getErrorFromResponse = async (response: Response): Promise<unknown> => {
|
|
|
162
162
|
const json = await response.json();
|
|
163
163
|
|
|
164
164
|
return json;
|
|
165
|
-
} catch (
|
|
165
|
+
} catch (_error) {
|
|
166
166
|
if (response.bodyUsed) return 'Unknown error';
|
|
167
167
|
const errorMessage = await response.text();
|
|
168
168
|
return errorMessage;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
-
ToolMessage,
|
|
2
|
+
type ToolMessage,
|
|
3
3
|
type AIMessage,
|
|
4
4
|
type BaseMessage,
|
|
5
5
|
} from '@langchain/core/messages';
|
|
@@ -45,7 +45,11 @@ export function transformGraphStateMessageToListMessageResponse(
|
|
|
45
45
|
return {
|
|
46
46
|
messages: messages.reduce<MessageDto[]>((acc, message) => {
|
|
47
47
|
const toolMsg = message.type === 'tool' ? (message as ToolMessage) : null;
|
|
48
|
-
if (
|
|
48
|
+
if (
|
|
49
|
+
message.type !== 'system' &&
|
|
50
|
+
message.type !== 'tool' &&
|
|
51
|
+
!message.additional_kwargs?.isError
|
|
52
|
+
) {
|
|
49
53
|
// Extract reasoning from additional_kwargs
|
|
50
54
|
const additionalKwargs =
|
|
51
55
|
message.additional_kwargs as CleanAdditionalKwargs;
|
|
@@ -53,8 +57,8 @@ export function transformGraphStateMessageToListMessageResponse(
|
|
|
53
57
|
|
|
54
58
|
acc.push({
|
|
55
59
|
type: message.type === 'ai' ? 'ai' : 'human',
|
|
56
|
-
content: message.content
|
|
57
|
-
id: uuidFromString(message.id ?? message.content
|
|
60
|
+
content: String(message.content),
|
|
61
|
+
id: uuidFromString(message.id ?? String(message.content)),
|
|
58
62
|
toolCalls: (message as AIMessage).tool_calls?.map((toolCall) => ({
|
|
59
63
|
name: toolCall.name,
|
|
60
64
|
args: toolCall.args,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Logger } from
|
|
1
|
+
import { Logger } from '@ixo/logger';
|
|
2
2
|
|
|
3
3
|
const ERROR_CODES = ['M_UNKNOWN_TOKEN', 'M_FORBIDDEN'];
|
|
4
4
|
export async function verifyMatrixOpenIdToken(
|
|
@@ -23,9 +23,9 @@ export async function verifyMatrixOpenIdToken(
|
|
|
23
23
|
userId: userInfo.sub, // The verified user ID
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
|
-
const error = await response.json() as { errcode: string };
|
|
26
|
+
const error = (await response.json()) as { errcode: string };
|
|
27
27
|
const isAuthError = ERROR_CODES.includes(error.errcode);
|
|
28
|
-
if (!isAuthError) {
|
|
28
|
+
if (!isAuthError) {
|
|
29
29
|
Logger.error('Error verifying Matrix OpenID token:', error);
|
|
30
30
|
}
|
|
31
31
|
return {
|
|
@@ -33,11 +33,14 @@ export async function verifyMatrixOpenIdToken(
|
|
|
33
33
|
error: `Server returned ${response.status}: ${response.statusText}`,
|
|
34
34
|
};
|
|
35
35
|
} catch (error) {
|
|
36
|
-
const errorMessage =
|
|
37
|
-
error instanceof Error ? error.message : String(error);
|
|
36
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
38
37
|
const errorStack = error instanceof Error ? error.stack : undefined;
|
|
39
38
|
|
|
40
|
-
console.error(
|
|
39
|
+
console.error(
|
|
40
|
+
'Error verifying Matrix OpenID token:',
|
|
41
|
+
errorMessage,
|
|
42
|
+
errorStack,
|
|
43
|
+
);
|
|
41
44
|
return {
|
|
42
45
|
isValid: false,
|
|
43
46
|
error: error instanceof Error ? error.message : 'Unknown error',
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Logger } from '@ixo/logger';
|
|
2
2
|
import { MatrixManager } from '@ixo/matrix';
|
|
3
3
|
import { getMatrixHomeServerCroppedForDid } from '@ixo/oracles-chain-client';
|
|
4
|
-
import { Database } from 'better-sqlite3';
|
|
4
|
+
import { type Database } from 'better-sqlite3';
|
|
5
5
|
import { getChatOpenAiModel } from '../../ai/index.js';
|
|
6
|
-
import { MemoryEngineService } from '../memory-engine/memory-engine.service.js';
|
|
6
|
+
import { type MemoryEngineService } from '../memory-engine/memory-engine.service.js';
|
|
7
7
|
import { type UserContextData } from '../memory-engine/types.js';
|
|
8
8
|
import {
|
|
9
9
|
type ChatSession,
|
|
@@ -99,7 +99,7 @@ ___________________________________________________________
|
|
|
99
99
|
`,
|
|
100
100
|
);
|
|
101
101
|
|
|
102
|
-
const title = response.content
|
|
102
|
+
const title = String(response.content);
|
|
103
103
|
return title;
|
|
104
104
|
}
|
|
105
105
|
|
|
@@ -347,7 +347,9 @@ ___________________________________________________________
|
|
|
347
347
|
public async createSession(
|
|
348
348
|
createSessionDto: CreateChatSessionDto,
|
|
349
349
|
): Promise<CreateChatSessionResponseDto> {
|
|
350
|
-
const userHomeServer =
|
|
350
|
+
const userHomeServer =
|
|
351
|
+
createSessionDto.homeServer ||
|
|
352
|
+
(await getMatrixHomeServerCroppedForDid(createSessionDto.did));
|
|
351
353
|
const { roomId } = await this.matrixManger.getOracleRoomIdWithHomeServer({
|
|
352
354
|
userDid: createSessionDto.did,
|
|
353
355
|
oracleEntityDid: createSessionDto.oracleEntityDid,
|
package/src/utils/index.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './get-user-subscription.js';
|
|
1
|
+
export * from './get-user-subscription.js';
|
package/tsconfig.json
CHANGED
|
@@ -11,6 +11,12 @@
|
|
|
11
11
|
"src/*": ["src/*"]
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
|
-
"include": ["src/**/*"
|
|
15
|
-
"exclude": [
|
|
14
|
+
"include": ["src/**/*"],
|
|
15
|
+
"exclude": [
|
|
16
|
+
"node_modules",
|
|
17
|
+
"dist",
|
|
18
|
+
"integration",
|
|
19
|
+
"**/*.test.ts",
|
|
20
|
+
"**/*.spec.ts"
|
|
21
|
+
]
|
|
16
22
|
}
|