feat(agent-projects): project-scoped Agent Mode — Agent Home PR2#2604
Draft
Emt-lin wants to merge 3 commits into
Draft
feat(agent-projects): project-scoped Agent Mode — Agent Home PR2#2604Emt-lin wants to merge 3 commits into
Emt-lin wants to merge 3 commits into
Conversation
️✅ There are no secrets present in this pull request anymore.If these secrets were true positive and are still valid, we highly recommend you to revoke them. 🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request. |
3d2233b to
4f67c7f
Compare
Turn Agent Mode "projects" into Claude Projects-style workspaces: entering a project gives a scoped workspace with its own sessions, chat history, and materialized context, while the global workspace becomes one special scope (GLOBAL_SCOPE sentinel) sharing the same code path. Session scope - AgentSessionManager keys sessions by an immutable projectId with per-scope MRU, resolveSessionCwd, getSessionsForScope, and enterProject/exitProject; the active-session invariant (active.projectId === activeProjectId) keeps existing UI helpers untouched. - Backend restarts / in-place replacement inherit the replaced session's projectId; project scope reuses the warm process instead of adopting the vault-root probe session. Context materialization - New projectContextMaterializer + contextCacheStore + manifestBuilder capture a project's context once per session, single-flight per project, written to a project-local cache. - The first prompt inlines a <project_context> block with absolute paths; the composer shows a context status icon and queues sends while context is still materializing, refreshing an empty landing after Retry/Edit. Instructions mirror - project.md stays the single source of truth, with a marker-gated AGENTS.md mirror generated by ensureAgentsMirror; a built-in policy is layered into every project's instructions and template-variable hints are dropped. Landing & project UI - AgentLandingStack spine with project landing state, project header, Welcome card, Project Chats tab variant, and project CRUD (anchored create popover, edit modal, overflow menu); shelf lists cap at 5 behind a View-all popover. History scope - Agent chat history is scope-keyed (a scope switch can't flash or stick the previous scope's chats); native session history is scoped to projects and resumed transcripts hydrate from the session's scope cwd. Legacy chats with no projectId resolve to GLOBAL_SCOPE. Todo / plan - Unified backend todo lists across claude/codex/opencode feed the project info popover, with per-session todo-id tracking and symmetric plan clear; parse claude's real TaskCreate result and steer agents to plan todos. Project list UX - MRU-sorted project list (touched on enter), running spinner on backgrounded recent-chat rows, live done-dot handoff with dual-id row matching, the global shelf tab kept selected across project round-trips, inline row actions, and memo-stable rename/cancel/save handlers. Fixes - Clear the in-flight loading flag when the composer remounts on the landing->conversation flip (first message no longer sticks the Thinking spinner / stop button), and cap content-conversion preview render so large snapshots don't freeze the modal. Tests - 27 new suites covering session scope, context materializer, cache store, AGENTS.md mirror, todo-plan pipeline, landing UI, and the new hooks.
… actionable When the content-conversion preview is truncated, mark the cut at the end of the rendered slice with a labelled divider and a "Copy full content" pill button, so it reads as truncated (not the natural end) and the full text is one click away without scrolling back to the header — the GitHub "Load diff" / Carbon overflow pattern. Share the copy-with-feedback handler between the header button and the marker button (it always copies the full content, never the truncated preview), and fire the icon-reset timer on the button's own window for popout safety.
…ter, not node:fs Replace the node:fs/node:path implementation of the project-context cache layer with Obsidian's vault adapter, so src/context holds no Node builtins and the eslint import/no-nodejs-modules exception for these files is removed. - contextCacheFs: createNodeContextCacheFs (node:fs) -> createVaultContextCacheFs(app), backed by vault.adapter. mkdirRecursive creates ancestors segment-by-segment; list returns entry basenames (the adapter returns full vault-relative paths); remove swallows missing-file errors to stay idempotent. - contextCacheStore: drop node:path, join cache paths with a local POSIX helper. - projectContextMaterializer: drop node:path; derive the vault-relative cache dir from the project record; resolve add-dir absolute paths via FileSystemAdapter.getFullPath (instanceof-guarded); in-cwd check via forward-slash prefix compare. - Delete the import/no-nodejs-modules exception block in eslint.config.mjs. Cache location/filenames/content and the paths the agent sees (absolute folder/note paths, .context-cache pointers, additionalDirectories) are unchanged; existing caches stay valid. Adds contextCacheFs unit tests and extends the obsidian mock with getFullPath/list/remove.
4f67c7f to
2f099f3
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
GLOBAL_SCOPEas the implicit global workspace; entering a project gets its own landing, header, and composer flow.project.mdstays the single source of truth with a marker-gatedAGENTS.mdmirror; the first prompt inlines a<project_context>block with absolute paths; context materialization is single-flight per project with retry/edit refresh for empty landings.AgentLandingStack(hero + composer + shelf), project landing tabs (Project Chats / Context) aligned with the global landing, standalone zero-chat context card, and a collapsible project header above the tab strip..context-cache/snapshots through Obsidian's vault adapter (and resolves add-dir roots viaFileSystemAdapter.getFullPath) instead ofnode:fs/node:path, removing theimport/no-nodejs-moduleslint exception. Cache location/format and the paths the agent sees (absolute folder/note paths,.context-cachepointers,additionalDirectories) are unchanged; existing caches stay valid.Test plan
npx jest src/agentMode— 86 suites / 1152 tests passdraft.loadingeslint+prettier --checkclean on changed filessrc/context+src/agentMode+src/searchgreen;src/contextproduction code has zero Node builtins