mirror of
https://github.com/logancyang/obsidian-copilot.git
synced 2026-07-22 07:50:24 +00:00
* feat(agent-home): Relevant Notes tab body + pop-out hint + device-local prefs
Phase 1 of surfacing Relevant Notes on the agent home shelf. Adds
RelevantNotesShelfPanel (reuses the existing RelevantNotes component
with a dismissible 'open in its own pane' hint) and homeShelfPrefs
localStorage helpers (selected tab + hint-dismissed, device-local).
Not wired into the shelf yet — that is Phase 2.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* feat(agent-home): wire Relevant Notes shelf tab with persistence + pane mutual-exclusion
Phase 2. Adds the Relevant Notes tab to the agent home shelf (order:
Recent Chats, Relevant Notes, Projects), rendered unconditionally so
embeddings-off users hit the existing enable-semantic-search CTA.
- useRelevantNotesPaneOpen: hide the tab while the dedicated pane is
open (no duplicate surface); restores when the pane closes.
- AgentHomeShelf: optional storageKey persists the selected tab in
device-local localStorage; keeps the fallback-to-first-selectable
resolution so an absent persisted id never breaks.
- AgentHomeTab/Section: count is optional; badge renders only when > 0
(Relevant Notes omits it, no eager semantic compute).
Adds focused AgentHomeShelf tests (count suppression, persistence,
fallback). No ribbon; the dedicated pane + command stay as the pop-out
target.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* fix(agent-home): refresh Relevant Notes shelf tab on note-switch
The Relevant Notes shelf tab (inside CopilotAgentView) never refreshed on
note-switch and stayed empty for indexed notes: its useActiveFile listens
for ACTIVE_LEAF_CHANGE on the view's own eventTarget, but nothing fed that
target. The legacy CopilotView was fed by a special-case dispatch in main.ts
and RelevantNotesView self-bridged, but CopilotAgentView did neither, so its
useActiveFile froze at the mount seed.
Extract one shared registerActiveLeafChangeBridge helper and call it in
CopilotView, CopilotAgentView, and RelevantNotesView onOpen; remove the
legacy-only dispatch from main.ts so every chat view self-owns its bridge.
Verified via Obsidian CLI: the agent view's eventTarget now fires on
note-switch (0x before, 3x after).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* test(jest): map @orama/orama to its CJS build
configuredModelGrouping.test.ts began failing to load: it imports the
@/agentMode barrel (for ModelEnableRow/isOpencodeZenWireId), and this PR
made AgentHome — re-exported through that barrel via CopilotAgentView —
depend on RelevantNotes → findRelevantNotes → dbOperations, which imports
@orama/orama. Under jsdom, @orama/orama resolves to its ESM "browser"
entry, which Jest can't parse ("Unexpected token 'export'").
Map it to the CJS build it ships under dist/commonjs/, mirroring the
existing yaml entry. Only modules that already reach @orama/orama are
affected, so no passing suite changes behavior.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
29 lines
1.4 KiB
JavaScript
29 lines
1.4 KiB
JavaScript
module.exports = {
|
|
preset: "ts-jest",
|
|
testEnvironment: "jsdom",
|
|
roots: ["<rootDir>/src"],
|
|
transform: {
|
|
"^.+\\.(js|jsx|ts|tsx)$": "ts-jest",
|
|
},
|
|
moduleNameMapper: {
|
|
"\\.svg$": "<rootDir>/__mocks__/svg.js",
|
|
"^@/(.*)$": "<rootDir>/src/$1",
|
|
"^obsidian$": "<rootDir>/__mocks__/obsidian.js",
|
|
// The yaml package's "exports" field defaults to a browser ESM entry under
|
|
// jsdom; Jest can't parse ESM without extra config, so point at the CJS
|
|
// build it ships under dist/.
|
|
"^yaml$": "<rootDir>/node_modules/yaml/dist/index.js",
|
|
// @orama/orama resolves to its ESM "browser" entry under jsdom, which Jest
|
|
// can't parse; point at the CJS build it ships under dist/commonjs/ (same
|
|
// reason as yaml above).
|
|
"^@orama/orama$": "<rootDir>/node_modules/@orama/orama/dist/commonjs/index.js",
|
|
"^@agentclientprotocol/sdk$": "<rootDir>/__mocks__/@agentclientprotocol/sdk.js",
|
|
"^@anthropic-ai/claude-agent-sdk$": "<rootDir>/__mocks__/@anthropic-ai/claude-agent-sdk.js",
|
|
// react-resizable-panels is ESM-only with no CJS build to point at; stub it.
|
|
"^react-resizable-panels$": "<rootDir>/__mocks__/react-resizable-panels.js",
|
|
},
|
|
testRegex: ".*\\.test\\.(jsx?|tsx?)$",
|
|
moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json", "node"],
|
|
testPathIgnorePatterns: ["/node_modules/"],
|
|
setupFiles: ["<rootDir>/jest.setup.js"],
|
|
};
|