opencode-graphiti 0.1.10 → 0.1.11
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/config.d.ts +8 -5
- package/esm/src/config.d.ts.map +1 -1
- package/esm/src/config.js +23 -10
- package/esm/src/services/client.d.ts +1 -0
- package/esm/src/services/client.d.ts.map +1 -1
- package/esm/src/services/client.js +22 -0
- package/package.json +1 -1
- package/script/src/config.d.ts +8 -5
- package/script/src/config.d.ts.map +1 -1
- package/script/src/config.js +23 -10
- package/script/src/services/client.d.ts +1 -0
- package/script/src/services/client.d.ts.map +1 -1
- package/script/src/services/client.js +22 -0
package/esm/src/config.d.ts
CHANGED
|
@@ -2,11 +2,14 @@ import type { GraphitiConfig } from "./types/index.js";
|
|
|
2
2
|
/**
|
|
3
3
|
* Load Graphiti configuration from JSONC files with defaults applied.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* global
|
|
5
|
+
* Lookup order:
|
|
6
|
+
* 1. `directory` (if provided): standard cosmiconfig search starting from that
|
|
7
|
+
* directory (no upward traversal past it) — project-local `.graphitirc`,
|
|
8
|
+
* `package.json#graphiti`, etc.
|
|
9
|
+
* 2. Standard global/home cosmiconfig locations discovered by walking upward
|
|
10
|
+
* from CWD to the home directory (e.g. `~/.graphitirc`).
|
|
11
|
+
* 3. Legacy fallback: `~/.config/opencode/.graphitirc` — the path used by
|
|
12
|
+
* earlier versions of the plugin.
|
|
10
13
|
*/
|
|
11
14
|
export declare function loadConfig(directory?: string): GraphitiConfig;
|
|
12
15
|
//# sourceMappingURL=config.d.ts.map
|
package/esm/src/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/src/config.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAgBvD
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/src/config.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAgBvD;;;;;;;;;;;GAWG;AACH,wBAAgB,UAAU,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,cAAc,CA8B7D"}
|
package/esm/src/config.js
CHANGED
|
@@ -16,21 +16,34 @@ const GraphitiConfigSchema = z.object({
|
|
|
16
16
|
/**
|
|
17
17
|
* Load Graphiti configuration from JSONC files with defaults applied.
|
|
18
18
|
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* global
|
|
19
|
+
* Lookup order:
|
|
20
|
+
* 1. `directory` (if provided): standard cosmiconfig search starting from that
|
|
21
|
+
* directory (no upward traversal past it) — project-local `.graphitirc`,
|
|
22
|
+
* `package.json#graphiti`, etc.
|
|
23
|
+
* 2. Standard global/home cosmiconfig locations discovered by walking upward
|
|
24
|
+
* from CWD to the home directory (e.g. `~/.graphitirc`).
|
|
25
|
+
* 3. Legacy fallback: `~/.config/opencode/.graphitirc` — the path used by
|
|
26
|
+
* earlier versions of the plugin.
|
|
24
27
|
*/
|
|
25
28
|
export function loadConfig(directory) {
|
|
26
|
-
const
|
|
29
|
+
const explorer = cosmiconfigSync("graphiti", {
|
|
27
30
|
stopDir: os.homedir(),
|
|
28
31
|
mergeSearchPlaces: true,
|
|
29
32
|
cache: false,
|
|
30
|
-
})
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
});
|
|
34
|
+
// Step 1 & 2: project-local search (with directory arg) or CWD upward walk.
|
|
35
|
+
const result = explorer.search(directory) ??
|
|
36
|
+
(() => {
|
|
37
|
+
// Step 3: legacy fallback — load the fixed path explicitly so that
|
|
38
|
+
// cosmiconfig's search-place joining does not mangle absolute paths.
|
|
39
|
+
const legacyPath = `${os.homedir()}/.config/opencode/.graphitirc`;
|
|
40
|
+
try {
|
|
41
|
+
return cosmiconfigSync("graphiti", { cache: false }).load(legacyPath);
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
})();
|
|
34
47
|
const merged = {
|
|
35
48
|
...DEFAULT_CONFIG,
|
|
36
49
|
...result?.config,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/src/services/client.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,eAAe,EACf,YAAY,EACZ,YAAY,EACb,MAAM,mBAAmB,CAAC;AAI3B;;;GAGG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,SAAS,CAAgC;IACjD,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,QAAQ,CAAS;IAEzB;;OAEG;gBACS,QAAQ,EAAE,MAAM;IAS5B,oDAAoD;IACpD,OAAO,CAAC,wBAAwB;IAUhC;;;OAGG;IACG,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC;IAgBjC;;OAEG;IACG,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;YAOnB,QAAQ;IAkCtB,OAAO,CAAC,gBAAgB;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/src/services/client.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,eAAe,EACf,YAAY,EACZ,YAAY,EACb,MAAM,mBAAmB,CAAC;AAI3B;;;GAGG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,SAAS,CAAgC;IACjD,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,QAAQ,CAAS;IAEzB;;OAEG;gBACS,QAAQ,EAAE,MAAM;IAS5B,oDAAoD;IACpD,OAAO,CAAC,wBAAwB;IAUhC;;;OAGG;IACG,OAAO,IAAI,OAAO,CAA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
@@ -115,6 +115,16 @@ export class GraphitiClient {
|
|
|
115
115
|
"code" in err &&
|
|
116
116
|
err.code === 404);
|
|
117
117
|
}
|
|
118
|
+
isRequestTimeout(err) {
|
|
119
|
+
if (typeof err === "string") {
|
|
120
|
+
return /request timed out/i.test(err);
|
|
121
|
+
}
|
|
122
|
+
if (!err || typeof err !== "object")
|
|
123
|
+
return false;
|
|
124
|
+
const { code, message } = err;
|
|
125
|
+
return code === -32001 ||
|
|
126
|
+
(typeof message === "string" && /request timed out/i.test(message));
|
|
127
|
+
}
|
|
118
128
|
async reconnect() {
|
|
119
129
|
this.connected = false;
|
|
120
130
|
try {
|
|
@@ -197,6 +207,10 @@ export class GraphitiClient {
|
|
|
197
207
|
return this.parseWrappedArray(result, "facts") ?? [];
|
|
198
208
|
}
|
|
199
209
|
catch (err) {
|
|
210
|
+
if (this.isRequestTimeout(err)) {
|
|
211
|
+
logger.warn("searchFacts request timed out; returning no facts");
|
|
212
|
+
return [];
|
|
213
|
+
}
|
|
200
214
|
logger.error("searchFacts error:", err);
|
|
201
215
|
return [];
|
|
202
216
|
}
|
|
@@ -214,6 +228,10 @@ export class GraphitiClient {
|
|
|
214
228
|
return this.parseWrappedArray(result, "nodes") ?? [];
|
|
215
229
|
}
|
|
216
230
|
catch (err) {
|
|
231
|
+
if (this.isRequestTimeout(err)) {
|
|
232
|
+
logger.warn("searchNodes request timed out; returning no nodes");
|
|
233
|
+
return [];
|
|
234
|
+
}
|
|
217
235
|
logger.error("searchNodes error:", err);
|
|
218
236
|
return [];
|
|
219
237
|
}
|
|
@@ -232,6 +250,10 @@ export class GraphitiClient {
|
|
|
232
250
|
return raw.map(normalizeEpisode);
|
|
233
251
|
}
|
|
234
252
|
catch (err) {
|
|
253
|
+
if (this.isRequestTimeout(err)) {
|
|
254
|
+
logger.warn("getEpisodes request timed out; returning no episodes");
|
|
255
|
+
return [];
|
|
256
|
+
}
|
|
235
257
|
logger.error("getEpisodes error:", err);
|
|
236
258
|
return [];
|
|
237
259
|
}
|
package/package.json
CHANGED
package/script/src/config.d.ts
CHANGED
|
@@ -2,11 +2,14 @@ import type { GraphitiConfig } from "./types/index.js";
|
|
|
2
2
|
/**
|
|
3
3
|
* Load Graphiti configuration from JSONC files with defaults applied.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* global
|
|
5
|
+
* Lookup order:
|
|
6
|
+
* 1. `directory` (if provided): standard cosmiconfig search starting from that
|
|
7
|
+
* directory (no upward traversal past it) — project-local `.graphitirc`,
|
|
8
|
+
* `package.json#graphiti`, etc.
|
|
9
|
+
* 2. Standard global/home cosmiconfig locations discovered by walking upward
|
|
10
|
+
* from CWD to the home directory (e.g. `~/.graphitirc`).
|
|
11
|
+
* 3. Legacy fallback: `~/.config/opencode/.graphitirc` — the path used by
|
|
12
|
+
* earlier versions of the plugin.
|
|
10
13
|
*/
|
|
11
14
|
export declare function loadConfig(directory?: string): GraphitiConfig;
|
|
12
15
|
//# sourceMappingURL=config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/src/config.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAgBvD
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/src/config.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAgBvD;;;;;;;;;;;GAWG;AACH,wBAAgB,UAAU,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,cAAc,CA8B7D"}
|
package/script/src/config.js
CHANGED
|
@@ -55,21 +55,34 @@ const GraphitiConfigSchema = z.object({
|
|
|
55
55
|
/**
|
|
56
56
|
* Load Graphiti configuration from JSONC files with defaults applied.
|
|
57
57
|
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
* global
|
|
58
|
+
* Lookup order:
|
|
59
|
+
* 1. `directory` (if provided): standard cosmiconfig search starting from that
|
|
60
|
+
* directory (no upward traversal past it) — project-local `.graphitirc`,
|
|
61
|
+
* `package.json#graphiti`, etc.
|
|
62
|
+
* 2. Standard global/home cosmiconfig locations discovered by walking upward
|
|
63
|
+
* from CWD to the home directory (e.g. `~/.graphitirc`).
|
|
64
|
+
* 3. Legacy fallback: `~/.config/opencode/.graphitirc` — the path used by
|
|
65
|
+
* earlier versions of the plugin.
|
|
63
66
|
*/
|
|
64
67
|
function loadConfig(directory) {
|
|
65
|
-
const
|
|
68
|
+
const explorer = (0, cosmiconfig_1.cosmiconfigSync)("graphiti", {
|
|
66
69
|
stopDir: node_os_1.default.homedir(),
|
|
67
70
|
mergeSearchPlaces: true,
|
|
68
71
|
cache: false,
|
|
69
|
-
})
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
72
|
+
});
|
|
73
|
+
// Step 1 & 2: project-local search (with directory arg) or CWD upward walk.
|
|
74
|
+
const result = explorer.search(directory) ??
|
|
75
|
+
(() => {
|
|
76
|
+
// Step 3: legacy fallback — load the fixed path explicitly so that
|
|
77
|
+
// cosmiconfig's search-place joining does not mangle absolute paths.
|
|
78
|
+
const legacyPath = `${node_os_1.default.homedir()}/.config/opencode/.graphitirc`;
|
|
79
|
+
try {
|
|
80
|
+
return (0, cosmiconfig_1.cosmiconfigSync)("graphiti", { cache: false }).load(legacyPath);
|
|
81
|
+
}
|
|
82
|
+
catch {
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
})();
|
|
73
86
|
const merged = {
|
|
74
87
|
...DEFAULT_CONFIG,
|
|
75
88
|
...result?.config,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/src/services/client.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,eAAe,EACf,YAAY,EACZ,YAA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AC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;QACrC,iBAAiB,CAAC,EAAE,MAAM,CAAC;KAC5B,GAAG,OAAO,CAAC,IAAI,CAAC;IAWjB;;;;;OAKG;IACH,iBAAiB,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,GAAG,CAAC,EAAE,GAAG,IAAI;IAYrE;;OAEG;IACG,WAAW,CAAC,MAAM,EAAE;QACxB,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;QACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC;IAkB3B;;OAEG;IACG,WAAW,CAAC,MAAM,EAAE;QACxB,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;QACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC;IAkB3B;;OAEG;IACG,WAAW,CAAC,MAAM,EAAE;QACxB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;IAmB9B;;OAEG;IACG,SAAS,IAAI,OAAO,CAAC,OAAO,CAAC;CAQpC"}
|
|
@@ -121,6 +121,16 @@ class GraphitiClient {
|
|
|
121
121
|
"code" in err &&
|
|
122
122
|
err.code === 404);
|
|
123
123
|
}
|
|
124
|
+
isRequestTimeout(err) {
|
|
125
|
+
if (typeof err === "string") {
|
|
126
|
+
return /request timed out/i.test(err);
|
|
127
|
+
}
|
|
128
|
+
if (!err || typeof err !== "object")
|
|
129
|
+
return false;
|
|
130
|
+
const { code, message } = err;
|
|
131
|
+
return code === -32001 ||
|
|
132
|
+
(typeof message === "string" && /request timed out/i.test(message));
|
|
133
|
+
}
|
|
124
134
|
async reconnect() {
|
|
125
135
|
this.connected = false;
|
|
126
136
|
try {
|
|
@@ -203,6 +213,10 @@ class GraphitiClient {
|
|
|
203
213
|
return this.parseWrappedArray(result, "facts") ?? [];
|
|
204
214
|
}
|
|
205
215
|
catch (err) {
|
|
216
|
+
if (this.isRequestTimeout(err)) {
|
|
217
|
+
logger_js_1.logger.warn("searchFacts request timed out; returning no facts");
|
|
218
|
+
return [];
|
|
219
|
+
}
|
|
206
220
|
logger_js_1.logger.error("searchFacts error:", err);
|
|
207
221
|
return [];
|
|
208
222
|
}
|
|
@@ -220,6 +234,10 @@ class GraphitiClient {
|
|
|
220
234
|
return this.parseWrappedArray(result, "nodes") ?? [];
|
|
221
235
|
}
|
|
222
236
|
catch (err) {
|
|
237
|
+
if (this.isRequestTimeout(err)) {
|
|
238
|
+
logger_js_1.logger.warn("searchNodes request timed out; returning no nodes");
|
|
239
|
+
return [];
|
|
240
|
+
}
|
|
223
241
|
logger_js_1.logger.error("searchNodes error:", err);
|
|
224
242
|
return [];
|
|
225
243
|
}
|
|
@@ -238,6 +256,10 @@ class GraphitiClient {
|
|
|
238
256
|
return raw.map(sdk_normalize_js_1.normalizeEpisode);
|
|
239
257
|
}
|
|
240
258
|
catch (err) {
|
|
259
|
+
if (this.isRequestTimeout(err)) {
|
|
260
|
+
logger_js_1.logger.warn("getEpisodes request timed out; returning no episodes");
|
|
261
|
+
return [];
|
|
262
|
+
}
|
|
241
263
|
logger_js_1.logger.error("getEpisodes error:", err);
|
|
242
264
|
return [];
|
|
243
265
|
}
|