SDK tui.submitPrompt() does not work #1660

Closed
opened 2026-02-16 17:32:01 -05:00 by yindo · 3 comments
Owner

Originally created by @ScriptedAlchemy on GitHub (Sep 9, 2025).

Originally assigned to: @thdxr on GitHub.

replication here:
https://github.com/sst/opencode/pull/2509

When calling submit prompt, it switches agent (presses tab not enter)

Originally created by @ScriptedAlchemy on GitHub (Sep 9, 2025). Originally assigned to: @thdxr on GitHub. replication here: https://github.com/sst/opencode/pull/2509 When calling submit prompt, it switches agent (presses `tab` not `enter`)
yindo closed this issue 2026-02-16 17:32:01 -05:00
Author
Owner

@brsc2909 commented on GitHub (Sep 21, 2025):

Also not working for me when calling client from plugin

import type { Plugin } from "@opencode-ai/plugin";

export const MyPlugin: Plugin = async ({
  project,
  client,
  $,
  directory,
  worktree,
}) => {
  return {
    event: async ({ event }) => {
      // Send notification on session completion
      if (event.type === "session.idle") {
        await client.tui.appendPrompt({ body: { text: "keep going and don't give up!" } });
        await client.tui.submitPrompt();
      }
    },
  };
};
@brsc2909 commented on GitHub (Sep 21, 2025): Also not working for me when calling client from plugin ```typescript import type { Plugin } from "@opencode-ai/plugin"; export const MyPlugin: Plugin = async ({ project, client, $, directory, worktree, }) => { return { event: async ({ event }) => { // Send notification on session completion if (event.type === "session.idle") { await client.tui.appendPrompt({ body: { text: "keep going and don't give up!" } }); await client.tui.submitPrompt(); } }, }; }; ```
Author
Owner

@brsc2909 commented on GitHub (Sep 21, 2025):

Not sure why this works but adding {body: {text: ""}} is working for me

import type { Plugin } from "@opencode-ai/plugin";

export const MyPlugin: Plugin = async ({
  project,
  client,
  $,
  directory,
  worktree,
}) => {
  return {
    event: async ({ event }) => {
      // Send notification on session completion
      if (event.type === "session.idle") {
        await client.tui.appendPrompt({ body: { text: "keep going and don't give up!" } });
        await client.tui.submitPrompt({ body: { text: "" } });
      }
    },
  };
};
@brsc2909 commented on GitHub (Sep 21, 2025): Not sure why this works but adding {body: {text: ""}} is working for me ```typescript import type { Plugin } from "@opencode-ai/plugin"; export const MyPlugin: Plugin = async ({ project, client, $, directory, worktree, }) => { return { event: async ({ event }) => { // Send notification on session completion if (event.type === "session.idle") { await client.tui.appendPrompt({ body: { text: "keep going and don't give up!" } }); await client.tui.submitPrompt({ body: { text: "" } }); } }, }; }; ```
Author
Owner

@rekram1-node commented on GitHub (Dec 27, 2025):

[automated] Closing due to 90+ days of inactivity. Feel free to reopen if you still need this!

@rekram1-node commented on GitHub (Dec 27, 2025): [automated] Closing due to 90+ days of inactivity. Feel free to reopen if you still need this!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#1660