···
1
1
import fs from "fs/promises"
2
2
import path from "path"
3
3
-
import { fileURLToPath } from "url"
4
3
import type { UserMessage, Message } from "./types.js"
5
5
-
import { CONTAINER_USER, USE_DOCKER_SHELL } from "./container/config.js"
4
4
+
import { CONTAINER_USER, HOME_DIR, USE_DOCKER_SHELL } from "./container/config.js"
6
5
import { imageRootForModelInput } from "./container/index.js"
7
6
8
8
-
const HOME_DIR = path.resolve(fileURLToPath(import.meta.url), "../../home")
9
7
const SOUL_FILE = path.join(HOME_DIR, "soul.md")
10
8
const MISPLACED_SOUL_FILE = path.join(HOME_DIR, "memories", "soul.md")
11
9
···
9
9
export const CONTAINER_NAME = configuredContainerName || "niri"
10
10
/** Linux user inside the container used for command execution. */
11
11
export const CONTAINER_USER = configuredContainerUser || "niri"
12
12
+
/** Repository fallback home used when a local OS home is unavailable. */
13
13
+
export const REPO_HOME_DIR = path.resolve(process.cwd(), "home")
14
14
+
/** Harness home for soul, memories, and local databases. */
15
15
+
export const HOME_DIR = USE_DOCKER_SHELL ? REPO_HOME_DIR : path.resolve(process.env.HOME ?? REPO_HOME_DIR)
12
16
13
17
/** Absolute image root allowed for `image_tool` operations. */
14
18
export const IMAGE_ROOT = (() => {
···
2
2
import fs from "fs"
3
3
import path from "path"
4
4
import * as sqliteVec from "sqlite-vec"
5
5
-
import { fileURLToPath } from "url"
5
5
+
import { HOME_DIR } from "./container/config.js"
6
6
7
7
-
const HOME_DIR = path.resolve(fileURLToPath(import.meta.url), "../../home")
8
7
const DB_PATH = path.join(HOME_DIR, "niri.db")
9
8
export const MEMORY_EMBEDDING_DIMENSIONS = 3072
10
9
···
1
1
import fs from "fs/promises"
2
2
import path from "path"
3
3
import { createHash } from "crypto"
4
4
-
import { fileURLToPath } from "url"
4
4
+
import { HOME_DIR } from "./container/config.js"
5
5
import type { Message } from "./types.js"
6
6
import { getDb, isVecAvailable, MEMORY_EMBEDDING_DIMENSIONS } from "./db.js"
7
7
import { EMBEDDING_DIMENSIONS, EMBEDDING_MODEL, embeddingsConfigured, embedTexts } from "./embeddings.js"
8
8
import { recordMetric } from "./metrics.js"
9
9
10
10
-
const HOME_DIR = path.resolve(fileURLToPath(import.meta.url), "../../home")
11
10
const MEMORIES_DIR = path.join(HOME_DIR, "memories")
12
11
const JOURNAL_DIR = path.join(MEMORIES_DIR, "journal")
13
12
const PEOPLE_DIR = path.join(MEMORIES_DIR, "people")
···
1
1
import Database from "better-sqlite3"
2
2
import fs from "fs"
3
3
import path from "path"
4
4
-
import { fileURLToPath } from "url"
5
4
import type OpenAI from "openai"
5
5
+
import { HOME_DIR } from "./container/config.js"
6
6
import { getDb } from "./db.js"
7
7
import type { Message } from "./types.js"
8
8
import type { MemorySearchResult } from "./memory.js"
···
152
152
createdAt: string
153
153
}
154
154
155
155
-
const HOME_DIR = path.resolve(fileURLToPath(import.meta.url), "../../home")
156
155
const DB_PATH = path.join(HOME_DIR, "metrics.db")
157
156
158
157
let db: Database.Database