Skip to content
Source
Sign inSign up
TanStack/ai
Open History to see the last commit

isRunStatus.md

31 lines989 Bytes

1---
2id: isRunStatus
3title: isRunStatus
4---
5​
6```ts
7function isRunStatus(value): value is RunStatus;
8```
9​
10Defined in: [packages/ai/src/activities/chat/middleware/run-store.ts:69](https://github.com/TanStack/ai/blob/main/packages/ai/src/activities/chat/middleware/run-store.ts#L69)
11​
12Whether `value` is a [RunStatus](../type-aliases/RunStatus.md) — the guard a backend validates a row
13with at DESERIALIZATION.
14​
15`RunStatus` is a compile-time claim about a storage column. A row arrives as
16JSON out of D1, a Durable Object, or Postgres, and nothing in the type system
17checked what that column actually held, so a `RunStore` implementation should
18run its row's `status` through this before handing the record on. The readers
19downstream act DESTRUCTIVELY on the answer — `@tanstack/ai-sandbox`'s journal
20sweep DELETES the journal of a run it believes terminal — so a row that lies
21about its status is not a display bug.
22​
23## Parameters
24​
25### value
26​
27`unknown`
28​
29## Returns
30​
31`value is RunStatus`