chore(deadcode): inline constant helper stubs

This commit is contained in:
Vincent Koc
2026-06-22 03:01:31 +08:00
parent 102ab759e7
commit 690efd2a16
6 changed files with 12 additions and 40 deletions

View File

@@ -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<PluginStateKeyedStore<MatrixSyncCacheRecord>, "lookup">;
}): Promise<boolean> {
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<void> {
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);

View File

@@ -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,
});

View File

@@ -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 };

View File

@@ -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";

View File

@@ -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);

View File

@@ -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 ??