Files
pi-agent-config/runtime/agent/extensions/pi-memo-trust.ts
T
Kai 98635022d0 feat(runtime): track user-level Pi configuration with the provider key templated
Mirrors ~/.pi/agent/ as the authoritative copy. models.json becomes
models.json.template with ${ZENMUX_API_KEY} substituted; the real value stays
in secrets/zenmux.env, which is untracked and enforced by the pre-commit guard.

Excluded with rationale: auth.json, trust.json, models-store.json, sessions/,
herdr-agent-state.ts (installer-managed, overwritten on reinstall) and the
third-party skills under ~/.agents/skills.

Recorded during migration: the configured fallback model zenmux/x-ai/grok-4.6 is
absent from models.json, so pi falls back to an undeclared custom model id with
no context window, cost table or thinkingLevelMap. Fixing that is a behaviour
change and is deferred rather than folded into this zero-change migration.
2026-08-26 22:52:48 -07:00

22 lines
661 B
TypeScript

import type {
ExtensionAPI,
ProjectTrustEventResult,
} from "@earendil-works/pi-coding-agent";
import { realpathSync } from "node:fs";
import { resolve } from "node:path";
const MEMO_WORKSPACE = "/home/claw/pi-workspaces/memo-inbox";
export default function piMemoTrust(pi: ExtensionAPI) {
pi.on("project_trust", async (event): Promise<ProjectTrustEventResult> => {
try {
if (realpathSync(resolve(event.cwd)) === realpathSync(MEMO_WORKSPACE)) {
return { trusted: "yes", remember: true };
}
} catch {
// Fall through to Pi's normal trust decision for every other path.
}
return { trusted: "undecided" };
});
}