mirror of
https://github.com/Kaelio/ktx.git
synced 2026-06-22 08:38:08 +02:00
* Improve schema setup and Notion ingest UX * Handle Postgres network scan failures * WIP: save local changes before main merge * Refine setup prompt choices * Tighten ingest reconciliation guidance * Commit setup config updates * Canonicalize unmapped fallback details * Count reconciliation actions in reports * Harden semantic layer source validation * Return wiki content after edits * Validate SL sources against manifests * Validate wiki refs before writes * Simplify CLI next steps * Clarify agent setup summary * Surface dbt target SL sources * Recover SL write fallbacks * Preserve failed context build metadata * Track raw paths for ingest actions * test(cli): update seeded demo expectations * fix(ingest): scope fallback recovery checks * fix(sl): tighten source validation guards * fix(wiki): ignore empty embedding vectors * Improve Notion ingest UX * Enforce flat wiki keys * test(context): update wiki key assertion --------- Co-authored-by: Andrey Avtomonov <andreybavt@gmail.com>
30 lines
865 B
TypeScript
30 lines
865 B
TypeScript
import type { ToolSession } from './tool-session.js';
|
|
|
|
type ActionRawPathValidation =
|
|
| { ok: true; rawPaths?: string[] }
|
|
| { ok: false; error: string };
|
|
|
|
export function validateActionRawPaths(
|
|
session: ToolSession | undefined,
|
|
rawPaths: readonly string[] | undefined,
|
|
): ActionRawPathValidation {
|
|
if (!rawPaths || rawPaths.length === 0) {
|
|
return { ok: true };
|
|
}
|
|
|
|
const uniqueRawPaths = [...new Set(rawPaths)];
|
|
const allowedRawPaths = session?.allowedRawPaths;
|
|
if (!allowedRawPaths) {
|
|
return { ok: true, rawPaths: uniqueRawPaths };
|
|
}
|
|
|
|
const unavailable = uniqueRawPaths.filter((rawPath) => !allowedRawPaths.has(rawPath));
|
|
if (unavailable.length > 0) {
|
|
return {
|
|
ok: false,
|
|
error: `rawPaths include unavailable ingest file(s): ${unavailable.join(', ')}`,
|
|
};
|
|
}
|
|
|
|
return { ok: true, rawPaths: uniqueRawPaths };
|
|
}
|