From 690efd2a162d4f5a375f828de048565682f7f67f Mon Sep 17 00:00:00 2001 From: Vincent Koc Date: Mon, 22 Jun 2026 03:01:31 +0800 Subject: [PATCH] chore(deadcode): inline constant helper stubs --- .../matrix/src/matrix/client/file-sync-store.ts | 10 +++------- extensions/memory-core/src/dreaming-narrative.ts | 14 +++++--------- extensions/oc-path/src/oc-path/emit.ts | 12 ------------ extensions/oc-path/src/oc-path/index.ts | 2 +- src/agents/auth-health.ts | 6 +----- src/auto-reply/reply/queue/settings.ts | 8 ++------ 6 files changed, 12 insertions(+), 40 deletions(-) diff --git a/extensions/matrix/src/matrix/client/file-sync-store.ts b/extensions/matrix/src/matrix/client/file-sync-store.ts index 788474762362..1e252304403e 100644 --- a/extensions/matrix/src/matrix/client/file-sync-store.ts +++ b/extensions/matrix/src/matrix/client/file-sync-store.ts @@ -171,7 +171,7 @@ export class SqliteBackedMatrixSyncStore extends MemoryStore { constructor(private readonly storageRootDir: string) { super(); - this.stateKey = resolveSyncCacheStateKey(storageRootDir); + this.stateKey = SYNC_CACHE_STATE_KEY; let restoredSavedSync: ISyncData | null = null; let restoredClientOptions: IStoredClientOpts | undefined; @@ -426,10 +426,6 @@ function openMatrixSyncCacheStore( ); } -function resolveSyncCacheStateKey(_storageRootDir: string): string { - return SYNC_CACHE_STATE_KEY; -} - function metaKey(stateKey: string): string { return `${stateKey}:meta`; } @@ -557,7 +553,7 @@ export async function hasMatrixSyncCacheStateInStore(params: { storageRootDir: string; store: Pick, "lookup">; }): Promise { - const stateKey = resolveSyncCacheStateKey(params.storageRootDir); + const stateKey = SYNC_CACHE_STATE_KEY; const meta = await params.store.lookup(metaKey(stateKey)); if (!isSyncCacheMeta(meta) || meta.chunkCount <= 0) { return false; @@ -586,7 +582,7 @@ export async function writeMatrixSyncCacheStateToStore(params: { payload: PersistedMatrixSyncStore; store: MatrixSyncCacheAsyncStore; }): Promise { - const stateKey = resolveSyncCacheStateKey(params.storageRootDir); + const stateKey = SYNC_CACHE_STATE_KEY; const rows = buildSyncCacheRows(stateKey, params.payload); for (const row of rows.chunks) { await params.store.register(row.key, row.value); diff --git a/extensions/memory-core/src/dreaming-narrative.ts b/extensions/memory-core/src/dreaming-narrative.ts index ad23b6fed97f..87b989d1774b 100644 --- a/extensions/memory-core/src/dreaming-narrative.ts +++ b/extensions/memory-core/src/dreaming-narrative.ts @@ -151,14 +151,8 @@ function formatFallbackWriteFailure(err: unknown): string { return "unknown error"; } -// Raw snippets and promotions are pre-processing memory staging fragments -// (session metadata, conversation summaries, operational logs). They must never -// be persisted to the human-readable dream diary. When narrative generation -// fails, always fall back to a generic placeholder so no staging content leaks -// into DREAMS.md. -function buildRequestScopedFallbackNarrative(_data: NarrativePhaseData): string { - return "A memory trace surfaced, but details were unavailable in this run."; -} +const REQUEST_SCOPED_FALLBACK_NARRATIVE = + "A memory trace surfaced, but details were unavailable in this run."; export async function appendFallbackNarrativeEntry(params: { workspaceDir: string; @@ -171,7 +165,9 @@ export async function appendFallbackNarrativeEntry(params: { try { await appendNarrativeEntry({ workspaceDir: params.workspaceDir, - narrative: buildRequestScopedFallbackNarrative(params.data), + // Raw snippets and promotions are pre-processing memory staging fragments. + // Keep fallback diary text generic so DREAMS.md never leaks staging content. + narrative: REQUEST_SCOPED_FALLBACK_NARRATIVE, nowMs: params.nowMs, timezone: params.timezone, }); diff --git a/extensions/oc-path/src/oc-path/emit.ts b/extensions/oc-path/src/oc-path/emit.ts index ad0ca54b0ac6..bdd613c358f0 100644 --- a/extensions/oc-path/src/oc-path/emit.ts +++ b/extensions/oc-path/src/oc-path/emit.ts @@ -125,18 +125,6 @@ function formatFrontmatterValue(value: string): string { return value; } -/** - * Mark an AST as "dirty" — useful for callers that mutate the AST - * structurally and want emitMd() to re-render rather than round-trip. - * - * Currently a no-op flag — emitMd() decides based on `opts.mode`. Kept - * as an extension point for a future invariant where the AST tracks - * its own dirty state. - */ -export function markDirty(_ast: MdAst): void { - // intentionally empty -} - // Re-export the frontmatter type for convenience so tests don't need // to import from ast.ts. export type { FrontmatterEntry }; diff --git a/extensions/oc-path/src/oc-path/index.ts b/extensions/oc-path/src/oc-path/index.ts index 75aa07e6b9b0..f32e15f45615 100644 --- a/extensions/oc-path/src/oc-path/index.ts +++ b/extensions/oc-path/src/oc-path/index.ts @@ -73,7 +73,7 @@ export type { JsonlParseResult } from "./jsonl/parse.js"; export type { YamlParseResult } from "./yaml/parse.js"; export type { EmitOptions } from "./emit.js"; -export { emitMd, markDirty } from "./emit.js"; +export { emitMd } from "./emit.js"; export type { JsoncEmitOptions } from "./jsonc/emit.js"; export { emitJsonc } from "./jsonc/emit.js"; export type { JsonlEmitOptions } from "./jsonl/emit.js"; diff --git a/src/agents/auth-health.ts b/src/agents/auth-health.ts index 0c8081228ac4..7e006e48b35b 100644 --- a/src/agents/auth-health.ts +++ b/src/agents/auth-health.ts @@ -62,10 +62,6 @@ export type AuthHealthSummary = { export const DEFAULT_OAUTH_WARN_MS = 24 * 60 * 60 * 1000; -function resolveAuthProfileSource(_profileId: string): AuthProfileSource { - return "store"; -} - /** Format a remaining-duration value for compact auth status displays. */ export function formatRemainingShort( remainingMs?: number, @@ -141,7 +137,7 @@ function buildProfileHealth(params: { allowKeychainPrompt, } = params; const label = resolveAuthProfileDisplayLabel({ cfg, store, profileId }); - const source = resolveAuthProfileSource(profileId); + const source: AuthProfileSource = "store"; const healthCredential = runtimeCredential ?? credential; const provider = normalizeProviderId(healthCredential.provider); diff --git a/src/auto-reply/reply/queue/settings.ts b/src/auto-reply/reply/queue/settings.ts index eb0d208b1ca9..ddb754117a77 100644 --- a/src/auto-reply/reply/queue/settings.ts +++ b/src/auto-reply/reply/queue/settings.ts @@ -7,11 +7,7 @@ import { normalizeQueueMode, } from "./normalize.js"; import { DEFAULT_QUEUE_CAP, DEFAULT_QUEUE_DEBOUNCE_MS, DEFAULT_QUEUE_DROP } from "./state.js"; -import type { QueueMode, QueueSettings, ResolveQueueSettingsParams } from "./types.js"; - -function defaultQueueModeForChannel(_channel?: string): QueueMode { - return "steer"; -} +import type { QueueSettings, ResolveQueueSettingsParams } from "./types.js"; /** Resolve per-channel debounce override from debounceMsByChannel map. */ function resolveChannelDebounce( @@ -37,7 +33,7 @@ export function resolveQueueSettings(params: ResolveQueueSettingsParams): QueueS normalizePersistedQueueMode(params.sessionEntry?.queueMode) ?? normalizeQueueMode(providerModeRaw) ?? normalizeQueueMode(queueCfg?.mode) ?? - defaultQueueModeForChannel(channelKey); + "steer"; const debounceRaw = params.inlineOptions?.debounceMs ?? params.sessionEntry?.queueDebounceMs ??