feat(console): inject prompts, MCP, tools, and credentials into a running session - #451
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Team Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Reviewer's GuideThis slice adds session-scoped operator injections through a metadata-backed overlay and typed API commands, projects them into the next runtime turn or live MCP/outbound resolution without mutating agent records, exposes safe controls in the Console Inspector, emits audit-only events, and includes API, integration, UI, and verification coverage. Sequence diagram for session injection and runtime applicationsequenceDiagram
actor Operator
participant Console as Console InjectPanel
participant API as Session API
participant Session as Session row
participant Runtime as Session runtime
participant Proxy as MCP or outbound proxy
Operator->>Console: Select injection action
Console->>API: POST /v1/sessions/:id/injections
API->>API: injectionCommandSchema.parse()
API->>Session: applyInjectionCommand()
API->>Session: Update metadata._oma_injections
API->>Runtime: recordConfigUpdated()
API-->>Console: SessionInjectionOverlay
alt Prompt or tools injection
Runtime->>Session: overlayFromMetadata()
Runtime->>Runtime: applyOverlayToAgent()
Runtime->>Runtime: injectionReminders()
Runtime-->>Runtime: Apply on next turn
else MCP or credential injection
Proxy->>Session: Read overlay on outbound call
Proxy->>Proxy: pickMcpServer() or credentialIdForHost()
Proxy-->>Proxy: Apply immediately
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
b4d902b to
e48b5f3
Compare
…ning session Operators can append a system prompt, mount an MCP server, toggle tools, or bind a vault credential on a live session without mutating the agent record. The overlay lives at session.metadata._oma_injections (stripped from GET metadata). Credentials are referenced by id only and never enter the sandbox. Co-authored-by: duyet <duyet@users.noreply.github.com>
Import overlay helpers from @duyet/oma-shared in the main worker (no direct api-types dep), widen the MCP merge cast, and complete AgentConfig fixtures. Co-authored-by: duyet <duyet@users.noreply.github.com>
e48b5f3 to
db3f5ca
Compare
Implements a first slice of #346 (part of #347): operators can intervene in a live session without mutating the agent record or restarting.
What this slice does
POST /v1/sessions/:id/injectionswith one command.PATCH /v1/sessions/:id/toolsis a thin alias (enabled/disabledorenabled_tools/disabled_tools).GET /v1/sessions/:id/injectionsreturns the overlay (never tokens).session.config_updatedis an audit event (prompt body omitted; credential detail ishost+credential_idonly). Crash recovery does not replay it.Design deviation from the issue (intentional)
The issue asked for injections that are not persisted (ephemeral to the running SessionDO). This slice stores the overlay on the session row at
metadata._oma_injectionsso:GET /v1/sessionsstill strips the key so caller metadata stays caller-owned.It remains session-scoped (not copied onto the agent). Creating a new session of the same agent does not inherit the overlay. Clients cannot clobber it via session create/update metadata.
Credentials
credential_idmust already belong to the session’svault_ids(422 otherwise).Out of scope (this PR)
oma-vaultsidecar overlay (CF outbound + Node MCP proxy are covered).Rebase
Rebased onto latest
mainto clear conflicts with:output_file/ Artifacts tab) — Inspector now has both Inject and Artifacts.SessionSecretServiceimport alongside injection overlay types.console-analyticsandconsole-inject.SessionDOnext to the AnyRouter import.Verification
pnpm typecheck— pass (post-rebase)InjectPanel+ Artifacts inspector tests — 5 passeddrive console-inject: inject-gate pass (signed-out/sessions/sess_fake→/login). Inject tab/sections skipped — no invented auth secrets. Panel behavior is covered by component tests.Summary by Sourcery
Enable operators to inject prompts, MCP servers, tool overrides, and vault credential bindings into running sessions through a session-scoped overlay.
New Features:
Bug Fixes:
Enhancements:
CI:
Documentation:
Tests: