openfox 0.1.0
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.
- package/README.md +68 -0
- package/dist/branch.api-WDHKZJS6.js +48 -0
- package/dist/branch.api-WDHKZJS6.js.map +1 -0
- package/dist/chunk-26NRL3HX.js +116 -0
- package/dist/chunk-26NRL3HX.js.map +1 -0
- package/dist/chunk-43SWNGYW.js +273 -0
- package/dist/chunk-43SWNGYW.js.map +1 -0
- package/dist/chunk-4Z2OZ6NX.js +132 -0
- package/dist/chunk-4Z2OZ6NX.js.map +1 -0
- package/dist/chunk-6MOGZMGX.js +218 -0
- package/dist/chunk-6MOGZMGX.js.map +1 -0
- package/dist/chunk-AF7XS4OI.js +55 -0
- package/dist/chunk-AF7XS4OI.js.map +1 -0
- package/dist/chunk-EI46G5WO.js +138 -0
- package/dist/chunk-EI46G5WO.js.map +1 -0
- package/dist/chunk-FF6Z2MC3.js +844 -0
- package/dist/chunk-FF6Z2MC3.js.map +1 -0
- package/dist/chunk-IKAWIOXM.js +5817 -0
- package/dist/chunk-IKAWIOXM.js.map +1 -0
- package/dist/chunk-IVHCPQO2.js +29 -0
- package/dist/chunk-IVHCPQO2.js.map +1 -0
- package/dist/chunk-MTX5Y3V3.js +46 -0
- package/dist/chunk-MTX5Y3V3.js.map +1 -0
- package/dist/chunk-N2XYX4ZA.js +83 -0
- package/dist/chunk-N2XYX4ZA.js.map +1 -0
- package/dist/chunk-QY7BMXWT.js +124 -0
- package/dist/chunk-QY7BMXWT.js.map +1 -0
- package/dist/chunk-U62ZECSQ.js +54 -0
- package/dist/chunk-U62ZECSQ.js.map +1 -0
- package/dist/chunk-YQ36AK5A.js +5570 -0
- package/dist/chunk-YQ36AK5A.js.map +1 -0
- package/dist/cli/dev.d.ts +1 -0
- package/dist/cli/dev.js +14 -0
- package/dist/cli/dev.js.map +1 -0
- package/dist/cli/index.d.ts +1 -0
- package/dist/cli/index.js +14 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/command-defaults/defaults/commit-push.command.md +13 -0
- package/dist/command-defaults/defaults/init.command.md +18 -0
- package/dist/command-defaults/defaults/test-ui.command.md +16 -0
- package/dist/config-6GJ4SVFH.js +33 -0
- package/dist/config-6GJ4SVFH.js.map +1 -0
- package/dist/init-UVZDOHMX.js +185 -0
- package/dist/init-UVZDOHMX.js.map +1 -0
- package/dist/paths-4BPXWB2W.js +17 -0
- package/dist/paths-4BPXWB2W.js.map +1 -0
- package/dist/project-creator-CWPKRIKI.js +69 -0
- package/dist/project-creator-CWPKRIKI.js.map +1 -0
- package/dist/protocol-BJsm88OW.d.ts +760 -0
- package/dist/provider-LCE6WZA6.js +343 -0
- package/dist/provider-LCE6WZA6.js.map +1 -0
- package/dist/serve-27DZK34K.js +177 -0
- package/dist/serve-27DZK34K.js.map +1 -0
- package/dist/server/index.d.ts +479 -0
- package/dist/server/index.js +20 -0
- package/dist/server/index.js.map +1 -0
- package/dist/settings-D5O3TMLD.js +17 -0
- package/dist/settings-D5O3TMLD.js.map +1 -0
- package/dist/shared/index.d.ts +19 -0
- package/dist/shared/index.js +17 -0
- package/dist/shared/index.js.map +1 -0
- package/dist/skill-defaults/defaults/playwright-cli.skill.md +38 -0
- package/dist/tools-R4YQAYUF.js +46 -0
- package/dist/tools-R4YQAYUF.js.map +1 -0
- package/dist/web/assets/html2canvas.esm-QH1iLAAe.js +22 -0
- package/dist/web/assets/index-BMNDCsbJ.js +120 -0
- package/dist/web/assets/index-BSlSWZrM.css +1 -0
- package/dist/web/assets/jetbrains-mono-cyrillic-400-normal-BEIGL1Tu.woff2 +0 -0
- package/dist/web/assets/jetbrains-mono-cyrillic-400-normal-ugxPyKxw.woff +0 -0
- package/dist/web/assets/jetbrains-mono-cyrillic-500-normal-DJqRU3vO.woff +0 -0
- package/dist/web/assets/jetbrains-mono-cyrillic-500-normal-DmUKJPL_.woff2 +0 -0
- package/dist/web/assets/jetbrains-mono-cyrillic-600-normal-8K4wrrwR.woff +0 -0
- package/dist/web/assets/jetbrains-mono-cyrillic-600-normal-EVf6-Yzo.woff2 +0 -0
- package/dist/web/assets/jetbrains-mono-greek-400-normal-B9oWc5Lo.woff +0 -0
- package/dist/web/assets/jetbrains-mono-greek-400-normal-C190GLew.woff2 +0 -0
- package/dist/web/assets/jetbrains-mono-greek-500-normal-D7SFKleX.woff +0 -0
- package/dist/web/assets/jetbrains-mono-greek-500-normal-JpySY46c.woff2 +0 -0
- package/dist/web/assets/jetbrains-mono-greek-600-normal-H7WoG9Et.woff2 +0 -0
- package/dist/web/assets/jetbrains-mono-greek-600-normal-mc2nkWzM.woff +0 -0
- package/dist/web/assets/jetbrains-mono-latin-400-normal-6-qcROiO.woff +0 -0
- package/dist/web/assets/jetbrains-mono-latin-400-normal-V6pRDFza.woff2 +0 -0
- package/dist/web/assets/jetbrains-mono-latin-500-normal-BWZEU5yA.woff2 +0 -0
- package/dist/web/assets/jetbrains-mono-latin-500-normal-CJOVTJB7.woff +0 -0
- package/dist/web/assets/jetbrains-mono-latin-600-normal-BfsvjouI.woff +0 -0
- package/dist/web/assets/jetbrains-mono-latin-600-normal-C8RAYTDA.woff2 +0 -0
- package/dist/web/assets/jetbrains-mono-latin-ext-400-normal-Bc8Ftmh3.woff2 +0 -0
- package/dist/web/assets/jetbrains-mono-latin-ext-400-normal-fXTG6kC5.woff +0 -0
- package/dist/web/assets/jetbrains-mono-latin-ext-500-normal-Cut-4mMH.woff2 +0 -0
- package/dist/web/assets/jetbrains-mono-latin-ext-500-normal-ckzbgY84.woff +0 -0
- package/dist/web/assets/jetbrains-mono-latin-ext-600-normal-BfB_LPfz.woff2 +0 -0
- package/dist/web/assets/jetbrains-mono-latin-ext-600-normal-DObL3zCW.woff +0 -0
- package/dist/web/assets/jetbrains-mono-vietnamese-400-normal-CqNFfHCs.woff +0 -0
- package/dist/web/assets/jetbrains-mono-vietnamese-500-normal-DNRqzVM1.woff +0 -0
- package/dist/web/assets/jetbrains-mono-vietnamese-600-normal-OWROknRo.woff +0 -0
- package/dist/web/assets/openfox.png +0 -0
- package/dist/web/fox.svg +25 -0
- package/dist/web/index.html +14 -0
- package/dist/web/sounds/achievement.mp3 +0 -0
- package/dist/web/sounds/intervention.mp3 +0 -0
- package/dist/web/sounds/notification.mp3 +0 -0
- package/dist/web/sounds/waiting-for-user.mp3 +0 -0
- package/package.json +101 -0
|
@@ -0,0 +1,479 @@
|
|
|
1
|
+
import { aL as ToolCall, b as Attachment, H as Diagnostic, ar as Session, aD as SessionSummary, a2 as Project, ax as SessionMode, az as SessionPhase, M as Message, D as Criterion, F as CriterionStatus, an as QueuedMessage, w as ContextState, ap as ServerMessage, aI as StatsIdentity, aO as ToolResult, af as Provider, u as Config } from '../protocol-BJsm88OW.js';
|
|
2
|
+
import { Server } from 'node:http';
|
|
3
|
+
|
|
4
|
+
interface LLMMessage {
|
|
5
|
+
role: 'system' | 'user' | 'assistant' | 'tool';
|
|
6
|
+
content: string;
|
|
7
|
+
toolCalls?: ToolCall[];
|
|
8
|
+
toolCallId?: string;
|
|
9
|
+
name?: string;
|
|
10
|
+
attachments?: Attachment[];
|
|
11
|
+
}
|
|
12
|
+
interface LLMToolDefinition {
|
|
13
|
+
type: 'function';
|
|
14
|
+
function: {
|
|
15
|
+
name: string;
|
|
16
|
+
description: string;
|
|
17
|
+
parameters: Record<string, unknown>;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
interface LLMCompletionRequest {
|
|
21
|
+
messages: LLMMessage[];
|
|
22
|
+
tools?: LLMToolDefinition[];
|
|
23
|
+
toolChoice?: 'auto' | 'none' | 'required' | {
|
|
24
|
+
type: 'function';
|
|
25
|
+
function: {
|
|
26
|
+
name: string;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
temperature?: number;
|
|
30
|
+
maxTokens?: number;
|
|
31
|
+
stream?: boolean;
|
|
32
|
+
signal?: AbortSignal;
|
|
33
|
+
disableThinking?: boolean;
|
|
34
|
+
}
|
|
35
|
+
interface LLMCompletionResponse {
|
|
36
|
+
id: string;
|
|
37
|
+
content: string;
|
|
38
|
+
toolCalls?: ToolCall[];
|
|
39
|
+
thinkingContent?: string;
|
|
40
|
+
finishReason: 'stop' | 'tool_calls' | 'length' | 'content_filter';
|
|
41
|
+
usage: {
|
|
42
|
+
promptTokens: number;
|
|
43
|
+
completionTokens: number;
|
|
44
|
+
totalTokens: number;
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
type LLMStreamEvent = {
|
|
48
|
+
type: 'text_delta';
|
|
49
|
+
content: string;
|
|
50
|
+
} | {
|
|
51
|
+
type: 'thinking_delta';
|
|
52
|
+
content: string;
|
|
53
|
+
} | {
|
|
54
|
+
type: 'tool_call_delta';
|
|
55
|
+
index: number;
|
|
56
|
+
id?: string;
|
|
57
|
+
name?: string;
|
|
58
|
+
arguments?: string;
|
|
59
|
+
} | {
|
|
60
|
+
type: 'done';
|
|
61
|
+
response: LLMCompletionResponse;
|
|
62
|
+
} | {
|
|
63
|
+
type: 'error';
|
|
64
|
+
error: string;
|
|
65
|
+
};
|
|
66
|
+
interface LLMClient {
|
|
67
|
+
complete(request: LLMCompletionRequest): Promise<LLMCompletionResponse>;
|
|
68
|
+
stream(request: LLMCompletionRequest): AsyncIterable<LLMStreamEvent>;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Model-specific configuration profiles.
|
|
73
|
+
* Different models have different optimal settings and capabilities.
|
|
74
|
+
*/
|
|
75
|
+
interface ModelProfile {
|
|
76
|
+
/** Display name for the model */
|
|
77
|
+
name: string;
|
|
78
|
+
/** Sampling parameters */
|
|
79
|
+
temperature: number;
|
|
80
|
+
topP: number;
|
|
81
|
+
topK?: number;
|
|
82
|
+
/** Whether the model outputs reasoning/thinking content */
|
|
83
|
+
supportsReasoning: boolean;
|
|
84
|
+
/** Whether reasoning should be treated as regular content (for broken configs) */
|
|
85
|
+
reasoningAsContent: boolean;
|
|
86
|
+
/** Max tokens to generate if not specified */
|
|
87
|
+
defaultMaxTokens: number;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* LLM Backend detection and capabilities.
|
|
92
|
+
* Supports vLLM, SGLang, Ollama, and llama.cpp inference engines.
|
|
93
|
+
*/
|
|
94
|
+
type Backend = 'vllm' | 'sglang' | 'ollama' | 'llamacpp' | 'unknown';
|
|
95
|
+
|
|
96
|
+
interface LLMClientWithModel extends LLMClient {
|
|
97
|
+
getModel(): string;
|
|
98
|
+
setModel(model: string): void;
|
|
99
|
+
getProfile(): ModelProfile;
|
|
100
|
+
getBackend(): Backend;
|
|
101
|
+
setBackend(backend: Backend): void;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
interface LspManagerInterface {
|
|
105
|
+
/**
|
|
106
|
+
* Notify the LSP that a file has changed and get diagnostics
|
|
107
|
+
* Returns diagnostics for the file (may be empty if no issues)
|
|
108
|
+
*/
|
|
109
|
+
notifyFileChange(path: string, content: string): Promise<Diagnostic[]>;
|
|
110
|
+
/**
|
|
111
|
+
* Get current diagnostics for a file without triggering a change
|
|
112
|
+
*/
|
|
113
|
+
getDiagnostics(path: string): Diagnostic[];
|
|
114
|
+
/**
|
|
115
|
+
* Check if LSP is available for a given file
|
|
116
|
+
*/
|
|
117
|
+
isAvailableFor(path: string): boolean;
|
|
118
|
+
/**
|
|
119
|
+
* Shutdown all LSP servers
|
|
120
|
+
*/
|
|
121
|
+
shutdown(): Promise<void>;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
type Unsubscribe = () => void;
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Manages multiple LSP servers for a session.
|
|
128
|
+
* Lazy-starts servers on first file access for each language.
|
|
129
|
+
*/
|
|
130
|
+
declare class LspManager implements LspManagerInterface {
|
|
131
|
+
private workdir;
|
|
132
|
+
private sessionId;
|
|
133
|
+
private servers;
|
|
134
|
+
private unavailableServers;
|
|
135
|
+
private serverPromises;
|
|
136
|
+
constructor(workdir: string, sessionId: string);
|
|
137
|
+
private getOrCreateServer;
|
|
138
|
+
private startServer;
|
|
139
|
+
private getServerForFile;
|
|
140
|
+
/**
|
|
141
|
+
* Notify LSP that a file has changed and get diagnostics.
|
|
142
|
+
* This is the main entry point for tools like write_file and edit_file.
|
|
143
|
+
*/
|
|
144
|
+
notifyFileChange(path: string, content: string): Promise<Diagnostic[]>;
|
|
145
|
+
/**
|
|
146
|
+
* Get current diagnostics for a file without triggering a change.
|
|
147
|
+
*/
|
|
148
|
+
getDiagnostics(path: string): Diagnostic[];
|
|
149
|
+
/**
|
|
150
|
+
* Check if LSP is available for a given file type.
|
|
151
|
+
* Returns true if we have or can start a server for this file type.
|
|
152
|
+
*/
|
|
153
|
+
isAvailableFor(path: string): boolean;
|
|
154
|
+
/**
|
|
155
|
+
* Shutdown all LSP servers.
|
|
156
|
+
*/
|
|
157
|
+
shutdown(): Promise<void>;
|
|
158
|
+
/**
|
|
159
|
+
* Get status of all servers.
|
|
160
|
+
*/
|
|
161
|
+
getStatus(): {
|
|
162
|
+
language: string;
|
|
163
|
+
state: string;
|
|
164
|
+
}[];
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
type SessionEvent = {
|
|
168
|
+
type: 'session_created';
|
|
169
|
+
session: Session;
|
|
170
|
+
} | {
|
|
171
|
+
type: 'session_updated';
|
|
172
|
+
session: Session;
|
|
173
|
+
} | {
|
|
174
|
+
type: 'session_deleted';
|
|
175
|
+
sessionId: string;
|
|
176
|
+
} | {
|
|
177
|
+
type: 'mode_changed';
|
|
178
|
+
sessionId: string;
|
|
179
|
+
from: SessionMode;
|
|
180
|
+
to: SessionMode;
|
|
181
|
+
} | {
|
|
182
|
+
type: 'phase_changed';
|
|
183
|
+
sessionId: string;
|
|
184
|
+
phase: SessionPhase;
|
|
185
|
+
} | {
|
|
186
|
+
type: 'running_changed';
|
|
187
|
+
sessionId: string;
|
|
188
|
+
isRunning: boolean;
|
|
189
|
+
} | {
|
|
190
|
+
type: 'criteria_updated';
|
|
191
|
+
sessionId: string;
|
|
192
|
+
criteria: Criterion[];
|
|
193
|
+
} | {
|
|
194
|
+
type: 'message_added';
|
|
195
|
+
sessionId: string;
|
|
196
|
+
message: Message;
|
|
197
|
+
};
|
|
198
|
+
declare class SessionManager {
|
|
199
|
+
private events;
|
|
200
|
+
private activeSessionId;
|
|
201
|
+
/**
|
|
202
|
+
* Create a new session. Emits session.initialized event.
|
|
203
|
+
*/
|
|
204
|
+
createSession(projectId: string, title?: string, providerId?: string | null, providerModel?: string | null): Session;
|
|
205
|
+
/**
|
|
206
|
+
* Get a session by ID. Returns null if not found.
|
|
207
|
+
* Session state is derived from EventStore.
|
|
208
|
+
*/
|
|
209
|
+
getSession(id: string): Session | null;
|
|
210
|
+
/**
|
|
211
|
+
* Get a session by ID. Throws if not found.
|
|
212
|
+
*/
|
|
213
|
+
requireSession(id: string): Session;
|
|
214
|
+
/**
|
|
215
|
+
* List all sessions (summary only).
|
|
216
|
+
*/
|
|
217
|
+
listSessions(): SessionSummary[];
|
|
218
|
+
/**
|
|
219
|
+
* List sessions for a project.
|
|
220
|
+
*/
|
|
221
|
+
listSessionsByProject(projectId: string): SessionSummary[];
|
|
222
|
+
/**
|
|
223
|
+
* Delete a session and all its events.
|
|
224
|
+
*/
|
|
225
|
+
deleteSession(id: string): void;
|
|
226
|
+
/**
|
|
227
|
+
* Get a project by ID.
|
|
228
|
+
*/
|
|
229
|
+
getProject(projectId: string): Project | null;
|
|
230
|
+
/**
|
|
231
|
+
* Delete all sessions for a project.
|
|
232
|
+
*/
|
|
233
|
+
deleteAllSessions(projectId: string, workdir: string): void;
|
|
234
|
+
/**
|
|
235
|
+
* Change session mode. Emits mode.changed event.
|
|
236
|
+
*/
|
|
237
|
+
setMode(sessionId: string, toMode: SessionMode): Session;
|
|
238
|
+
/**
|
|
239
|
+
* Change session phase. Emits phase.changed event.
|
|
240
|
+
*/
|
|
241
|
+
setPhase(sessionId: string, phase: SessionPhase): Session;
|
|
242
|
+
/**
|
|
243
|
+
* Set session running state. Emits running.changed event.
|
|
244
|
+
*/
|
|
245
|
+
setRunning(sessionId: string, isRunning: boolean): Session;
|
|
246
|
+
/**
|
|
247
|
+
* Set session summary. Updates DB directly (metadata, not event).
|
|
248
|
+
*/
|
|
249
|
+
setSummary(sessionId: string, summary: string): Session;
|
|
250
|
+
/**
|
|
251
|
+
* Set session provider/model. Updates DB directly.
|
|
252
|
+
*/
|
|
253
|
+
setSessionProvider(sessionId: string, providerId: string | null, providerModel: string | null): Session;
|
|
254
|
+
/**
|
|
255
|
+
* Add to the cumulative token usage.
|
|
256
|
+
*/
|
|
257
|
+
addTokensUsed(sessionId: string, tokens: number): void;
|
|
258
|
+
/**
|
|
259
|
+
* Increment tool call counter.
|
|
260
|
+
*/
|
|
261
|
+
incrementToolCalls(sessionId: string): void;
|
|
262
|
+
/**
|
|
263
|
+
* Add a message. Delegates to EventStore.
|
|
264
|
+
*/
|
|
265
|
+
addMessage(sessionId: string, message: Omit<Message, 'id' | 'timestamp'>): Message;
|
|
266
|
+
/**
|
|
267
|
+
* Add an assistant message. Delegates to EventStore.
|
|
268
|
+
*/
|
|
269
|
+
addAssistantMessage(sessionId: string, message: Omit<Message, 'id' | 'timestamp' | 'role'>): Message;
|
|
270
|
+
/**
|
|
271
|
+
* Update message stats. Delegates to EventStore (emits message.done if needed).
|
|
272
|
+
*/
|
|
273
|
+
updateMessageStats(sessionId: string, messageId: string, stats: Message['stats']): void;
|
|
274
|
+
/**
|
|
275
|
+
* Update a message. Delegates to EventStore.
|
|
276
|
+
*/
|
|
277
|
+
updateMessage(sessionId: string, messageId: string, updates: Partial<Omit<Message, 'id' | 'timestamp' | 'role'>>): void;
|
|
278
|
+
/**
|
|
279
|
+
* Get messages for the current context window.
|
|
280
|
+
*/
|
|
281
|
+
getCurrentWindowMessages(sessionId: string): Message[];
|
|
282
|
+
/**
|
|
283
|
+
* Compact context. Delegates to EventStore.
|
|
284
|
+
*/
|
|
285
|
+
compactContext(sessionId: string, summary: string, tokenCountAtClose: number): void;
|
|
286
|
+
/**
|
|
287
|
+
* Set current context size (for token tracking).
|
|
288
|
+
* Emits a context.state event with the real promptTokens from the LLM.
|
|
289
|
+
*/
|
|
290
|
+
setCurrentContextSize(sessionId: string, promptTokens: number): void;
|
|
291
|
+
/**
|
|
292
|
+
* Set criteria. Delegates to EventStore.
|
|
293
|
+
*/
|
|
294
|
+
setCriteria(sessionId: string, criteria: Criterion[]): void;
|
|
295
|
+
/**
|
|
296
|
+
* Update criterion status. Delegates to EventStore.
|
|
297
|
+
*/
|
|
298
|
+
updateCriterionStatus(sessionId: string, criterionId: string, status: CriterionStatus): void;
|
|
299
|
+
/**
|
|
300
|
+
* Reset all criteria verification attempts.
|
|
301
|
+
*/
|
|
302
|
+
resetAllCriteriaAttempts(sessionId: string): void;
|
|
303
|
+
/**
|
|
304
|
+
* Add a criterion attempt.
|
|
305
|
+
*/
|
|
306
|
+
addCriterionAttempt(sessionId: string, criterionId: string, attempt: Criterion['attempts'][number]): void;
|
|
307
|
+
/**
|
|
308
|
+
* Record that a file was modified.
|
|
309
|
+
*/
|
|
310
|
+
addModifiedFile(sessionId: string, filePath: string): void;
|
|
311
|
+
/**
|
|
312
|
+
* Add a criterion. Returns the updated criteria list.
|
|
313
|
+
*/
|
|
314
|
+
addCriterion(sessionId: string, criterion: Criterion): {
|
|
315
|
+
criteria: Criterion[];
|
|
316
|
+
actualId: string;
|
|
317
|
+
} | {
|
|
318
|
+
error: string;
|
|
319
|
+
};
|
|
320
|
+
/**
|
|
321
|
+
* Update criterion description.
|
|
322
|
+
*/
|
|
323
|
+
updateCriterionFull(sessionId: string, criterionId: string, updates: Partial<Pick<Criterion, 'description'>>): Criterion[];
|
|
324
|
+
/**
|
|
325
|
+
* Remove a criterion.
|
|
326
|
+
*/
|
|
327
|
+
removeCriterion(sessionId: string, criterionId: string): Criterion[];
|
|
328
|
+
private messageQueues;
|
|
329
|
+
queueMessage(sessionId: string, mode: 'asap' | 'completion', content: string, attachments?: Attachment[]): QueuedMessage;
|
|
330
|
+
cancelQueuedMessage(sessionId: string, queueId: string): boolean;
|
|
331
|
+
drainAsapMessages(sessionId: string): QueuedMessage[];
|
|
332
|
+
drainCompletionMessages(sessionId: string): QueuedMessage[];
|
|
333
|
+
getQueueState(sessionId: string): QueuedMessage[];
|
|
334
|
+
clearMessageQueue(sessionId: string): void;
|
|
335
|
+
private readFilesCache;
|
|
336
|
+
/**
|
|
337
|
+
* Record that a file was read.
|
|
338
|
+
*/
|
|
339
|
+
recordFileRead(sessionId: string, filePath: string, contentHash: string): void;
|
|
340
|
+
/**
|
|
341
|
+
* Get read files cache.
|
|
342
|
+
*/
|
|
343
|
+
getReadFiles(sessionId: string): Record<string, {
|
|
344
|
+
hash: string;
|
|
345
|
+
readAt: string;
|
|
346
|
+
}>;
|
|
347
|
+
/**
|
|
348
|
+
* Update file hash after write.
|
|
349
|
+
*/
|
|
350
|
+
updateFileHash(sessionId: string, filePath: string, contentHash: string): void;
|
|
351
|
+
/**
|
|
352
|
+
* Record a tool failure.
|
|
353
|
+
*/
|
|
354
|
+
recordToolFailure(sessionId: string, tool: string, reason: string): void;
|
|
355
|
+
/**
|
|
356
|
+
* Reset tool failures.
|
|
357
|
+
*/
|
|
358
|
+
resetToolFailures(sessionId: string): void;
|
|
359
|
+
/**
|
|
360
|
+
* Update execution state.
|
|
361
|
+
*/
|
|
362
|
+
updateExecutionState(sessionId: string, updates: Record<string, unknown>): void;
|
|
363
|
+
/**
|
|
364
|
+
* @deprecated Use addMessage + compactContext instead
|
|
365
|
+
*/
|
|
366
|
+
compactMessages(sessionId: string, _messageIds: string[], summary: string): Message;
|
|
367
|
+
/**
|
|
368
|
+
* @deprecated Use addTokensUsed instead
|
|
369
|
+
*/
|
|
370
|
+
incrementTokenCount(sessionId: string, tokens: number): void;
|
|
371
|
+
/**
|
|
372
|
+
* Get the current context state for a session.
|
|
373
|
+
*/
|
|
374
|
+
getContextState(sessionId: string): ContextState;
|
|
375
|
+
/**
|
|
376
|
+
* Get the LSP manager for a session.
|
|
377
|
+
*/
|
|
378
|
+
getLspManager(sessionId: string): LspManager;
|
|
379
|
+
setActiveSession(id: string | null): void;
|
|
380
|
+
getActiveSessionId(): string | null;
|
|
381
|
+
subscribe(callback: (event: SessionEvent) => void): Unsubscribe;
|
|
382
|
+
subscribeToSession(sessionId: string, callback: (event: SessionEvent) => void): Unsubscribe;
|
|
383
|
+
private emit;
|
|
384
|
+
/**
|
|
385
|
+
* Build a full Session object from DB session + EventStore state
|
|
386
|
+
*/
|
|
387
|
+
private buildSessionFromDb;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
interface ToolContext {
|
|
391
|
+
workdir: string;
|
|
392
|
+
sessionId: string;
|
|
393
|
+
sessionManager: SessionManager;
|
|
394
|
+
signal?: AbortSignal | undefined;
|
|
395
|
+
onProgress?: ((message: string) => void) | undefined;
|
|
396
|
+
onEvent?: ((event: ServerMessage) => void) | undefined;
|
|
397
|
+
lspManager?: LspManagerInterface | undefined;
|
|
398
|
+
llmClient?: LLMClientWithModel | undefined;
|
|
399
|
+
statsIdentity?: StatsIdentity | undefined;
|
|
400
|
+
}
|
|
401
|
+
interface Tool {
|
|
402
|
+
name: string;
|
|
403
|
+
definition: LLMToolDefinition;
|
|
404
|
+
execute: (args: Record<string, unknown>, context: ToolContext) => Promise<ToolResult>;
|
|
405
|
+
}
|
|
406
|
+
interface ToolRegistry {
|
|
407
|
+
tools: Tool[];
|
|
408
|
+
definitions: LLMToolDefinition[];
|
|
409
|
+
execute: (name: string, args: Record<string, unknown>, context: ToolContext) => Promise<ToolResult>;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
interface ProviderManager {
|
|
413
|
+
getProviders(): Provider[];
|
|
414
|
+
getActiveProvider(): Provider | undefined;
|
|
415
|
+
getActiveProviderId(): string | undefined;
|
|
416
|
+
getCurrentModel(): string | undefined;
|
|
417
|
+
getLLMClient(): LLMClientWithModel;
|
|
418
|
+
activateProvider(providerId: string, options?: {
|
|
419
|
+
model?: string;
|
|
420
|
+
}): Promise<{
|
|
421
|
+
success: boolean;
|
|
422
|
+
error?: string;
|
|
423
|
+
}>;
|
|
424
|
+
addProvider(provider: Omit<Provider, 'id' | 'createdAt'>): Provider;
|
|
425
|
+
removeProvider(providerId: string): boolean;
|
|
426
|
+
setProviders(providers: Provider[], defaultModelSelection?: string): void;
|
|
427
|
+
getProviderStatus(providerId: string): 'connected' | 'disconnected' | 'unknown';
|
|
428
|
+
getProviderModels(providerId: string): Promise<string[]>;
|
|
429
|
+
setDefaultModelSelection(providerId: string, model: string): Promise<{
|
|
430
|
+
success: boolean;
|
|
431
|
+
error?: string;
|
|
432
|
+
}>;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
/**
|
|
436
|
+
* Server Context
|
|
437
|
+
*
|
|
438
|
+
* Holds all server dependencies in a single object that can be passed through
|
|
439
|
+
* the application. This replaces singleton imports and enables:
|
|
440
|
+
* - Easy testing with isolated instances
|
|
441
|
+
* - Parallel test execution
|
|
442
|
+
* - Clear dependency flow
|
|
443
|
+
*/
|
|
444
|
+
|
|
445
|
+
interface ServerContext {
|
|
446
|
+
config: Config;
|
|
447
|
+
sessionManager: SessionManager;
|
|
448
|
+
llmClient: LLMClientWithModel;
|
|
449
|
+
toolRegistry: ToolRegistry;
|
|
450
|
+
providerManager?: ProviderManager;
|
|
451
|
+
}
|
|
452
|
+
interface ServerHandle {
|
|
453
|
+
httpServer: Server;
|
|
454
|
+
ctx: ServerContext;
|
|
455
|
+
/** Start listening on the given port (0 for dynamic) */
|
|
456
|
+
start: (port?: number) => Promise<{
|
|
457
|
+
port: number;
|
|
458
|
+
}>;
|
|
459
|
+
/** Gracefully close the server */
|
|
460
|
+
close: () => Promise<void>;
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
/**
|
|
464
|
+
* Create a server handle that can be started on any port.
|
|
465
|
+
* Returns a ServerHandle with start() and close() methods.
|
|
466
|
+
*
|
|
467
|
+
* Use this for:
|
|
468
|
+
* - In-process testing with isolated instances
|
|
469
|
+
* - Programmatic server control
|
|
470
|
+
*/
|
|
471
|
+
declare function createServerHandle(config: Config): Promise<ServerHandle>;
|
|
472
|
+
/**
|
|
473
|
+
* Create and start a server (convenience function for CLI).
|
|
474
|
+
* Starts listening immediately on the configured port.
|
|
475
|
+
* Sets up SIGINT/SIGTERM handlers.
|
|
476
|
+
*/
|
|
477
|
+
declare function createServer(config: Config): Promise<void>;
|
|
478
|
+
|
|
479
|
+
export { createServer, createServerHandle };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createServer,
|
|
3
|
+
createServerHandle
|
|
4
|
+
} from "../chunk-YQ36AK5A.js";
|
|
5
|
+
import "../chunk-IKAWIOXM.js";
|
|
6
|
+
import "../chunk-MTX5Y3V3.js";
|
|
7
|
+
import "../chunk-N2XYX4ZA.js";
|
|
8
|
+
import "../chunk-4Z2OZ6NX.js";
|
|
9
|
+
import "../chunk-QY7BMXWT.js";
|
|
10
|
+
import "../chunk-IVHCPQO2.js";
|
|
11
|
+
import "../chunk-6MOGZMGX.js";
|
|
12
|
+
import "../chunk-FF6Z2MC3.js";
|
|
13
|
+
import "../chunk-26NRL3HX.js";
|
|
14
|
+
import "../chunk-U62ZECSQ.js";
|
|
15
|
+
import "../chunk-AF7XS4OI.js";
|
|
16
|
+
export {
|
|
17
|
+
createServer,
|
|
18
|
+
createServerHandle
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import {
|
|
2
|
+
SETTINGS_KEYS,
|
|
3
|
+
deleteSetting,
|
|
4
|
+
getAllSettings,
|
|
5
|
+
getSetting,
|
|
6
|
+
setSetting
|
|
7
|
+
} from "./chunk-MTX5Y3V3.js";
|
|
8
|
+
import "./chunk-4Z2OZ6NX.js";
|
|
9
|
+
import "./chunk-U62ZECSQ.js";
|
|
10
|
+
export {
|
|
11
|
+
SETTINGS_KEYS,
|
|
12
|
+
deleteSetting,
|
|
13
|
+
getAllSettings,
|
|
14
|
+
getSetting,
|
|
15
|
+
setSetting
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=settings-D5O3TMLD.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { M as Message, S as SessionStats } from '../protocol-BJsm88OW.js';
|
|
2
|
+
export { A as AgentEvent, a as AskUserEvent, b as Attachment, C as CallStatsDataPoint, c as ChatDeltaPayload, d as ChatDonePayload, e as ChatErrorPayload, f as ChatFormatRetryPayload, g as ChatMessagePayload, h as ChatMessageUpdatedPayload, i as ChatPathConfirmationPayload, j as ChatProgressPayload, k as ChatSendPayload, l as ChatSummaryPayload, m as ChatThinkingPayload, n as ChatTodoPayload, o as ChatToolCallPayload, p as ChatToolOutputPayload, q as ChatToolPreparingPayload, r as ChatToolResultPayload, s as ClientMessage, t as ClientMessageType, u as Config, v as ContextCompactionEvent, w as ContextState, x as ContextStatePayload, y as ContextWindow, z as CriteriaEditPayload, B as CriteriaUpdatedPayload, D as Criterion, E as CriterionAttempt, F as CriterionStatus, G as CriterionValidation, H as Diagnostic, I as EditContextEdit, J as EditContextLine, K as EditContextRegion, L as ErrorPayload, N as ExecutionState, O as FileReadEntry, P as InjectedFile, Q as LLMCallStats, R as LlmBackend, T as LspDiagnosticsPayload, U as MessageRole, V as MessageSegment, W as MessageStats, X as ModeChangedPayload, Y as ModeSwitchPayload, Z as ModelSessionStats, _ as PathConfirmPayload, $ as PathConfirmationReason, a0 as PhaseChangedPayload, a1 as PreparingToolCall, a2 as Project, a3 as ProjectCreatePayload, a4 as ProjectCreateWithDirPayload, a5 as ProjectDeletePayload, a6 as ProjectDeletedPayload, a7 as ProjectListPayload, a8 as ProjectLoadPayload, a9 as ProjectStatePayload, aa as ProjectUpdatePayload, ab as PromptContext, ac as PromptContextMessage, ad as PromptContextTool, ae as PromptRequestOptions, af as Provider, ag as ProviderActivatePayload, ah as ProviderBackend, ai as ProviderChangedPayload, aj as QueueAsapPayload, ak as QueueCancelPayload, al as QueueCompletionPayload, am as QueueStatePayload, an as QueuedMessage, ao as RecentUserPrompt, ap as ServerMessage, aq as ServerMessageType, ar as Session, as as SessionCreatePayload, at as SessionDeleteAllPayload, au as SessionListPayload, av as SessionLoadPayload, aw as SessionMetadata, ax as SessionMode, ay as SessionNameGeneratedPayload, az as SessionPhase, aA as SessionRunningPayload, aB as SessionSetProviderPayload, aC as SessionStatePayload, aD as SessionSummary, aE as SettingsGetPayload, aF as SettingsSetPayload, aG as SettingsValuePayload, aH as StatsDataPoint, aI as StatsIdentity, aJ as TaskCompletedPayload, aK as Todo, aL as ToolCall, aM as ToolMode, aN as ToolName, aO as ToolResult, aP as ValidationResult, aQ as createClientMessage, aR as createServerMessage, aS as isClientMessage, aT as isServerMessage } from '../protocol-BJsm88OW.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Session stats computation - aggregates response-level MessageStats from
|
|
6
|
+
* multiple assistant messages into SessionStats for benchmarking and trends.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Compute aggregated session stats from an array of messages.
|
|
11
|
+
*
|
|
12
|
+
* Returns null if no messages have stats.
|
|
13
|
+
*
|
|
14
|
+
* Weighted average for speeds: totalTokens / totalTime
|
|
15
|
+
* This gives accurate average throughput across varying context sizes.
|
|
16
|
+
*/
|
|
17
|
+
declare function computeSessionStats(messages: Message[]): SessionStats | null;
|
|
18
|
+
|
|
19
|
+
export { Message, SessionStats, computeSessionStats };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import {
|
|
2
|
+
computeSessionStats
|
|
3
|
+
} from "../chunk-QY7BMXWT.js";
|
|
4
|
+
import {
|
|
5
|
+
createClientMessage,
|
|
6
|
+
createServerMessage,
|
|
7
|
+
isClientMessage,
|
|
8
|
+
isServerMessage
|
|
9
|
+
} from "../chunk-IVHCPQO2.js";
|
|
10
|
+
export {
|
|
11
|
+
computeSessionStats,
|
|
12
|
+
createClientMessage,
|
|
13
|
+
createServerMessage,
|
|
14
|
+
isClientMessage,
|
|
15
|
+
isServerMessage
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: playwright-cli
|
|
3
|
+
name: Playwright CLI
|
|
4
|
+
description: Interactive browser control via playwright-cli commands (open, snapshot, click, fill, screenshot, etc.)
|
|
5
|
+
version: 1.0.0
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# playwright-cli
|
|
9
|
+
|
|
10
|
+
You have access to `npx playwright-cli` for interactive browser automation via the terminal.
|
|
11
|
+
Use `run_command` to execute these commands.
|
|
12
|
+
|
|
13
|
+
## Core Workflow
|
|
14
|
+
|
|
15
|
+
The typical workflow is: open a page -> snapshot to get element refs -> interact using refs -> snapshot again.
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
# Open a URL
|
|
19
|
+
npx playwright-cli open https://example.com
|
|
20
|
+
# Take a snapshot to see the page and get element refs
|
|
21
|
+
npx playwright-cli snapshot
|
|
22
|
+
# Click an element by ref number from snapshot
|
|
23
|
+
npx playwright-cli click 42
|
|
24
|
+
# Fill a form field by ref
|
|
25
|
+
npx playwright-cli fill 15 "hello world"
|
|
26
|
+
# Take a screenshot
|
|
27
|
+
npx playwright-cli screenshot
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Screenshot workflow
|
|
31
|
+
|
|
32
|
+
After doing `npx playwright-cli screenshot`, always use the `read_file` tool on the path of the image returned by playwright-cli.
|
|
33
|
+
This allows you to see the image, and for the user to see it as well.
|
|
34
|
+
|
|
35
|
+
## All Commands
|
|
36
|
+
|
|
37
|
+
- `open [url]` -- open the browser (optionally to a URL)
|
|
38
|
+
- use `npx playwright-cli --help` to get all available commands
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AskUserInterrupt,
|
|
3
|
+
PathAccessDeniedError,
|
|
4
|
+
addAllowedPaths,
|
|
5
|
+
cancelPathConfirmation,
|
|
6
|
+
cancelPathConfirmationsForSession,
|
|
7
|
+
cancelQuestion,
|
|
8
|
+
cancelQuestionsForSession,
|
|
9
|
+
clearAllowedPaths,
|
|
10
|
+
clearTodos,
|
|
11
|
+
createToolRegistry,
|
|
12
|
+
getTodos,
|
|
13
|
+
getToolRegistryForAgent,
|
|
14
|
+
getToolRegistryForSubAgent,
|
|
15
|
+
provideAnswer,
|
|
16
|
+
providePathConfirmation,
|
|
17
|
+
requestPathAccess,
|
|
18
|
+
setTodoUpdateCallback
|
|
19
|
+
} from "./chunk-IKAWIOXM.js";
|
|
20
|
+
import "./chunk-MTX5Y3V3.js";
|
|
21
|
+
import "./chunk-N2XYX4ZA.js";
|
|
22
|
+
import "./chunk-4Z2OZ6NX.js";
|
|
23
|
+
import "./chunk-IVHCPQO2.js";
|
|
24
|
+
import "./chunk-26NRL3HX.js";
|
|
25
|
+
import "./chunk-U62ZECSQ.js";
|
|
26
|
+
import "./chunk-AF7XS4OI.js";
|
|
27
|
+
export {
|
|
28
|
+
AskUserInterrupt,
|
|
29
|
+
PathAccessDeniedError,
|
|
30
|
+
addAllowedPaths,
|
|
31
|
+
cancelPathConfirmation,
|
|
32
|
+
cancelPathConfirmationsForSession,
|
|
33
|
+
cancelQuestion,
|
|
34
|
+
cancelQuestionsForSession,
|
|
35
|
+
clearAllowedPaths,
|
|
36
|
+
clearTodos,
|
|
37
|
+
createToolRegistry,
|
|
38
|
+
getTodos,
|
|
39
|
+
getToolRegistryForAgent,
|
|
40
|
+
getToolRegistryForSubAgent,
|
|
41
|
+
provideAnswer,
|
|
42
|
+
providePathConfirmation,
|
|
43
|
+
requestPathAccess,
|
|
44
|
+
setTodoUpdateCallback
|
|
45
|
+
};
|
|
46
|
+
//# sourceMappingURL=tools-R4YQAYUF.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|