Skip to content

Cloud Agent - Add Slash Command Support#3162

Open
eshurakov wants to merge 6 commits into
mainfrom
eshurakov/cloud-agent-next-slash-commands
Open

Cloud Agent - Add Slash Command Support#3162
eshurakov wants to merge 6 commits into
mainfrom
eshurakov/cloud-agent-next-slash-commands

Conversation

@eshurakov
Copy link
Copy Markdown
Contributor

@eshurakov eshurakov commented May 10, 2026

Summary

Add end-to-end slash command support across the cloud agent stack by introducing discriminated send payloads (prompt vs command).

  • Execution layer: Introduce ExecutionPayload union (PromptExecutionPayload | CommandExecutionPayload) and dispatchToWrapper() to route prompts vs commands to the wrapper client.
  • Command catalog: Add commands.available event to cache and broadcast kilo slash commands to connecting clients. Remove hardcoded default-command-sets in favor of runtime catalog from kilo.
  • Web SDK & UI: Update transport, session manager, normalizer, and chat components to handle command payloads and available commands.
  • Mobile: Update session manager and detail content for slash command support.
  • Wrapper: Open ingest connection for slash commands (mirroring prompt flow) and push command catalog on connect/reconnect.

Verification

Screenshot 2026-05-12 at 10 59 55

Reviewer Notes

  • Both prompt and command payloads ride the same sendMessageV2 tRPC method; the orchestrator branches only at the final wrapper call.
  • model validation is skipped for command payloads since kilo applies the command's own agent/model override.
  • The DO caches the command catalog separately from session metadata to avoid polluting MetadataSchema.

Comment thread apps/mobile/src/components/agents/mobile-session-manager.ts Outdated
Comment thread services/cloud-agent-next/wrapper/src/server.ts
Comment thread services/cloud-agent-next/src/session/ingest-handlers/commands-available.ts Outdated
Comment thread services/cloud-agent-next/src/websocket/stream.ts
Comment thread apps/web/src/components/cloud-agent-next/CloudAgentProvider.tsx
@kilo-code-bot
Copy link
Copy Markdown
Contributor

kilo-code-bot Bot commented May 10, 2026

Code Review Summary

Status: No Issues Found | Recommendation: Merge

All Fixed Issues (across all review rounds)
File Issue
services/cloud-agent-next/wrapper/src/server.ts ✅ WARNING — state.setActive(false) now called on both success and error paths
services/cloud-agent-next/src/session/ingest-handlers/commands-available.ts as cast replaced with commandsPayloadSchema.safeParse(data)
services/cloud-agent-next/src/websocket/stream.ts eventId: 0 sentinel comment added
apps/web/src/components/cloud-agent-next/CloudAgentProvider.tsx ✅ Inline WorkerPayload replaced with imported SendMessagePayload
apps/web/src/components/cloud-agent-next/NewSessionPanel.tsx DEFAULT_SLASH_COMMANDS unused import removed
apps/mobile/src/components/agents/mobile-session-manager.ts ✅ Inline WorkerPayload type removed; now uses SendMessagePayload from apps/web/src/lib/cloud-agent-next/types.ts
Other Observations

Circular dependency resolved: SlashCommandInfo type was moved from slash-commands.ts into default-slash-commands.generated.ts and re-exported, eliminating the import cycle between the two files.

DB migration squash: Branch-local migrations were squashed per AGENTS.md guidelines. The agent_environment_profile_kilo_commands table creation is in 0117_wise_taskmaster.sql. Content is clean — CREATE TABLE on a new table, proper ON DELETE cascade FK, unique constraint on (profile_id, name), profile_id index. No blocking DDL.

GDPR / soft-delete: The new table cascades off agent_environment_profiles, which is already deleted in softDeleteUser. No GDPR update needed.

SendMessagePayload consolidation: Shared type in apps/web/src/lib/cloud-agent-next/types.ts, re-exported from cloud-agent-client.ts, used in mobile-session-manager.ts.

messageId thread-through: Correctly plumbed from dispatchToWrapper through WrapperCommandOptions, kilo-api.ts, and server.ts.

listCommands skill filter: kilo-api.ts filters out source === "skill" from the live catalog, matching TUI behavior.

@cloud-agent-shared path alias: The tsconfig.json alias points apps/web directly at services/cloud-agent-next/src/shared/slash-commands.ts, creating a cross-package import without a formal boundary. Works today but may need attention if packages are split or build system changes.

Files Reviewed (incremental, 3 files)
  • services/cloud-agent-next/src/session-service.test.ts — test model fixture updated from claude-sonnet-4-20250514 to kilo/claude-sonnet-4-20250514 to match normalizeKilocodeModel behavior; no issues
  • services/cloud-agent-next/src/shared/default-slash-commands.generated.tsSlashCommandInfo type moved here from slash-commands.ts to break circular dependency; no issues
  • services/cloud-agent-next/src/shared/slash-commands.ts — now imports and re-exports SlashCommandInfo from generated file; no issues

Reviewed by claude-sonnet-4.6 · 886,363 tokens

@eshurakov eshurakov force-pushed the eshurakov/cloud-agent-next-slash-commands branch from 92ef2c5 to 121c1a9 Compare May 11, 2026 13:20
Comment thread apps/web/src/components/cloud-agent-next/NewSessionPanel.tsx Outdated
@eshurakov eshurakov force-pushed the eshurakov/cloud-agent-next-slash-commands branch 2 times, most recently from 91e551e to 2e3f27f Compare May 12, 2026 11:24
…payloads

Add discriminated send payloads (prompt vs command) across the cloud
agent stack:

- Introduce ExecutionPayload union (PromptExecutionPayload |
  CommandExecutionPayload) in cloud-agent-next execution types.
- Add dispatchToWrapper() to route prompts vs commands to the wrapper.
- Add commands.available event to cache and broadcast kilo slash commands.
- Update web SDK transport, session manager, and UI to handle command
  payloads and available commands.
- Update mobile session manager and detail content for slash commands.
- Remove hardcoded default-command-sets in favor of runtime catalog.
@eshurakov eshurakov force-pushed the eshurakov/cloud-agent-next-slash-commands branch from 2e3f27f to 8190a61 Compare May 12, 2026 11:32
eshurakov added 5 commits May 12, 2026 14:01
Extract SendMessagePayload into a shared types.ts file (no server-only
deps) so both web and mobile apps can import it. Add kiloCommandCount
and kiloCommands to storybook mock data to match the updated
ProfileSummary/ProfileDetails types. Add eventId: 0 sentinel comment
in stream.ts.
Restore 0117_snapshot.json from main and regenerate the
agent_environment_profile_kilo_commands migration as 0124 on top of
main's latest schema. Extract SendMessagePayload into shared types.ts
for cross-app use. Fix storybook mock data for new profile fields.
This branch-local migration was superseded by 0124_known_catseye.sql
after regenerating on top of main's schema.
@eshurakov eshurakov changed the title CloudAgentNext - Add Slash Command Support With Discriminated Payloads Cloud Agent - Add Slash Command Support May 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant