@activepieces/piece-goodmem 0.0.1
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/package.json +16 -0
- package/src/index.d.ts +9 -0
- package/src/index.d.ts.map +1 -0
- package/src/index.js +69 -0
- package/src/index.js.map +1 -0
- package/src/lib/actions/create-memory.d.ts +16 -0
- package/src/lib/actions/create-memory.d.ts.map +1 -0
- package/src/lib/actions/create-memory.js +143 -0
- package/src/lib/actions/create-memory.js.map +1 -0
- package/src/lib/actions/create-space.d.ts +12 -0
- package/src/lib/actions/create-space.d.ts.map +1 -0
- package/src/lib/actions/create-space.js +187 -0
- package/src/lib/actions/create-space.js.map +1 -0
- package/src/lib/actions/delete-memory.d.ts +7 -0
- package/src/lib/actions/delete-memory.d.ts.map +1 -0
- package/src/lib/actions/delete-memory.js +49 -0
- package/src/lib/actions/delete-memory.js.map +1 -0
- package/src/lib/actions/get-memory.d.ts +8 -0
- package/src/lib/actions/get-memory.d.ts.map +1 -0
- package/src/lib/actions/get-memory.js +54 -0
- package/src/lib/actions/get-memory.js.map +1 -0
- package/src/lib/actions/retrieve-memories.d.ts +25 -0
- package/src/lib/actions/retrieve-memories.d.ts.map +1 -0
- package/src/lib/actions/retrieve-memories.js +182 -0
- package/src/lib/actions/retrieve-memories.js.map +1 -0
- package/src/lib/common/index.d.ts +26 -0
- package/src/lib/common/index.d.ts.map +1 -0
- package/src/lib/common/index.js +210 -0
- package/src/lib/common/index.js.map +1 -0
package/package.json
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@activepieces/piece-goodmem",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"main": "./src/index.js",
|
|
5
|
+
"types": "./src/index.d.ts",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "tsc -p tsconfig.lib.json && cp package.json dist/",
|
|
8
|
+
"lint": "eslint 'src/**/*.ts'"
|
|
9
|
+
},
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"@activepieces/pieces-common": "0.12.0",
|
|
12
|
+
"@activepieces/pieces-framework": "0.26.0",
|
|
13
|
+
"@activepieces/shared": "0.43.0",
|
|
14
|
+
"tslib": "2.6.2"
|
|
15
|
+
}
|
|
16
|
+
}
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const goodmemAuth: import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
baseUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
|
+
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
4
|
+
}>;
|
|
5
|
+
export declare const goodmem: import("@activepieces/pieces-framework").Piece<import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
6
|
+
baseUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
7
|
+
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
8
|
+
}>>;
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,WAAW;;;EAuCtB,CAAC;AAEH,eAAO,MAAM,OAAO;;;GAiBlB,CAAC"}
|
package/src/index.js
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.goodmem = exports.goodmemAuth = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const shared_1 = require("@activepieces/shared");
|
|
7
|
+
const create_memory_1 = require("./lib/actions/create-memory");
|
|
8
|
+
const retrieve_memories_1 = require("./lib/actions/retrieve-memories");
|
|
9
|
+
const delete_memory_1 = require("./lib/actions/delete-memory");
|
|
10
|
+
const get_memory_1 = require("./lib/actions/get-memory");
|
|
11
|
+
const create_space_1 = require("./lib/actions/create-space");
|
|
12
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
13
|
+
exports.goodmemAuth = pieces_framework_1.PieceAuth.CustomAuth({
|
|
14
|
+
displayName: 'GoodMem Authentication',
|
|
15
|
+
description: 'Connect to your GoodMem API instance for vector-based memory storage and semantic retrieval',
|
|
16
|
+
props: {
|
|
17
|
+
baseUrl: pieces_framework_1.Property.ShortText({
|
|
18
|
+
displayName: 'Base URL',
|
|
19
|
+
description: 'The base URL of your GoodMem API server (e.g., https://api.goodmem.ai or http://localhost:8080)',
|
|
20
|
+
required: true,
|
|
21
|
+
}),
|
|
22
|
+
apiKey: pieces_framework_1.PieceAuth.SecretText({
|
|
23
|
+
displayName: 'API Key',
|
|
24
|
+
description: 'Your GoodMem API key for authentication (X-API-Key)',
|
|
25
|
+
required: true,
|
|
26
|
+
}),
|
|
27
|
+
},
|
|
28
|
+
validate: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
|
|
29
|
+
try {
|
|
30
|
+
const baseUrl = auth.baseUrl.replace(/\/$/, '');
|
|
31
|
+
yield pieces_common_1.httpClient.sendRequest({
|
|
32
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
33
|
+
url: `${baseUrl}/v1/spaces`,
|
|
34
|
+
headers: {
|
|
35
|
+
'X-API-Key': auth.apiKey,
|
|
36
|
+
'Content-Type': 'application/json',
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
return {
|
|
40
|
+
valid: true,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
return {
|
|
45
|
+
valid: false,
|
|
46
|
+
error: 'Invalid API key or base URL. Please check your credentials.',
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
}),
|
|
50
|
+
required: true,
|
|
51
|
+
});
|
|
52
|
+
exports.goodmem = (0, pieces_framework_1.createPiece)({
|
|
53
|
+
displayName: 'GoodMem',
|
|
54
|
+
description: 'Store documents as memories with vector embeddings and perform similarity-based semantic retrieval using GoodMem',
|
|
55
|
+
auth: exports.goodmemAuth,
|
|
56
|
+
minimumSupportedRelease: '0.36.1',
|
|
57
|
+
logoUrl: 'https://cdn.activepieces.com/pieces/goodmem.png',
|
|
58
|
+
categories: [shared_1.PieceCategory.ARTIFICIAL_INTELLIGENCE],
|
|
59
|
+
authors: ['bashareid', 'sanket-a11y'],
|
|
60
|
+
actions: [
|
|
61
|
+
create_space_1.createSpace,
|
|
62
|
+
create_memory_1.createMemory,
|
|
63
|
+
retrieve_memories_1.retrieveMemories,
|
|
64
|
+
get_memory_1.getMemory,
|
|
65
|
+
delete_memory_1.deleteMemory,
|
|
66
|
+
],
|
|
67
|
+
triggers: [],
|
|
68
|
+
});
|
|
69
|
+
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;AAAA,qEAIwC;AACxC,iDAAqD;AACrD,+DAA2D;AAC3D,uEAAmE;AACnE,+DAA2D;AAC3D,yDAAqD;AACrD,6DAAyD;AACzD,+DAAqE;AAExD,QAAA,WAAW,GAAG,4BAAS,CAAC,UAAU,CAAC;IAC9C,WAAW,EAAE,wBAAwB;IACrC,WAAW,EACT,6FAA6F;IAC/F,KAAK,EAAE;QACL,OAAO,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC1B,WAAW,EAAE,UAAU;YACvB,WAAW,EACT,iGAAiG;YACnG,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,MAAM,EAAE,4BAAS,CAAC,UAAU,CAAC;YAC3B,WAAW,EAAE,SAAS;YACtB,WAAW,EAAE,qDAAqD;YAClE,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;IACD,QAAQ,EAAE,KAAiB,EAAE,oDAAZ,EAAE,IAAI,EAAE;QACvB,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;YAChD,MAAM,0BAAU,CAAC,WAAW,CAAC;gBAC3B,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,GAAG,EAAE,GAAG,OAAO,YAAY;gBAC3B,OAAO,EAAE;oBACP,WAAW,EAAE,IAAI,CAAC,MAAM;oBACxB,cAAc,EAAE,kBAAkB;iBACnC;aACF,CAAC,CAAC;YACH,OAAO;gBACL,KAAK,EAAE,IAAI;aACZ,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO;gBACL,KAAK,EAAE,KAAK;gBACZ,KAAK,EAAE,6DAA6D;aACrE,CAAC;QACJ,CAAC;IACH,CAAC,CAAA;IACD,QAAQ,EAAE,IAAI;CACf,CAAC,CAAC;AAEU,QAAA,OAAO,GAAG,IAAA,8BAAW,EAAC;IACjC,WAAW,EAAE,SAAS;IACtB,WAAW,EACT,kHAAkH;IACpH,IAAI,EAAE,mBAAW;IACjB,uBAAuB,EAAE,QAAQ;IACjC,OAAO,EAAE,iDAAiD;IAC1D,UAAU,EAAE,CAAC,sBAAa,CAAC,uBAAuB,CAAC;IACnD,OAAO,EAAE,CAAC,WAAW,EAAE,aAAa,CAAC;IACrC,OAAO,EAAE;QACP,0BAAW;QACX,4BAAY;QACZ,oCAAgB;QAChB,sBAAS;QACT,4BAAY;KACb;IACD,QAAQ,EAAE,EAAE;CACb,CAAC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare const createMemory: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
baseUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
|
+
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
4
|
+
}>, {
|
|
5
|
+
spaceId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
6
|
+
baseUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
7
|
+
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
8
|
+
}>>;
|
|
9
|
+
file: import("@activepieces/pieces-framework").FileProperty<false>;
|
|
10
|
+
textContent: import("@activepieces/pieces-framework").LongTextProperty<false>;
|
|
11
|
+
source: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
12
|
+
author: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
13
|
+
tags: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
14
|
+
metadata: import("@activepieces/pieces-framework").JsonProperty<false>;
|
|
15
|
+
}>;
|
|
16
|
+
//# sourceMappingURL=create-memory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-memory.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/create-memory.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,YAAY;;;;;;;;;;;;;;EA6GvB,CAAC"}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createMemory = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
|
+
const index_1 = require("../../index");
|
|
8
|
+
const common_1 = require("../common");
|
|
9
|
+
exports.createMemory = (0, pieces_framework_1.createAction)({
|
|
10
|
+
auth: index_1.goodmemAuth,
|
|
11
|
+
name: 'create_memory',
|
|
12
|
+
displayName: 'Create Memory',
|
|
13
|
+
description: 'Store a document as a new memory in a space. The memory is processed asynchronously - chunked into searchable pieces and embedded into vectors. Accepts a file or plain text.',
|
|
14
|
+
props: {
|
|
15
|
+
spaceId: common_1.spaceIdDropdown,
|
|
16
|
+
file: pieces_framework_1.Property.File({
|
|
17
|
+
displayName: 'File',
|
|
18
|
+
description: 'A file to store as memory (PDF, DOCX, image, etc.). Connect the output of a trigger or action that provides a file. Content type is auto-detected from the file extension.',
|
|
19
|
+
required: false,
|
|
20
|
+
}),
|
|
21
|
+
textContent: pieces_framework_1.Property.LongText({
|
|
22
|
+
displayName: 'Text Content',
|
|
23
|
+
description: 'Plain text content to store as memory (sent as text/plain). If both File and Text Content are provided, the file takes priority.',
|
|
24
|
+
required: false,
|
|
25
|
+
}),
|
|
26
|
+
source: pieces_framework_1.Property.ShortText({
|
|
27
|
+
displayName: 'Source',
|
|
28
|
+
description: 'Where this memory came from (e.g., "google-drive", "gmail", "manual upload"). Stored in metadata.source',
|
|
29
|
+
required: false,
|
|
30
|
+
}),
|
|
31
|
+
author: pieces_framework_1.Property.ShortText({
|
|
32
|
+
displayName: 'Author',
|
|
33
|
+
description: 'The author or creator of the content. Stored in metadata.author',
|
|
34
|
+
required: false,
|
|
35
|
+
}),
|
|
36
|
+
tags: pieces_framework_1.Property.ShortText({
|
|
37
|
+
displayName: 'Tags',
|
|
38
|
+
description: 'Comma-separated tags for categorization (e.g., "legal,research,important"). Stored in metadata.tags as an array',
|
|
39
|
+
required: false,
|
|
40
|
+
}),
|
|
41
|
+
metadata: pieces_framework_1.Property.Json({
|
|
42
|
+
displayName: 'Additional Metadata',
|
|
43
|
+
description: 'Extra key-value metadata as JSON. Merged with Source, Author, and Tags fields above',
|
|
44
|
+
required: false,
|
|
45
|
+
}),
|
|
46
|
+
},
|
|
47
|
+
run(context) {
|
|
48
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
49
|
+
var _a;
|
|
50
|
+
const { spaceId, file, textContent, source, author, tags, metadata } = context.propsValue;
|
|
51
|
+
const { baseUrl: rawBaseUrl, apiKey } = (0, common_1.extractAuthFromContext)(context.auth);
|
|
52
|
+
const baseUrl = (0, common_1.getBaseUrl)(rawBaseUrl);
|
|
53
|
+
const requestBody = {
|
|
54
|
+
spaceId,
|
|
55
|
+
};
|
|
56
|
+
if (file && file.base64) {
|
|
57
|
+
// File provided — auto-detect content type from extension
|
|
58
|
+
const detectedMimeType = file.extension
|
|
59
|
+
? getMimeType(file.extension)
|
|
60
|
+
: null;
|
|
61
|
+
const mimeType = detectedMimeType || 'application/octet-stream';
|
|
62
|
+
// For text file types, decode base64 and send as originalContent
|
|
63
|
+
if (mimeType.startsWith('text/')) {
|
|
64
|
+
const decoded = Buffer.from(file.base64, 'base64').toString('utf-8');
|
|
65
|
+
requestBody.contentType = mimeType;
|
|
66
|
+
requestBody.originalContent = decoded;
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
// For binary types (PDF, images, etc.), send as base64
|
|
70
|
+
requestBody.contentType = mimeType;
|
|
71
|
+
requestBody.originalContentB64 = file.base64;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
else if (textContent) {
|
|
75
|
+
// Plain text provided
|
|
76
|
+
requestBody.contentType = 'text/plain';
|
|
77
|
+
requestBody.originalContent = textContent;
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
return {
|
|
81
|
+
success: false,
|
|
82
|
+
error: 'No content provided. Please provide a file or text content.',
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
const mergedMetadata = {};
|
|
86
|
+
if (metadata && typeof metadata === 'object' && Object.keys(metadata).length > 0) {
|
|
87
|
+
Object.assign(mergedMetadata, metadata);
|
|
88
|
+
}
|
|
89
|
+
if (source) {
|
|
90
|
+
mergedMetadata.source = source;
|
|
91
|
+
}
|
|
92
|
+
if (author) {
|
|
93
|
+
mergedMetadata.author = author;
|
|
94
|
+
}
|
|
95
|
+
if (tags) {
|
|
96
|
+
mergedMetadata.tags = tags.split(',').map((t) => t.trim()).filter((t) => t.length > 0);
|
|
97
|
+
}
|
|
98
|
+
if (Object.keys(mergedMetadata).length > 0) {
|
|
99
|
+
requestBody.metadata = mergedMetadata;
|
|
100
|
+
}
|
|
101
|
+
try {
|
|
102
|
+
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
103
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
104
|
+
url: `${baseUrl}/v1/memories`,
|
|
105
|
+
headers: (0, common_1.getCommonHeaders)(apiKey),
|
|
106
|
+
body: requestBody,
|
|
107
|
+
});
|
|
108
|
+
return response.body;
|
|
109
|
+
}
|
|
110
|
+
catch (error) {
|
|
111
|
+
return {
|
|
112
|
+
success: false,
|
|
113
|
+
error: error.message || 'Failed to create memory',
|
|
114
|
+
details: ((_a = error.response) === null || _a === void 0 ? void 0 : _a.body) || error,
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
},
|
|
119
|
+
});
|
|
120
|
+
function getMimeType(extension) {
|
|
121
|
+
const mimeTypes = {
|
|
122
|
+
pdf: 'application/pdf',
|
|
123
|
+
png: 'image/png',
|
|
124
|
+
jpg: 'image/jpeg',
|
|
125
|
+
jpeg: 'image/jpeg',
|
|
126
|
+
gif: 'image/gif',
|
|
127
|
+
webp: 'image/webp',
|
|
128
|
+
txt: 'text/plain',
|
|
129
|
+
html: 'text/html',
|
|
130
|
+
md: 'text/markdown',
|
|
131
|
+
csv: 'text/csv',
|
|
132
|
+
json: 'application/json',
|
|
133
|
+
xml: 'application/xml',
|
|
134
|
+
doc: 'application/msword',
|
|
135
|
+
docx: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
|
136
|
+
xls: 'application/vnd.ms-excel',
|
|
137
|
+
xlsx: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
|
138
|
+
ppt: 'application/vnd.ms-powerpoint',
|
|
139
|
+
pptx: 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
|
|
140
|
+
};
|
|
141
|
+
return mimeTypes[extension.toLowerCase().replace('.', '')] || null;
|
|
142
|
+
}
|
|
143
|
+
//# sourceMappingURL=create-memory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-memory.js","sourceRoot":"","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D,OAAO,EAAE,CAAA,MAAA,KAAK,CAAC,QAAQ,0CAAE,IAAI,KAAI,KAAK;iBACvC,CAAC;YACJ,CAAC;QACH,CAAC;KAAA;CACF,CAAC,CAAC;AAEH,SAAS,WAAW,CAAC,SAAiB;IACpC,MAAM,SAAS,GAA2B;QACxC,GAAG,EAAE,iBAAiB;QACtB,GAAG,EAAE,WAAW;QAChB,GAAG,EAAE,YAAY;QACjB,IAAI,EAAE,YAAY;QAClB,GAAG,EAAE,WAAW;QAChB,IAAI,EAAE,YAAY;QAClB,GAAG,EAAE,YAAY;QACjB,IAAI,EAAE,WAAW;QACjB,EAAE,EAAE,eAAe;QACnB,GAAG,EAAE,UAAU;QACf,IAAI,EAAE,kBAAkB;QACxB,GAAG,EAAE,iBAAiB;QACtB,GAAG,EAAE,oBAAoB;QACzB,IAAI,EAAE,yEAAyE;QAC/E,GAAG,EAAE,0BAA0B;QAC/B,IAAI,EAAE,mEAAmE;QACzE,GAAG,EAAE,+BAA+B;QACpC,IAAI,EAAE,2EAA2E;KAClF,CAAC;IACF,OAAO,SAAS,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,IAAI,IAAI,CAAC;AACrE,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const createSpace: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
baseUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
|
+
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
4
|
+
}>, {
|
|
5
|
+
name: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
6
|
+
embedderId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
7
|
+
baseUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
8
|
+
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
9
|
+
}>>;
|
|
10
|
+
advancedChunking: import("@activepieces/pieces-framework").DynamicProperties<false, undefined>;
|
|
11
|
+
}>;
|
|
12
|
+
//# sourceMappingURL=create-space.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-space.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/create-space.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,WAAW;;;;;;;;;;EA+KtB,CAAC"}
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createSpace = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
|
+
const index_1 = require("../../index");
|
|
8
|
+
const common_1 = require("../common");
|
|
9
|
+
exports.createSpace = (0, pieces_framework_1.createAction)({
|
|
10
|
+
auth: index_1.goodmemAuth,
|
|
11
|
+
name: 'create_space',
|
|
12
|
+
displayName: 'Create Space',
|
|
13
|
+
description: 'Create a new space or reuse an existing one. A space is a logical container for organizing related memories, configured with embedders that convert text to vector embeddings',
|
|
14
|
+
props: {
|
|
15
|
+
name: pieces_framework_1.Property.ShortText({
|
|
16
|
+
displayName: 'Space Name',
|
|
17
|
+
description: 'A unique name for the space. If a space with this name already exists, its ID will be returned instead of creating a duplicate',
|
|
18
|
+
required: true,
|
|
19
|
+
}),
|
|
20
|
+
embedderId: pieces_framework_1.Property.Dropdown({
|
|
21
|
+
displayName: 'Embedder',
|
|
22
|
+
description: 'The embedder model that converts text into vector representations for similarity search',
|
|
23
|
+
required: true,
|
|
24
|
+
refreshers: [],
|
|
25
|
+
auth: index_1.goodmemAuth,
|
|
26
|
+
options(_a) {
|
|
27
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth }) {
|
|
28
|
+
if (!auth) {
|
|
29
|
+
return { disabled: true, placeholder: 'Connect your GoodMem account first', options: [] };
|
|
30
|
+
}
|
|
31
|
+
try {
|
|
32
|
+
const authProps = auth.props || auth;
|
|
33
|
+
const baseUrl = (authProps.baseUrl || '').replace(/\/$/, '');
|
|
34
|
+
const apiKey = authProps.apiKey || '';
|
|
35
|
+
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
36
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
37
|
+
url: `${baseUrl}/v1/embedders`,
|
|
38
|
+
headers: {
|
|
39
|
+
'X-API-Key': apiKey,
|
|
40
|
+
'Content-Type': 'application/json',
|
|
41
|
+
'Accept': 'application/json',
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
const body = response.body;
|
|
45
|
+
const embedders = Array.isArray(body) ? body : ((body === null || body === void 0 ? void 0 : body.embedders) || []);
|
|
46
|
+
return {
|
|
47
|
+
disabled: false,
|
|
48
|
+
options: embedders.map((e) => ({
|
|
49
|
+
label: `${e.displayName || e.name || e.modelIdentifier || 'Unnamed'} (${e.modelIdentifier || e.model || 'unknown'})`,
|
|
50
|
+
value: e.embedderId || e.id,
|
|
51
|
+
})),
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
return { disabled: true, placeholder: 'Failed to load embedders. Check your connection.', options: [] };
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
},
|
|
59
|
+
}),
|
|
60
|
+
advancedChunking: pieces_framework_1.Property.DynamicProperties({
|
|
61
|
+
displayName: 'Advanced Chunking Options',
|
|
62
|
+
required: false,
|
|
63
|
+
refreshers: [],
|
|
64
|
+
auth: pieces_framework_1.PieceAuth.None(),
|
|
65
|
+
props: () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
66
|
+
return {
|
|
67
|
+
chunkSize: pieces_framework_1.Property.Number({
|
|
68
|
+
displayName: 'Chunk Size',
|
|
69
|
+
description: 'Number of characters per chunk when splitting documents',
|
|
70
|
+
required: false,
|
|
71
|
+
defaultValue: 256,
|
|
72
|
+
}),
|
|
73
|
+
chunkOverlap: pieces_framework_1.Property.Number({
|
|
74
|
+
displayName: 'Chunk Overlap',
|
|
75
|
+
description: 'Number of overlapping characters between consecutive chunks',
|
|
76
|
+
required: false,
|
|
77
|
+
defaultValue: 25,
|
|
78
|
+
}),
|
|
79
|
+
keepStrategy: pieces_framework_1.Property.StaticDropdown({
|
|
80
|
+
displayName: 'Keep Separator Strategy',
|
|
81
|
+
description: 'Where to attach the separator when splitting',
|
|
82
|
+
required: false,
|
|
83
|
+
defaultValue: 'KEEP_END',
|
|
84
|
+
options: {
|
|
85
|
+
disabled: false,
|
|
86
|
+
options: [
|
|
87
|
+
{ label: 'Keep at End (default)', value: 'KEEP_END' },
|
|
88
|
+
{ label: 'Keep at Start', value: 'KEEP_START' },
|
|
89
|
+
{ label: 'Discard', value: 'DISCARD' },
|
|
90
|
+
],
|
|
91
|
+
},
|
|
92
|
+
}),
|
|
93
|
+
lengthMeasurement: pieces_framework_1.Property.StaticDropdown({
|
|
94
|
+
displayName: 'Length Measurement',
|
|
95
|
+
description: 'How chunk size is measured',
|
|
96
|
+
required: false,
|
|
97
|
+
defaultValue: 'CHARACTER_COUNT',
|
|
98
|
+
options: {
|
|
99
|
+
disabled: false,
|
|
100
|
+
options: [
|
|
101
|
+
{ label: 'Character Count (default)', value: 'CHARACTER_COUNT' },
|
|
102
|
+
{ label: 'Token Count', value: 'TOKEN_COUNT' },
|
|
103
|
+
],
|
|
104
|
+
},
|
|
105
|
+
}),
|
|
106
|
+
};
|
|
107
|
+
}),
|
|
108
|
+
}),
|
|
109
|
+
},
|
|
110
|
+
run(context) {
|
|
111
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
112
|
+
var _a;
|
|
113
|
+
const { name, embedderId, advancedChunking } = context.propsValue;
|
|
114
|
+
const { baseUrl: rawBaseUrl, apiKey } = (0, common_1.extractAuthFromContext)(context.auth);
|
|
115
|
+
const baseUrl = (0, common_1.getBaseUrl)(rawBaseUrl);
|
|
116
|
+
const chunkSize = (advancedChunking === null || advancedChunking === void 0 ? void 0 : advancedChunking.chunkSize) || 256;
|
|
117
|
+
const chunkOverlap = (advancedChunking === null || advancedChunking === void 0 ? void 0 : advancedChunking.chunkOverlap) || 25;
|
|
118
|
+
const keepStrategy = (advancedChunking === null || advancedChunking === void 0 ? void 0 : advancedChunking.keepStrategy) || 'KEEP_END';
|
|
119
|
+
const lengthMeasurement = (advancedChunking === null || advancedChunking === void 0 ? void 0 : advancedChunking.lengthMeasurement) || 'CHARACTER_COUNT';
|
|
120
|
+
// Check if a space with the same name already exists
|
|
121
|
+
try {
|
|
122
|
+
const listResponse = yield pieces_common_1.httpClient.sendRequest({
|
|
123
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
124
|
+
url: `${baseUrl}/v1/spaces`,
|
|
125
|
+
headers: (0, common_1.getCommonHeaders)(apiKey),
|
|
126
|
+
});
|
|
127
|
+
const body = listResponse.body;
|
|
128
|
+
const spaces = Array.isArray(body) ? body : ((body === null || body === void 0 ? void 0 : body.spaces) || []);
|
|
129
|
+
if (spaces.length > 0) {
|
|
130
|
+
const existing = spaces.find((s) => s.name === name);
|
|
131
|
+
if (existing) {
|
|
132
|
+
return {
|
|
133
|
+
success: true,
|
|
134
|
+
spaceId: existing.spaceId,
|
|
135
|
+
name: existing.name,
|
|
136
|
+
embedderId,
|
|
137
|
+
message: 'Space already exists, reusing existing space',
|
|
138
|
+
reused: true,
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
catch (listError) {
|
|
144
|
+
// If listing fails, proceed to create
|
|
145
|
+
}
|
|
146
|
+
const requestBody = {
|
|
147
|
+
name,
|
|
148
|
+
spaceEmbedders: [{ embedderId, defaultRetrievalWeight: 1.0 }],
|
|
149
|
+
defaultChunkingConfig: {
|
|
150
|
+
recursive: {
|
|
151
|
+
chunkSize,
|
|
152
|
+
chunkOverlap,
|
|
153
|
+
separators: ['\n\n', '\n', '. ', ' ', ''],
|
|
154
|
+
keepStrategy,
|
|
155
|
+
separatorIsRegex: false,
|
|
156
|
+
lengthMeasurement,
|
|
157
|
+
},
|
|
158
|
+
},
|
|
159
|
+
};
|
|
160
|
+
try {
|
|
161
|
+
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
162
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
163
|
+
url: `${baseUrl}/v1/spaces`,
|
|
164
|
+
headers: (0, common_1.getCommonHeaders)(apiKey),
|
|
165
|
+
body: requestBody,
|
|
166
|
+
});
|
|
167
|
+
return {
|
|
168
|
+
success: true,
|
|
169
|
+
spaceId: response.body.spaceId,
|
|
170
|
+
name: response.body.name,
|
|
171
|
+
embedderId,
|
|
172
|
+
chunkingConfig: requestBody.defaultChunkingConfig,
|
|
173
|
+
message: 'Space created successfully',
|
|
174
|
+
reused: false,
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
catch (error) {
|
|
178
|
+
return {
|
|
179
|
+
success: false,
|
|
180
|
+
error: error.message || 'Failed to create space',
|
|
181
|
+
details: ((_a = error.response) === null || _a === void 0 ? void 0 : _a.body) || error,
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
},
|
|
186
|
+
});
|
|
187
|
+
//# sourceMappingURL=create-space.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-space.js","sourceRoot":"","sources":["../../../../src/lib/actions/create-space.ts"],"names":[],"mappings":";;;;AAAA,qEAAwH;AACxH,+DAAqE;AACrE,uCAA0C;AAC1C,sCAAiF;AAEpE,QAAA,WAAW,GAAG,IAAA,+BAAY,EAAC;IACtC,IAAI,EAAE,mBAAW;IACjB,IAAI,EAAE,cAAc;IACpB,WAAW,EAAE,cAAc;IAC3B,WAAW,EAAE,+KAA+K;IAC5L,KAAK,EAAE;QACL,IAAI,EAAE,2BAAQ,CAAC,SAAS,CAAC;Y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;gBAC7D,qBAAqB,EAAE;oBACrB,SAAS,EAAE;wBACT,SAAS;wBACT,YAAY;wBACZ,UAAU,EAAE,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,CAAC;wBACzC,YAAY;wBACZ,gBAAgB,EAAE,KAAK;wBACvB,iBAAiB;qBAClB;iBACF;aACF,CAAC;YAEF,IAAI,CAAC;gBACH,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAC;oBAC5C,MAAM,EAAE,0BAAU,CAAC,IAAI;oBACvB,GAAG,EAAE,GAAG,OAAO,YAAY;oBAC3B,OAAO,EAAE,IAAA,yBAAgB,EAAC,MAAM,CAAC;oBACjC,IAAI,EAAE,WAAW;iBAClB,CAAC,CAAC;gBAEH,OAAO;oBACL,OAAO,EAAE,IAAI;oBACb,OAAO,EAAE,QAAQ,CAAC,IAAI,CAAC,OAAO;oBAC9B,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,IAAI;oBACxB,UAAU;oBACV,cAAc,EAAE,WAAW,CAAC,qBAAqB;oBACjD,OAAO,EAAE,4BAA4B;oBACrC,MAAM,EAAE,KAAK;iBACd,CAAC;YACJ,CAAC;YAAC,OAAO,KAAU,EAAE,CAAC;gBACpB,OAAO;oBACL,OAAO,EAAE,KAAK;oBACd,KAAK,EAAE,KAAK,CAAC,OAAO,IAAI,wBAAwB;oBAChD,OAAO,EAAE,CAAA,MAAA,KAAK,CAAC,QAAQ,0CAAE,IAAI,KAAI,KAAK;iBACvC,CAAC;YACJ,CAAC;QACH,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const deleteMemory: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
baseUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
|
+
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
4
|
+
}>, {
|
|
5
|
+
memoryId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
6
|
+
}>;
|
|
7
|
+
//# sourceMappingURL=delete-memory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete-memory.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/delete-memory.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,YAAY;;;;;EAqCvB,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deleteMemory = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
|
+
const index_1 = require("../../index");
|
|
8
|
+
const common_1 = require("../common");
|
|
9
|
+
exports.deleteMemory = (0, pieces_framework_1.createAction)({
|
|
10
|
+
auth: index_1.goodmemAuth,
|
|
11
|
+
name: 'delete_memory',
|
|
12
|
+
displayName: 'Delete Memory',
|
|
13
|
+
description: 'Permanently delete a memory and its associated chunks and vector embeddings.',
|
|
14
|
+
props: {
|
|
15
|
+
memoryId: pieces_framework_1.Property.ShortText({
|
|
16
|
+
displayName: 'Memory ID',
|
|
17
|
+
description: 'The UUID of the memory to delete (returned by Create Memory)',
|
|
18
|
+
required: true,
|
|
19
|
+
}),
|
|
20
|
+
},
|
|
21
|
+
run(context) {
|
|
22
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
23
|
+
var _a;
|
|
24
|
+
const { memoryId } = context.propsValue;
|
|
25
|
+
const { baseUrl: rawBaseUrl, apiKey } = (0, common_1.extractAuthFromContext)(context.auth);
|
|
26
|
+
const baseUrl = (0, common_1.getBaseUrl)(rawBaseUrl);
|
|
27
|
+
try {
|
|
28
|
+
yield pieces_common_1.httpClient.sendRequest({
|
|
29
|
+
method: pieces_common_1.HttpMethod.DELETE,
|
|
30
|
+
url: `${baseUrl}/v1/memories/${memoryId}`,
|
|
31
|
+
headers: (0, common_1.getCommonHeaders)(apiKey),
|
|
32
|
+
});
|
|
33
|
+
return {
|
|
34
|
+
success: true,
|
|
35
|
+
memoryId,
|
|
36
|
+
message: 'Memory deleted successfully',
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
return {
|
|
41
|
+
success: false,
|
|
42
|
+
error: error.message || 'Failed to delete memory',
|
|
43
|
+
details: ((_a = error.response) === null || _a === void 0 ? void 0 : _a.body) || error,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
//# sourceMappingURL=delete-memory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete-memory.js","sourceRoot":"","sources":["../../../../src/lib/actions/delete-memory.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAqE;AACrE,uCAA0C;AAC1C,sCAAiF;AAEpE,QAAA,YAAY,GAAG,IAAA,+BAAY,EAAC;IACvC,IAAI,EAAE,mBAAW;IACjB,IAAI,EAAE,eAAe;IACrB,WAAW,EAAE,eAAe;IAC5B,WAAW,EAAE,8EAA8E;IAC3F,KAAK,EAAE;QACL,QAAQ,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC3B,WAAW,EAAE,WAAW;YACxB,WAAW,EAAE,8DAA8D;YAC3E,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;;YACf,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YACxC,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,IAAA,+BAAsB,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YAC7E,MAAM,OAAO,GAAG,IAAA,mBAAU,EAAC,UAAU,CAAC,CAAC;YAEvC,IAAI,CAAC;gBACH,MAAM,0BAAU,CAAC,WAAW,CAAC;oBAC3B,MAAM,EAAE,0BAAU,CAAC,MAAM;oBACzB,GAAG,EAAE,GAAG,OAAO,gBAAgB,QAAQ,EAAE;oBACzC,OAAO,EAAE,IAAA,yBAAgB,EAAC,MAAM,CAAC;iBAClC,CAAC,CAAC;gBAEH,OAAO;oBACL,OAAO,EAAE,IAAI;oBACb,QAAQ;oBACR,OAAO,EAAE,6BAA6B;iBACvC,CAAC;YACJ,CAAC;YAAC,OAAO,KAAU,EAAE,CAAC;gBACpB,OAAO;oBACL,OAAO,EAAE,KAAK;oBACd,KAAK,EAAE,KAAK,CAAC,OAAO,IAAI,yBAAyB;oBACjD,OAAO,EAAE,CAAA,MAAA,KAAK,CAAC,QAAQ,0CAAE,IAAI,KAAI,KAAK;iBACvC,CAAC;YACJ,CAAC;QACH,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const getMemory: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
baseUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
|
+
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
4
|
+
}>, {
|
|
5
|
+
memoryId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
6
|
+
includeContent: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
7
|
+
}>;
|
|
8
|
+
//# sourceMappingURL=get-memory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-memory.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/get-memory.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,SAAS;;;;;;EA0CpB,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getMemory = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
|
+
const index_1 = require("../../index");
|
|
8
|
+
const common_1 = require("../common");
|
|
9
|
+
exports.getMemory = (0, pieces_framework_1.createAction)({
|
|
10
|
+
auth: index_1.goodmemAuth,
|
|
11
|
+
name: 'get_memory',
|
|
12
|
+
displayName: 'Get Memory',
|
|
13
|
+
description: 'Fetch a specific memory record by its ID, including metadata, processing status, and optionally the original content.',
|
|
14
|
+
props: {
|
|
15
|
+
memoryId: pieces_framework_1.Property.ShortText({
|
|
16
|
+
displayName: 'Memory ID',
|
|
17
|
+
description: 'The UUID of the memory to fetch (returned by Create Memory)',
|
|
18
|
+
required: true,
|
|
19
|
+
}),
|
|
20
|
+
includeContent: pieces_framework_1.Property.Checkbox({
|
|
21
|
+
displayName: 'Include Content',
|
|
22
|
+
description: 'Fetch the original document content of the memory in addition to its metadata',
|
|
23
|
+
required: false,
|
|
24
|
+
defaultValue: true,
|
|
25
|
+
}),
|
|
26
|
+
},
|
|
27
|
+
run(context) {
|
|
28
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
var _a;
|
|
30
|
+
const { memoryId, includeContent } = context.propsValue;
|
|
31
|
+
const { baseUrl: rawBaseUrl, apiKey } = (0, common_1.extractAuthFromContext)(context.auth);
|
|
32
|
+
const baseUrl = (0, common_1.getBaseUrl)(rawBaseUrl);
|
|
33
|
+
try {
|
|
34
|
+
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
35
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
36
|
+
url: `${baseUrl}/v1/memories/${memoryId}?includeContent=${includeContent !== null && includeContent !== void 0 ? includeContent : false}`,
|
|
37
|
+
headers: (0, common_1.getCommonHeaders)(apiKey),
|
|
38
|
+
});
|
|
39
|
+
return {
|
|
40
|
+
success: true,
|
|
41
|
+
memory: response.body,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
return {
|
|
46
|
+
success: false,
|
|
47
|
+
error: error.message || 'Failed to get memory',
|
|
48
|
+
details: ((_a = error.response) === null || _a === void 0 ? void 0 : _a.body) || error,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
//# sourceMappingURL=get-memory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-memory.js","sourceRoot":"","sources":["../../../../src/lib/actions/get-memory.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAqE;AACrE,uCAA0C;AAC1C,sCAAiF;AAEpE,QAAA,SAAS,GAAG,IAAA,+BAAY,EAAC;IACpC,IAAI,EAAE,mBAAW;IACjB,IAAI,EAAE,YAAY;IAClB,WAAW,EAAE,YAAY;IACzB,WAAW,EAAE,uHAAuH;IACpI,KAAK,EAAE;QACL,QAAQ,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC3B,WAAW,EAAE,WAAW;YACxB,WAAW,EAAE,6DAA6D;YAC1E,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,cAAc,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YAChC,WAAW,EAAE,iBAAiB;YAC9B,WAAW,EAAE,+EAA+E;YAC5F,QAAQ,EAAE,KAAK;YACf,YAAY,EAAE,IAAI;SACnB,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;;YACf,MAAM,EAAE,QAAQ,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YACxD,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,IAAA,+BAAsB,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YAC7E,MAAM,OAAO,GAAG,IAAA,mBAAU,EAAC,UAAU,CAAC,CAAC;YAEvC,IAAI,CAAC;gBACH,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAC;oBAC5C,MAAM,EAAE,0BAAU,CAAC,GAAG;oBACtB,GAAG,EAAE,GAAG,OAAO,gBAAgB,QAAQ,mBAAmB,cAAc,aAAd,cAAc,cAAd,cAAc,GAAI,KAAK,EAAE;oBACnF,OAAO,EAAE,IAAA,yBAAgB,EAAC,MAAM,CAAC;iBAClC,CAAC,CAAC;gBAEH,OAAO;oBACL,OAAO,EAAE,IAAI;oBACb,MAAM,EAAE,QAAQ,CAAC,IAAI;iBACtB,CAAC;YACJ,CAAC;YAAC,OAAO,KAAU,EAAE,CAAC;gBACpB,OAAO;oBACL,OAAO,EAAE,KAAK;oBACd,KAAK,EAAE,KAAK,CAAC,OAAO,IAAI,sBAAsB;oBAC9C,OAAO,EAAE,CAAA,MAAA,KAAK,CAAC,QAAQ,0CAAE,IAAI,KAAI,KAAK;iBACvC,CAAC;YACJ,CAAC;QACH,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export declare const retrieveMemories: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
baseUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
|
+
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
4
|
+
}>, {
|
|
5
|
+
query: import("@activepieces/pieces-framework").LongTextProperty<true>;
|
|
6
|
+
spaceIds: import("@activepieces/pieces-framework").MultiSelectDropdownProperty<string, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
7
|
+
baseUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
8
|
+
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
9
|
+
}>>;
|
|
10
|
+
maxResults: import("@activepieces/pieces-framework").NumberProperty<false>;
|
|
11
|
+
includeMemoryDefinition: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
12
|
+
waitForIndexing: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
13
|
+
rerankerId: import("@activepieces/pieces-framework").DropdownProperty<string, false, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
14
|
+
baseUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
15
|
+
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
16
|
+
}>>;
|
|
17
|
+
llmId: import("@activepieces/pieces-framework").DropdownProperty<string, false, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
18
|
+
baseUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
19
|
+
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
20
|
+
}>>;
|
|
21
|
+
relevanceThreshold: import("@activepieces/pieces-framework").NumberProperty<false>;
|
|
22
|
+
llmTemperature: import("@activepieces/pieces-framework").NumberProperty<false>;
|
|
23
|
+
chronologicalResort: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
24
|
+
}>;
|
|
25
|
+
//# sourceMappingURL=retrieve-memories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retrieve-memories.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/retrieve-memories.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;EAyL3B,CAAC"}
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.retrieveMemories = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
|
+
const index_1 = require("../../index");
|
|
8
|
+
const common_1 = require("../common");
|
|
9
|
+
exports.retrieveMemories = (0, pieces_framework_1.createAction)({
|
|
10
|
+
auth: index_1.goodmemAuth,
|
|
11
|
+
name: 'retrieve_memories',
|
|
12
|
+
displayName: 'Retrieve Memories',
|
|
13
|
+
description: 'Perform similarity-based semantic retrieval across one or more spaces. Returns matching chunks ranked by relevance, with optional full memory definitions.',
|
|
14
|
+
props: {
|
|
15
|
+
query: pieces_framework_1.Property.LongText({
|
|
16
|
+
displayName: 'Query',
|
|
17
|
+
description: 'A natural language query used to find semantically similar memory chunks',
|
|
18
|
+
required: true,
|
|
19
|
+
}),
|
|
20
|
+
spaceIds: common_1.multiSpaceDropdown,
|
|
21
|
+
maxResults: pieces_framework_1.Property.Number({
|
|
22
|
+
displayName: 'Maximum Results',
|
|
23
|
+
description: 'Limit the number of returned memories',
|
|
24
|
+
required: false,
|
|
25
|
+
defaultValue: 5,
|
|
26
|
+
}),
|
|
27
|
+
includeMemoryDefinition: pieces_framework_1.Property.Checkbox({
|
|
28
|
+
displayName: 'Include Memory Definition',
|
|
29
|
+
description: 'Fetch the full memory metadata (source document info, processing status) alongside the matched chunks',
|
|
30
|
+
required: false,
|
|
31
|
+
defaultValue: true,
|
|
32
|
+
}),
|
|
33
|
+
waitForIndexing: pieces_framework_1.Property.Checkbox({
|
|
34
|
+
displayName: 'Wait for Indexing',
|
|
35
|
+
description: 'Retry for up to 60 seconds when no results are found. Enable this when memories were just added and may still be undergoing chunking and embedding',
|
|
36
|
+
required: false,
|
|
37
|
+
defaultValue: true,
|
|
38
|
+
}),
|
|
39
|
+
rerankerId: common_1.rerankerDropdown,
|
|
40
|
+
llmId: common_1.llmDropdown,
|
|
41
|
+
relevanceThreshold: pieces_framework_1.Property.Number({
|
|
42
|
+
displayName: 'Relevance Threshold',
|
|
43
|
+
description: 'Minimum score (0-1) for including results. Only used when Reranker or LLM is set.',
|
|
44
|
+
required: false,
|
|
45
|
+
}),
|
|
46
|
+
llmTemperature: pieces_framework_1.Property.Number({
|
|
47
|
+
displayName: 'LLM Temperature',
|
|
48
|
+
description: 'Creativity setting for LLM generation (0-2). Only used when LLM ID is set.',
|
|
49
|
+
required: false,
|
|
50
|
+
}),
|
|
51
|
+
chronologicalResort: pieces_framework_1.Property.Checkbox({
|
|
52
|
+
displayName: 'Chronological Resort',
|
|
53
|
+
description: 'Reorder results by creation time instead of relevance score',
|
|
54
|
+
required: false,
|
|
55
|
+
defaultValue: false,
|
|
56
|
+
}),
|
|
57
|
+
},
|
|
58
|
+
run(context) {
|
|
59
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
60
|
+
var _a;
|
|
61
|
+
const { query, spaceIds, maxResults, includeMemoryDefinition, waitForIndexing, rerankerId, llmId, relevanceThreshold, llmTemperature, chronologicalResort } = context.propsValue;
|
|
62
|
+
const { baseUrl: rawBaseUrl, apiKey } = (0, common_1.extractAuthFromContext)(context.auth);
|
|
63
|
+
const baseUrl = (0, common_1.getBaseUrl)(rawBaseUrl);
|
|
64
|
+
// spaceIds is now an array from MultiSelectDropdown
|
|
65
|
+
const selectedSpaces = Array.isArray(spaceIds) ? spaceIds : [spaceIds];
|
|
66
|
+
const spaceKeys = selectedSpaces
|
|
67
|
+
.filter((id) => id && id.length > 0)
|
|
68
|
+
.map((spaceId) => ({ spaceId }));
|
|
69
|
+
if (spaceKeys.length === 0) {
|
|
70
|
+
return {
|
|
71
|
+
success: false,
|
|
72
|
+
error: 'At least one space must be selected.',
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
const requestBody = {
|
|
76
|
+
message: query,
|
|
77
|
+
spaceKeys,
|
|
78
|
+
requestedSize: maxResults || 5,
|
|
79
|
+
fetchMemory: includeMemoryDefinition !== false,
|
|
80
|
+
};
|
|
81
|
+
// Add post-processor config if reranker or LLM is specified
|
|
82
|
+
if (rerankerId || llmId) {
|
|
83
|
+
const config = {};
|
|
84
|
+
if (rerankerId)
|
|
85
|
+
config.reranker_id = rerankerId;
|
|
86
|
+
if (llmId)
|
|
87
|
+
config.llm_id = llmId;
|
|
88
|
+
if (relevanceThreshold !== undefined && relevanceThreshold !== null)
|
|
89
|
+
config.relevance_threshold = relevanceThreshold;
|
|
90
|
+
if (llmTemperature !== undefined && llmTemperature !== null)
|
|
91
|
+
config.llm_temp = llmTemperature;
|
|
92
|
+
if (maxResults)
|
|
93
|
+
config.max_results = maxResults;
|
|
94
|
+
if (chronologicalResort === true)
|
|
95
|
+
config.chronological_resort = true;
|
|
96
|
+
requestBody.postProcessor = {
|
|
97
|
+
name: 'com.goodmem.retrieval.postprocess.ChatPostProcessorFactory',
|
|
98
|
+
config,
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
const maxWaitMs = 60000;
|
|
102
|
+
const pollIntervalMs = 5000;
|
|
103
|
+
const shouldWait = waitForIndexing !== false;
|
|
104
|
+
const startTime = Date.now();
|
|
105
|
+
let lastResult = null;
|
|
106
|
+
try {
|
|
107
|
+
do {
|
|
108
|
+
const retrieveHeaders = Object.assign(Object.assign({}, (0, common_1.getCommonHeaders)(apiKey)), { 'Accept': 'application/x-ndjson' });
|
|
109
|
+
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
110
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
111
|
+
url: `${baseUrl}/v1/memories:retrieve`,
|
|
112
|
+
headers: retrieveHeaders,
|
|
113
|
+
body: requestBody,
|
|
114
|
+
});
|
|
115
|
+
const results = [];
|
|
116
|
+
const memories = [];
|
|
117
|
+
let resultSetId = '';
|
|
118
|
+
let abstractReply = null;
|
|
119
|
+
// GoodMem API may return NDJSON or SSE format
|
|
120
|
+
const responseText = typeof response.body === 'string' ? response.body : JSON.stringify(response.body);
|
|
121
|
+
const lines = responseText.trim().split('\n');
|
|
122
|
+
lines.forEach((line) => {
|
|
123
|
+
var _a, _b, _c;
|
|
124
|
+
let jsonStr = line.trim();
|
|
125
|
+
if (!jsonStr)
|
|
126
|
+
return;
|
|
127
|
+
// Handle SSE format: extract JSON from "data: {...}" lines
|
|
128
|
+
if (jsonStr.startsWith('data:')) {
|
|
129
|
+
jsonStr = jsonStr.substring(5).trim();
|
|
130
|
+
}
|
|
131
|
+
// Skip SSE event type lines and close events
|
|
132
|
+
if (jsonStr.startsWith('event:') || jsonStr === '')
|
|
133
|
+
return;
|
|
134
|
+
try {
|
|
135
|
+
const item = JSON.parse(jsonStr);
|
|
136
|
+
if (item.resultSetBoundary) {
|
|
137
|
+
resultSetId = item.resultSetBoundary.resultSetId;
|
|
138
|
+
}
|
|
139
|
+
else if (item.memoryDefinition) {
|
|
140
|
+
memories.push(item.memoryDefinition);
|
|
141
|
+
}
|
|
142
|
+
else if (item.abstractReply) {
|
|
143
|
+
abstractReply = item.abstractReply;
|
|
144
|
+
}
|
|
145
|
+
else if (item.retrievedItem) {
|
|
146
|
+
results.push({
|
|
147
|
+
chunkId: (_a = item.retrievedItem.chunk) === null || _a === void 0 ? void 0 : _a.chunkId,
|
|
148
|
+
chunkText: (_b = item.retrievedItem.chunk) === null || _b === void 0 ? void 0 : _b.chunkText,
|
|
149
|
+
memoryId: (_c = item.retrievedItem.chunk) === null || _c === void 0 ? void 0 : _c.memoryId,
|
|
150
|
+
relevanceScore: item.retrievedItem.relevanceScore,
|
|
151
|
+
memoryIndex: item.retrievedItem.memoryIndex,
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
catch (parseError) {
|
|
156
|
+
// Skip non-JSON lines (e.g., SSE event types, close events)
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
lastResult = Object.assign({ success: true, resultSetId,
|
|
160
|
+
results,
|
|
161
|
+
memories, totalResults: results.length, query }, (abstractReply ? { abstractReply } : {}));
|
|
162
|
+
if (results.length > 0 || !shouldWait) {
|
|
163
|
+
return lastResult;
|
|
164
|
+
}
|
|
165
|
+
const elapsed = Date.now() - startTime;
|
|
166
|
+
if (elapsed >= maxWaitMs) {
|
|
167
|
+
return Object.assign(Object.assign({}, lastResult), { message: 'No results found after waiting 60 seconds for indexing. Memories may still be processing.' });
|
|
168
|
+
}
|
|
169
|
+
yield new Promise((resolve) => setTimeout(resolve, pollIntervalMs));
|
|
170
|
+
} while (true);
|
|
171
|
+
}
|
|
172
|
+
catch (error) {
|
|
173
|
+
return {
|
|
174
|
+
success: false,
|
|
175
|
+
error: error.message || 'Failed to retrieve memories',
|
|
176
|
+
details: ((_a = error.response) === null || _a === void 0 ? void 0 : _a.body) || error,
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
},
|
|
181
|
+
});
|
|
182
|
+
//# sourceMappingURL=retrieve-memories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retrieve-memories.js","sourceRoot":"","sources":["../../../../src/lib/actions/retrieve-memories.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAqE;AACrE,uCAA0C;AAC1C,sCAAoI;AAEvH,QAAA,gBAAgB,GAAG,IAAA,+BAAY,EAAC;IAC3C,IAAI,EAAE,mBAAW;IACjB,IAAI,EAAE,mBAAmB;IACzB,WAAW,EAAE,mBAAmB;IAChC,WAAW,EAAE,4JAA4J;IACzK,KAAK,EAAE;QACL,KAAK,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YACvB,WAAW,EAAE,OAAO;YACpB,WAAW,EAAE,0EAA0E;YACvF,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,QAAQ,EAAE,2BAAkB;QAC5B,UAAU,EAAE,2BAAQ,CAAC,MAAM,CAAC;YAC1B,WAAW,EAAE,iBAAiB;YAC9B,WAAW,EAAE,uCAAuC;YACpD,QAAQ,EAAE,KAAK;YACf,YAAY,EAAE,CAAC;SAChB,CAAC;QACF,uBAAuB,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YACzC,WAAW,EAAE,2BAA2B;YACxC,WAAW,EAAE,uGAAuG;YACpH,QAAQ,EAAE,KAAK;YACf,YAAY,EAAE,IAAI;SACnB,CAAC;QACF,eAAe,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YACjC,WAAW,EAAE,mBAAmB;YAChC,WAAW,EAAE,oJAAoJ;YACjK,QAAQ,EAAE,KAAK;YACf,Y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MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS,CAAC;oBACvC,IAAI,OAAO,IAAI,SAAS,EAAE,CAAC;wBACzB,uCACK,UAAU,KACb,OAAO,EAAE,2FAA2F,IACpG;oBACJ,CAAC;oBAED,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC,CAAC;gBACtE,CAAC,QAAQ,IAAI,EAAE;YACjB,CAAC;YAAC,OAAO,KAAU,EAAE,CAAC;gBACpB,OAAO;oBACL,OAAO,EAAE,KAAK;oBACd,KAAK,EAAE,KAAK,CAAC,OAAO,IAAI,6BAA6B;oBACrD,OAAO,EAAE,CAAA,MAAA,KAAK,CAAC,QAAQ,0CAAE,IAAI,KAAI,KAAK;iBACvC,CAAC;YACJ,CAAC;QACH,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { AppConnectionValueForAuthProperty } from '@activepieces/pieces-framework';
|
|
2
|
+
import { goodmemAuth } from '../../index';
|
|
3
|
+
export interface GoodMemAuthConfig {
|
|
4
|
+
baseUrl: string;
|
|
5
|
+
apiKey: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function extractAuthFromContext(auth: AppConnectionValueForAuthProperty<typeof goodmemAuth>): GoodMemAuthConfig;
|
|
8
|
+
export declare function getBaseUrl(baseUrl: string): string;
|
|
9
|
+
export declare function getCommonHeaders(apiKey: string): Record<string, string>;
|
|
10
|
+
export declare const spaceIdDropdown: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
11
|
+
baseUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
12
|
+
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
13
|
+
}>>;
|
|
14
|
+
export declare const multiSpaceDropdown: import("@activepieces/pieces-framework").MultiSelectDropdownProperty<string, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
15
|
+
baseUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
16
|
+
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
17
|
+
}>>;
|
|
18
|
+
export declare const rerankerDropdown: import("@activepieces/pieces-framework").DropdownProperty<string, false, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
19
|
+
baseUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
20
|
+
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
21
|
+
}>>;
|
|
22
|
+
export declare const llmDropdown: import("@activepieces/pieces-framework").DropdownProperty<string, false, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
23
|
+
baseUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
24
|
+
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
25
|
+
}>>;
|
|
26
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/common/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iCAAiC,EAElC,MAAM,gCAAgC,CAAC;AAExC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,iCAAiC,CAAC,OAAO,WAAW,CAAC,GAC1D,iBAAiB,CAiBnB;AAED,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAElD;AAED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAMvE;AAED,eAAO,MAAM,eAAe;;;GA2C1B,CAAC;AAEH,eAAO,MAAM,kBAAkB;;;GA2C7B,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;GA2C3B,CAAC;AAEH,eAAO,MAAM,WAAW;;;GA0CvB,CAAC"}
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.llmDropdown = exports.rerankerDropdown = exports.multiSpaceDropdown = exports.spaceIdDropdown = void 0;
|
|
4
|
+
exports.extractAuthFromContext = extractAuthFromContext;
|
|
5
|
+
exports.getBaseUrl = getBaseUrl;
|
|
6
|
+
exports.getCommonHeaders = getCommonHeaders;
|
|
7
|
+
const tslib_1 = require("tslib");
|
|
8
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
9
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
10
|
+
const index_1 = require("../../index");
|
|
11
|
+
function extractAuthFromContext(auth) {
|
|
12
|
+
if (typeof auth === 'string') {
|
|
13
|
+
throw new Error('Invalid auth format');
|
|
14
|
+
}
|
|
15
|
+
const actualAuth = auth.props;
|
|
16
|
+
if (!actualAuth || !actualAuth.baseUrl || !actualAuth.apiKey) {
|
|
17
|
+
throw new Error('Invalid authentication: Base URL and API Key are required');
|
|
18
|
+
}
|
|
19
|
+
return {
|
|
20
|
+
baseUrl: actualAuth.baseUrl,
|
|
21
|
+
apiKey: actualAuth.apiKey,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
function getBaseUrl(baseUrl) {
|
|
25
|
+
return baseUrl.replace(/\/$/, '');
|
|
26
|
+
}
|
|
27
|
+
function getCommonHeaders(apiKey) {
|
|
28
|
+
return {
|
|
29
|
+
'X-API-Key': apiKey,
|
|
30
|
+
'Content-Type': 'application/json',
|
|
31
|
+
Accept: 'application/json',
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
exports.spaceIdDropdown = pieces_framework_1.Property.Dropdown({
|
|
35
|
+
displayName: 'Space',
|
|
36
|
+
description: 'Select a space to use',
|
|
37
|
+
required: true,
|
|
38
|
+
refreshers: ['auth'],
|
|
39
|
+
auth: index_1.goodmemAuth,
|
|
40
|
+
options(_a) {
|
|
41
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth }) {
|
|
42
|
+
var _b;
|
|
43
|
+
if (!auth) {
|
|
44
|
+
return {
|
|
45
|
+
disabled: true,
|
|
46
|
+
placeholder: 'Connect your GoodMem account first',
|
|
47
|
+
options: [],
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
try {
|
|
51
|
+
const { baseUrl, apiKey } = auth.props;
|
|
52
|
+
const baseUrlClean = baseUrl.replace(/\/$/, '');
|
|
53
|
+
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
54
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
55
|
+
url: `${baseUrlClean}/v1/spaces`,
|
|
56
|
+
headers: getCommonHeaders(apiKey),
|
|
57
|
+
});
|
|
58
|
+
const body = response.body;
|
|
59
|
+
const spaces = Array.isArray(body) ? body : ((_b = body === null || body === void 0 ? void 0 : body.spaces) !== null && _b !== void 0 ? _b : []);
|
|
60
|
+
return {
|
|
61
|
+
disabled: false,
|
|
62
|
+
options: spaces.map((s) => ({
|
|
63
|
+
label: s.name,
|
|
64
|
+
value: s.spaceId,
|
|
65
|
+
})),
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
catch (error) {
|
|
69
|
+
return {
|
|
70
|
+
disabled: true,
|
|
71
|
+
placeholder: 'Failed to load spaces. Check your connection.',
|
|
72
|
+
options: [],
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
},
|
|
77
|
+
});
|
|
78
|
+
exports.multiSpaceDropdown = pieces_framework_1.Property.MultiSelectDropdown({
|
|
79
|
+
displayName: 'Spaces',
|
|
80
|
+
description: 'Select one or more spaces to search across',
|
|
81
|
+
required: true,
|
|
82
|
+
refreshers: ['auth'],
|
|
83
|
+
auth: index_1.goodmemAuth,
|
|
84
|
+
options(_a) {
|
|
85
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth }) {
|
|
86
|
+
var _b;
|
|
87
|
+
if (!auth) {
|
|
88
|
+
return {
|
|
89
|
+
disabled: true,
|
|
90
|
+
placeholder: 'Connect your GoodMem account first',
|
|
91
|
+
options: [],
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
try {
|
|
95
|
+
const { baseUrl, apiKey } = auth.props;
|
|
96
|
+
const baseUrlClean = baseUrl.replace(/\/$/, '');
|
|
97
|
+
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
98
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
99
|
+
url: `${baseUrlClean}/v1/spaces`,
|
|
100
|
+
headers: getCommonHeaders(apiKey),
|
|
101
|
+
});
|
|
102
|
+
const body = response.body;
|
|
103
|
+
const spaces = Array.isArray(body) ? body : ((_b = body === null || body === void 0 ? void 0 : body.spaces) !== null && _b !== void 0 ? _b : []);
|
|
104
|
+
return {
|
|
105
|
+
disabled: false,
|
|
106
|
+
options: spaces.map((s) => ({
|
|
107
|
+
label: s.name,
|
|
108
|
+
value: s.spaceId,
|
|
109
|
+
})),
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
catch (error) {
|
|
113
|
+
return {
|
|
114
|
+
disabled: true,
|
|
115
|
+
placeholder: 'Failed to load spaces. Check your connection.',
|
|
116
|
+
options: [],
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
},
|
|
121
|
+
});
|
|
122
|
+
exports.rerankerDropdown = pieces_framework_1.Property.Dropdown({
|
|
123
|
+
displayName: 'Reranker',
|
|
124
|
+
description: 'Optional reranker model to improve result ordering',
|
|
125
|
+
required: false,
|
|
126
|
+
refreshers: ['auth'],
|
|
127
|
+
auth: index_1.goodmemAuth,
|
|
128
|
+
options(_a) {
|
|
129
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth }) {
|
|
130
|
+
var _b;
|
|
131
|
+
if (!auth) {
|
|
132
|
+
return {
|
|
133
|
+
disabled: true,
|
|
134
|
+
placeholder: 'Connect your GoodMem account first',
|
|
135
|
+
options: [],
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
try {
|
|
139
|
+
const { baseUrl, apiKey } = auth.props;
|
|
140
|
+
const baseUrlClean = baseUrl.replace(/\/$/, '');
|
|
141
|
+
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
142
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
143
|
+
url: `${baseUrlClean}/v1/rerankers`,
|
|
144
|
+
headers: getCommonHeaders(apiKey),
|
|
145
|
+
});
|
|
146
|
+
const body = response.body;
|
|
147
|
+
const rerankers = Array.isArray(body) ? body : ((_b = body === null || body === void 0 ? void 0 : body.rerankers) !== null && _b !== void 0 ? _b : []);
|
|
148
|
+
return {
|
|
149
|
+
disabled: false,
|
|
150
|
+
options: rerankers.map((r) => ({
|
|
151
|
+
label: r.displayName,
|
|
152
|
+
value: r.rerankerId,
|
|
153
|
+
})),
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
catch (error) {
|
|
157
|
+
return {
|
|
158
|
+
disabled: true,
|
|
159
|
+
placeholder: 'Failed to load rerankers. Check your connection.',
|
|
160
|
+
options: [],
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
},
|
|
165
|
+
});
|
|
166
|
+
exports.llmDropdown = pieces_framework_1.Property.Dropdown({
|
|
167
|
+
displayName: 'LLM',
|
|
168
|
+
description: 'Optional LLM to generate contextual responses alongside retrieved chunks',
|
|
169
|
+
required: false,
|
|
170
|
+
refreshers: ['auth'],
|
|
171
|
+
auth: index_1.goodmemAuth,
|
|
172
|
+
options(_a) {
|
|
173
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth }) {
|
|
174
|
+
var _b;
|
|
175
|
+
if (!auth) {
|
|
176
|
+
return {
|
|
177
|
+
disabled: true,
|
|
178
|
+
placeholder: 'Connect your GoodMem account first',
|
|
179
|
+
options: [],
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
try {
|
|
183
|
+
const { baseUrl, apiKey } = auth.props;
|
|
184
|
+
const baseUrlClean = baseUrl.replace(/\/$/, '');
|
|
185
|
+
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
186
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
187
|
+
url: `${baseUrlClean}/v1/llms`,
|
|
188
|
+
headers: getCommonHeaders(apiKey),
|
|
189
|
+
});
|
|
190
|
+
const body = response.body;
|
|
191
|
+
const llms = Array.isArray(body) ? body : ((_b = body === null || body === void 0 ? void 0 : body.llms) !== null && _b !== void 0 ? _b : []);
|
|
192
|
+
return {
|
|
193
|
+
disabled: false,
|
|
194
|
+
options: llms.map((l) => ({
|
|
195
|
+
label: l.displayName,
|
|
196
|
+
value: l.llmId,
|
|
197
|
+
})),
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
catch (error) {
|
|
201
|
+
return {
|
|
202
|
+
disabled: true,
|
|
203
|
+
placeholder: 'Failed to load LLMs. Check your connection.',
|
|
204
|
+
options: [],
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
},
|
|
209
|
+
});
|
|
210
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/lib/common/index.ts"],"names":[],"mappings":";;;AAYA,wDAmBC;AAED,gCAEC;AAED,4CAMC;;AA3CD,qEAGwC;AACxC,+DAAqE;AACrE,uCAA0C;AAO1C,SAAgB,sBAAsB,CACpC,IAA2D;IAE3D,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC7B,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;IACzC,CAAC;IAED,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC;IAE9B,IAAI,CAAC,UAAU,IAAI,CAAC,UAAU,CAAC,OA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