fix(cli): MCP agentChat — task-bound session creation
CreateSessionRequestBody now requires `taskIdentifier` and `triggerConfig` because Sessions are task-bound (the server reuses the config for every run scheduled by the session — initial + continuations). The MCP `agentChat` tool was still passing only `{ type, externalId }` from the pre-Sessions-as-run-manager API. Add `taskIdentifier: input.agentId` and a minimal `triggerConfig` with `basePayload: { chatId, ...clientData }` and the `chat:{chatId}` auto-tag.
Unblocks typecheck on PR #3173 (and Windows CLI v3 e2e, which builds cli-v3 in pre-test).
This commit is contained in:
@@ -115,9 +115,17 @@ export const startAgentChatTool = {
|
||||
|
||||
// Create (or upsert) the backing Session. Idempotent via externalId —
|
||||
// two MCP clients targeting the same chatId converge to the same row.
|
||||
// Sessions are now task-bound: taskIdentifier + triggerConfig are
|
||||
// required, and the server reuses them for every run scheduled by
|
||||
// this session (initial + continuations after run termination).
|
||||
const session = await apiClient.createSession({
|
||||
type: "chat.agent",
|
||||
externalId: chatId,
|
||||
taskIdentifier: input.agentId,
|
||||
triggerConfig: {
|
||||
basePayload: { chatId, ...(input.clientData ?? {}) },
|
||||
tags: [`chat:${chatId}`],
|
||||
},
|
||||
});
|
||||
|
||||
if (input.preload) {
|
||||
|
||||
Reference in New Issue
Block a user