lembas -l / --local: everything in the project, nothing written elsewhere
Config, data and state are rooted at <project>/.agent/local/lembas (or .lembas/), kept out of git; a local directory the repository carries is refused. The user's logins and connections.yaml are read, never written; the user's config.yaml is not read. The TUI is started with TMPDIR inside it (the compiled binary unpacks its native library there) and OpenTUI's cache goes there too; the agent's commands keep the user's TMPDIR. An instance serves models, chat, speech and the balance only: the link, /remote, the service and the hub are off, deletes are not sent, and the server library, search, fetch, embeddings and personalization are not used. Self-update and uninstall are refused. hardline_disable is ignored, and tools treat the local directory as outside the project. The smoke test runs a whole local session in the compiled binary and checks that HOME, the XDG directories and TMPDIR gained nothing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
27 files changed
+636
-105
No files matched your search
+4
-2
@@ -20,7 +20,7 @@
|
||||
import { chmodSync, existsSync, mkdirSync, rmSync } from "node:fs"
|
||||
import { connect, createServer, type Server, type Socket } from "node:net"
|
||||
import { join } from "node:path"
|
||||
import { paths } from "../config/paths.ts"
|
||||
import { isLocal, paths } from "../config/paths.ts"
|
||||
import type { Mode } from "../config/schema.ts"
|
||||
import type { CommandInfo } from "../session/commands.ts"
|
||||
import { clampMode, refusalFor, type AcpAgent, type Limits } from "./agent.ts"
|
||||
@@ -77,7 +77,8 @@ export function answers(path = hubSocket(), timeoutMs = 1000): Promise<boolean>
|
||||
|
||||
/** Connect to the hub, if one runs. */
|
||||
export function connectHub(path = hubSocket()): Promise<Peer | undefined> {
|
||||
if (!existsSync(path)) return Promise.resolve(undefined)
|
||||
// Local mode shares nothing: no hub is reached, and none is held.
|
||||
if (isLocal() || !existsSync(path)) return Promise.resolve(undefined)
|
||||
return new Promise((resolve) => {
|
||||
const sock = connect(path)
|
||||
const timer = setTimeout(() => (sock.destroy(), resolve(undefined)), 2000)
|
||||
@@ -138,6 +139,7 @@ export class Hub {
|
||||
|
||||
/** Take the socket. False: another hub is alive on it. */
|
||||
async listen(path = hubSocket()): Promise<boolean> {
|
||||
if (isLocal()) return false
|
||||
mkdirSync(paths.state, { recursive: true })
|
||||
if (existsSync(path)) {
|
||||
if (await answers(path)) return false
|
||||
|
||||
Reference in new issue
Block a user