Skip to content

feat(components): send role instructions as shortcuts - #339

Draft
lawvs wants to merge 1 commit into
LodyAI:mainfrom
lawvs:feat/role-instruction-shortcut
Draft

feat(components): send role instructions as shortcuts#339
lawvs wants to merge 1 commit into
LodyAI:mainfrom
lawvs:feat/role-instruction-shortcut

Conversation

@lawvs

@lawvs lawvs commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Related issue

Closes #338

Problem / pressure

Agent Role prompts can serve as reusable instructions, but the existing picker only applies the complete Role configuration. Sending just the prompt required manual copying and could disturb an in-progress composer draft or its attachments.

Summary

  • Add a persisted-Session shortcut that sends a Role prompt as a standalone Role-less user turn through the existing direct, guide, or queued submission route.
  • Preserve the current Session identity, composer text, mentions, pasted text, pending uploads, images, and files.
  • Add a compact desktop detail-header action and mobile long-press actions for Apply Role and Send instruction.
  • Keep Apply Role availability-aware while allowing a stored prompt to be sent even when the Role's execution configuration is unavailable.
  • Keep Chat Landing and uncreated child tabs unchanged, and cover the behavior with tests, stories, translations, and scoped contributor invariants.

Before / after

image
Before After
A Role could only be applied; sending only its prompt required copying it into the composer. A persisted Session can send the Role prompt directly without applying the Role or changing the current draft, attachments, or Session.
Touch layouts selected a Role with a tap and offered no alternate action. A long press opens explicit Apply Role and Send instruction actions; a normal tap still applies the Role.

Test plan

  • pnpm format
  • pnpm --filter @lody/components typecheck
  • NODE_NO_WARNINGS=1 FORCE_COLOR=0 pnpm --filter @lody/components test --maxWorkers=1 — 420 files and 3,023 tests passed.
  • NODE_NO_WARNINGS=1 FORCE_COLOR=0 pnpm --filter @lody/components exec vitest run tests/agent-role-detail-pane.test.tsx tests/composer-agent-role-panel.test.tsx tests/mobile-run-config-role-row.test.tsx tests/session-chat-input-submission.test.tsx tests/agent-role-row.test.tsx --maxWorkers=1 — 5 files and 40 tests passed after rebasing onto origin/main.
  • pnpm lint:i18n
  • pnpm check:code-collab-imports
  • pnpm check:platform-boundaries
  • pnpm check:public-boundary
  • git diff --check origin/main...HEAD
  • pnpm check reached passing workspace typechecks and lint with zero errors, but its default concurrent test stage was terminated by the local resource limit; the affected components suite was then rerun serially as recorded above.

Context handoff

Instructions for reviewing agents

  • Review focus: Check the standalone submission wiring in session-chat-interface.tsx, draft-preservation contract in session-chat-input-area.tsx, and the split Apply/Send behavior in the desktop and mobile Role surfaces.
  • Decisions to challenge: Verify that limiting the shortcut to persisted Sessions and allowing prompt sending for an otherwise unavailable Role match the intended product boundary.
  • Plausible failures / evidence gaps: Pay particular attention to direct versus guide versus queued routing, suppression of the tap after a mobile long press, and preservation of pending composer assets; automated coverage exercises each state transition, but physical-device long-press feel remains a manual-review concern.

Authoring context

  • User goal / directives: Treat Agent Role instructions as shortcuts that can be sent directly without applying the Role, changing Session identity, or altering existing draft text and attachments.
  • Constraints / non-goals: Keep the implementation explicit and small; do not add the action to Chat Landing or uncreated child tabs, and do not change normal Role selection semantics.
  • Risk-bearing decisions: The shortcut intentionally submits a Role-less turn, and prompt availability is independent from whether the Role's stored machine, agent, model, mode, or permission configuration can currently be applied.
  • Destructive or irreversible behavior: There are no migrations, catalog mutations, or cleanup operations; the only externally visible mutation is the user turn sent after an explicit Send instruction action.
  • Deliberately not done or tested: No backend protocol or blank-Session flow was added; the default repo-wide concurrent test stage could not complete under the local resource limit, so the full components suite and focused post-rebase tests were run serially instead.
  • Unknowns / confidence: Confidence is high in Session and composer-state preservation from unit coverage; the residual uncertainty is the exact long-press feel across physical touch devices.

@Leeeon233

Copy link
Copy Markdown
Contributor

I think this would make the concept of "role" complex and difficult to understand. I'd prefer to simply add a new "lody shortcut" for this. We might need to have a discussion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request] Send an Agent Role instruction as a shortcut

2 participants