@oortmem/core 0.5.0 → 0.5.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/dist/config.d.ts +9 -0
- package/dist/config.js +25 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/config.d.ts
CHANGED
|
@@ -48,12 +48,21 @@ export declare const OortConfig: z.ZodObject<{
|
|
|
48
48
|
id: z.ZodOptional<z.ZodString>;
|
|
49
49
|
private: z.ZodDefault<z.ZodBoolean>;
|
|
50
50
|
}, z.core.$strict>>;
|
|
51
|
+
serve: z.ZodDefault<z.ZodObject<{
|
|
52
|
+
autostart: z.ZodDefault<z.ZodBoolean>;
|
|
53
|
+
idleMinutes: z.ZodDefault<z.ZodNumber>;
|
|
54
|
+
}, z.core.$strict>>;
|
|
51
55
|
}, z.core.$strict>;
|
|
52
56
|
export type OortConfig = z.infer<typeof OortConfig>;
|
|
53
57
|
export type ConfigSource = 'project' | 'home' | 'default';
|
|
54
58
|
export type ResolvedConfig = OortConfig & {
|
|
55
59
|
home: string;
|
|
56
60
|
sources: Record<string, ConfigSource>;
|
|
61
|
+
/**
|
|
62
|
+
* Keys a project's `oort.config.json` set that only the home config may set (`serve`: a
|
|
63
|
+
* repository must not start processes on this machine). Ignored; absent when there are none.
|
|
64
|
+
*/
|
|
65
|
+
ignoredProjectKeys?: string[];
|
|
57
66
|
};
|
|
58
67
|
/**
|
|
59
68
|
* Oort's home directory, always absolute: `OORT_HOME` resolved against the
|
package/dist/config.js
CHANGED
|
@@ -99,6 +99,18 @@ const project = z
|
|
|
99
99
|
private: z.boolean().default(false),
|
|
100
100
|
})
|
|
101
101
|
.default({ private: false });
|
|
102
|
+
/**
|
|
103
|
+
* `oort serve`, the local daemon the hooks talk to (CON-18). Read from the home config only: a
|
|
104
|
+
* repository's `oort.config.json` cannot start processes on this machine.
|
|
105
|
+
*/
|
|
106
|
+
const serve = z
|
|
107
|
+
.strictObject({
|
|
108
|
+
/** SessionStart starts a detached daemon when none is running. */
|
|
109
|
+
autostart: z.boolean().default(false),
|
|
110
|
+
/** The daemon exits after this many minutes without a hook request. */
|
|
111
|
+
idleMinutes: z.number().int().min(1).max(1440).default(30),
|
|
112
|
+
})
|
|
113
|
+
.default({ autostart: false, idleMinutes: 30 });
|
|
102
114
|
export const OortConfig = z.strictObject({
|
|
103
115
|
embed,
|
|
104
116
|
rerank,
|
|
@@ -107,7 +119,10 @@ export const OortConfig = z.strictObject({
|
|
|
107
119
|
activation,
|
|
108
120
|
recall,
|
|
109
121
|
project,
|
|
122
|
+
serve,
|
|
110
123
|
});
|
|
124
|
+
/** Keys read from the home config only; a project file's value is ignored (and reported). */
|
|
125
|
+
const HOME_ONLY_KEYS = new Set(['serve']);
|
|
111
126
|
const CONFIG_KEYS = Object.keys(OortConfig.shape);
|
|
112
127
|
function findProjectConfig(cwd) {
|
|
113
128
|
let dir = path.resolve(cwd);
|
|
@@ -175,8 +190,11 @@ export function resolveConfig(cwd, env = process.env, opts = {}) {
|
|
|
175
190
|
const homeRaw = fs.existsSync(homeFile) ? readConfigFile(homeFile) : {};
|
|
176
191
|
const merged = {};
|
|
177
192
|
const sources = {};
|
|
193
|
+
const ignored = [];
|
|
178
194
|
for (const key of CONFIG_KEYS) {
|
|
179
|
-
if (key in projectRaw)
|
|
195
|
+
if (key in projectRaw && HOME_ONLY_KEYS.has(key))
|
|
196
|
+
ignored.push(key);
|
|
197
|
+
if (key in projectRaw && !HOME_ONLY_KEYS.has(key)) {
|
|
180
198
|
merged[key] = projectRaw[key];
|
|
181
199
|
sources[key] = 'project';
|
|
182
200
|
}
|
|
@@ -188,6 +206,11 @@ export function resolveConfig(cwd, env = process.env, opts = {}) {
|
|
|
188
206
|
sources[key] = 'default';
|
|
189
207
|
}
|
|
190
208
|
}
|
|
191
|
-
return {
|
|
209
|
+
return {
|
|
210
|
+
...OortConfig.parse(merged),
|
|
211
|
+
home,
|
|
212
|
+
sources,
|
|
213
|
+
...(ignored.length > 0 && { ignoredProjectKeys: ignored }),
|
|
214
|
+
};
|
|
192
215
|
}
|
|
193
216
|
//# sourceMappingURL=config.js.map
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED