> ## Documentation Index
> Fetch the complete documentation index at: https://cognitio-agent.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Publish TUI event

> Publish a TUI event



## OpenAPI

````yaml /openapi.json post /tui/publish
openapi: 3.1.1
info:
  title: cognitio
  description: cognitio api
  version: 1.0.0
servers: []
security: []
paths:
  /tui/publish:
    post:
      summary: Publish TUI event
      description: Publish a TUI event
      operationId: tui.publish
      parameters:
        - in: query
          name: directory
          schema:
            type: string
        - in: query
          name: workspace
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              anyOf:
                - $ref: '#/components/schemas/Event.tui.prompt.append'
                - $ref: '#/components/schemas/Event.tui.command.execute'
                - $ref: '#/components/schemas/Event.tui.toast.show'
                - $ref: '#/components/schemas/Event.tui.session.select'
      responses:
        '200':
          description: Event published successfully
          content:
            application/json:
              schema:
                type: boolean
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadRequestError'
      x-codeSamples:
        - lang: js
          source: |-
            import { createCognitioClient } from "@cognitio/sdk

            const client = createCognitioClient()
            await client.tui.publish({
              ...
            })
components:
  schemas:
    Event.tui.prompt.append:
      type: object
      properties:
        type:
          type: string
          const: tui.prompt.append
        properties:
          type: object
          properties:
            text:
              type: string
          required:
            - text
      required:
        - type
        - properties
    Event.tui.command.execute:
      type: object
      properties:
        type:
          type: string
          const: tui.command.execute
        properties:
          type: object
          properties:
            command:
              anyOf:
                - type: string
                  enum:
                    - session.list
                    - session.new
                    - session.share
                    - session.interrupt
                    - session.compact
                    - session.page.up
                    - session.page.down
                    - session.line.up
                    - session.line.down
                    - session.half.page.up
                    - session.half.page.down
                    - session.first
                    - session.last
                    - prompt.clear
                    - prompt.submit
                    - agent.cycle
                - type: string
          required:
            - command
      required:
        - type
        - properties
    Event.tui.toast.show:
      type: object
      properties:
        type:
          type: string
          const: tui.toast.show
        properties:
          type: object
          properties:
            title:
              type: string
            message:
              type: string
            variant:
              type: string
              enum:
                - info
                - success
                - warning
                - error
            duration:
              description: Duration in milliseconds
              default: 5000
              type: number
            sessionID:
              description: Session ID associated with the notification
              type: string
              pattern: ^ses.*
          required:
            - message
            - variant
      required:
        - type
        - properties
    Event.tui.session.select:
      type: object
      properties:
        type:
          type: string
          const: tui.session.select
        properties:
          type: object
          properties:
            sessionID:
              description: Session ID to navigate to
              type: string
              pattern: ^ses.*
          required:
            - sessionID
      required:
        - type
        - properties
    BadRequestError:
      type: object
      properties:
        data: {}
        errors:
          type: array
          items:
            type: object
            propertyNames:
              type: string
            additionalProperties: {}
        success:
          type: boolean
          const: false
      required:
        - data
        - errors
        - success

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.