fix(cli): align run app --conversation mode list with runtime gate (#37733)

This commit is contained in:
Xiyuan Chen 2026-06-21 23:42:51 -07:00 committed by GitHub
parent c1ab6226a2
commit 762e7f7e8a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 12 additions and 7 deletions

View File

@ -1,7 +1,7 @@
import type { RunContext, RunStrategy } from './index'
import type { SseEvent } from '@/http/sse'
import { buildRunBody } from '@/api/app-run'
import { chatConversationHint, newAppRunObject, RUN_MODES } from '@/commands/run/app/handlers'
import { CHAT_MODES, chatConversationHint, newAppRunObject } from '@/commands/run/app/handlers'
import { renderHitlHint, renderHitlOutput } from '@/commands/run/app/hitl-render'
import { collect, HitlPauseError } from '@/commands/run/app/sse-collector'
import { formatted, stringifyOutput } from '@/framework/output'
@ -10,8 +10,6 @@ import { colorEnabled, colorScheme } from '@/sys/io/color'
import { startSpinner } from '@/sys/io/spinner'
import { extractThinkBlocks, stripThinkBlocks } from '@/sys/io/think-filter'
const CHAT_MODES: ReadonlySet<string> = new Set([RUN_MODES.Chat, RUN_MODES.AgentChat, RUN_MODES.AdvancedChat])
async function* captureTaskId(
iter: AsyncIterable<SseEvent>,
onCapture: (id: string) => void,

View File

@ -9,12 +9,12 @@ WORKFLOW
difyctl run app <id> --inputs '{"key":"value"}' -o json
APP MODES
chat / advanced-chat Conversational. Accepts --conversation <id> to
resume an existing thread.
chat / agent-chat / Conversational. Accept --conversation <id> to
advanced-chat resume an existing thread. agent-chat adds
autonomous tool use.
completion Single-turn. Ignores --conversation.
workflow Multi-step graph. Pass all input variables as a
JSON object via --inputs.
agent-chat Conversational with autonomous tool use.
HITL PAUSE (exit code 0 success-with-pending)
When a workflow pauses for human input, stdout receives a JSON object

View File

@ -11,6 +11,12 @@ export const RUN_MODES = {
export type RunMode = typeof RUN_MODES[keyof typeof RUN_MODES]
export const CHAT_MODES: ReadonlySet<string> = new Set<RunMode>([
RUN_MODES.Chat,
RUN_MODES.AgentChat,
RUN_MODES.AdvancedChat,
])
export type AppRunObject = FormattedPrintable
export function newAppRunObject(mode: string, resp: Record<string, unknown>): AppRunObject {

View File

@ -4,6 +4,7 @@ import { httpRetryFlag } from '@/commands/_shared/global-flags'
import { Args, Flags } from '@/framework/flags'
import { OutputFormat } from '@/framework/output'
import { agentGuide } from './guide'
import { CHAT_MODES } from './handlers'
import { runApp } from './run'
export default class RunApp extends DifyCommand {
@ -30,7 +31,7 @@ export default class RunApp extends DifyCommand {
'inputs': Flags.string({ description: 'Input variables as a JSON object, e.g. --inputs \'{"key":"value"}\'. Mutually exclusive with --inputs-file.' }),
'inputs-file': Flags.string({ description: 'Path to a JSON file containing the inputs object. Mutually exclusive with --inputs.' }),
'file': Flags.stringArray({ description: 'Named file input: --file key=@path for a local file or --file key=https://url for a remote URL. Repeatable.', default: [] }),
'conversation': Flags.string({ description: 'Resume a chat conversation by id (chat/advanced-chat only)' }),
'conversation': Flags.string({ description: `Resume a chat conversation by id (${[...CHAT_MODES].join('/')} only)` }),
'workflow-id': Flags.string({ description: 'Pin to a specific published workflow version' }),
'workspace': Flags.string({ description: 'Workspace id (overrides DIFY_WORKSPACE_ID and stored default)' }),
'stream': Flags.boolean({ description: 'Print output live as tokens/events arrive (default: collect and print at end)', default: false }),