opencode-graphiti 0.1.2 → 0.1.3
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/esm/src/index.d.ts.map +1 -1
- package/esm/src/index.js +1 -1
- package/esm/src/utils.d.ts +2 -2
- package/esm/src/utils.d.ts.map +1 -1
- package/esm/src/utils.js +10 -9
- package/package.json +1 -1
- package/script/src/index.d.ts.map +1 -1
- package/script/src/index.js +1 -1
- package/script/src/utils.d.ts +2 -2
- package/script/src/utils.d.ts.map +1 -1
- package/script/src/utils.js +10 -9
package/esm/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAe,MAAM,qBAAqB,CAAC;AAW/D;;GAEG;AACH,eAAO,MAAM,QAAQ,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAe,MAAM,qBAAqB,CAAC;AAW/D;;GAEG;AACH,eAAO,MAAM,QAAQ,EAAE,MAkDtB,CAAC"}
|
package/esm/src/index.js
CHANGED
|
@@ -19,7 +19,7 @@ export const graphiti = async (input) => {
|
|
|
19
19
|
logger.warn("Memory features will be unavailable until connection is established");
|
|
20
20
|
}
|
|
21
21
|
const defaultGroupId = makeGroupId(config.groupIdPrefix, input.directory);
|
|
22
|
-
const defaultUserGroupId = makeUserGroupId(config.groupIdPrefix);
|
|
22
|
+
const defaultUserGroupId = makeUserGroupId(config.groupIdPrefix, input.directory);
|
|
23
23
|
logger.info("Plugin initialized. Group ID:", defaultGroupId);
|
|
24
24
|
const sessionManager = new SessionManager(defaultGroupId, defaultUserGroupId, sdkClient, client);
|
|
25
25
|
return {
|
package/esm/src/utils.d.ts
CHANGED
|
@@ -2,11 +2,11 @@ import type { Part } from "@opencode-ai/sdk";
|
|
|
2
2
|
/**
|
|
3
3
|
* Build a sanitized Graphiti group ID from a prefix and project directory.
|
|
4
4
|
*/
|
|
5
|
-
export declare const makeGroupId: (prefix
|
|
5
|
+
export declare const makeGroupId: (prefix?: string, directory?: string) => string;
|
|
6
6
|
/**
|
|
7
7
|
* Build a sanitized Graphiti group ID from a prefix and user home directory.
|
|
8
8
|
*/
|
|
9
|
-
export declare const makeUserGroupId: (prefix
|
|
9
|
+
export declare const makeUserGroupId: (prefix?: string, directory?: string) => string;
|
|
10
10
|
/**
|
|
11
11
|
* Narrow an OpenCode Part to a non-synthetic text part.
|
|
12
12
|
*/
|
package/esm/src/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAW7C;;GAEG;AACH,eAAO,MAAM,WAAW,GACtB,SAAS,MAAM,EACf,kBAAyB,KACxB,MAIF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,GAC1B,SAAS,MAAM,EACf,kBAAyB,KACxB,MAKF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,UAAU,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,IAAI,GAAG;IAC1D,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CAMd,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,oBAAoB,GAAI,OAAO,IAAI,EAAE,KAAG,MACe,CAAC"}
|
package/esm/src/utils.js
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
import os from "node:os";
|
|
2
|
+
import process from "node:process";
|
|
3
|
+
const getProjectName = (directory) => directory.split("/").filter(Boolean).at(-1)?.trim() || "default";
|
|
4
|
+
const getUserName = (home = os.homedir().split("/").filter(Boolean).at(-1)) => home?.trim() || undefined;
|
|
2
5
|
/**
|
|
3
6
|
* Build a sanitized Graphiti group ID from a prefix and project directory.
|
|
4
7
|
*/
|
|
5
|
-
export const makeGroupId = (prefix, directory) => {
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const rawGroupId = `${prefix}_${projectName}`;
|
|
8
|
+
export const makeGroupId = (prefix, directory = process.cwd()) => {
|
|
9
|
+
const projectName = getProjectName(directory);
|
|
10
|
+
const rawGroupId = `${prefix?.concat("-")}${projectName}__main`;
|
|
9
11
|
return rawGroupId.replace(/[^A-Za-z0-9_-]/g, "_");
|
|
10
12
|
};
|
|
11
13
|
/**
|
|
12
14
|
* Build a sanitized Graphiti group ID from a prefix and user home directory.
|
|
13
15
|
*/
|
|
14
|
-
export const makeUserGroupId = (prefix) => {
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const rawGroupId = `${prefix}_user_${userName}`;
|
|
16
|
+
export const makeUserGroupId = (prefix, directory = process.cwd()) => {
|
|
17
|
+
const projectName = getProjectName(directory);
|
|
18
|
+
const userName = getUserName();
|
|
19
|
+
const rawGroupId = `${prefix?.concat("-")}${projectName}__user-${userName}`;
|
|
19
20
|
return rawGroupId.replace(/[^A-Za-z0-9_-]/g, "_");
|
|
20
21
|
};
|
|
21
22
|
/**
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAe,MAAM,qBAAqB,CAAC;AAW/D;;GAEG;AACH,eAAO,MAAM,QAAQ,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAe,MAAM,qBAAqB,CAAC;AAW/D;;GAEG;AACH,eAAO,MAAM,QAAQ,EAAE,MAkDtB,CAAC"}
|
package/script/src/index.js
CHANGED
|
@@ -22,7 +22,7 @@ const graphiti = async (input) => {
|
|
|
22
22
|
logger_js_1.logger.warn("Memory features will be unavailable until connection is established");
|
|
23
23
|
}
|
|
24
24
|
const defaultGroupId = (0, utils_js_1.makeGroupId)(config.groupIdPrefix, input.directory);
|
|
25
|
-
const defaultUserGroupId = (0, utils_js_1.makeUserGroupId)(config.groupIdPrefix);
|
|
25
|
+
const defaultUserGroupId = (0, utils_js_1.makeUserGroupId)(config.groupIdPrefix, input.directory);
|
|
26
26
|
logger_js_1.logger.info("Plugin initialized. Group ID:", defaultGroupId);
|
|
27
27
|
const sessionManager = new session_js_1.SessionManager(defaultGroupId, defaultUserGroupId, sdkClient, client);
|
|
28
28
|
return {
|
package/script/src/utils.d.ts
CHANGED
|
@@ -2,11 +2,11 @@ import type { Part } from "@opencode-ai/sdk";
|
|
|
2
2
|
/**
|
|
3
3
|
* Build a sanitized Graphiti group ID from a prefix and project directory.
|
|
4
4
|
*/
|
|
5
|
-
export declare const makeGroupId: (prefix
|
|
5
|
+
export declare const makeGroupId: (prefix?: string, directory?: string) => string;
|
|
6
6
|
/**
|
|
7
7
|
* Build a sanitized Graphiti group ID from a prefix and user home directory.
|
|
8
8
|
*/
|
|
9
|
-
export declare const makeUserGroupId: (prefix
|
|
9
|
+
export declare const makeUserGroupId: (prefix?: string, directory?: string) => string;
|
|
10
10
|
/**
|
|
11
11
|
* Narrow an OpenCode Part to a non-synthetic text part.
|
|
12
12
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAW7C;;GAEG;AACH,eAAO,MAAM,WAAW,GACtB,SAAS,MAAM,EACf,kBAAyB,KACxB,MAIF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,GAC1B,SAAS,MAAM,EACf,kBAAyB,KACxB,MAKF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,UAAU,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,IAAI,GAAG;IAC1D,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CAMd,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,oBAAoB,GAAI,OAAO,IAAI,EAAE,KAAG,MACe,CAAC"}
|
package/script/src/utils.js
CHANGED
|
@@ -5,24 +5,25 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.extractTextFromParts = exports.isTextPart = exports.makeUserGroupId = exports.makeGroupId = void 0;
|
|
7
7
|
const node_os_1 = __importDefault(require("node:os"));
|
|
8
|
+
const node_process_1 = __importDefault(require("node:process"));
|
|
9
|
+
const getProjectName = (directory) => directory.split("/").filter(Boolean).at(-1)?.trim() || "default";
|
|
10
|
+
const getUserName = (home = node_os_1.default.homedir().split("/").filter(Boolean).at(-1)) => home?.trim() || undefined;
|
|
8
11
|
/**
|
|
9
12
|
* Build a sanitized Graphiti group ID from a prefix and project directory.
|
|
10
13
|
*/
|
|
11
|
-
const makeGroupId = (prefix, directory) => {
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const rawGroupId = `${prefix}_${projectName}`;
|
|
14
|
+
const makeGroupId = (prefix, directory = node_process_1.default.cwd()) => {
|
|
15
|
+
const projectName = getProjectName(directory);
|
|
16
|
+
const rawGroupId = `${prefix?.concat("-")}${projectName}__main`;
|
|
15
17
|
return rawGroupId.replace(/[^A-Za-z0-9_-]/g, "_");
|
|
16
18
|
};
|
|
17
19
|
exports.makeGroupId = makeGroupId;
|
|
18
20
|
/**
|
|
19
21
|
* Build a sanitized Graphiti group ID from a prefix and user home directory.
|
|
20
22
|
*/
|
|
21
|
-
const makeUserGroupId = (prefix) => {
|
|
22
|
-
const
|
|
23
|
-
const
|
|
24
|
-
const
|
|
25
|
-
const rawGroupId = `${prefix}_user_${userName}`;
|
|
23
|
+
const makeUserGroupId = (prefix, directory = node_process_1.default.cwd()) => {
|
|
24
|
+
const projectName = getProjectName(directory);
|
|
25
|
+
const userName = getUserName();
|
|
26
|
+
const rawGroupId = `${prefix?.concat("-")}${projectName}__user-${userName}`;
|
|
26
27
|
return rawGroupId.replace(/[^A-Za-z0-9_-]/g, "_");
|
|
27
28
|
};
|
|
28
29
|
exports.makeUserGroupId = makeUserGroupId;
|