mirror of
https://github.com/lossless-group/perplexed-plugin.git
synced 2026-07-22 17:00:32 +00:00
Two threads bundled because they were one session's work and the changelog tells the joined story:
1. PARTIALS + PREAMBLES — shared guidance moves out of TypeScript constants and out of duplicated template blocks into vault-visible markdown that templates pull in by name.
Three peer folders under templatesRoot's parent:
zz-cf-lib/templates/ (existing — your four profile templates)
zz-cf-lib/partials/ (new — pulled in via {{include: name}})
zz-cf-lib/preambles/ (new — auto-attached to every Perplexity request)
What moved:
- INLINE_CITATION_DIRECTIVE → src/docs/preambles/inline-citation.md
- IMAGE_PLACEMENT_DIRECTIVE → src/docs/preambles/image-placement.md
- buildResearchFraming() → src/docs/preambles/research-framing.md
- mermaid syntax discipline block (was duplicated across all four profile templates) → src/docs/partials/mermaid-discipline.md
New engine surface in src/services/directoryTemplateService.ts:
- expandIncludes(app, text, partialsRoot) — async, recursive, max depth 5, cycle-detected. Missing partials surface as inline [[include: <name> — file not found]] markers; cycles as [[include: <name> — cycle detected]].
- loadPreamble(app, preamblesRoot, name) — vault first, bundled default fallback with console.warn.
- parsePreambleOverrides(cftConfig) — per-template { system, skip-user, skip-all } in the cft fence.
- applyTemplate refactored: expand-then-interpolate for cftSystem and userSkeleton; preambles resolved (each expanded + interpolated) then assembled before sending.
DirectoryTemplateSettings extended with partialsRoot, preamblesRoot, systemPreambles, userPreambles. PerplexedPluginSettings + DEFAULT_SETTINGS mirror these (defaults: zz-cf-lib/partials, zz-cf-lib/preambles, [inline-citation], [{research-framing,always},{image-placement,return-images}]). Four new settings-tab rows expose them. buildDirectoryTemplateSettings() helper replaces two duplicated dirSettings literals.
templateSeederService.ts rewritten around a shared seedFolder() helper. Now seeds three folders (templates / partials / preambles) with the same idempotent rule (README always; content files only when target folder is missing or empty). Exports BUNDLED_PREAMBLES for runtime fallback when a vault preamble file is absent. seedTemplatesIfMissing and reSeedMissingFiles both take optional partialsRoot/preamblesRoot args.
The four bundled profile templates now reference {{include: mermaid-discipline}} in place of the previously-duplicated checklist block.
2. SETTINGS-UI FIX — eight call sites in main.ts had activeDocument.createEl('textarea'), an Obsidian global that's undefined in current Obsidian versions. The first one threw at the Perplexity "Request body template" textarea and aborted PerplexedSettingTab.display() before any of the other 11 sections (Claude, Perplexica/Vane, LM Studio, prompt blocks, Directory templates, Find Images) could mount. All eight switched to containerEl.createEl, matching every other DOM operation in the file. Settings tab now renders end-to-end.
Build green: pnpm build (eslint + tsc + esbuild production) exits 0.
Architecture review and design rationale captured at content-farm/context-v/issues/Partials-And-Preambles-For-Perplexed-Templates.md before implementing.
Vault-seeding caveat unchanged: existing vault templates won't auto-replace on plugin update. Copy the four updated bundled templates into your vault manually (or delete + reload) to pick up the {{include: …}} directive; the seeder will create zz-cf-lib/partials/ and zz-cf-lib/preambles/ on next plugin load.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
||
|---|---|---|
| .. | ||
| Getting-Claude-to-Respond-With-Research.md | ||
| Partials-And-Preambles-For-Perplexed-Templates.md | ||
| Updating-Naming-to-Reflect-Provider-Rebrand.md | ||