blink 0.1.12 → 0.1.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,207 @@
1
+ import { AsyncIterableStream, FinishReason, InferUIMessageChunk, ModelMessage, StreamTextResult } from "ai";
2
+
3
+ //#region src/api/chat.d.ts
4
+ interface Chat {
5
+ readonly id: string;
6
+ }
7
+ type Message = ModelMessage & {
8
+ readonly metadata?: Record<string, string>;
9
+ };
10
+ interface CreateChatOptions {
11
+ readonly messages: ReadonlyArray<Message>;
12
+ readonly labels?: ReadonlyArray<string>;
13
+ readonly title?: string;
14
+ }
15
+ interface MessageOptions {
16
+ readonly behavior?: "interrupt" | "queue";
17
+ }
18
+ declare const chat: Readonly<{
19
+ find(labels: ReadonlyArray<string>): Promise<Chat | undefined>;
20
+ create(options: CreateChatOptions): Promise<Chat>;
21
+ message(chat: string, message: Message, options?: MessageOptions): Promise<void>;
22
+ }>;
23
+ //#endregion
24
+ //#region src/api/agent.d.ts
25
+ interface StreamTextOptions {
26
+ readonly messages: Message[];
27
+ readonly abortSignal?: AbortSignal;
28
+ readonly stream: WritableStream<InferUIMessageChunk<any>>;
29
+ }
30
+ interface StreamTextResult$1 {
31
+ toUIMessageStream(): AsyncIterableStream<InferUIMessageChunk<any>>;
32
+ readonly response: StreamTextResult<any, any>["response"];
33
+ readonly finishReason: Promise<FinishReason>;
34
+ }
35
+ interface AgentOptions {
36
+ readonly name: string;
37
+ readonly description?: string;
38
+ streamText(options: StreamTextOptions): Promise<StreamTextResult$1>;
39
+ webhook?(request: Request): Promise<Response | void>;
40
+ }
41
+ declare function agent(options: AgentOptions): {
42
+ name: string;
43
+ description: string | undefined;
44
+ streamText: (options: StreamTextOptions) => Promise<StreamTextResult$1>;
45
+ webhook: ((request: Request) => Promise<Response | void>) | undefined;
46
+ };
47
+ //#endregion
48
+ //#region src/api/compute.d.ts
49
+ interface WaitProcess {
50
+ pid: number;
51
+ command: string;
52
+ args: string[];
53
+ cwd: string;
54
+ env: Record<string, string>;
55
+ ansiOutput: string;
56
+ plainOutput: {
57
+ totalLines: number;
58
+ lines: string[];
59
+ };
60
+ title?: string;
61
+ durationMs?: number;
62
+ exitCode?: number;
63
+ exitSignal?: number;
64
+ }
65
+ interface ReadFileResult {
66
+ content: string;
67
+ total_lines: number;
68
+ lines_read: number;
69
+ start_line: number;
70
+ mime_type: string;
71
+ }
72
+ interface ReadDirectoryEntry {
73
+ type: "file" | "directory" | "symlink";
74
+ name: string;
75
+ }
76
+ type Options<T = {}> = T & {
77
+ instance?: string;
78
+ abortSignal?: AbortSignal;
79
+ };
80
+ declare const compute: Readonly<{
81
+ execute(command: string, options?: Options<{
82
+ args?: string[];
83
+ env?: Record<string, string>;
84
+ cwd?: string;
85
+ }>): Promise<{
86
+ pid: number;
87
+ }>;
88
+ writeProcessInput(pid: number, input: string, options?: Options): Promise<void>;
89
+ waitProcess(pid: number, options?: Options<{
90
+ onOutput?: (output: string) => void;
91
+ idleOutputTimeoutMs?: number;
92
+ timeoutMs?: number;
93
+ }>): Promise<WaitProcess>;
94
+ readProcessOutput(pid: number, options?: Options<{
95
+ mode?: "plain" | "ansi";
96
+ }>): Promise<string>;
97
+ killProcess(pid: number, signal?: string, options?: Options): Promise<void>;
98
+ readFile(path: string, options?: Options<{
99
+ lineStart?: number;
100
+ lineEnd?: number;
101
+ }>): Promise<ReadFileResult>;
102
+ writeFile(path: string, content: string, options?: Options): Promise<void>;
103
+ readDirectory(path: string, options?: Options): Promise<ReadDirectoryEntry[]>;
104
+ }>;
105
+ //#endregion
106
+ //#region src/api/unsafe_internal.d.ts
107
+ interface InternalRequest {
108
+ url: string;
109
+ headers: Record<string, string>;
110
+ method: string;
111
+ }
112
+ interface RepositoryFilesystem {
113
+ readFile(path: string): Promise<string>;
114
+ readdir(path: string): Promise<Array<{
115
+ type: "file" | "directory";
116
+ name: string;
117
+ mode: string;
118
+ size?: number;
119
+ }>>;
120
+ }
121
+ declare const __unsafe_internal: {
122
+ createRepositoryFilesystem?(request: InternalRequest): Promise<RepositoryFilesystem>;
123
+ findChat?(labels: ReadonlyArray<string>): Promise<Chat | undefined>;
124
+ createChat?(options: CreateChatOptions): Promise<Chat>;
125
+ messageChat?(id: string, message: Message, options?: MessageOptions): Promise<void>;
126
+ computeExecute?(args: {
127
+ instanceID?: string;
128
+ command: string;
129
+ args?: string[];
130
+ env?: Record<string, string>;
131
+ cwd?: string;
132
+ abortSignal?: AbortSignal;
133
+ }): Promise<{
134
+ pid: number;
135
+ }>;
136
+ computeSetenv?(args: {
137
+ instanceID?: string;
138
+ abortSignal?: AbortSignal;
139
+ env: Record<string, string>;
140
+ }): Promise<void>;
141
+ computeReadFile?(args: {
142
+ instanceID?: string;
143
+ abortSignal?: AbortSignal;
144
+ path: string;
145
+ lineStart?: number;
146
+ lineEnd?: number;
147
+ }): Promise<ReadFileResult>;
148
+ computeWriteFile?(args: {
149
+ instanceID?: string;
150
+ abortSignal?: AbortSignal;
151
+ path: string;
152
+ content: string;
153
+ }): Promise<void>;
154
+ computeReadDirectory?(args: {
155
+ instanceID?: string;
156
+ abortSignal?: AbortSignal;
157
+ path: string;
158
+ }): Promise<Array<ReadDirectoryEntry>>;
159
+ writeProcessInput?(args: {
160
+ instanceID?: string;
161
+ abortSignal?: AbortSignal;
162
+ pid: number;
163
+ input: string;
164
+ }): Promise<void>;
165
+ waitProcess?(args: {
166
+ instanceID?: string;
167
+ pid: number;
168
+ onOutput?: (output: string) => void;
169
+ idleOutputTimeoutMs?: number;
170
+ timeoutMs?: number;
171
+ abortSignal?: AbortSignal;
172
+ }): Promise<WaitProcess>;
173
+ listProcesses?(args: {
174
+ instanceID?: string;
175
+ }): Promise<{
176
+ pid: number;
177
+ command: string;
178
+ args: string[];
179
+ env: Record<string, string>;
180
+ cwd: string;
181
+ abortSignal?: AbortSignal;
182
+ }>;
183
+ readProcessOutput?(args: {
184
+ instanceID?: string;
185
+ abortSignal?: AbortSignal;
186
+ mode?: "plain" | "ansi";
187
+ pid: number;
188
+ lineStart?: number;
189
+ lineEnd?: number;
190
+ }): Promise<string>;
191
+ killProcess?(args: {
192
+ abortSignal?: AbortSignal;
193
+ instanceID?: string;
194
+ pid: number;
195
+ signal?: string;
196
+ }): Promise<void>;
197
+ };
198
+ //#endregion
199
+ //#region src/api/index.d.ts
200
+ interface Runtime {
201
+ readonly name: string;
202
+ readonly description?: string;
203
+ streamText: AgentOptions["streamText"];
204
+ webhook?(req: Request): Promise<Response | void>;
205
+ }
206
+ //#endregion
207
+ export { AgentOptions, Chat, CreateChatOptions, Message, MessageOptions, Options, ReadDirectoryEntry, ReadFileResult, Runtime, StreamTextOptions, StreamTextResult$1 as StreamTextResult, WaitProcess, __unsafe_internal, agent, chat, compute };
Binary file