feat(agent-config): hash-guarded read/save, editor UI, JS bundling #76

Merged
jasoncouture merged 23 commits from feat/agent-config-hash into main 2026-05-11 00:34:16 -04:00
jasoncouture commented 2026-05-11 00:34:10 -04:00 (Migrated from github.com)

Summary

  • AgentConfig gains a SHA-256 Hash stamped from raw bytes before deserialize; AgentManager reconciles by hash (fixes 10-min reload loop)
  • IAgentConfigProvider grows ReadFileAsync + SaveAsync with optimistic concurrency, deserialize validation, atomic .tmp+rename, and timestamped .bak rotation (10 deep, per-agent)
  • /agents listing + /agents/{id}/edit editor (CodeMirror 6, JSON lint, localStorage draft, conflict/invalid banners); pencil-button on chat header
  • JS pipeline: source in src/LlamaShears.Api.Web/js, MSBuild BundleJs target runs npm ci + esbuild into wwwroot/dist; Dockerfile installs node+npm in the build stage
  • Chat slash commands join the agent data scope before dispatch
  • Thought bubbles collapse with first-line title; tool bubbles relabeled; dark theme retinted
  • LoggerMessage methods converted to instance where the type already owns _logger
  • ModelTokenInformationContextEntry gains a Timestamp
  • ContextCompactor preempts at floor(window * 0.75) with predict + next-message budget

Test plan

  • build clean
  • tests 478/478
  • manual smoke for editor save / conflict / invalid paths

🤖 Generated with Claude Code

## Summary - AgentConfig gains a SHA-256 Hash stamped from raw bytes before deserialize; AgentManager reconciles by hash (fixes 10-min reload loop) - IAgentConfigProvider grows ReadFileAsync + SaveAsync with optimistic concurrency, deserialize validation, atomic .tmp+rename, and timestamped .bak rotation (10 deep, per-agent) - /agents listing + /agents/{id}/edit editor (CodeMirror 6, JSON lint, localStorage draft, conflict/invalid banners); pencil-button on chat header - JS pipeline: source in src/LlamaShears.Api.Web/js, MSBuild BundleJs target runs npm ci + esbuild into wwwroot/dist; Dockerfile installs node+npm in the build stage - Chat slash commands join the agent data scope before dispatch - Thought bubbles collapse with first-line title; tool bubbles relabeled; dark theme retinted - LoggerMessage methods converted to instance where the type already owns _logger - ModelTokenInformationContextEntry gains a Timestamp - ContextCompactor preempts at floor(window * 0.75) with predict + next-message budget ## Test plan - [x] build clean - [x] tests 478/478 - [ ] manual smoke for editor save / conflict / invalid paths 🤖 Generated with [Claude Code](https://claude.com/claude-code)
github-actions[bot] commented 2026-05-11 00:36:03 -04:00 (Migrated from github.com)
Package Line Rate Branch Rate Complexity Health
LlamaShears.Provider.Ollama 3% 1% 176
LlamaShears.IntegrationTests 85% 73% 71
LlamaShears.Core 41% 27% 1317
LlamaShears.Core.Eventing 89% 73% 53
StrangeSoft.Plugins.Host 20% 21% 87
LlamaShears.Core.Abstractions 32% 15% 333
LlamaShears.Api.Web 31% 17% 428
LlamaShears.Hosting 26% 8% 27
LlamaShears 76% 57% 16
LlamaShears.Provider.Onnx.Embeddings 3% 0% 72
LlamaShears.Plugins.Host 34% 24% 36
LlamaShears.Api 9% 3% 462
LlamaShears.Plugins 0% 100% 1
LlamaShears.Provider.OpenAI 2% 0% 223
LlamaShears.Core.Eventing.Extensions 100% 100% 1
LlamaShears.Provider.Ollama 3% 1% 176
LlamaShears.Core 41% 26% 1317
LlamaShears.Core.Eventing 89% 73% 53
StrangeSoft.Plugins.Host 20% 21% 87
LlamaShears.Core.Abstractions 32% 15% 333
LlamaShears.Api.Web 21% 10% 428
LlamaShears.Hosting 26% 8% 27
LlamaShears 76% 57% 16
LlamaShears.Provider.Onnx.Embeddings 3% 0% 72
LlamaShears.Plugins.Host 34% 24% 36
LlamaShears.Api 7% 1% 462
LlamaShears.Plugins 0% 100% 1
LlamaShears.Provider.OpenAI 2% 0% 223
LlamaShears.Core.Eventing.Extensions 100% 100% 1
LlamaShears.Provider.Ollama 42% 22% 176
LlamaShears.Core 43% 38% 1317
LlamaShears.Core.Eventing 91% 84% 53
LlamaShears.Core.Abstractions 46% 32% 333
LlamaShears.Api.Web 1% 1% 428
LlamaShears.Hosting 33% 21% 27
LlamaShears.Provider.Onnx.Embeddings 37% 38% 72
LlamaShears.Api 24% 25% 462
LlamaShears.Provider.OpenAI 64% 64% 223
LlamaShears.Core.Eventing.Extensions 100% 100% 1
LlamaShears.Analyzers 88% 76% 199
LlamaShears.Analyzers.CodeFixes 85% 69% 60
Summary 46% (10269 / 30632) 35% (2139 / 9151) 9886
Package | Line Rate | Branch Rate | Complexity | Health -------- | --------- | ----------- | ---------- | ------ LlamaShears.Provider.Ollama | 3% | 1% | 176 | ❌ LlamaShears.IntegrationTests | 85% | 73% | 71 | ✔ LlamaShears.Core | 41% | 27% | 1317 | ❌ LlamaShears.Core.Eventing | 89% | 73% | 53 | ✔ StrangeSoft.Plugins.Host | 20% | 21% | 87 | ❌ LlamaShears.Core.Abstractions | 32% | 15% | 333 | ❌ LlamaShears.Api.Web | 31% | 17% | 428 | ❌ LlamaShears.Hosting | 26% | 8% | 27 | ❌ LlamaShears | 76% | 57% | 16 | ✔ LlamaShears.Provider.Onnx.Embeddings | 3% | 0% | 72 | ❌ LlamaShears.Plugins.Host | 34% | 24% | 36 | ❌ LlamaShears.Api | 9% | 3% | 462 | ❌ LlamaShears.Plugins | 0% | 100% | 1 | ❌ LlamaShears.Provider.OpenAI | 2% | 0% | 223 | ❌ LlamaShears.Core.Eventing.Extensions | 100% | 100% | 1 | ✔ LlamaShears.Provider.Ollama | 3% | 1% | 176 | ❌ LlamaShears.Core | 41% | 26% | 1317 | ❌ LlamaShears.Core.Eventing | 89% | 73% | 53 | ✔ StrangeSoft.Plugins.Host | 20% | 21% | 87 | ❌ LlamaShears.Core.Abstractions | 32% | 15% | 333 | ❌ LlamaShears.Api.Web | 21% | 10% | 428 | ❌ LlamaShears.Hosting | 26% | 8% | 27 | ❌ LlamaShears | 76% | 57% | 16 | ✔ LlamaShears.Provider.Onnx.Embeddings | 3% | 0% | 72 | ❌ LlamaShears.Plugins.Host | 34% | 24% | 36 | ❌ LlamaShears.Api | 7% | 1% | 462 | ❌ LlamaShears.Plugins | 0% | 100% | 1 | ❌ LlamaShears.Provider.OpenAI | 2% | 0% | 223 | ❌ LlamaShears.Core.Eventing.Extensions | 100% | 100% | 1 | ✔ LlamaShears.Provider.Ollama | 42% | 22% | 176 | ❌ LlamaShears.Core | 43% | 38% | 1317 | ❌ LlamaShears.Core.Eventing | 91% | 84% | 53 | ✔ LlamaShears.Core.Abstractions | 46% | 32% | 333 | ❌ LlamaShears.Api.Web | 1% | 1% | 428 | ❌ LlamaShears.Hosting | 33% | 21% | 27 | ❌ LlamaShears.Provider.Onnx.Embeddings | 37% | 38% | 72 | ❌ LlamaShears.Api | 24% | 25% | 462 | ❌ LlamaShears.Provider.OpenAI | 64% | 64% | 223 | ➖ LlamaShears.Core.Eventing.Extensions | 100% | 100% | 1 | ✔ LlamaShears.Analyzers | 88% | 76% | 199 | ✔ LlamaShears.Analyzers.CodeFixes | 85% | 69% | 60 | ✔ **Summary** | **46%** (10269 / 30632) | **35%** (2139 / 9151) | **9886** | ❌ <!-- Sticky Pull Request Commentcoverage -->
copilot-pull-request-reviewer[bot] (Migrated from github.com) reviewed 2026-05-11 00:41:03 -04:00
copilot-pull-request-reviewer[bot] (Migrated from github.com) left a comment

Pull request overview

This PR extends LlamaShears’ agent configuration pipeline to support hash-based change detection and optimistic-concurrency saves, and adds a web UI for listing/editing agent JSON configs (with a new JS bundling pipeline). It also includes a broad set of supporting runtime/UI refinements (logging generator refactors, context-compaction heuristics, token timestamping, and eventing refactors).

Changes:

  • Add SHA-256 hashing to agent config load + new IAgentConfigProvider.ReadFileAsync/SaveAsync APIs with backup rotation and optimistic concurrency.
  • Add /agents listing and /agents/{id}/edit editor UI (CodeMirror) plus an esbuild-based JS bundling MSBuild target and Docker build support.
  • Misc updates: join agent data-scope for slash commands, adjust compaction thresholding, add token timestamping, and refactor many LoggerMessage usages.

Reviewed changes

Copilot reviewed 82 out of 90 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
tests/LlamaShears.UnitTests/Context/AgentContextProviderTests.cs Updates stub IAgentConfigProvider to satisfy new interface members.
tests/LlamaShears.UnitTests/AgentConfigProviderTests.cs Adds tests for config hashing, raw reads, optimistic-concurrency saves, and backup retention.
tests/LlamaShears.UnitTests/Agent/Core/InferenceRunnerToolDispatchTests.cs Updates InferenceRunner construction to include logger dependency.
tests/LlamaShears.UnitTests/Agent/Core/ContextCompactorTests.cs Updates InferenceRunner construction to include logger dependency.
tests/LlamaShears.UnitTests/Agent/Core/AgentTurnFlowTests.cs Updates InferenceRunner construction to include logger dependency.
tests/LlamaShears.UnitTests/Agent/Core/AgentLoopTests.cs Updates InferenceRunner construction to include logger dependency.
tests/LlamaShears.UnitTests/Agent/Core/AgentInterruptTests.cs Updates InferenceRunner construction to include logger dependency.
tests/LlamaShears.UnitTests/Agent/Core/AgentInterruptGracefulTests.cs Updates InferenceRunner construction to include logger dependency.
tests/LlamaShears.UnitTests/Agent/Core/AgentEventPublishingTests.cs Updates InferenceRunner construction to include logger dependency.
src/public/LlamaShears.Core.Abstractions/Provider/ModelTokenInformationContextEntry.cs Adds timestamp to token-info context entries.
src/public/LlamaShears.Core.Abstractions/Agent/SaveAgentConfigResult.cs Introduces save outcome discriminated union for config saves.
src/public/LlamaShears.Core.Abstractions/Agent/IAgentConfigProvider.cs Adds raw read + optimistic save APIs to the config provider interface.
src/public/LlamaShears.Core.Abstractions/Agent/AgentConfigFile.cs Defines raw config snapshot type (content + hash).
src/public/LlamaShears.Core.Abstractions/Agent/AgentConfig.cs Adds Hash to loaded configs (non-serialized change token).
src/LlamaShears/appsettings.json Adjusts log levels for MCP-related components.
src/LlamaShears.Provider.OpenAI/OpenAILanguageModel.cs Refactors logger-message methods to instance partials where applicable.
src/LlamaShears.Provider.Ollama/OllamaLanguageModel.cs Refactors logger-message methods to instance partials.
src/LlamaShears.Hosting/HostRestarter.cs Refactors logger-message methods to instance partials.
src/LlamaShears.Core/Tools/ModelContextProtocol/ModelContextProtocolToolDiscovery.cs Refactors logger-message methods to instance partials.
src/LlamaShears.Core/Tools/ModelContextProtocol/ModelContextProtocolToolCallDispatcher.cs Refactors logger-message methods to instance partials.
src/LlamaShears.Core/Tools/ModelContextProtocol/ModelContextProtocolServerRegistry.cs Refactors logger-message methods to instance partials.
src/LlamaShears.Core/Tools/ModelContextProtocol/LoopbackBearerHandler.cs Refactors logger-message methods to instance partials.
src/LlamaShears.Core/Todo/TodoStorage.cs Refactors logger-message methods to instance partials.
src/LlamaShears.Core/Seeding/DirectorySeeder.cs Refactors logger-message methods to instance partials.
src/LlamaShears.Core/Memory/SqliteMemoryService.cs Refactors logger-message methods to instance partials.
src/LlamaShears.Core/Memory/MemoryIndexerBackgroundService.cs Refactors logger-message methods to instance partials.
src/LlamaShears.Core/InferenceRunner.cs Adds logger dependency + tool-call logging; class becomes partial.
src/LlamaShears.Core/EagerCompactor.cs Refactors logger-message methods to instance partials.
src/LlamaShears.Core/Cron/JsonCronStore.cs Refactors logger-message methods to instance partials.
src/LlamaShears.Core/Cron/CronScheduler.cs Refactors logger-message methods to instance partials.
src/LlamaShears.Core/Cron/CronExecutor.cs Refactors logger-message methods to instance partials.
src/LlamaShears.Core/ContextCompactor.cs Adjusts compaction preemption thresholding and logging method style.
src/LlamaShears.Core/AgentTurnLogger.cs Refactors logger-message methods to instance partials.
src/LlamaShears.Core/AgentManager.cs Uses config hash to detect reloads; refactors logging generator usage.
src/LlamaShears.Core/AgentConfigProvider.cs Implements raw read/save APIs, hashes raw bytes pre-deserialize, adds backup rotation.
src/LlamaShears.Core/Agent.cs Emits token info entries with timestamps; refactors logging generator usage.
src/LlamaShears.Core.Eventing/SubscriptionHandle.cs Extracts subscription disposal logging into a dedicated type.
src/LlamaShears.Core.Eventing/EventHandlerWrapperOptions.cs Extracts wrapper options from EventBus into a named type.
src/LlamaShears.Core.Eventing/EventHandlerWrapper.cs Extracts event handler wrapper from EventBus into its own type.
src/LlamaShears.Core.Eventing/EventBus.cs Uses extracted wrapper/handle types and instance logger-message method.
src/LlamaShears.Api/Tools/ModelContextProtocol/Shell/ShellTools.cs Refactors logger-message methods to instance partials.
src/LlamaShears.Api/Tools/ModelContextProtocol/Memory/StoreMemoryTool.cs Refactors logger-message methods to instance partials.
src/LlamaShears.Api/Tools/ModelContextProtocol/Memory/SearchMemoryTool.cs Refactors logger-message methods to instance partials.
src/LlamaShears.Api/Tools/ModelContextProtocol/Memory/IndexMemoryTool.cs Refactors logger-message methods to instance partials.
src/LlamaShears.Api/Tools/ModelContextProtocol/Filesystem/WriteFileTool.cs Refactors logger-message methods to instance partials.
src/LlamaShears.Api/Tools/ModelContextProtocol/Filesystem/RegexReplaceFileTool.cs Refactors logger-message methods to instance partials.
src/LlamaShears.Api/Tools/ModelContextProtocol/Filesystem/ReadFileTool.cs Refactors logger-message methods to instance partials.
src/LlamaShears.Api/Tools/ModelContextProtocol/Filesystem/ListFilesTool.cs Refactors logger-message methods to instance partials.
src/LlamaShears.Api/Tools/ModelContextProtocol/Filesystem/GrepTool.cs Refactors logger-message methods to instance partials.
src/LlamaShears.Api/Tools/ModelContextProtocol/Filesystem/DeleteFileTool.cs Refactors logger-message methods to instance partials.
src/LlamaShears.Api/Tools/ModelContextProtocol/Filesystem/AppendFileTool.cs Refactors logger-message methods to instance partials.
src/LlamaShears.Api/Tools/ModelContextProtocol/Cron/ScheduleCronTool.cs Refactors logger-message methods to instance partials.
src/LlamaShears.Api/Tools/ModelContextProtocol/Cron/EditCronTool.cs Refactors logger-message methods to instance partials.
src/LlamaShears.Api.Web/wwwroot/site.css Updates dark theme palette and related UI colors.
src/LlamaShears.Api.Web/Services/IconProvider.cs Refactors logger-message methods to instance partials.
src/LlamaShears.Api.Web/Services/ChatSession.cs Joins agent data-scope prior to slash-command dispatch.
src/LlamaShears.Api.Web/Pages/AgentList.razor.css Adds styling for the new agents list page.
src/LlamaShears.Api.Web/Pages/AgentList.razor Adds /agents listing page linking to editor routes.
src/LlamaShears.Api.Web/Pages/AgentEditor.razor.css Adds styling for the new agent JSON editor page.
src/LlamaShears.Api.Web/Pages/AgentEditor.razor Adds /agents/{id}/edit editor with hashing/conflict banners and local drafts.
src/LlamaShears.Api.Web/LlamaShears.Api.Web.csproj Adds MSBuild targets to bundle JS via npm+esbuild and copy to wwwroot.
src/LlamaShears.Api.Web/Layout/MainLayout.razor.css Updates nav layout styling and adds focus-visible affordances.
src/LlamaShears.Api.Web/Layout/MainLayout.razor Adds “Agents” navigation item and nav sectioning/ARIA label.
src/LlamaShears.Api.Web/js/scripts/reconnect-auto-reload.js Adds reconnect terminal-state auto reload behavior.
src/LlamaShears.Api.Web/js/scripts/messages.js Adds auto-scroll behavior for streaming chat containers.
src/LlamaShears.Api.Web/js/scripts/highlight-init.js Adds mutation-driven highlight.js initialization.
src/LlamaShears.Api.Web/js/scripts/composer.js Adds Enter-to-send behavior for composer textarea.
src/LlamaShears.Api.Web/js/scripts/composer-paste.js Adds image paste bridge from clipboard to Blazor composer.
src/LlamaShears.Api.Web/js/scripts/agent-editor.js Implements CodeMirror-based JSON editor + lint + change callbacks.
src/LlamaShears.Api.Web/js/package.json Adds JS build dependencies (esbuild, CodeMirror packages).
src/LlamaShears.Api.Web/js/package-lock.json Locks JS dependency graph for deterministic bundling.
src/LlamaShears.Api.Web/js/entries/site.js Defines side-effect bundle entrypoint for global UI listeners.
src/LlamaShears.Api.Web/Components/Chat/ChatHeader.razor.css Ensures header button anchors don’t get underlined.
src/LlamaShears.Api.Web/Components/Chat/ChatHeader.razor Adds pencil button linking to the selected agent’s editor.
src/LlamaShears.Api.Web/Components/Chat/ChatBubbleView.razor.css Adds collapsible thought bubble styling + tool args default-collapsed.
src/LlamaShears.Api.Web/Components/Chat/ChatBubbleView.razor Collapses thought bubbles with a first-line summary; tweaks tool label/args expansion.
src/LlamaShears.Api.Web/App.razor Switches from individual scripts to bundled dist/site.js.
docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Agent/SaveAgentConfigResult/Ok.md Adds generated API docs for SaveAgentConfigResult.Ok.
docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Agent/SaveAgentConfigResult/InvalidJson.md Adds generated API docs for SaveAgentConfigResult.InvalidJson.
docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Agent/SaveAgentConfigResult/index.md Adds generated API docs index for save result subtypes.
docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Agent/SaveAgentConfigResult/Conflict.md Adds generated API docs for SaveAgentConfigResult.Conflict.
docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Agent/SaveAgentConfigResult.md Adds generated API docs for SaveAgentConfigResult.
docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Agent/index.md Updates agent namespace index to include new types.
docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Agent/IAgentConfigProvider.md Updates API docs to include new read/save methods.
docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Agent/AgentConfigFile.md Adds generated API docs for AgentConfigFile.
docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Agent/AgentConfig.md Updates docs for new Hash parameter/property.
docs/api/LlamaShears.Core.Abstractions/index.md Updates top-level docs index for new types and namespace.
Dockerfile Installs node+npm in build stage to support JS bundling during publish.
.gitignore Ignores JS bundler output dist/ directories.
Files not reviewed (1)
  • src/LlamaShears.Api.Web/js/package-lock.json: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

## Pull request overview This PR extends LlamaShears’ agent configuration pipeline to support hash-based change detection and optimistic-concurrency saves, and adds a web UI for listing/editing agent JSON configs (with a new JS bundling pipeline). It also includes a broad set of supporting runtime/UI refinements (logging generator refactors, context-compaction heuristics, token timestamping, and eventing refactors). **Changes:** - Add SHA-256 hashing to agent config load + new `IAgentConfigProvider.ReadFileAsync`/`SaveAsync` APIs with backup rotation and optimistic concurrency. - Add `/agents` listing and `/agents/{id}/edit` editor UI (CodeMirror) plus an esbuild-based JS bundling MSBuild target and Docker build support. - Misc updates: join agent data-scope for slash commands, adjust compaction thresholding, add token timestamping, and refactor many `LoggerMessage` usages. ### Reviewed changes Copilot reviewed 82 out of 90 changed files in this pull request and generated 6 comments. <details> <summary>Show a summary per file</summary> | File | Description | | ---- | ----------- | | tests/LlamaShears.UnitTests/Context/AgentContextProviderTests.cs | Updates stub `IAgentConfigProvider` to satisfy new interface members. | | tests/LlamaShears.UnitTests/AgentConfigProviderTests.cs | Adds tests for config hashing, raw reads, optimistic-concurrency saves, and backup retention. | | tests/LlamaShears.UnitTests/Agent/Core/InferenceRunnerToolDispatchTests.cs | Updates `InferenceRunner` construction to include logger dependency. | | tests/LlamaShears.UnitTests/Agent/Core/ContextCompactorTests.cs | Updates `InferenceRunner` construction to include logger dependency. | | tests/LlamaShears.UnitTests/Agent/Core/AgentTurnFlowTests.cs | Updates `InferenceRunner` construction to include logger dependency. | | tests/LlamaShears.UnitTests/Agent/Core/AgentLoopTests.cs | Updates `InferenceRunner` construction to include logger dependency. | | tests/LlamaShears.UnitTests/Agent/Core/AgentInterruptTests.cs | Updates `InferenceRunner` construction to include logger dependency. | | tests/LlamaShears.UnitTests/Agent/Core/AgentInterruptGracefulTests.cs | Updates `InferenceRunner` construction to include logger dependency. | | tests/LlamaShears.UnitTests/Agent/Core/AgentEventPublishingTests.cs | Updates `InferenceRunner` construction to include logger dependency. | | src/public/LlamaShears.Core.Abstractions/Provider/ModelTokenInformationContextEntry.cs | Adds timestamp to token-info context entries. | | src/public/LlamaShears.Core.Abstractions/Agent/SaveAgentConfigResult.cs | Introduces save outcome discriminated union for config saves. | | src/public/LlamaShears.Core.Abstractions/Agent/IAgentConfigProvider.cs | Adds raw read + optimistic save APIs to the config provider interface. | | src/public/LlamaShears.Core.Abstractions/Agent/AgentConfigFile.cs | Defines raw config snapshot type (content + hash). | | src/public/LlamaShears.Core.Abstractions/Agent/AgentConfig.cs | Adds `Hash` to loaded configs (non-serialized change token). | | src/LlamaShears/appsettings.json | Adjusts log levels for MCP-related components. | | src/LlamaShears.Provider.OpenAI/OpenAILanguageModel.cs | Refactors logger-message methods to instance partials where applicable. | | src/LlamaShears.Provider.Ollama/OllamaLanguageModel.cs | Refactors logger-message methods to instance partials. | | src/LlamaShears.Hosting/HostRestarter.cs | Refactors logger-message methods to instance partials. | | src/LlamaShears.Core/Tools/ModelContextProtocol/ModelContextProtocolToolDiscovery.cs | Refactors logger-message methods to instance partials. | | src/LlamaShears.Core/Tools/ModelContextProtocol/ModelContextProtocolToolCallDispatcher.cs | Refactors logger-message methods to instance partials. | | src/LlamaShears.Core/Tools/ModelContextProtocol/ModelContextProtocolServerRegistry.cs | Refactors logger-message methods to instance partials. | | src/LlamaShears.Core/Tools/ModelContextProtocol/LoopbackBearerHandler.cs | Refactors logger-message methods to instance partials. | | src/LlamaShears.Core/Todo/TodoStorage.cs | Refactors logger-message methods to instance partials. | | src/LlamaShears.Core/Seeding/DirectorySeeder.cs | Refactors logger-message methods to instance partials. | | src/LlamaShears.Core/Memory/SqliteMemoryService.cs | Refactors logger-message methods to instance partials. | | src/LlamaShears.Core/Memory/MemoryIndexerBackgroundService.cs | Refactors logger-message methods to instance partials. | | src/LlamaShears.Core/InferenceRunner.cs | Adds logger dependency + tool-call logging; class becomes partial. | | src/LlamaShears.Core/EagerCompactor.cs | Refactors logger-message methods to instance partials. | | src/LlamaShears.Core/Cron/JsonCronStore.cs | Refactors logger-message methods to instance partials. | | src/LlamaShears.Core/Cron/CronScheduler.cs | Refactors logger-message methods to instance partials. | | src/LlamaShears.Core/Cron/CronExecutor.cs | Refactors logger-message methods to instance partials. | | src/LlamaShears.Core/ContextCompactor.cs | Adjusts compaction preemption thresholding and logging method style. | | src/LlamaShears.Core/AgentTurnLogger.cs | Refactors logger-message methods to instance partials. | | src/LlamaShears.Core/AgentManager.cs | Uses config hash to detect reloads; refactors logging generator usage. | | src/LlamaShears.Core/AgentConfigProvider.cs | Implements raw read/save APIs, hashes raw bytes pre-deserialize, adds backup rotation. | | src/LlamaShears.Core/Agent.cs | Emits token info entries with timestamps; refactors logging generator usage. | | src/LlamaShears.Core.Eventing/SubscriptionHandle.cs | Extracts subscription disposal logging into a dedicated type. | | src/LlamaShears.Core.Eventing/EventHandlerWrapperOptions.cs | Extracts wrapper options from `EventBus` into a named type. | | src/LlamaShears.Core.Eventing/EventHandlerWrapper.cs | Extracts event handler wrapper from `EventBus` into its own type. | | src/LlamaShears.Core.Eventing/EventBus.cs | Uses extracted wrapper/handle types and instance logger-message method. | | src/LlamaShears.Api/Tools/ModelContextProtocol/Shell/ShellTools.cs | Refactors logger-message methods to instance partials. | | src/LlamaShears.Api/Tools/ModelContextProtocol/Memory/StoreMemoryTool.cs | Refactors logger-message methods to instance partials. | | src/LlamaShears.Api/Tools/ModelContextProtocol/Memory/SearchMemoryTool.cs | Refactors logger-message methods to instance partials. | | src/LlamaShears.Api/Tools/ModelContextProtocol/Memory/IndexMemoryTool.cs | Refactors logger-message methods to instance partials. | | src/LlamaShears.Api/Tools/ModelContextProtocol/Filesystem/WriteFileTool.cs | Refactors logger-message methods to instance partials. | | src/LlamaShears.Api/Tools/ModelContextProtocol/Filesystem/RegexReplaceFileTool.cs | Refactors logger-message methods to instance partials. | | src/LlamaShears.Api/Tools/ModelContextProtocol/Filesystem/ReadFileTool.cs | Refactors logger-message methods to instance partials. | | src/LlamaShears.Api/Tools/ModelContextProtocol/Filesystem/ListFilesTool.cs | Refactors logger-message methods to instance partials. | | src/LlamaShears.Api/Tools/ModelContextProtocol/Filesystem/GrepTool.cs | Refactors logger-message methods to instance partials. | | src/LlamaShears.Api/Tools/ModelContextProtocol/Filesystem/DeleteFileTool.cs | Refactors logger-message methods to instance partials. | | src/LlamaShears.Api/Tools/ModelContextProtocol/Filesystem/AppendFileTool.cs | Refactors logger-message methods to instance partials. | | src/LlamaShears.Api/Tools/ModelContextProtocol/Cron/ScheduleCronTool.cs | Refactors logger-message methods to instance partials. | | src/LlamaShears.Api/Tools/ModelContextProtocol/Cron/EditCronTool.cs | Refactors logger-message methods to instance partials. | | src/LlamaShears.Api.Web/wwwroot/site.css | Updates dark theme palette and related UI colors. | | src/LlamaShears.Api.Web/Services/IconProvider.cs | Refactors logger-message methods to instance partials. | | src/LlamaShears.Api.Web/Services/ChatSession.cs | Joins agent data-scope prior to slash-command dispatch. | | src/LlamaShears.Api.Web/Pages/AgentList.razor.css | Adds styling for the new agents list page. | | src/LlamaShears.Api.Web/Pages/AgentList.razor | Adds `/agents` listing page linking to editor routes. | | src/LlamaShears.Api.Web/Pages/AgentEditor.razor.css | Adds styling for the new agent JSON editor page. | | src/LlamaShears.Api.Web/Pages/AgentEditor.razor | Adds `/agents/{id}/edit` editor with hashing/conflict banners and local drafts. | | src/LlamaShears.Api.Web/LlamaShears.Api.Web.csproj | Adds MSBuild targets to bundle JS via npm+esbuild and copy to wwwroot. | | src/LlamaShears.Api.Web/Layout/MainLayout.razor.css | Updates nav layout styling and adds focus-visible affordances. | | src/LlamaShears.Api.Web/Layout/MainLayout.razor | Adds “Agents” navigation item and nav sectioning/ARIA label. | | src/LlamaShears.Api.Web/js/scripts/reconnect-auto-reload.js | Adds reconnect terminal-state auto reload behavior. | | src/LlamaShears.Api.Web/js/scripts/messages.js | Adds auto-scroll behavior for streaming chat containers. | | src/LlamaShears.Api.Web/js/scripts/highlight-init.js | Adds mutation-driven highlight.js initialization. | | src/LlamaShears.Api.Web/js/scripts/composer.js | Adds Enter-to-send behavior for composer textarea. | | src/LlamaShears.Api.Web/js/scripts/composer-paste.js | Adds image paste bridge from clipboard to Blazor composer. | | src/LlamaShears.Api.Web/js/scripts/agent-editor.js | Implements CodeMirror-based JSON editor + lint + change callbacks. | | src/LlamaShears.Api.Web/js/package.json | Adds JS build dependencies (esbuild, CodeMirror packages). | | src/LlamaShears.Api.Web/js/package-lock.json | Locks JS dependency graph for deterministic bundling. | | src/LlamaShears.Api.Web/js/entries/site.js | Defines side-effect bundle entrypoint for global UI listeners. | | src/LlamaShears.Api.Web/Components/Chat/ChatHeader.razor.css | Ensures header button anchors don’t get underlined. | | src/LlamaShears.Api.Web/Components/Chat/ChatHeader.razor | Adds pencil button linking to the selected agent’s editor. | | src/LlamaShears.Api.Web/Components/Chat/ChatBubbleView.razor.css | Adds collapsible thought bubble styling + tool args default-collapsed. | | src/LlamaShears.Api.Web/Components/Chat/ChatBubbleView.razor | Collapses thought bubbles with a first-line summary; tweaks tool label/args expansion. | | src/LlamaShears.Api.Web/App.razor | Switches from individual scripts to bundled `dist/site.js`. | | docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Agent/SaveAgentConfigResult/Ok.md | Adds generated API docs for `SaveAgentConfigResult.Ok`. | | docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Agent/SaveAgentConfigResult/InvalidJson.md | Adds generated API docs for `SaveAgentConfigResult.InvalidJson`. | | docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Agent/SaveAgentConfigResult/index.md | Adds generated API docs index for save result subtypes. | | docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Agent/SaveAgentConfigResult/Conflict.md | Adds generated API docs for `SaveAgentConfigResult.Conflict`. | | docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Agent/SaveAgentConfigResult.md | Adds generated API docs for `SaveAgentConfigResult`. | | docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Agent/index.md | Updates agent namespace index to include new types. | | docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Agent/IAgentConfigProvider.md | Updates API docs to include new read/save methods. | | docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Agent/AgentConfigFile.md | Adds generated API docs for `AgentConfigFile`. | | docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Agent/AgentConfig.md | Updates docs for new `Hash` parameter/property. | | docs/api/LlamaShears.Core.Abstractions/index.md | Updates top-level docs index for new types and namespace. | | Dockerfile | Installs node+npm in build stage to support JS bundling during publish. | | .gitignore | Ignores JS bundler output `dist/` directories. | </details> <details> <summary>Files not reviewed (1)</summary> * **src/LlamaShears.Api.Web/js/package-lock.json**: Language not supported </details> --- 💡 <a href="/jasoncouture/llama-shears/new/main?filename=.github/instructions/*.instructions.md" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">Add Copilot custom instructions</a> for smarter, more guided reviews. <a href="https://docs.github.com/en/copilot/customizing-copilot/adding-repository-custom-instructions-for-github-copilot" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">Learn how to get started</a>.
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2026-05-11 00:41:03 -04:00

TryJoinContextScope can throw if a different scope is already present on this call chain, and it also leaves IDataContextFactory.Current set for subsequent UI operations. Consider capturing/restoring the prior scope (or calling ClearCurrent in a finally) so one slash command doesn't permanently pin the circuit to an agent scope or crash when the selected agent changes.

TryJoinContextScope can throw if a different scope is already present on this call chain, and it also leaves IDataContextFactory.Current set for subsequent UI operations. Consider capturing/restoring the prior scope (or calling ClearCurrent in a finally) so one slash command doesn't permanently pin the circuit to an agent scope or crash when the selected agent changes.
@ -65,0 +78,4 @@
var hash = Convert.ToHexString(SHA256.HashData(bytes));
return new AgentConfigFile(Encoding.UTF8.GetString(bytes), hash);
}
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2026-05-11 00:41:02 -04:00

ReadFileAsync builds the on-disk path from the untrusted agentId via Path.Combine(..., agentId + ".json"). With values like "../foo" this can traverse outside the agents directory, enabling arbitrary file reads when the editor UI hits this API. Consider validating agentId as a safe file name (no directory separators / no ".." segments), or compute the full path and reject anything outside the agents root before accessing the file system.

ReadFileAsync builds the on-disk path from the untrusted agentId via Path.Combine(..., agentId + ".json"). With values like "../foo" this can traverse outside the agents directory, enabling arbitrary file reads when the editor UI hits this API. Consider validating agentId as a safe file name (no directory separators / no ".." segments), or compute the full path and reject anything outside the agents root before accessing the file system.
@ -65,0 +96,4 @@
{
var existing = await File.ReadAllBytesAsync(path, cancellationToken);
currentHash = Convert.ToHexString(SHA256.HashData(existing));
}
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2026-05-11 00:41:02 -04:00

SaveAsync also builds the target path from the untrusted agentId (Path.Combine(..., agentId + ".json")). If agentId contains path traversal sequences, this becomes an arbitrary file write via the editor save endpoint. Please constrain agentId to a safe file name / verify the resulting full path stays under the agents directory before writing, copying backups, or renaming temp files.

SaveAsync also builds the target path from the untrusted agentId (Path.Combine(..., agentId + ".json")). If agentId contains path traversal sequences, this becomes an arbitrary file write via the editor save endpoint. Please constrain agentId to a safe file name / verify the resulting full path stays under the agents directory before writing, copying backups, or renaming temp files.
@ -65,0 +128,4 @@
var tempPath = path + ".tmp";
await File.WriteAllBytesAsync(tempPath, bytes, cancellationToken);
File.Move(tempPath, path, overwrite: true);
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2026-05-11 00:41:03 -04:00

Backup filenames use DateTimeOffset.UtcNow.ToUnixTimeSeconds() as the unique suffix. Multiple saves within the same second will attempt to create the same ".{unixSeconds}.bak" name and File.Copy(..., overwrite: false) will throw, causing the save to fail. Use a higher-resolution timestamp (e.g., milliseconds/ticks) and/or add a random suffix / retry loop to guarantee uniqueness.

Backup filenames use DateTimeOffset.UtcNow.ToUnixTimeSeconds() as the unique suffix. Multiple saves within the same second will attempt to create the same ".{unixSeconds}.bak" name and File.Copy(..., overwrite: false) will throw, causing the save to fail. Use a higher-resolution timestamp (e.g., milliseconds/ticks) and/or add a random suffix / retry loop to guarantee uniqueness.
@ -65,0 +163,4 @@
private static long ParseBackupTimestamp(string fullPath)
{
var fileName = Path.GetFileName(fullPath);
if (!fileName.EndsWith(".bak", StringComparison.Ordinal))
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2026-05-11 00:41:03 -04:00

This catch block swallows IOException without any rationale. Per ADR-0010 (docs/adr/0010-exception-handling-requires-justification.md), swallowed exceptions should include an explicit "Ignored — ..." justification (and/or logging) so reviewers/operators understand why deleting stale backups can safely fail here.

This catch block swallows IOException without any rationale. Per ADR-0010 (docs/adr/0010-exception-handling-requires-justification.md), swallowed exceptions should include an explicit "Ignored — ..." justification (and/or logging) so reviewers/operators understand why deleting stale backups can safely fail here.
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2026-05-11 00:41:03 -04:00

LogToolCall records full tool-call arguments at Information level (args={Arguments}). Tool arguments can be large and may include sensitive data (paths, file contents, tokens). Consider lowering this to Debug/Trace and/or redacting/truncating arguments to avoid leaking data into logs and to keep log volume manageable.

LogToolCall records full tool-call arguments at Information level (args={Arguments}). Tool arguments can be large and may include sensitive data (paths, file contents, tokens). Consider lowering this to Debug/Trace and/or redacting/truncating arguments to avoid leaking data into logs and to keep log volume manageable.
Sign in to join this conversation.
No description provided.