dsh-fundus 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/lib/client.js.map +1 -1
- package/lib/core.mjs +29 -2
- package/lib/core.mjs.map +2 -2
- package/lib/index.js +29 -2
- package/lib/index.js.map +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# dsh-fundus
|
|
2
2
|
|
|
3
|
-
> **Status:** `0.1.
|
|
3
|
+
> **Status:** `0.1.2` — Tier-1 Unified Local Studio Archive for **[The Ivory Tower](https://github.com/janpauldahlke/the-ivory-tower)** / [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness)
|
|
4
4
|
|
|
5
5
|
Indexes documents, `dsh-web-missions` receipts, and tagged media in `~/.ivory-tower/fundus/` (`node:sqlite` FTS5 + BM25), verifies primary-source quote provenance via `ctx.galley.registerPreflight('fundus-quotes')`, and exposes a calm read-only **Sources & Media** right-sidebar inspector.
|
|
6
6
|
|
package/lib/client.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/client/index.tsx", "../src/shared/types.ts", "../src/shared/i18n.ts", "../src/client/FundusIcon.tsx", "../src/client/FundusPane.tsx"],
|
|
4
|
-
"sourcesContent": ["/** dsh-fundus \u2014 browser client face (ModuleLoader CJS entry). */\nimport type { Context } from '@deepseek-ai/cordis'\nimport { PLUGIN } from '../shared/types.ts'\nimport { t, type LocaleCode } from '../shared/i18n.ts'\nimport { FundusIcon } from './FundusIcon.tsx'\nimport { FundusPane } from './FundusPane.tsx'\n\nexport const name = PLUGIN\nexport const inject = ['slots', 'sidebarRightTabs']\n\nconst STYLE = `[data-dsh-fundus],.dsh-fundus-pane{--f-paper:var(--ivory-paper,#FAF7F2);--f-desk:var(--ivory-desk,#EFE9DF);--f-ink:var(--ivory-ink,#1C1917);--f-muted:var(--ivory-ink-muted,#57534E);--f-line:var(--ivory-line,#E3DCD0);--f-ok:var(--ivory-verified,#3D6B4F);color:var(--f-ink);font:13px/1.45 ui-sans-serif,system-ui,sans-serif}.dsh-fundus-pane{display:flex;flex-direction:column;gap:8px;height:100%;padding:8px;background:var(--f-paper)}.dsh-fundus-head{display:flex;justify-content:space-between;align-items:center;color:var(--f-muted);font-size:12px}.dsh-fundus-refresh,.dsh-fundus-pills button,.dsh-fundus-id{border:1px solid var(--f-line);background:var(--f-desk);color:var(--f-ink);border-radius:4px;cursor:pointer;padding:2px 8px}.dsh-fundus-search{width:100%;border:1px solid var(--f-line);border-radius:4px;padding:6px 8px;background:#fff;color:var(--f-ink)}.dsh-fundus-pills{display:flex;gap:4px;flex-wrap:wrap}.dsh-fundus-pills button.is-active{background:var(--f-ok);color:#fff;border-color:var(--f-ok)}.dsh-fundus-list{overflow:auto;display:flex;flex-direction:column;gap:8px}.dsh-fundus-card{display:flex;gap:8px;border-top:1px solid var(--f-line);padding-top:8px;cursor:pointer}.dsh-fundus-thumb{width:48px;height:48px;object-fit:cover;background:var(--f-desk);flex:none}.dsh-fundus-card-body{min-width:0;flex:1}.dsh-fundus-card header{display:flex;justify-content:space-between;gap:8px;align-items:baseline}.dsh-fundus-meta,.dsh-fundus-card footer,.dsh-fundus-empty{color:var(--f-muted);font-size:12px}.dsh-fundus-detail{white-space:pre-wrap;background:var(--f-desk);padding:8px;border-radius:4px;font-size:12px}.dsh-fundus-id{font-family:ui-monospace,monospace;font-size:11px}`\n\nfunction resolveLocale(ctx: Context): LocaleCode {\n try {\n const loc =\n typeof ctx.get === 'function' ? (ctx.get('locale') as { lang?: string } | undefined) : undefined\n return loc?.lang === 'de' ? 'de' : 'en'\n } catch {\n return 'en'\n }\n}\n\nfunction label(ctx: Context, key: 'tabTitle' | 'tabDescription') {\n return t(resolveLocale(ctx), key)\n}\n\nexport function apply(ctx: Context): void {\n if (typeof document !== 'undefined' && !document.querySelector('style[data-dsh-fundus]')) {\n const el = document.createElement('style')\n el.setAttribute('data-dsh-fundus', '')\n el.textContent = STYLE\n document.head.appendChild(el)\n ctx.effect(() => () => el.remove(), 'fundus: style')\n }\n const tabs = ctx.sidebarRightTabs as { register: (d: Record<string, unknown>) => () => void }\n const slots = ctx.slots as {\n inject: (n: string, f: () => () => void) => () => void\n register: (s: { name: string; key: string }, c: unknown) => () => void\n }\n const disposeType = tabs.register({\n id: 'fundus',\n kind: 'fundus',\n title: () => label(ctx, 'tabTitle'),\n guide: [\n {\n id: 'fundus',\n order: 290,\n title: () => label(ctx, 'tabTitle'),\n description: () => label(ctx, 'tabDescription'),\n icon: FundusIcon,\n },\n ],\n })\n const disposeBody = slots.inject('sidebar.right.pane.tab', () =>\n slots.register({ name: 'sidebar.right.pane.tab', key: 'fundus' }, FundusPane),\n )\n ctx.effect(\n () => () => {\n disposeBody()\n disposeType()\n },\n 'fundus: rightbar tab',\n )\n}\n", "/**\n * dsh-fundus \u2014 shared constants & public type authority.\n * Mirror of agent/STUDIO_CONTRACTS.d.ts seams needed by this brick (never import agent/).\n */\n\nexport const PLUGIN = 'dsh-fundus'\nexport const VERSION = '0.1.1'\n\nexport interface HealthProbe {\n ok: true\n plugin: typeof PLUGIN\n version: string\n}\n\nexport type StudioToolCategory =\n | 'archive-intake'\n | 'archive-admin'\n | 'planning'\n | 'plates'\n | 'review'\n\nexport interface StudioTailToolPropertySchema {\n readonly type: 'string' | 'number' | 'integer' | 'boolean' | 'array'\n readonly description: string\n readonly enum?: readonly string[]\n readonly items?: {\n readonly type: 'string' | 'number' | 'integer' | 'boolean'\n readonly enum?: readonly string[]\n }\n readonly minimum?: number\n readonly maximum?: number\n}\n\nexport interface StudioTailToolSchema {\n readonly type: 'object'\n readonly properties: Readonly<Record<string, StudioTailToolPropertySchema>>\n readonly required: readonly string[]\n readonly additionalProperties: false\n}\n\nexport interface StudioTailToolExecContext {\n readonly cwd?: string\n readonly sessionId?: string\n readonly signal?: AbortSignal\n}\n\nexport interface StudioTailToolDescriptor {\n readonly name: string\n readonly owner: string\n readonly category: StudioToolCategory\n readonly description: string\n readonly searchTerms: readonly string[]\n readonly parametersSchema: StudioTailToolSchema\n execute(\n args: Record<string, unknown>,\n exec?: StudioTailToolExecContext,\n ): Promise<Record<string, unknown>> | Record<string, unknown>\n}\n\nexport interface StudioTailToolProvider {\n listTailTools(): readonly StudioTailToolDescriptor[]\n executeTailTool(\n name: string,\n args: Record<string, unknown>,\n exec?: StudioTailToolExecContext,\n ): Promise<Record<string, unknown>>\n}\n\nexport interface SourceProvenanceLike {\n readonly sourceId: string\n readonly quoteSha256?: string\n readonly citation?: string\n readonly locator?: string\n}\n\nexport type GalleyInlineLike =\n | { readonly t: 'text'; readonly v: string }\n | { readonly t: 'strong'; readonly c: readonly GalleyInlineLike[] }\n | { readonly t: 'emph'; readonly c: readonly GalleyInlineLike[] }\n | { readonly t: 'code'; readonly v: string }\n | { readonly t: 'cloze'; readonly hint?: string }\n | { readonly t: 'math'; readonly v: string }\n | { readonly t: 'newline' }\n\nexport interface GalleyBlockLike {\n readonly id: string\n readonly type: string\n readonly body?: readonly GalleyInlineLike[]\n readonly provenance?: SourceProvenanceLike\n readonly [key: string]: unknown\n}\n\nexport interface GalleyPacketLike {\n readonly id: string\n readonly sheetOrder: readonly string[]\n readonly sheets: Readonly<\n Record<\n string,\n {\n readonly id: string\n readonly title: string\n readonly blocks: readonly GalleyBlockLike[]\n }\n >\n >\n readonly [key: string]: unknown\n}\n\nexport interface GalleyPreflightWarningLike {\n readonly code: string\n readonly severity: 'info' | 'warn' | 'error'\n readonly sheetId?: string\n readonly blockId?: string\n readonly message: string\n}\n\nexport interface GalleyServiceLike {\n registerPreflight(\n id: string,\n check: (packet: GalleyPacketLike, cwd: string) => GalleyPreflightWarningLike[],\n ): () => void\n getStore(cwd?: string): {\n listAnnotations?(packetId: string): ReadonlyArray<{\n readonly id: string\n readonly blockId: string\n readonly body: readonly GalleyInlineLike[]\n readonly provenance?: SourceProvenanceLike\n readonly resolved: boolean\n }>\n }\n}\n\nexport interface CompanionShelfItemLike {\n readonly id: string\n readonly section: 'sources' | 'unit-plan' | 'custom'\n readonly label: { readonly en: string; readonly de?: string }\n readonly badge?: string | number\n readonly rightTabKind?: string\n readonly starterPrompt?: string\n}\n\nexport interface IvoryShellServiceLike {\n registerShelfItem(item: CompanionShelfItemLike): () => void\n}\n\nexport type FundusSearchKind = 'all' | 'passage' | 'source' | 'media'\nexport type FundusSourceKind = 'markdown' | 'text' | 'json-pack' | 'web-mission' | 'media'\nexport type FundusVisionStatus = 'none' | 'pending' | 'done' | 'failed'\n\nexport interface FundusQuoteVerification {\n readonly ok: boolean\n readonly code:\n | 'VERIFIED_EXACT'\n | 'VERIFIED_EXCERPT'\n | 'NON_FUNDUS_ID'\n | 'FUNDUS_UNKNOWN_SOURCE'\n | 'FUNDUS_QUOTE_DRIFT'\n | 'FUNDUS_HASH_MISMATCH'\n readonly sourceId: string\n readonly canonicalSha256: string\n readonly expectedSha256?: string\n readonly message?: string\n}\n\nexport interface FundusVisionAdapter {\n readonly id: string\n describeMedia(input: {\n readonly bytes: Buffer\n readonly mimeType: string\n readonly filename?: string\n readonly hintTitle?: string\n readonly signal?: AbortSignal\n }): Promise<{\n readonly description: string\n readonly ocrText?: string\n readonly suggestedTags?: readonly string[]\n readonly model: string\n }>\n}\n\nexport interface FundusConfig {\n readonly enabled?: boolean\n readonly vaultDir?: string\n readonly maxPassageChars?: number\n}\n\nexport interface FundusServiceLike extends StudioTailToolProvider {\n getVaultDir(): string\n getStats(): {\n readonly sources: number\n readonly passages: number\n readonly media: number\n readonly blobs: number\n }\n search(input: {\n readonly query: string\n readonly kind?: FundusSearchKind\n readonly tag?: string\n readonly language?: string\n readonly limit?: number\n }): Record<string, unknown>\n read(input: {\n readonly id: string\n readonly includePassages?: boolean\n }): Record<string, unknown>\n verifyQuote(input: {\n readonly text: string\n readonly provenance: SourceProvenanceLike\n }): FundusQuoteVerification\n registerVisionAdapter?(adapter: FundusVisionAdapter): () => void\n}\n\nexport interface WebMissionPageJson {\n readonly artifact_id: string\n readonly mission_id: string\n readonly url: string\n readonly finalUrl: string\n readonly normalized_url: string\n readonly status: number\n readonly contentType: string\n readonly title: string\n readonly content: string\n readonly fetchedAt: string\n readonly stored_at?: string\n readonly quality: 'full' | 'thin' | 'blocked'\n readonly qualitySignals?: readonly string[]\n}\n", "/**\n * EN + DE UI strings with 100% key parity.\n */\n\nexport type LocaleCode = 'en' | 'de'\n\nconst STRINGS = {\n en: {\n tabTitle: 'Sources & Media',\n tabDescription: 'Search and inspect the local Fundus archive of passages, sources, and media.',\n sourcesLabel: 'Sources & Media',\n refresh: 'Refresh',\n searchPlaceholder: 'Search passages, sources, media\u2026',\n filterAll: 'All',\n filterPassages: 'Passages',\n filterSources: 'Sources',\n filterMedia: 'Media',\n empty: 'No results yet. Ingest sources or clear the search box to browse recent entries.',\n copyId: 'Copy ID',\n stats: '{sources} sources \u00B7 {passages} passages \u00B7 {media} media',\n },\n de: {\n tabTitle: 'Quellen & Medien',\n tabDescription: 'Lokales Fundus-Archiv durchsuchen und Passagen, Quellen sowie Medien pr\u00FCfen.',\n sourcesLabel: 'Quellen & Medien',\n refresh: 'Aktualisieren',\n searchPlaceholder: 'Passagen, Quellen, Medien suchen\u2026',\n filterAll: 'Alle',\n filterPassages: 'Passagen',\n filterSources: 'Quellen',\n filterMedia: 'Medien',\n empty: 'Noch keine Treffer. Quellen einspielen oder Suchfeld leeren, um aktuelle Eintr\u00E4ge zu sehen.',\n copyId: 'ID kopieren',\n stats: '{sources} Quellen \u00B7 {passages} Passagen \u00B7 {media} Medien',\n },\n} as const\n\nexport type FundusUiKey = keyof typeof STRINGS.en\n\nexport function t(locale: LocaleCode, key: FundusUiKey): string {\n return STRINGS[locale][key] ?? STRINGS.en[key]\n}\n\nexport function formatStats(\n locale: LocaleCode,\n stats: { sources: number; passages: number; media: number },\n): string {\n return t(locale, 'stats')\n .replace('{sources}', String(stats.sources))\n .replace('{passages}', String(stats.passages))\n .replace('{media}', String(stats.media))\n}\n\nexport { STRINGS }\n", "/** Minimal archive / index-card icon for the Fundus right-sidebar tab. */\nexport function FundusIcon(props: { size?: number; className?: string }) {\n const size = props.size ?? 18\n return (\n <svg\n className={props.className as string | undefined}\n width={size}\n height={size}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n aria-hidden=\"true\"\n >\n <rect x=\"3\" y=\"4\" width=\"18\" height=\"16\" rx=\"2\" stroke=\"currentColor\" strokeWidth=\"1.5\" />\n <path d=\"M7 9h10M7 13h7M7 17h5\" stroke=\"currentColor\" strokeWidth=\"1.5\" strokeLinecap=\"round\" />\n </svg>\n )\n}\n", "import { useCallback, useEffect, useRef, useState } from 'react'\nimport { formatStats, t, type LocaleCode } from '../shared/i18n.ts'\n\ntype Hit = {\n kind: 'passage' | 'source' | 'media'\n id: string\n sourceId: string\n title: string\n locator?: string\n passageCount?: number\n snippet?: string\n license: string\n tags: string[]\n quoteSha256?: string\n mimeType?: string\n widthPx?: number | null\n heightPx?: number | null\n caption?: string\n}\ntype Filter = 'all' | 'passage' | 'source' | 'media'\n\nfunction resolvePaneLocale(ctx?: { get?: (k: string) => unknown }): LocaleCode {\n try {\n const loc =\n typeof ctx?.get === 'function' ? (ctx.get('locale') as { lang?: string } | undefined) : undefined\n return loc?.lang === 'de' ? 'de' : 'en'\n } catch {\n return 'en'\n }\n}\n\nexport function FundusPane(props: { ctx?: { get?: (k: string) => unknown } }) {\n const locale: LocaleCode = resolvePaneLocale(props.ctx)\n const [query, setQuery] = useState('')\n const [filter, setFilter] = useState<Filter>('all')\n const [hits, setHits] = useState<Hit[]>([])\n const [stats, setStats] = useState({ sources: 0, passages: 0, media: 0 })\n const [expanded, setExpanded] = useState<string | null>(null)\n const [detail, setDetail] = useState('')\n const timer = useRef<ReturnType<typeof setTimeout> | null>(null)\n\n const load = useCallback(async (q: string, kind: Filter) => {\n try {\n const res = await fetch(`/api/fundus/search?q=${encodeURIComponent(q || '*')}&kind=${kind}&limit=20`)\n const json = (await res.json()) as { hits?: Hit[]; stats?: typeof stats }\n setHits(json.hits ?? [])\n if (json.stats) setStats(json.stats)\n } catch {\n setHits([])\n }\n }, [])\n\n useEffect(() => {\n if (timer.current) clearTimeout(timer.current)\n timer.current = setTimeout(() => void load(query, filter), 150)\n return () => {\n if (timer.current) clearTimeout(timer.current)\n }\n }, [query, filter, load])\n\n const expand = async (hit: Hit) => {\n if (expanded === hit.id) {\n setExpanded(null)\n setDetail('')\n return\n }\n setExpanded(hit.id)\n try {\n const extra = hit.kind === 'source' ? '&includePassages=1' : ''\n const json = (await (await fetch(`/api/fundus/item?id=${encodeURIComponent(hit.id)}${extra}`)).json()) as {\n text?: string\n quoteSha256?: string\n caption?: string\n passages?: Array<{ id: string; locator: string; text: string }>\n }\n if (hit.kind === 'passage') {\n setDetail(`${json.text ?? ''}\\n\\nsha256: ${json.quoteSha256 ?? ''}`)\n } else if (hit.kind === 'source') {\n setDetail((json.passages ?? []).map((p) => `[${p.id} \u00B7 ${p.locator}] ${p.text}`).join('\\n\\n'))\n } else {\n setDetail(String(json.caption ?? hit.caption ?? ''))\n }\n } catch {\n setDetail('')\n }\n }\n\n const pills: Array<[Filter, string]> = [\n ['all', t(locale, 'filterAll')],\n ['passage', t(locale, 'filterPassages')],\n ['source', t(locale, 'filterSources')],\n ['media', t(locale, 'filterMedia')],\n ]\n\n return (\n <div className=\"dsh-fundus-pane\">\n <div className=\"dsh-fundus-head\">\n <span>{formatStats(locale, stats)}</span>\n <button type=\"button\" className=\"dsh-fundus-refresh\" onClick={() => void load(query, filter)}>\n \u21BB\n </button>\n </div>\n <input\n className=\"dsh-fundus-search\"\n value={query}\n placeholder={t(locale, 'searchPlaceholder')}\n onChange={(e: { target: { value: string } }) => setQuery(e.target.value)}\n />\n <div className=\"dsh-fundus-pills\">\n {pills.map(([id, label]) => (\n <button key={id} type=\"button\" className={filter === id ? 'is-active' : ''} onClick={() => setFilter(id)}>\n {label}\n </button>\n ))}\n </div>\n <div className=\"dsh-fundus-list\">\n {!hits.length ? <p className=\"dsh-fundus-empty\">{t(locale, 'empty')}</p> : null}\n {hits.map((hit) => (\n <article key={hit.id} className=\"dsh-fundus-card\" onClick={() => void expand(hit)}>\n {hit.kind === 'media' ? (\n <img className=\"dsh-fundus-thumb\" src={`/api/fundus/blob?sourceId=${hit.sourceId}`} alt=\"\" width={48} height={48} />\n ) : null}\n <div className=\"dsh-fundus-card-body\">\n <header>\n <strong>{hit.title}</strong>\n <button\n type=\"button\"\n className=\"dsh-fundus-id\"\n onClick={(e: { stopPropagation: () => void }) => {\n e.stopPropagation()\n void navigator.clipboard?.writeText(hit.id)\n }}\n >\n {hit.id}\n </button>\n </header>\n <div className=\"dsh-fundus-meta\">\n {hit.kind === 'passage'\n ? hit.locator\n : hit.kind === 'source'\n ? `${hit.passageCount ?? 0} passages`\n : `${hit.widthPx ?? '?'}\u00D7${hit.heightPx ?? '?'} \u00B7 ${hit.mimeType}`}\n </div>\n <p>{hit.kind === 'media' ? hit.caption : hit.snippet}</p>\n <footer>\n {hit.license}\n {hit.tags?.length ? ` \u00B7 ${hit.tags.join(', ')}` : ''}\n </footer>\n {expanded === hit.id && detail ? <pre className=\"dsh-fundus-detail\">{detail}</pre> : null}\n </div>\n </article>\n ))}\n </div>\n </div>\n )\n}\n"],
|
|
4
|
+
"sourcesContent": ["/** dsh-fundus \u2014 browser client face (ModuleLoader CJS entry). */\nimport type { Context } from '@deepseek-ai/cordis'\nimport { PLUGIN } from '../shared/types.ts'\nimport { t, type LocaleCode } from '../shared/i18n.ts'\nimport { FundusIcon } from './FundusIcon.tsx'\nimport { FundusPane } from './FundusPane.tsx'\n\nexport const name = PLUGIN\nexport const inject = ['slots', 'sidebarRightTabs']\n\nconst STYLE = `[data-dsh-fundus],.dsh-fundus-pane{--f-paper:var(--ivory-paper,#FAF7F2);--f-desk:var(--ivory-desk,#EFE9DF);--f-ink:var(--ivory-ink,#1C1917);--f-muted:var(--ivory-ink-muted,#57534E);--f-line:var(--ivory-line,#E3DCD0);--f-ok:var(--ivory-verified,#3D6B4F);color:var(--f-ink);font:13px/1.45 ui-sans-serif,system-ui,sans-serif}.dsh-fundus-pane{display:flex;flex-direction:column;gap:8px;height:100%;padding:8px;background:var(--f-paper)}.dsh-fundus-head{display:flex;justify-content:space-between;align-items:center;color:var(--f-muted);font-size:12px}.dsh-fundus-refresh,.dsh-fundus-pills button,.dsh-fundus-id{border:1px solid var(--f-line);background:var(--f-desk);color:var(--f-ink);border-radius:4px;cursor:pointer;padding:2px 8px}.dsh-fundus-search{width:100%;border:1px solid var(--f-line);border-radius:4px;padding:6px 8px;background:#fff;color:var(--f-ink)}.dsh-fundus-pills{display:flex;gap:4px;flex-wrap:wrap}.dsh-fundus-pills button.is-active{background:var(--f-ok);color:#fff;border-color:var(--f-ok)}.dsh-fundus-list{overflow:auto;display:flex;flex-direction:column;gap:8px}.dsh-fundus-card{display:flex;gap:8px;border-top:1px solid var(--f-line);padding-top:8px;cursor:pointer}.dsh-fundus-thumb{width:48px;height:48px;object-fit:cover;background:var(--f-desk);flex:none}.dsh-fundus-card-body{min-width:0;flex:1}.dsh-fundus-card header{display:flex;justify-content:space-between;gap:8px;align-items:baseline}.dsh-fundus-meta,.dsh-fundus-card footer,.dsh-fundus-empty{color:var(--f-muted);font-size:12px}.dsh-fundus-detail{white-space:pre-wrap;background:var(--f-desk);padding:8px;border-radius:4px;font-size:12px}.dsh-fundus-id{font-family:ui-monospace,monospace;font-size:11px}`\n\nfunction resolveLocale(ctx: Context): LocaleCode {\n try {\n const loc =\n typeof ctx.get === 'function' ? (ctx.get('locale') as { lang?: string } | undefined) : undefined\n return loc?.lang === 'de' ? 'de' : 'en'\n } catch {\n return 'en'\n }\n}\n\nfunction label(ctx: Context, key: 'tabTitle' | 'tabDescription') {\n return t(resolveLocale(ctx), key)\n}\n\nexport function apply(ctx: Context): void {\n if (typeof document !== 'undefined' && !document.querySelector('style[data-dsh-fundus]')) {\n const el = document.createElement('style')\n el.setAttribute('data-dsh-fundus', '')\n el.textContent = STYLE\n document.head.appendChild(el)\n ctx.effect(() => () => el.remove(), 'fundus: style')\n }\n const tabs = ctx.sidebarRightTabs as { register: (d: Record<string, unknown>) => () => void }\n const slots = ctx.slots as {\n inject: (n: string, f: () => () => void) => () => void\n register: (s: { name: string; key: string }, c: unknown) => () => void\n }\n const disposeType = tabs.register({\n id: 'fundus',\n kind: 'fundus',\n title: () => label(ctx, 'tabTitle'),\n guide: [\n {\n id: 'fundus',\n order: 290,\n title: () => label(ctx, 'tabTitle'),\n description: () => label(ctx, 'tabDescription'),\n icon: FundusIcon,\n },\n ],\n })\n const disposeBody = slots.inject('sidebar.right.pane.tab', () =>\n slots.register({ name: 'sidebar.right.pane.tab', key: 'fundus' }, FundusPane),\n )\n ctx.effect(\n () => () => {\n disposeBody()\n disposeType()\n },\n 'fundus: rightbar tab',\n )\n}\n", "/**\n * dsh-fundus \u2014 shared constants & public type authority.\n * Mirror of agent/STUDIO_CONTRACTS.d.ts seams needed by this brick (never import agent/).\n */\n\nexport const PLUGIN = 'dsh-fundus'\nexport const VERSION = '0.1.2'\n\nexport interface HealthProbe {\n ok: true\n plugin: typeof PLUGIN\n version: string\n}\n\nexport type StudioToolCategory =\n | 'archive-intake'\n | 'archive-admin'\n | 'planning'\n | 'plates'\n | 'review'\n\nexport interface StudioTailToolPropertySchema {\n readonly type: 'string' | 'number' | 'integer' | 'boolean' | 'array'\n readonly description: string\n readonly enum?: readonly string[]\n readonly items?: {\n readonly type: 'string' | 'number' | 'integer' | 'boolean'\n readonly enum?: readonly string[]\n }\n readonly minimum?: number\n readonly maximum?: number\n}\n\nexport interface StudioTailToolSchema {\n readonly type: 'object'\n readonly properties: Readonly<Record<string, StudioTailToolPropertySchema>>\n readonly required: readonly string[]\n readonly additionalProperties: false\n}\n\nexport interface StudioTailToolExecContext {\n readonly cwd?: string\n readonly sessionId?: string\n readonly signal?: AbortSignal\n}\n\nexport interface StudioTailToolDescriptor {\n readonly name: string\n readonly owner: string\n readonly category: StudioToolCategory\n readonly description: string\n readonly searchTerms: readonly string[]\n readonly parametersSchema: StudioTailToolSchema\n execute(\n args: Record<string, unknown>,\n exec?: StudioTailToolExecContext,\n ): Promise<Record<string, unknown>> | Record<string, unknown>\n}\n\nexport interface StudioTailToolProvider {\n listTailTools(): readonly StudioTailToolDescriptor[]\n executeTailTool(\n name: string,\n args: Record<string, unknown>,\n exec?: StudioTailToolExecContext,\n ): Promise<Record<string, unknown>>\n}\n\nexport interface SourceProvenanceLike {\n readonly sourceId: string\n readonly quoteSha256?: string\n readonly citation?: string\n readonly locator?: string\n}\n\nexport type GalleyInlineLike =\n | { readonly t: 'text'; readonly v: string }\n | { readonly t: 'strong'; readonly c: readonly GalleyInlineLike[] }\n | { readonly t: 'emph'; readonly c: readonly GalleyInlineLike[] }\n | { readonly t: 'code'; readonly v: string }\n | { readonly t: 'cloze'; readonly hint?: string }\n | { readonly t: 'math'; readonly v: string }\n | { readonly t: 'newline' }\n\nexport interface GalleyBlockLike {\n readonly id: string\n readonly type: string\n readonly body?: readonly GalleyInlineLike[]\n readonly provenance?: SourceProvenanceLike\n readonly [key: string]: unknown\n}\n\nexport interface GalleyPacketLike {\n readonly id: string\n readonly sheetOrder: readonly string[]\n readonly sheets: Readonly<\n Record<\n string,\n {\n readonly id: string\n readonly title: string\n readonly blocks: readonly GalleyBlockLike[]\n }\n >\n >\n readonly [key: string]: unknown\n}\n\nexport interface GalleyPreflightWarningLike {\n readonly code: string\n readonly severity: 'info' | 'warn' | 'error'\n readonly sheetId?: string\n readonly blockId?: string\n readonly message: string\n}\n\nexport interface GalleyServiceLike {\n registerPreflight(\n id: string,\n check: (packet: GalleyPacketLike, cwd: string) => GalleyPreflightWarningLike[],\n ): () => void\n getStore(cwd?: string): {\n listAnnotations?(packetId: string): ReadonlyArray<{\n readonly id: string\n readonly blockId: string\n readonly body: readonly GalleyInlineLike[]\n readonly provenance?: SourceProvenanceLike\n readonly resolved: boolean\n }>\n }\n}\n\nexport interface CompanionShelfItemLike {\n readonly id: string\n readonly section: 'sources' | 'unit-plan' | 'custom'\n readonly label: { readonly en: string; readonly de?: string }\n readonly badge?: string | number\n readonly rightTabKind?: string\n readonly starterPrompt?: string\n}\n\nexport interface IvoryShellServiceLike {\n registerShelfItem(item: CompanionShelfItemLike): () => void\n}\n\nexport type FundusSearchKind = 'all' | 'passage' | 'source' | 'media'\nexport type FundusSourceKind = 'markdown' | 'text' | 'json-pack' | 'web-mission' | 'media'\nexport type FundusVisionStatus = 'none' | 'pending' | 'done' | 'failed'\n\nexport interface FundusQuoteVerification {\n readonly ok: boolean\n readonly code:\n | 'VERIFIED_EXACT'\n | 'VERIFIED_EXCERPT'\n | 'NON_FUNDUS_ID'\n | 'FUNDUS_UNKNOWN_SOURCE'\n | 'FUNDUS_QUOTE_DRIFT'\n | 'FUNDUS_HASH_MISMATCH'\n readonly sourceId: string\n readonly canonicalSha256: string\n readonly expectedSha256?: string\n readonly message?: string\n}\n\nexport interface FundusVisionAdapter {\n readonly id: string\n describeMedia(input: {\n readonly bytes: Buffer\n readonly mimeType: string\n readonly filename?: string\n readonly hintTitle?: string\n readonly signal?: AbortSignal\n }): Promise<{\n readonly description: string\n readonly ocrText?: string\n readonly suggestedTags?: readonly string[]\n readonly model: string\n }>\n}\n\nexport interface FundusConfig {\n readonly enabled?: boolean\n readonly vaultDir?: string\n readonly maxPassageChars?: number\n}\n\nexport interface FundusServiceLike extends StudioTailToolProvider {\n getVaultDir(): string\n getStats(): {\n readonly sources: number\n readonly passages: number\n readonly media: number\n readonly blobs: number\n }\n search(input: {\n readonly query: string\n readonly kind?: FundusSearchKind\n readonly tag?: string\n readonly language?: string\n readonly limit?: number\n }): Record<string, unknown>\n read(input: {\n readonly id: string\n readonly includePassages?: boolean\n }): Record<string, unknown>\n verifyQuote(input: {\n readonly text: string\n readonly provenance: SourceProvenanceLike\n }): FundusQuoteVerification\n registerVisionAdapter?(adapter: FundusVisionAdapter): () => void\n}\n\nexport interface WebMissionPageJson {\n readonly artifact_id: string\n readonly mission_id: string\n readonly url: string\n readonly finalUrl: string\n readonly normalized_url: string\n readonly status: number\n readonly contentType: string\n readonly title: string\n readonly content: string\n readonly fetchedAt: string\n readonly stored_at?: string\n readonly quality: 'full' | 'thin' | 'blocked'\n readonly qualitySignals?: readonly string[]\n}\n", "/**\n * EN + DE UI strings with 100% key parity.\n */\n\nexport type LocaleCode = 'en' | 'de'\n\nconst STRINGS = {\n en: {\n tabTitle: 'Sources & Media',\n tabDescription: 'Search and inspect the local Fundus archive of passages, sources, and media.',\n sourcesLabel: 'Sources & Media',\n refresh: 'Refresh',\n searchPlaceholder: 'Search passages, sources, media\u2026',\n filterAll: 'All',\n filterPassages: 'Passages',\n filterSources: 'Sources',\n filterMedia: 'Media',\n empty: 'No results yet. Ingest sources or clear the search box to browse recent entries.',\n copyId: 'Copy ID',\n stats: '{sources} sources \u00B7 {passages} passages \u00B7 {media} media',\n },\n de: {\n tabTitle: 'Quellen & Medien',\n tabDescription: 'Lokales Fundus-Archiv durchsuchen und Passagen, Quellen sowie Medien pr\u00FCfen.',\n sourcesLabel: 'Quellen & Medien',\n refresh: 'Aktualisieren',\n searchPlaceholder: 'Passagen, Quellen, Medien suchen\u2026',\n filterAll: 'Alle',\n filterPassages: 'Passagen',\n filterSources: 'Quellen',\n filterMedia: 'Medien',\n empty: 'Noch keine Treffer. Quellen einspielen oder Suchfeld leeren, um aktuelle Eintr\u00E4ge zu sehen.',\n copyId: 'ID kopieren',\n stats: '{sources} Quellen \u00B7 {passages} Passagen \u00B7 {media} Medien',\n },\n} as const\n\nexport type FundusUiKey = keyof typeof STRINGS.en\n\nexport function t(locale: LocaleCode, key: FundusUiKey): string {\n return STRINGS[locale][key] ?? STRINGS.en[key]\n}\n\nexport function formatStats(\n locale: LocaleCode,\n stats: { sources: number; passages: number; media: number },\n): string {\n return t(locale, 'stats')\n .replace('{sources}', String(stats.sources))\n .replace('{passages}', String(stats.passages))\n .replace('{media}', String(stats.media))\n}\n\nexport { STRINGS }\n", "/** Minimal archive / index-card icon for the Fundus right-sidebar tab. */\nexport function FundusIcon(props: { size?: number; className?: string }) {\n const size = props.size ?? 18\n return (\n <svg\n className={props.className as string | undefined}\n width={size}\n height={size}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n aria-hidden=\"true\"\n >\n <rect x=\"3\" y=\"4\" width=\"18\" height=\"16\" rx=\"2\" stroke=\"currentColor\" strokeWidth=\"1.5\" />\n <path d=\"M7 9h10M7 13h7M7 17h5\" stroke=\"currentColor\" strokeWidth=\"1.5\" strokeLinecap=\"round\" />\n </svg>\n )\n}\n", "import { useCallback, useEffect, useRef, useState } from 'react'\nimport { formatStats, t, type LocaleCode } from '../shared/i18n.ts'\n\ntype Hit = {\n kind: 'passage' | 'source' | 'media'\n id: string\n sourceId: string\n title: string\n locator?: string\n passageCount?: number\n snippet?: string\n license: string\n tags: string[]\n quoteSha256?: string\n mimeType?: string\n widthPx?: number | null\n heightPx?: number | null\n caption?: string\n}\ntype Filter = 'all' | 'passage' | 'source' | 'media'\n\nfunction resolvePaneLocale(ctx?: { get?: (k: string) => unknown }): LocaleCode {\n try {\n const loc =\n typeof ctx?.get === 'function' ? (ctx.get('locale') as { lang?: string } | undefined) : undefined\n return loc?.lang === 'de' ? 'de' : 'en'\n } catch {\n return 'en'\n }\n}\n\nexport function FundusPane(props: { ctx?: { get?: (k: string) => unknown } }) {\n const locale: LocaleCode = resolvePaneLocale(props.ctx)\n const [query, setQuery] = useState('')\n const [filter, setFilter] = useState<Filter>('all')\n const [hits, setHits] = useState<Hit[]>([])\n const [stats, setStats] = useState({ sources: 0, passages: 0, media: 0 })\n const [expanded, setExpanded] = useState<string | null>(null)\n const [detail, setDetail] = useState('')\n const timer = useRef<ReturnType<typeof setTimeout> | null>(null)\n\n const load = useCallback(async (q: string, kind: Filter) => {\n try {\n const res = await fetch(`/api/fundus/search?q=${encodeURIComponent(q || '*')}&kind=${kind}&limit=20`)\n const json = (await res.json()) as { hits?: Hit[]; stats?: typeof stats }\n setHits(json.hits ?? [])\n if (json.stats) setStats(json.stats)\n } catch {\n setHits([])\n }\n }, [])\n\n useEffect(() => {\n if (timer.current) clearTimeout(timer.current)\n timer.current = setTimeout(() => void load(query, filter), 150)\n return () => {\n if (timer.current) clearTimeout(timer.current)\n }\n }, [query, filter, load])\n\n const expand = async (hit: Hit) => {\n if (expanded === hit.id) {\n setExpanded(null)\n setDetail('')\n return\n }\n setExpanded(hit.id)\n try {\n const extra = hit.kind === 'source' ? '&includePassages=1' : ''\n const json = (await (await fetch(`/api/fundus/item?id=${encodeURIComponent(hit.id)}${extra}`)).json()) as {\n text?: string\n quoteSha256?: string\n caption?: string\n passages?: Array<{ id: string; locator: string; text: string }>\n }\n if (hit.kind === 'passage') {\n setDetail(`${json.text ?? ''}\\n\\nsha256: ${json.quoteSha256 ?? ''}`)\n } else if (hit.kind === 'source') {\n setDetail((json.passages ?? []).map((p) => `[${p.id} \u00B7 ${p.locator}] ${p.text}`).join('\\n\\n'))\n } else {\n setDetail(String(json.caption ?? hit.caption ?? ''))\n }\n } catch {\n setDetail('')\n }\n }\n\n const pills: Array<[Filter, string]> = [\n ['all', t(locale, 'filterAll')],\n ['passage', t(locale, 'filterPassages')],\n ['source', t(locale, 'filterSources')],\n ['media', t(locale, 'filterMedia')],\n ]\n\n return (\n <div className=\"dsh-fundus-pane\">\n <div className=\"dsh-fundus-head\">\n <span>{formatStats(locale, stats)}</span>\n <button type=\"button\" className=\"dsh-fundus-refresh\" onClick={() => void load(query, filter)}>\n \u21BB\n </button>\n </div>\n <input\n className=\"dsh-fundus-search\"\n value={query}\n placeholder={t(locale, 'searchPlaceholder')}\n onChange={(e: { target: { value: string } }) => setQuery(e.target.value)}\n />\n <div className=\"dsh-fundus-pills\">\n {pills.map(([id, label]) => (\n <button key={id} type=\"button\" className={filter === id ? 'is-active' : ''} onClick={() => setFilter(id)}>\n {label}\n </button>\n ))}\n </div>\n <div className=\"dsh-fundus-list\">\n {!hits.length ? <p className=\"dsh-fundus-empty\">{t(locale, 'empty')}</p> : null}\n {hits.map((hit) => (\n <article key={hit.id} className=\"dsh-fundus-card\" onClick={() => void expand(hit)}>\n {hit.kind === 'media' ? (\n <img className=\"dsh-fundus-thumb\" src={`/api/fundus/blob?sourceId=${hit.sourceId}`} alt=\"\" width={48} height={48} />\n ) : null}\n <div className=\"dsh-fundus-card-body\">\n <header>\n <strong>{hit.title}</strong>\n <button\n type=\"button\"\n className=\"dsh-fundus-id\"\n onClick={(e: { stopPropagation: () => void }) => {\n e.stopPropagation()\n void navigator.clipboard?.writeText(hit.id)\n }}\n >\n {hit.id}\n </button>\n </header>\n <div className=\"dsh-fundus-meta\">\n {hit.kind === 'passage'\n ? hit.locator\n : hit.kind === 'source'\n ? `${hit.passageCount ?? 0} passages`\n : `${hit.widthPx ?? '?'}\u00D7${hit.heightPx ?? '?'} \u00B7 ${hit.mimeType}`}\n </div>\n <p>{hit.kind === 'media' ? hit.caption : hit.snippet}</p>\n <footer>\n {hit.license}\n {hit.tags?.length ? ` \u00B7 ${hit.tags.join(', ')}` : ''}\n </footer>\n {expanded === hit.id && detail ? <pre className=\"dsh-fundus-detail\">{detail}</pre> : null}\n </div>\n </article>\n ))}\n </div>\n </div>\n )\n}\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACKO,IAAM,SAAS;;;ACCtB,IAAM,UAAU;AAAA,EACd,IAAI;AAAA,IACF,UAAU;AAAA,IACV,gBAAgB;AAAA,IAChB,cAAc;AAAA,IACd,SAAS;AAAA,IACT,mBAAmB;AAAA,IACnB,WAAW;AAAA,IACX,gBAAgB;AAAA,IAChB,eAAe;AAAA,IACf,aAAa;AAAA,IACb,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,OAAO;AAAA,EACT;AAAA,EACA,IAAI;AAAA,IACF,UAAU;AAAA,IACV,gBAAgB;AAAA,IA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|
|
6
6
|
"names": ["import_jsx_runtime", "label"]
|
|
7
7
|
}
|
package/lib/core.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// src/shared/types.ts
|
|
2
2
|
var PLUGIN = "dsh-fundus";
|
|
3
|
-
var VERSION = "0.1.
|
|
3
|
+
var VERSION = "0.1.2";
|
|
4
4
|
|
|
5
5
|
// src/core/config.ts
|
|
6
6
|
import { homedir } from "node:os";
|
|
@@ -874,7 +874,18 @@ CREATE VIRTUAL TABLE IF NOT EXISTS fundus_fts USING fts5(
|
|
|
874
874
|
if (!sheet) continue;
|
|
875
875
|
for (const block of sheet.blocks) {
|
|
876
876
|
blockSheetMap.set(block.id, sheetId);
|
|
877
|
-
if (!block.provenance)
|
|
877
|
+
if (!block.provenance) {
|
|
878
|
+
if (block.type === "source_text") {
|
|
879
|
+
warnings.push({
|
|
880
|
+
code: "FUNDUS_UNSOURCED_QUOTE_BLOCK",
|
|
881
|
+
severity: "warn",
|
|
882
|
+
sheetId,
|
|
883
|
+
blockId: block.id,
|
|
884
|
+
message: `Block ${block.id} (source_text) has no provenance metadata attached.`
|
|
885
|
+
});
|
|
886
|
+
}
|
|
887
|
+
continue;
|
|
888
|
+
}
|
|
878
889
|
const text = galleyInlinesToText(block.body);
|
|
879
890
|
const res = this.verifyQuote({ text, provenance: block.provenance });
|
|
880
891
|
if (!res.ok) {
|
|
@@ -885,6 +896,14 @@ CREATE VIRTUAL TABLE IF NOT EXISTS fundus_fts USING fts5(
|
|
|
885
896
|
blockId: block.id,
|
|
886
897
|
message: `Block ${block.id} provenance ${block.provenance.sourceId}: ${res.message ?? res.code}`
|
|
887
898
|
});
|
|
899
|
+
} else if (res.code === "NON_FUNDUS_ID") {
|
|
900
|
+
warnings.push({
|
|
901
|
+
code: "FUNDUS_UNVERIFIED_EXTERNAL_ID",
|
|
902
|
+
severity: "warn",
|
|
903
|
+
sheetId,
|
|
904
|
+
blockId: block.id,
|
|
905
|
+
message: `Block ${block.id} provenance "${res.sourceId}" is an unverified external reference (not a Fundus pas-*/src-* ID).`
|
|
906
|
+
});
|
|
888
907
|
}
|
|
889
908
|
}
|
|
890
909
|
}
|
|
@@ -901,6 +920,14 @@ CREATE VIRTUAL TABLE IF NOT EXISTS fundus_fts USING fts5(
|
|
|
901
920
|
blockId: ann.blockId,
|
|
902
921
|
message: `Annotation ${ann.id} (block ${ann.blockId}) provenance ${ann.provenance.sourceId}: ${res.message ?? res.code}`
|
|
903
922
|
});
|
|
923
|
+
} else if (res.code === "NON_FUNDUS_ID") {
|
|
924
|
+
warnings.push({
|
|
925
|
+
code: "FUNDUS_UNVERIFIED_EXTERNAL_ID",
|
|
926
|
+
severity: "warn",
|
|
927
|
+
sheetId: blockSheetMap.get(ann.blockId),
|
|
928
|
+
blockId: ann.blockId,
|
|
929
|
+
message: `Annotation ${ann.id} (block ${ann.blockId}) provenance "${res.sourceId}" is an unverified external reference (not a Fundus pas-*/src-* ID).`
|
|
930
|
+
});
|
|
904
931
|
}
|
|
905
932
|
}
|
|
906
933
|
}
|