mindnet_obsidian/src/settings.ts
Lars 86c88bc275
Some checks are pending
Node.js build / build (20.x) (push) Waiting to run
Node.js build / build (22.x) (push) Waiting to run
Enhance Mindnet settings and chain inspection features
- Added new settings for analysis policies path, chain inspector include candidates, and max template matches.
- Updated MindnetSettingTab to allow user configuration of new settings with validation.
- Enhanced chain inspection logic to respect includeCandidates option consistently across findings.
- Improved template matching to apply slot type defaults for known templates, ensuring better handling of allowed node types.
- Refactored tests to validate new functionality and ensure consistent behavior in edge case scenarios.
2026-01-19 15:47:23 +01:00

116 lines
4.7 KiB
TypeScript

export interface MindnetSettings {
edgeVocabularyPath: string; // vault-relativ
graphSchemaPath: string; // vault-relativ (später)
maxHops: number;
strictMode: boolean;
showCanonicalHints: boolean;
chainDirection: "forward" | "backward" | "both";
interviewConfigPath: string; // vault-relativ
autoStartInterviewOnCreate: boolean;
interceptUnresolvedLinkClicks: boolean;
autoStartOnUnresolvedClick: boolean; // Auto-start interview when creating note from unresolved link
bypassModifier: "Alt" | "Ctrl" | "Shift" | "None"; // Modifier key to bypass intercept (Reading View)
editorFollowModifier: "Alt" | "Ctrl" | "Shift" | "None"; // Modifier key required for editor intercept (Live Preview/Source)
waitForFirstModifyAfterCreate: boolean; // Wait for Templater to modify file before starting wizard
waitForModifyTimeoutMs: number; // Timeout in ms for waiting for modify event
debugLogging: boolean; // Enable debug logging for unresolved link handling
adoptNewNotesInEditor: boolean; // Auto-adopt newly created notes in editor
adoptMaxChars: number; // Max content length to consider note as adopt-candidate
adoptConfirmMode: "always" | "onlyLowConfidence" | "never"; // When to show adoption confirmation
highConfidenceWindowMs: number; // Time window in ms for high-confidence adoption
// Semantic mapping builder settings
mappingWrapperCalloutType: string; // default: "abstract"
mappingWrapperTitle: string; // default: "🕸️ Semantic Mapping"
mappingWrapperFolded: boolean; // default: true
defaultEdgeType: string; // default: ""
unassignedHandling: "prompt" | "none" | "defaultType" | "advisor"; // default: "prompt"
allowOverwriteExistingMappings: boolean; // default: false
defaultNotesFolder: string; // default: "" (vault root)
// Inline micro edge suggester settings
inlineMicroEnabled: boolean; // default: true
inlineMaxAlternatives: number; // default: 6
inlineCancelBehavior: "keep_link"; // default: "keep_link" (future: "revert")
// Export settings
exportPath: string; // default: "_system/exports/graph_export.json"
chainRolesPath: string; // default: "_system/dictionary/chain_roles.yaml"
chainTemplatesPath: string; // default: "_system/dictionary/chain_templates.yaml"
analysisPoliciesPath: string; // default: "_system/dictionary/analysis_policies.yaml"
templateMatchingProfile: "discovery" | "decisioning"; // default: "discovery"
// Chain Inspector settings
chainInspectorIncludeCandidates: boolean; // default: false
chainInspectorMaxTemplateMatches: number; // default: 3
// Fix Actions settings
fixActions: {
createMissingNote: {
mode: "skeleton_only" | "create_and_open_profile_picker" | "create_and_start_wizard";
defaultTypeStrategy: "profile_picker" | "inference_then_picker" | "default_concept_no_prompt";
includeZones: "none" | "note_links_only" | "candidates_only" | "both";
};
createMissingHeading: {
level: number;
};
promoteCandidate: {
keepOriginal: boolean;
};
};
}
export const DEFAULT_SETTINGS: MindnetSettings = {
edgeVocabularyPath: "_system/dictionary/edge_vocabulary.md",
graphSchemaPath: "_system/dictionary/graph_schema.md",
maxHops: 3,
strictMode: false,
showCanonicalHints: false,
chainDirection: "forward",
interviewConfigPath: "_system/dictionary/interview_config.yaml",
autoStartInterviewOnCreate: false,
interceptUnresolvedLinkClicks: true,
autoStartOnUnresolvedClick: true,
bypassModifier: "Alt",
editorFollowModifier: "Ctrl",
waitForFirstModifyAfterCreate: true,
waitForModifyTimeoutMs: 1200,
debugLogging: false,
adoptNewNotesInEditor: true,
adoptMaxChars: 200,
adoptConfirmMode: "onlyLowConfidence",
highConfidenceWindowMs: 3000,
mappingWrapperCalloutType: "abstract",
mappingWrapperTitle: "🕸️ Semantic Mapping",
mappingWrapperFolded: true,
defaultEdgeType: "",
unassignedHandling: "prompt",
allowOverwriteExistingMappings: false,
defaultNotesFolder: "",
inlineMicroEnabled: true,
inlineMaxAlternatives: 6,
inlineCancelBehavior: "keep_link",
exportPath: "_system/exports/graph_export.json",
chainRolesPath: "_system/dictionary/chain_roles.yaml",
chainTemplatesPath: "_system/dictionary/chain_templates.yaml",
analysisPoliciesPath: "_system/dictionary/analysis_policies.yaml",
templateMatchingProfile: "discovery",
chainInspectorIncludeCandidates: false,
chainInspectorMaxTemplateMatches: 3,
fixActions: {
createMissingNote: {
mode: "skeleton_only",
defaultTypeStrategy: "profile_picker",
includeZones: "none",
},
createMissingHeading: {
level: 2,
},
promoteCandidate: {
keepOriginal: true,
},
},
};
/**
* Optional helper: normalize to Obsidian vault paths (forward slashes).
*/
export function normalizeVaultPath(p: string): string {
return (p || "").trim().replace(/\\/g, "/");
}