Skip to content

An open-source, faster Devin alternative

TypeScript

sdk: question.closed is stopped only; a held turn's reason and questionId on the turn record

Igor Zalutskib61dc30d7941
diff --git a/sdks/typescript/src/agents/shapes.ts b/sdks/typescript/src/agents/shapes.ts
index 4644d4a5..ceea8523 100644
--- a/sdks/typescript/src/agents/shapes.ts
+++ b/sdks/typescript/src/agents/shapes.ts
@@ -232,6 +232,8 @@ export const turn: Shape<Turn> = object({
mode: oneOf("queue", "steer", "interrupt"),
status: stringAs<TurnStatus>(),
outcome: optional(stringAs<TurnOutcome>()),
+ reason: optional(string),
+ questionId: optional(string),
payload: optional(jsonValue),
deliveries: optional(array(turnOutcomeDelivery)),
createdAt: string,
diff --git a/sdks/typescript/src/agents/types.ts b/sdks/typescript/src/agents/types.ts
index 7493edb7..378b5898 100644
--- a/sdks/typescript/src/agents/types.ts
+++ b/sdks/typescript/src/agents/types.ts
@@ -80,6 +80,13 @@ export interface Turn {
status: TurnStatus;
/** `question` on a completed turn that ended by asking. */
outcome?: TurnOutcome;
+ /**
+ * Why a cancelled turn ended. `held`: it was queued behind a turn that
+ * asked a question, and its input reaches the agent with the answer, as
+ * `steering`; `questionId` names that question.
+ */
+ reason?: string;
+ questionId?: string;
/** The structured input sent with the turn. */
payload?: DataValue;
/** Present when an event subscription selected the turn's outcome. */
@@ -369,7 +376,7 @@ export type SessionEvent =
})
| (EventBase & { type: "question.asked"; data: { questionId: string; text: string; options: QuestionOption[] } })
| (EventBase & { type: "question.answered"; data: { questionId: string; answer: QuestionAnswer } })
- | (EventBase & { type: "question.closed"; data: { questionId: string; reason: "stopped" | "replaced" | (string & {}) } })
+ | (EventBase & { type: "question.closed"; data: { questionId: string; reason: "stopped" | (string & {}) } })
| (EventBase & { type: "turn.failed"; data: Failure })
| (EventBase & {
type: "turn.cancelled";