feat(sharing): per-agent custom instructions for public & channel chats (#1205)#1337
feat(sharing): per-agent custom instructions for public & channel chats (#1205)#1337dolho wants to merge 1 commit into
Conversation
…ts (#1205) Owners can attach extra system-prompt instructions that apply to public-facing conversations ONLY — public links, channel chats (Slack/Telegram/WhatsApp), and x402 paid chat — without changing the agent's behavior in their own authenticated chats, scheduled runs, loops, or agent-to-agent calls. The text-surface counterpart of voice_system_prompt. - schema/migration: agent_ownership.public_channel_system_prompt TEXT (schema.py + tables.py Core object + versioned migration, Invariant #3) - db: get/set_public_channel_system_prompt (set strips, empty clears) + facade delegation - models: PublicChannelPrompt / PublicChannelPromptUpdate (4000-char cap) - api: owner-only GET/PUT /api/agents/{name}/public-prompt (sharing.py), mirroring the voice-prompt endpoints - injection: platform_prompt_service.build_public_channel_caller_prompt folds the fragment with the MEM-001 memory block (public fragment first); wired into the three public-facing sites — message_router (channels), public.py (sync+async), paid.py (x402). Authenticated chat / schedules / loops / a2a never call it, so the scope exclusion holds by construction. Unset = strict no-op; a DB error degrades to the memory block (never blocks a chat) - ui: Additional Instructions textarea (save/clear, char counter) in SharingPanel.vue via two agents-store methods - tests: db get/set/clear/isolation + helper composition (4 combos + db-error degradation), SQLite + Postgres; schema-parity + migrations suites green - docs: requirements section 44, architecture endpoint + column Related to #1205 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
vybe
left a comment
There was a problem hiding this comment.
Validated via /validate-pr — two blockers (the prompt-injection framing, public/channel/x402 wiring, and tests look solid otherwise):
1. Missing Postgres/Alembic migration (Invariant #3). Adds agent_ownership.public_channel_system_prompt via a SQLite migration (_migrate_agent_ownership_public_channel_prompt) + schema.py/tables.py, but no Alembic revision under src/backend/migrations/versions/. PG deployments won't get the column. (schema-parity only guards the SQLite track — same gap as #1339.)
2. Conflicts with dev after #1317. #1317 restructured SharingPanel.vue (moved operator management to the new Access tab, reframed around Identity Proof / access policy). This PR was built on the old layout, so the SharingPanel.vue / routers/sharing.py conflicts need a rebase onto the redesigned component.
— posted via /validate-pr
|
Resolve by running |
Summary
Adds a per-agent Additional instructions field on the Sharing tab that injects a custom system-prompt fragment into public-facing conversations only — public links, channel chats (Slack/Telegram/WhatsApp), and x402 paid chat. Owners can tailor persona, scope limits, disclaimers, or guardrails for outside audiences without touching how the agent behaves in their own authenticated chats, scheduled work, or agent-to-agent calls. The text-surface counterpart of the existing
voice_system_prompt.Implementation (mirrors
voice_system_promptend-to-end)agent_ownership.public_channel_system_prompt TEXTinschema.pyand thedb/tables.pyCore object, plus a versioned migration (Invariant Feature/vector log retention #3). Covers SQLite + Postgres.get/set_public_channel_system_prompt(set strips whitespace, empty clears) + facade delegation.PublicChannelPrompt/PublicChannelPromptUpdate, 4000-char cap (Invariant Add internal health route, without which main didn't start #14).GET/PUT /api/agents/{name}/public-prompt(sharing.py).platform_prompt_service.build_public_channel_caller_promptfolds the fragment with the MEM-001 memory block (public fragment first), wired into the three public-facing sites:message_router.py(all channels),public.py(public chat sync + async),paid.py(x402). Authenticated chat / Session tab / schedules / loops / a2a never call it — the scope exclusion holds by construction.SharingPanel.vuevia two agents-store methods (Invariants Feature/process engine #6/security: Fix token logging and add HTML reports to gitignore #7).Behavior guarantees
caller_prompt).Acceptance criteria
caller_promptTesting
30 passed— newtest_public_channel_prompt.py(db get/set/clear/isolation on SQLite + Postgres; helper composition: 4 combos + db-error degradation) plus the schema-parity and migrations suites green.Related to #1205
🤖 Generated with Claude Code