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

SandboxFileHookEvent.md

107 lines1.9 KB

1---
2id: SandboxFileHookEvent
3title: SandboxFileHookEvent
4---
5​
6Defined in: packages/ai/src/activities/chat/middleware/types.ts:48
7​
8The file event a sandbox hook receives: the serializable [SandboxFileEvent](SandboxFileEvent.md)
9 plus lazy, git-backed content accessors. Accessors compute on call, so a hook
10 that only reads `path`/`type` pays nothing. Never present on the serialized
11 `sandbox.file` CUSTOM chunk.
12​
13## Extends
14​
15- [`SandboxFileEvent`](SandboxFileEvent.md)
16​
17## Properties
18​
19### after
20​
21```ts
22after: () => Promise<string>;
23```
24​
25Defined in: packages/ai/src/activities/chat/middleware/types.ts:52
26​
27Current content (`''` when the event is a delete).
28​
29#### Returns
30​
31`Promise`\<`string`\>
32​
33***
34​
35### before
36​
37```ts
38before: () => Promise<string>;
39```
40​
41Defined in: packages/ai/src/activities/chat/middleware/types.ts:50
42​
43Content at the session baseline (`''` for a new file or non-git workspace).
44​
45#### Returns
46​
47`Promise`\<`string`\>
48​
49***
50​
51### diff
52​
53```ts
54diff: () => Promise<string>;
55```
56​
57Defined in: packages/ai/src/activities/chat/middleware/types.ts:54
58​
59Unified patch vs the session baseline (synthesized add-patch when non-git).
60​
61#### Returns
62​
63`Promise`\<`string`\>
64​
65***
66​
67### path
68​
69```ts
70path: string;
71```
72​
73Defined in: packages/ai/src/activities/chat/middleware/types.ts:40
74​
75Absolute path inside the sandbox (under the workspace root).
76​
77#### Inherited from
78​
79[`SandboxFileEvent`](SandboxFileEvent.md).[`path`](SandboxFileEvent.md#path)
80​
81***
82​
83### timestamp
84​
85```ts
86timestamp: number;
87```
88​
89Defined in: packages/ai/src/activities/chat/middleware/types.ts:41
90​
91#### Inherited from
92​
93[`SandboxFileEvent`](SandboxFileEvent.md).[`timestamp`](SandboxFileEvent.md#timestamp)
94​
95***
96​
97### type
98​
99```ts
100type: "create" | "change" | "delete";
101```
102​
103Defined in: packages/ai/src/activities/chat/middleware/types.ts:38
104​
105#### Inherited from
106​
107[`SandboxFileEvent`](SandboxFileEvent.md).[`type`](SandboxFileEvent.md#type)