mirror of
https://github.com/langgenius/dify.git
synced 2026-06-23 20:41:17 +08:00
fix(cli): document HITL pause exit code as 0, not 2 (#37737)
This commit is contained in:
parent
ea3ef81396
commit
1acf6e7eb6
@ -1,14 +1,15 @@
|
||||
export const agentGuide = `
|
||||
WHEN TO USE
|
||||
Continue a workflow that paused for human input. run app (or a prior
|
||||
resume app) exits 2 and prints a JSON object with status "paused",
|
||||
resume app) exits 0 and prints a JSON object with status "paused",
|
||||
form_token, workflow_run_id and resolved_default_values. Resume with:
|
||||
difyctl resume app <app_id> <form_token> --workflow-run-id <id> \\
|
||||
--inputs '{"name":"Alice"}' -o json
|
||||
|
||||
LOOP
|
||||
A resume can pause again (exit 2 with a new form_token). Repeat until
|
||||
exit 0. Pass --stream to print events live.
|
||||
A resume can pause again (exit 0 with a new form_token and status
|
||||
"paused"). Repeat until the output is no longer a pause. Pass --stream
|
||||
to print events live.
|
||||
|
||||
ERROR RECOVERY
|
||||
not logged in (exit 4) difyctl auth login
|
||||
|
||||
@ -16,7 +16,7 @@ APP MODES
|
||||
JSON object via --inputs.
|
||||
agent-chat Conversational with autonomous tool use.
|
||||
|
||||
HITL PAUSE (exit code 2)
|
||||
HITL PAUSE (exit code 0 — success-with-pending)
|
||||
When a workflow pauses for human input, stdout receives a JSON object
|
||||
with status "paused", form_token, workflow_run_id, and resolved_default_values.
|
||||
Resume with:
|
||||
|
||||
@ -14,9 +14,9 @@ export type Contract = {
|
||||
}
|
||||
|
||||
const EXIT_CODE_DESCRIPTIONS: Readonly<Record<number, string>> = {
|
||||
[ExitCode.Success]: 'success',
|
||||
[ExitCode.Success]: 'success (also a workflow paused for human input — check stdout for status "paused")',
|
||||
[ExitCode.Generic]: 'generic error',
|
||||
[ExitCode.Usage]: 'usage error (bad flag / missing arg), or a workflow paused for human input',
|
||||
[ExitCode.Usage]: 'usage error (bad flag / missing arg)',
|
||||
[ExitCode.Auth]: 'auth error (not logged in / token expired)',
|
||||
[ExitCode.VersionCompat]: 'version / compatibility error',
|
||||
}
|
||||
@ -42,7 +42,7 @@ export const CONTRACT: Contract = {
|
||||
},
|
||||
hitl: {
|
||||
description:
|
||||
'When a workflow pauses for human input, `run app` exits 2 and writes a JSON object to stdout with status "paused", form_token, workflow_run_id and resolved_default_values.',
|
||||
'When a workflow pauses for human input, `run app` exits 0 (success-with-pending) and writes a JSON object to stdout with status "paused", form_token, workflow_run_id and resolved_default_values.',
|
||||
resume:
|
||||
'difyctl resume app <app_id> <form_token> --workflow-run-id <id> [--inputs \'{"key":"value"}\']',
|
||||
},
|
||||
|
||||
@ -26,7 +26,7 @@ output formats, error envelope, HITL protocol). Treat that JSON as the
|
||||
source of truth; this file only bootstraps you into it.
|
||||
|
||||
## The one non-obvious thing: HITL pauses are not failures
|
||||
A run can pause for human input. It exits with **code 2** and emits a
|
||||
A run can pause for human input. It exits with **code 0** and emits a
|
||||
\`paused\` JSON payload — this is success-with-pending, NOT a crash.
|
||||
Resume as the payload instructs (see \`difyctl resume app --help\`).
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user