@eleboucher/pi-memini 0.6.5 → 0.6.6

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/README.md CHANGED
@@ -56,7 +56,8 @@ stay out of any file):
56
56
  | Env var | Default | Purpose |
57
57
  | -------------------------------- | ----------------------- | --------------------------------------------------------------------------------------------- |
58
58
  | `MEMINI_BASE_URL` | `http://localhost:8080` | memini REST base URL (alias: `MEMINI_URL`) |
59
- | `MEMINI_NAMESPACE` | cwd basename | tenant the memory is scoped to (`X-Memini-Namespace`) |
59
+ | `MEMINI_NAMESPACE` | cwd basename | project the memory is scoped to (`X-Memini-Namespace`) |
60
+ | `MEMINI_HOME` | unset | caller's personal namespace, sent as `X-Memini-Home`; unset = no home leg |
60
61
  | `MEMINI_RECALL` | on | `0`/`false` disables recall-before-turn |
61
62
  | `MEMINI_CAPTURE` | on | `0`/`false` disables capture-after-turn |
62
63
  | `MEMINI_RECALL_LIMIT` | `3` | max memories injected per turn |
package/dist/index.js CHANGED
@@ -102,6 +102,10 @@ function resolveAgent(opts) {
102
102
  if (!agent) return void 0;
103
103
  return sanitizeSegment(agent);
104
104
  }
105
+ function resolveHome(env) {
106
+ const home = (env["MEMINI_HOME"] || "").trim();
107
+ return home || void 0;
108
+ }
105
109
  function applyTemplate(template, segments) {
106
110
  const all = {
107
111
  tenant: segments.tenant,
@@ -119,9 +123,11 @@ function applyTemplate(template, segments) {
119
123
  function resolveNamespace(opts) {
120
124
  const env = opts.env || process.env;
121
125
  const cwd = opts.cwd && opts.cwd.trim() ? opts.cwd : process.cwd();
126
+ const home = resolveHome(env);
127
+ const homeSource = home ? "env" : void 0;
122
128
  const nsEnv = (env["MEMINI_NAMESPACE"] || "").trim();
123
129
  if (nsEnv) {
124
- return { namespace: nsEnv, segments: {}, source: "env" };
130
+ return { namespace: nsEnv, segments: {}, source: "env", home, homeSource };
125
131
  }
126
132
  const config = readConfig(opts.configPath);
127
133
  if (!config.found) {
@@ -129,7 +135,9 @@ function resolveNamespace(opts) {
129
135
  return {
130
136
  namespace: project2,
131
137
  segments: project2 ? { project: project2 } : {},
132
- source: "cwd"
138
+ source: "cwd",
139
+ home,
140
+ homeSource
133
141
  };
134
142
  }
135
143
  const tenant = resolveTenant(cwd, config);
@@ -147,7 +155,7 @@ function resolveNamespace(opts) {
147
155
  if (tenant) source = "config";
148
156
  else if (opts.gitRemoteUrl || gitOut("remote get-url origin", cwd)) source = "git";
149
157
  else source = "cwd";
150
- return { namespace, segments, source };
158
+ return { namespace, segments, source, home, homeSource };
151
159
  }
152
160
 
153
161
  // src/index.ts
@@ -212,12 +220,14 @@ function resolveConfig(env, cwd) {
212
220
  const n = Number(e.MEMINI_RECALL_LIMIT);
213
221
  return Number.isFinite(n) && n >= 0 ? n : DEFAULT_RECALL_LIMIT;
214
222
  })();
223
+ const homeEnv = (e.MEMINI_HOME || "").trim();
215
224
  return {
216
225
  base_url: e.MEMINI_BASE_URL || e.MEMINI_URL || DEFAULT_BASE_URL,
217
226
  // namespace is already resolved above (raw-trimmed on the env path,
218
227
  // per-segment sanitized on the resolver path); re-sanitizing here would
219
228
  // flatten tenant separators.
220
229
  namespace: namespace || DEFAULT_NAMESPACE,
230
+ home: homeEnv || void 0,
221
231
  recall: envBool(e.MEMINI_RECALL, true),
222
232
  capture: envBool(e.MEMINI_CAPTURE, true),
223
233
  recall_limit,
@@ -315,6 +325,7 @@ function createClient(cfg, warn) {
315
325
  function headers(extra) {
316
326
  const h = { "X-Memini-Namespace": cfg.namespace, ...extra || {} };
317
327
  if (secret) h.Authorization = `Bearer ${secret}`;
328
+ if (cfg.home) h["X-Memini-Home"] = cfg.home;
318
329
  return h;
319
330
  }
320
331
  async function request(method, path2, body) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eleboucher/pi-memini",
3
- "version": "0.6.5",
3
+ "version": "0.6.6",
4
4
  "description": "Shared cross-session memory for the Pi coding agent, backed by a memini service.",
5
5
  "files": [
6
6
  "dist"