mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-26 04:15:48 -06:00
6d7bc062e3
* fix(session-catalog): hide OpenClaw-managed upstream sessions * fix(codex): filter managed paired-node sessions * fix(codex): classify legacy managed sessions * fix(session-catalog): classify managed provider sessions * fix(session-catalog): backfill inter-session ownership * fix(session-catalog): classify Claude internal prompts * fix(session-catalog): retain durable provenance * fix(codex): keep rollout home derivation private * fix(anthropic): declare catalog schema dependency * fix(anthropic): avoid catalog schema dependency * fix(session-catalog): scope managed ownership to Codex * fix(codex): contain catalog provenance reads * fix(codex): bind managed threads to catalog home --------- Co-authored-by: VACInc <3279061+VACInc@users.noreply.github.com> Co-authored-by: Josh Lehman <550978+jalehman@users.noreply.github.com>
52 lines
2.4 KiB
TypeScript
52 lines
2.4 KiB
TypeScript
/** Lazy store facade that keeps binding schema/auth code off plugin startup. */
|
|
import type { PluginStateSyncKeyedStore } from "openclaw/plugin-sdk/plugin-state-runtime";
|
|
import {
|
|
createCodexManagedThreadStore,
|
|
type CodexManagedThreadStore,
|
|
type StoredCodexManagedThread,
|
|
} from "./managed-thread-store.js";
|
|
import {
|
|
CODEX_APP_SERVER_BINDING_MAX_ENTRIES,
|
|
CODEX_APP_SERVER_BINDING_NAMESPACE,
|
|
} from "./session-binding-meta.js";
|
|
import type { CodexAppServerBindingStore, StoredCodexAppServerBinding } from "./session-binding.js";
|
|
|
|
export { CODEX_APP_SERVER_BINDING_MAX_ENTRIES, CODEX_APP_SERVER_BINDING_NAMESPACE };
|
|
export type { StoredCodexAppServerBinding } from "./session-binding.js";
|
|
|
|
/** Defers schema compilation and auth loading until the first binding operation. */
|
|
export function createLazyCodexAppServerBindingStore(
|
|
state: Pick<
|
|
PluginStateSyncKeyedStore<StoredCodexAppServerBinding>,
|
|
"entries" | "lookup" | "update"
|
|
>,
|
|
managedThreadState?: Pick<
|
|
PluginStateSyncKeyedStore<StoredCodexManagedThread>,
|
|
"entries" | "registerIfAbsent"
|
|
>,
|
|
): CodexAppServerBindingStore {
|
|
let resolved: Promise<CodexAppServerBindingStore> | undefined;
|
|
const store = () =>
|
|
(resolved ??= import("./session-binding.js").then(({ createCodexAppServerBindingStore }) =>
|
|
createCodexAppServerBindingStore(state),
|
|
));
|
|
const managedThreads: CodexManagedThreadStore | undefined = managedThreadState
|
|
? createCodexManagedThreadStore(managedThreadState)
|
|
: undefined;
|
|
return {
|
|
...(managedThreads ? { managedThreads } : {}),
|
|
read: async (identity) => (await store()).read(identity),
|
|
hasOtherThreadOwner: async (threadId, currentIdentity) =>
|
|
(await store()).hasOtherThreadOwner(threadId, currentIdentity),
|
|
mutate: async (identity, mutation) => (await store()).mutate(identity, mutation),
|
|
prepareSessionGenerationReclaim: async (identity) =>
|
|
(await store()).prepareSessionGenerationReclaim(identity),
|
|
adoptSessionGeneration: async (identity, previousSessionId) =>
|
|
(await store()).adoptSessionGeneration(identity, previousSessionId),
|
|
resetSessionGeneration: async (identity) => (await store()).resetSessionGeneration(identity),
|
|
retireSessionGeneration: async (identity) => (await store()).retireSessionGeneration(identity),
|
|
withThreadArchiveFence: async (run) => (await store()).withThreadArchiveFence(run),
|
|
withLease: async (identity, run) => (await store()).withLease(identity, run),
|
|
};
|
|
}
|