refactor(cli): resource-command refactors — --kb resolver, MCP session_ask, session stop (BREAKING)
Unify the --kb resolver (accepts name or UUID) across kb/doc/chunk/session/ search/chat/link; `agent create` attaches knowledge bases via --attach-kb (no longer --kb). Rename the MCP tool agent_invoke → session_ask and drop dead MCP error codes. Add `session stop` (StopSession), completing the start / continue-stream / stop triad. Across these commands, bring the agent contract up to par: --dry-run previews on mutations (incl. kb pin/unpin, session stop), agent-help blobs on the read/health surface, accurate destructive-confirmation verbs, and search has_more truncation signalling so an agent can tell its results were capped.
This commit is contained in:
@@ -291,3 +291,23 @@ func TestWaitResult_ExitCode(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// On aggregate failure, doc wait emits the partition envelope to stdout; the
|
||||
// returned error must be Silent so PrintError does NOT write a second,
|
||||
// contradictory {ok:false} envelope to stderr. Regression for the dual-envelope
|
||||
// contract violation (stdout ok:true + stderr ok:false for one invocation).
|
||||
func TestDocWait_FailureError_IsSilent(t *testing.T) {
|
||||
// Mirror RunBatch's contract: the failure carries CodeOperationFailed for
|
||||
// the exit code, but Silent=true suppresses the stderr envelope.
|
||||
err := cmdutil.NewError(cmdutil.CodeOperationFailed, "1 doc(s) failed").WithSilent()
|
||||
typed := cmdutil.AsError(err)
|
||||
if typed == nil {
|
||||
t.Fatal("expected typed *Error")
|
||||
}
|
||||
if !typed.Silent {
|
||||
t.Error("doc wait failure error must be Silent to avoid a contradictory stderr envelope")
|
||||
}
|
||||
if cmdutil.ExitCode(err) != 1 {
|
||||
t.Errorf("exit code = %d, want 1", cmdutil.ExitCode(err))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user