import type { KgScope } from '../memory/memory-kg.js'; import type { OrgDaemon } from './daemon.js'; import type { RunSummary } from './reporting.js'; import type { OrgDef } from './types.js'; /** THE resolver for an org's flat-memory namespace. Runtime writes and the * `org memory search` CLI both go through it — when the CLI hardcoded * `org:` instead, an org with a configured `memory_namespace` was * searched in a namespace nothing had ever written to. */ export declare function orgMemoryNamespace(name: string, def: OrgDef): string; /** Ownership scope for everything this org puts in the knowledge graph. * * All orgs under one root share the org-memory store, so the KG needs the org * named explicitly: without it, org A's entities, rules, glossary and * rollbacks all reach org B's. Unlike flat memory this is keyed on the ORG * NAME, not on `memory_namespace` — a shared or renamed flat namespace must * not silently merge two orgs' graph claims. */ export declare function orgKgScope(name: string): KgScope; /** Store dir for org cross-run memory — inside the org root so the bridge's * path guard accepts it when the daemon runs from the project (the normal * case) and test roots stay isolated. */ export declare function orgMemoryDbPath(root: string): string; /** The memory bridge's traversal guard silently redirects out-of-tree paths * to the per-project default store. For an org rooted outside cwd (tests, * unusual daemon setups) that redirect would write into the WRONG project's * memory — verify the guard kept our path, and skip org memory otherwise. */ export declare function orgMemoryUsable(root: string): Promise; /** Namespace for a role's PRIVATE memories, inside the org memory DB. */ export declare function agentMemoryNamespace(name: string, def: OrgDef, role: string): string; /** org_remember implementation: a deliberate write to org-shared or * role-private memory (both in the org memory DB, split by namespace). */ export declare function rememberOrgMemory(root: string, name: string, def: OrgDef, role: string, content: string, scope: 'org' | 'agent', run: string): Promise; /** org_recall implementation: searches the org's flat memory namespaces AND * the org's memory knowledge graph — independently, then merges. They used to * be chained: an empty flat-memory result returned early, so an org whose * knowledge lived only in the graph was told "nothing found" while the graph * held the answer (graph-boundaries B3 / memory-KG K6). Failures return a * message, never throw into the tool. */ export declare function recallOrgMemory(daemon: OrgDaemon, name: string, def: OrgDef, query: string, role?: string): Promise<{ text: string; hits: number; }>; /** knowledge_search implementation for org agents: the user's Second Brain * (this project's documents + the personal global brain), merged with the * same project-first ranking every other surface uses. Failures return a * message, never throw into the tool call. */ export declare function searchProjectKnowledge(root: string, query: string): Promise<{ text: string; hits: number; }>; /** org_learn implementation: merge coordinator-extracted entities/relations/ * rules into the org's knowledge graph (LLM extraction happens inside the * agent's own subscription-auth SDK session — no separate LLM call here). */ export declare function learnOrgKnowledge(daemon: OrgDaemon, name: string, run: string, payload: { nodes?: unknown[]; edges?: unknown[]; rules?: unknown[]; }): Promise; /** What a caller must do with a failed run-memory store: record it where the * operator will look later. `stored: false` means org_recall will never find * this run — see storeRunMemory. */ export interface RunMemoryResult { stored: boolean; /** Why nothing was stored. Present only when `stored` is false. */ reason?: string; } /** The minimum of OrgBus storeRunMemory needs to report a loss. */ type AuditSink = { emit: (e: { type: 'audit'; reason: string; msg: string; }) => unknown; }; /** Persist the run's outcome into cross-run org memory so org_recall (and * future runs) can find it by meaning, not just recency. * * #293: best-effort used to mean invisible. `bridgeStoreEntry` returns `null` * when the backend cannot be resolved (an unbuilt or half-installed * `@monoes/memory`, a corrupt store) — this function ignored that, its caller * sat in a `try` whose `catch` never fired because nothing threw, and the only * trace was a `logBridgeError` line printed solely under MONOMIND_DEBUG=1. So * a run finished, wrote runtime.json and history, and had saved nothing; every * later org_recall came back empty with no hint why. * * It still does NOT throw: the run itself succeeded and its history is already * on disk by the time this runs, so failing it over post-run bookkeeping would * be a worse outcome than a loud warning (and in stopOrg it would land in a * `catch` that blames the history write). Instead the loss is reported three * ways — an `audit` event on `bus`, an unconditional stderr warning, and the * returned result, which stopOrg persists into runtime.json so `org status` * still shows it long after the terminal has scrolled away. */ export declare function storeRunMemory(daemon: OrgDaemon, name: string, def: OrgDef, run: string, summary: RunSummary, bus?: AuditSink): Promise; export {}; //# sourceMappingURL=org-memory.d.ts.map