mockpit 0.0.0-stage → 1.0.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/LICENSE +22 -0
- package/README.md +232 -2
- package/bin/demoData.js +132 -0
- package/bin/initDesign.js +846 -0
- package/bin/mockpit.js +1830 -0
- package/bin/serveUrl.d.ts +1 -0
- package/bin/serveUrl.js +7 -0
- package/dist/mcp/server.d.ts +2 -0
- package/dist/mcp/server.js +230 -0
- package/dist/server/apiViews.d.ts +329 -0
- package/dist/server/apiViews.js +135 -0
- package/dist/server/app.d.ts +53 -0
- package/dist/server/app.js +3112 -0
- package/dist/server/base64.d.ts +1 -0
- package/dist/server/base64.js +16 -0
- package/dist/server/cdn.d.ts +6 -0
- package/dist/server/cdn.js +33 -0
- package/dist/server/codeRunner.d.ts +5 -0
- package/dist/server/codeRunner.js +89 -0
- package/dist/server/codeWorker.d.ts +1 -0
- package/dist/server/codeWorker.js +196 -0
- package/dist/server/designGuide.d.ts +16 -0
- package/dist/server/designGuide.js +311 -0
- package/dist/server/events.d.ts +53 -0
- package/dist/server/events.js +14 -0
- package/dist/server/feedbackBatch.d.ts +43 -0
- package/dist/server/feedbackBatch.js +98 -0
- package/dist/server/icons.d.ts +50 -0
- package/dist/server/icons.js +225 -0
- package/dist/server/index.d.ts +1 -0
- package/dist/server/index.js +64 -0
- package/dist/server/kits.d.ts +36 -0
- package/dist/server/kits.js +279 -0
- package/dist/server/knobs.d.ts +15 -0
- package/dist/server/knobs.js +333 -0
- package/dist/server/mcpHttp.d.ts +53 -0
- package/dist/server/mcpHttp.js +143 -0
- package/dist/server/mcpSpec.d.ts +191 -0
- package/dist/server/mcpSpec.js +402 -0
- package/dist/server/parts.d.ts +31 -0
- package/dist/server/parts.js +338 -0
- package/dist/server/postMarkdown.d.ts +10 -0
- package/dist/server/postMarkdown.js +271 -0
- package/dist/server/postSurfaces.d.ts +40 -0
- package/dist/server/postSurfaces.js +407 -0
- package/dist/server/public.d.ts +5 -0
- package/dist/server/public.js +5 -0
- package/dist/server/push.d.ts +45 -0
- package/dist/server/push.js +234 -0
- package/dist/server/richRender.d.ts +15 -0
- package/dist/server/richRender.js +392 -0
- package/dist/server/run.d.ts +82 -0
- package/dist/server/run.js +290 -0
- package/dist/server/runApi.d.ts +6 -0
- package/dist/server/runApi.js +82 -0
- package/dist/server/slots.d.ts +14 -0
- package/dist/server/slots.js +71 -0
- package/dist/server/sqlStore.d.ts +119 -0
- package/dist/server/sqlStore.js +954 -0
- package/dist/server/sqliteStorage.d.ts +2 -0
- package/dist/server/sqliteStorage.js +90 -0
- package/dist/server/surfacePage.d.ts +48 -0
- package/dist/server/surfacePage.js +1099 -0
- package/dist/server/themes.d.ts +48 -0
- package/dist/server/themes.js +305 -0
- package/dist/server/types.d.ts +599 -0
- package/dist/server/types.js +299 -0
- package/dist/workers/public.d.ts +1 -0
- package/dist/workers/public.js +3 -0
- package/extensions/mockpit.js +703 -0
- package/guide/AGENT_SETUP.md +23 -0
- package/guide/topics/asks.md +87 -0
- package/guide/topics/feedback.md +127 -0
- package/guide/topics/html.md +175 -0
- package/guide/topics/http.md +76 -0
- package/guide/topics/knobs.md +72 -0
- package/guide/topics/scripts.md +129 -0
- package/guide/topics/surfaces.md +100 -0
- package/package.json +165 -4
- package/skills/launch-video/SKILL.md +159 -0
- package/skills/mockpit/SKILL.md +40 -0
- package/viewer/dist/index.html +1922 -0
|
@@ -0,0 +1,599 @@
|
|
|
1
|
+
import type { Palette } from "./themes.ts";
|
|
2
|
+
export interface Session {
|
|
3
|
+
id: string;
|
|
4
|
+
agent: string;
|
|
5
|
+
title: string | null;
|
|
6
|
+
cwd: string | null;
|
|
7
|
+
createdAt: string;
|
|
8
|
+
lastActiveAt: string;
|
|
9
|
+
agentSeq: number;
|
|
10
|
+
project: string | null;
|
|
11
|
+
}
|
|
12
|
+
export declare const SURFACE_KINDS: readonly ["html", "diff", "image", "markdown", "terminal", "mermaid", "json", "code"];
|
|
13
|
+
export type SurfaceKind = (typeof SURFACE_KINDS)[number];
|
|
14
|
+
export type SurfaceContentField = "html" | "markdown" | "mermaid" | "patch" | "text" | "data" | "code";
|
|
15
|
+
export interface SurfaceKindMetadata {
|
|
16
|
+
contentField?: SurfaceContentField;
|
|
17
|
+
sandboxed: boolean;
|
|
18
|
+
frameClass?: string;
|
|
19
|
+
}
|
|
20
|
+
export declare const SURFACE_KIND_METADATA: {
|
|
21
|
+
readonly html: {
|
|
22
|
+
readonly contentField: "html";
|
|
23
|
+
readonly sandboxed: true;
|
|
24
|
+
};
|
|
25
|
+
readonly diff: {
|
|
26
|
+
readonly contentField: "patch";
|
|
27
|
+
readonly sandboxed: true;
|
|
28
|
+
readonly frameClass: "diffframe";
|
|
29
|
+
};
|
|
30
|
+
readonly image: {
|
|
31
|
+
readonly sandboxed: false;
|
|
32
|
+
};
|
|
33
|
+
readonly markdown: {
|
|
34
|
+
readonly contentField: "markdown";
|
|
35
|
+
readonly sandboxed: true;
|
|
36
|
+
readonly frameClass: "mdframe";
|
|
37
|
+
};
|
|
38
|
+
readonly terminal: {
|
|
39
|
+
readonly contentField: "text";
|
|
40
|
+
readonly sandboxed: true;
|
|
41
|
+
readonly frameClass: "termframe";
|
|
42
|
+
};
|
|
43
|
+
readonly mermaid: {
|
|
44
|
+
readonly contentField: "mermaid";
|
|
45
|
+
readonly sandboxed: true;
|
|
46
|
+
readonly frameClass: "mermaidframe";
|
|
47
|
+
};
|
|
48
|
+
readonly json: {
|
|
49
|
+
readonly contentField: "data";
|
|
50
|
+
readonly sandboxed: false;
|
|
51
|
+
};
|
|
52
|
+
readonly code: {
|
|
53
|
+
readonly contentField: "code";
|
|
54
|
+
readonly sandboxed: true;
|
|
55
|
+
readonly frameClass: "codeframe";
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
export declare const SURFACE_KIND_LIST: string;
|
|
59
|
+
export declare const SANDBOXED_SURFACE_KINDS: ("html" | "diff" | "image" | "markdown" | "terminal" | "mermaid" | "json" | "code")[];
|
|
60
|
+
export declare const NATIVE_SURFACE_KINDS: ("html" | "diff" | "image" | "markdown" | "terminal" | "mermaid" | "json" | "code")[];
|
|
61
|
+
export declare const SURFACE_CONTENT_FIELDS: Partial<Record<SurfaceKind, SurfaceContentField>>;
|
|
62
|
+
export declare const SURFACE_FRAME_CLASSES: Partial<Record<SurfaceKind, string>>;
|
|
63
|
+
export declare function isSurfaceKind(kind: unknown): kind is SurfaceKind;
|
|
64
|
+
export declare function isSandboxedSurfaceKind(kind: unknown): kind is SurfaceKind;
|
|
65
|
+
export interface HtmlSurface {
|
|
66
|
+
kind: "html";
|
|
67
|
+
html: string;
|
|
68
|
+
kits?: string[];
|
|
69
|
+
}
|
|
70
|
+
export interface MarkdownSurface {
|
|
71
|
+
kind: "markdown";
|
|
72
|
+
markdown: string;
|
|
73
|
+
}
|
|
74
|
+
export interface MermaidSurface {
|
|
75
|
+
kind: "mermaid";
|
|
76
|
+
mermaid: string;
|
|
77
|
+
}
|
|
78
|
+
export interface DiffFile {
|
|
79
|
+
filename: string;
|
|
80
|
+
before: string;
|
|
81
|
+
after: string;
|
|
82
|
+
language?: string;
|
|
83
|
+
}
|
|
84
|
+
export interface DiffSurface {
|
|
85
|
+
kind: "diff";
|
|
86
|
+
patch?: string;
|
|
87
|
+
files?: DiffFile[];
|
|
88
|
+
layout?: "unified" | "split";
|
|
89
|
+
}
|
|
90
|
+
export interface ImageSurface {
|
|
91
|
+
kind: "image";
|
|
92
|
+
assetId: string;
|
|
93
|
+
alt?: string;
|
|
94
|
+
caption?: string;
|
|
95
|
+
}
|
|
96
|
+
export interface TerminalSurface {
|
|
97
|
+
kind: "terminal";
|
|
98
|
+
text: string;
|
|
99
|
+
cols?: number;
|
|
100
|
+
title?: string;
|
|
101
|
+
}
|
|
102
|
+
export interface JsonSurface {
|
|
103
|
+
kind: "json";
|
|
104
|
+
data: unknown;
|
|
105
|
+
}
|
|
106
|
+
export interface CodeSurface {
|
|
107
|
+
kind: "code";
|
|
108
|
+
code: string;
|
|
109
|
+
language?: string;
|
|
110
|
+
title?: string;
|
|
111
|
+
lineStart?: number;
|
|
112
|
+
}
|
|
113
|
+
export type Surface = (HtmlSurface & {
|
|
114
|
+
id?: string;
|
|
115
|
+
}) | (DiffSurface & {
|
|
116
|
+
id?: string;
|
|
117
|
+
}) | (ImageSurface & {
|
|
118
|
+
id?: string;
|
|
119
|
+
}) | (MarkdownSurface & {
|
|
120
|
+
id?: string;
|
|
121
|
+
}) | (TerminalSurface & {
|
|
122
|
+
id?: string;
|
|
123
|
+
}) | (MermaidSurface & {
|
|
124
|
+
id?: string;
|
|
125
|
+
}) | (JsonSurface & {
|
|
126
|
+
id?: string;
|
|
127
|
+
}) | (CodeSurface & {
|
|
128
|
+
id?: string;
|
|
129
|
+
});
|
|
130
|
+
export interface SliderKnob {
|
|
131
|
+
type: "slider";
|
|
132
|
+
value: number;
|
|
133
|
+
min: number;
|
|
134
|
+
max: number;
|
|
135
|
+
step?: number;
|
|
136
|
+
}
|
|
137
|
+
export interface ToggleKnob {
|
|
138
|
+
type: "toggle";
|
|
139
|
+
value: boolean;
|
|
140
|
+
}
|
|
141
|
+
export type KnobOption = string | {
|
|
142
|
+
value: string;
|
|
143
|
+
label: string;
|
|
144
|
+
};
|
|
145
|
+
export interface SelectKnob {
|
|
146
|
+
type: "select";
|
|
147
|
+
value?: string;
|
|
148
|
+
options: KnobOption[];
|
|
149
|
+
}
|
|
150
|
+
export interface ColorKnob {
|
|
151
|
+
type: "color";
|
|
152
|
+
value?: string;
|
|
153
|
+
gradient?: boolean;
|
|
154
|
+
contrast?: string;
|
|
155
|
+
}
|
|
156
|
+
export interface TextKnob {
|
|
157
|
+
type: "text";
|
|
158
|
+
value?: string;
|
|
159
|
+
placeholder?: string;
|
|
160
|
+
}
|
|
161
|
+
export interface SpringKnob {
|
|
162
|
+
type: "spring";
|
|
163
|
+
stiffness?: number;
|
|
164
|
+
damping?: number;
|
|
165
|
+
mass?: number;
|
|
166
|
+
visualDuration?: number;
|
|
167
|
+
bounce?: number;
|
|
168
|
+
}
|
|
169
|
+
export interface EasingKnob {
|
|
170
|
+
type: "easing";
|
|
171
|
+
duration: number;
|
|
172
|
+
ease: [number, number, number, number];
|
|
173
|
+
}
|
|
174
|
+
export interface ImageKnob {
|
|
175
|
+
type: "image";
|
|
176
|
+
value?: string;
|
|
177
|
+
options?: KnobOption[];
|
|
178
|
+
}
|
|
179
|
+
export type KnobAxis = [number, number, number] | [number, number, number, number];
|
|
180
|
+
export interface PadKnob {
|
|
181
|
+
type: "pad";
|
|
182
|
+
x?: KnobAxis;
|
|
183
|
+
y?: KnobAxis;
|
|
184
|
+
labels?: {
|
|
185
|
+
x?: string;
|
|
186
|
+
y?: string;
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
export type ExplicitKnob = SliderKnob | ToggleKnob | SelectKnob | ColorKnob | TextKnob | SpringKnob | EasingKnob | ImageKnob | PadKnob;
|
|
190
|
+
export type KnobConfig = ExplicitKnob | KnobAxis | number | boolean | string;
|
|
191
|
+
export type Knobs = Record<string, KnobConfig>;
|
|
192
|
+
export interface PadValue {
|
|
193
|
+
x: number;
|
|
194
|
+
y: number;
|
|
195
|
+
}
|
|
196
|
+
export type KnobValue = number | boolean | string | PadValue | SpringKnob | EasingKnob;
|
|
197
|
+
export type MockKind = "page" | "component";
|
|
198
|
+
export type PostStatus = "open" | "accepted" | "archived";
|
|
199
|
+
export interface AskOption {
|
|
200
|
+
id: string;
|
|
201
|
+
label: string;
|
|
202
|
+
variant?: string;
|
|
203
|
+
set?: Record<string, KnobValue>;
|
|
204
|
+
}
|
|
205
|
+
export type AskAnswer = string | string[];
|
|
206
|
+
export interface Ask {
|
|
207
|
+
id: string;
|
|
208
|
+
text: string;
|
|
209
|
+
scope: "mock" | "state" | "part";
|
|
210
|
+
state?: string;
|
|
211
|
+
part?: string;
|
|
212
|
+
options: AskOption[];
|
|
213
|
+
multi?: boolean;
|
|
214
|
+
answer?: AskAnswer;
|
|
215
|
+
other?: string;
|
|
216
|
+
note?: string;
|
|
217
|
+
at: string;
|
|
218
|
+
}
|
|
219
|
+
export declare const OTHER_ID = "other";
|
|
220
|
+
export interface PartCommentAnchor {
|
|
221
|
+
offset?: [number, number];
|
|
222
|
+
quote?: string;
|
|
223
|
+
selector?: string;
|
|
224
|
+
box?: number[];
|
|
225
|
+
}
|
|
226
|
+
export interface PartComment {
|
|
227
|
+
part: string | null;
|
|
228
|
+
state: string | null;
|
|
229
|
+
text: string;
|
|
230
|
+
anchor?: PartCommentAnchor;
|
|
231
|
+
}
|
|
232
|
+
export interface ReplyDecision {
|
|
233
|
+
kind: "accept" | "revise" | "drop";
|
|
234
|
+
state: string | null;
|
|
235
|
+
variant: string;
|
|
236
|
+
}
|
|
237
|
+
export interface Draft {
|
|
238
|
+
version: number;
|
|
239
|
+
answers: Record<string, AskAnswer>;
|
|
240
|
+
mix: Record<string, string>;
|
|
241
|
+
tuned: Record<string, KnobValue>;
|
|
242
|
+
comments: PartComment[];
|
|
243
|
+
others?: Record<string, string>;
|
|
244
|
+
notes?: Record<string, string>;
|
|
245
|
+
updatedAt: string;
|
|
246
|
+
}
|
|
247
|
+
export interface Reply {
|
|
248
|
+
mockId: string;
|
|
249
|
+
version: number;
|
|
250
|
+
answers: Record<string, AskAnswer>;
|
|
251
|
+
mix: Record<string, string>;
|
|
252
|
+
tuned: Record<string, KnobValue>;
|
|
253
|
+
comments: PartComment[];
|
|
254
|
+
others?: Record<string, string>;
|
|
255
|
+
notes?: Record<string, string>;
|
|
256
|
+
text?: string;
|
|
257
|
+
decision?: ReplyDecision;
|
|
258
|
+
}
|
|
259
|
+
export interface Mock {
|
|
260
|
+
id: string;
|
|
261
|
+
project: string;
|
|
262
|
+
slug: string;
|
|
263
|
+
title: string;
|
|
264
|
+
kind: MockKind;
|
|
265
|
+
states: string[];
|
|
266
|
+
asks: Ask[];
|
|
267
|
+
knobs: Knobs;
|
|
268
|
+
draft: Draft | null;
|
|
269
|
+
sessionId: string | null;
|
|
270
|
+
createdAt: string;
|
|
271
|
+
updatedAt: string;
|
|
272
|
+
}
|
|
273
|
+
export interface Slot {
|
|
274
|
+
slug: string;
|
|
275
|
+
variant: string;
|
|
276
|
+
version: number;
|
|
277
|
+
}
|
|
278
|
+
export interface PostVersion {
|
|
279
|
+
version: number;
|
|
280
|
+
title: string;
|
|
281
|
+
surfaces: Surface[];
|
|
282
|
+
at: string;
|
|
283
|
+
from?: number;
|
|
284
|
+
prompt?: string;
|
|
285
|
+
author?: string;
|
|
286
|
+
}
|
|
287
|
+
export interface Post {
|
|
288
|
+
id: string;
|
|
289
|
+
sessionId: string;
|
|
290
|
+
mock: string;
|
|
291
|
+
state: string | null;
|
|
292
|
+
variant: string;
|
|
293
|
+
status: PostStatus;
|
|
294
|
+
title: string;
|
|
295
|
+
surfaces: Surface[];
|
|
296
|
+
createdAt: string;
|
|
297
|
+
updatedAt: string;
|
|
298
|
+
version: number;
|
|
299
|
+
history: PostVersion[];
|
|
300
|
+
knobs?: Knobs;
|
|
301
|
+
slots: Slot[];
|
|
302
|
+
from?: number;
|
|
303
|
+
prompt?: string;
|
|
304
|
+
author?: string;
|
|
305
|
+
}
|
|
306
|
+
export interface ProjectSummary {
|
|
307
|
+
name: string;
|
|
308
|
+
mocks: number;
|
|
309
|
+
open: number;
|
|
310
|
+
lastActiveAt: string;
|
|
311
|
+
sessions: number;
|
|
312
|
+
}
|
|
313
|
+
export interface DesignSettings {
|
|
314
|
+
detected: {
|
|
315
|
+
tailwind: boolean;
|
|
316
|
+
shadcn: boolean;
|
|
317
|
+
cssVars: number;
|
|
318
|
+
fonts: string[];
|
|
319
|
+
} | null;
|
|
320
|
+
palette: {
|
|
321
|
+
light: Palette;
|
|
322
|
+
dark: Palette;
|
|
323
|
+
} | null;
|
|
324
|
+
kit: string;
|
|
325
|
+
cssVars: string;
|
|
326
|
+
tailwindCss: string;
|
|
327
|
+
strippedImports: string[];
|
|
328
|
+
iconSets: IconSetRef[];
|
|
329
|
+
projectKits: ProjectKit[];
|
|
330
|
+
designFiles?: DesignFiles | null;
|
|
331
|
+
updatedAt: string;
|
|
332
|
+
}
|
|
333
|
+
export interface ProjectKit {
|
|
334
|
+
id: string;
|
|
335
|
+
href: string;
|
|
336
|
+
script?: string;
|
|
337
|
+
doc: string;
|
|
338
|
+
}
|
|
339
|
+
export interface DesignFiles {
|
|
340
|
+
designMd?: {
|
|
341
|
+
name: string;
|
|
342
|
+
colors: Record<string, string>;
|
|
343
|
+
typography: Record<string, Record<string, string>>;
|
|
344
|
+
rounded: Record<string, string>;
|
|
345
|
+
spacing: Record<string, string>;
|
|
346
|
+
components: Record<string, Record<string, string>>;
|
|
347
|
+
headings: string[];
|
|
348
|
+
dos: string;
|
|
349
|
+
};
|
|
350
|
+
tokens?: {
|
|
351
|
+
files: string[];
|
|
352
|
+
count: number;
|
|
353
|
+
cssVars: boolean;
|
|
354
|
+
values: Record<string, string>;
|
|
355
|
+
};
|
|
356
|
+
shadcn?: {
|
|
357
|
+
style: string;
|
|
358
|
+
baseColor: string;
|
|
359
|
+
iconLibrary: string;
|
|
360
|
+
components: string[];
|
|
361
|
+
};
|
|
362
|
+
}
|
|
363
|
+
export interface IconSetRef {
|
|
364
|
+
prefix: string;
|
|
365
|
+
assetId: string;
|
|
366
|
+
count: number;
|
|
367
|
+
}
|
|
368
|
+
export type CommentAnchor = {
|
|
369
|
+
kind: "point";
|
|
370
|
+
surfaceIndex: number;
|
|
371
|
+
surfaceId?: string;
|
|
372
|
+
surfaceKind?: SurfaceKind;
|
|
373
|
+
postVersion: number;
|
|
374
|
+
x: number;
|
|
375
|
+
y: number;
|
|
376
|
+
} | {
|
|
377
|
+
kind: "rect";
|
|
378
|
+
surfaceIndex: number;
|
|
379
|
+
surfaceId?: string;
|
|
380
|
+
surfaceKind?: SurfaceKind;
|
|
381
|
+
postVersion: number;
|
|
382
|
+
x: number;
|
|
383
|
+
y: number;
|
|
384
|
+
w: number;
|
|
385
|
+
h: number;
|
|
386
|
+
} | {
|
|
387
|
+
kind: "lineRange";
|
|
388
|
+
surfaceIndex: number;
|
|
389
|
+
surfaceId?: string;
|
|
390
|
+
surfaceKind?: SurfaceKind;
|
|
391
|
+
postVersion: number;
|
|
392
|
+
startLine: number;
|
|
393
|
+
endLine: number;
|
|
394
|
+
file?: string;
|
|
395
|
+
} | ({
|
|
396
|
+
kind: "part";
|
|
397
|
+
part: string;
|
|
398
|
+
state: string | null;
|
|
399
|
+
} & PartCommentAnchor);
|
|
400
|
+
export type CommentKind = "comment" | "ask" | "reply";
|
|
401
|
+
export interface Anchor {
|
|
402
|
+
ref: string;
|
|
403
|
+
shape: "pin" | "rect" | "circle";
|
|
404
|
+
box: number[];
|
|
405
|
+
surfaceIndex: number;
|
|
406
|
+
postVersion: number;
|
|
407
|
+
path?: string;
|
|
408
|
+
text?: string;
|
|
409
|
+
viewport?: number;
|
|
410
|
+
}
|
|
411
|
+
export interface Comment {
|
|
412
|
+
id: string;
|
|
413
|
+
seq: number;
|
|
414
|
+
sessionId: string;
|
|
415
|
+
mockId: string | null;
|
|
416
|
+
postId: string | null;
|
|
417
|
+
author: string;
|
|
418
|
+
text: string;
|
|
419
|
+
createdAt: string;
|
|
420
|
+
anchor?: CommentAnchor;
|
|
421
|
+
kind: CommentKind;
|
|
422
|
+
anchors: Anchor[];
|
|
423
|
+
postVersion: number | null;
|
|
424
|
+
viewport: number | null;
|
|
425
|
+
payload?: Reply;
|
|
426
|
+
}
|
|
427
|
+
export type AssetKind = "image" | "file";
|
|
428
|
+
export interface Asset {
|
|
429
|
+
id: string;
|
|
430
|
+
sessionId: string;
|
|
431
|
+
kind: AssetKind;
|
|
432
|
+
contentType: string;
|
|
433
|
+
byteLength: number;
|
|
434
|
+
filename: string | null;
|
|
435
|
+
data: Uint8Array;
|
|
436
|
+
createdAt: string;
|
|
437
|
+
lastAccessedAt: string;
|
|
438
|
+
}
|
|
439
|
+
export interface CreateAssetInput {
|
|
440
|
+
sessionId: string;
|
|
441
|
+
kind: AssetKind;
|
|
442
|
+
contentType: string;
|
|
443
|
+
filename?: string;
|
|
444
|
+
data: Uint8Array;
|
|
445
|
+
}
|
|
446
|
+
export interface CreateSessionInput {
|
|
447
|
+
agent: string;
|
|
448
|
+
title?: string;
|
|
449
|
+
cwd?: string;
|
|
450
|
+
project?: string;
|
|
451
|
+
key?: string;
|
|
452
|
+
}
|
|
453
|
+
export interface CreateMockInput {
|
|
454
|
+
project: string;
|
|
455
|
+
slug: string;
|
|
456
|
+
title?: string;
|
|
457
|
+
kind?: MockKind;
|
|
458
|
+
states?: string[];
|
|
459
|
+
knobs?: Knobs;
|
|
460
|
+
sessionId?: string | null;
|
|
461
|
+
}
|
|
462
|
+
export interface UpdateMockInput {
|
|
463
|
+
title?: string;
|
|
464
|
+
kind?: MockKind;
|
|
465
|
+
states?: string[];
|
|
466
|
+
asks?: Ask[];
|
|
467
|
+
knobs?: Knobs;
|
|
468
|
+
sessionId?: string | null;
|
|
469
|
+
}
|
|
470
|
+
export interface CreatePostInput {
|
|
471
|
+
sessionId: string;
|
|
472
|
+
mock: string;
|
|
473
|
+
state: string | null;
|
|
474
|
+
variant?: string;
|
|
475
|
+
title?: string;
|
|
476
|
+
surfaces: Surface[];
|
|
477
|
+
knobs?: Knobs;
|
|
478
|
+
slots?: Slot[];
|
|
479
|
+
from?: number;
|
|
480
|
+
prompt?: string;
|
|
481
|
+
author?: string;
|
|
482
|
+
}
|
|
483
|
+
export interface UpdatePostInput {
|
|
484
|
+
title?: string;
|
|
485
|
+
surfaces?: Surface[];
|
|
486
|
+
knobs?: Knobs | null;
|
|
487
|
+
slots?: Slot[];
|
|
488
|
+
from?: number;
|
|
489
|
+
prompt?: string;
|
|
490
|
+
author?: string;
|
|
491
|
+
state?: string | null;
|
|
492
|
+
}
|
|
493
|
+
export interface CreateCommentInput {
|
|
494
|
+
sessionId: string;
|
|
495
|
+
mockId?: string | null;
|
|
496
|
+
postId?: string | null;
|
|
497
|
+
author: string;
|
|
498
|
+
text: string;
|
|
499
|
+
anchor?: CommentAnchor;
|
|
500
|
+
kind?: CommentKind;
|
|
501
|
+
anchors?: Anchor[];
|
|
502
|
+
postVersion?: number | null;
|
|
503
|
+
viewport?: number | null;
|
|
504
|
+
payload?: Reply;
|
|
505
|
+
}
|
|
506
|
+
export interface CommentQuery {
|
|
507
|
+
sessionId?: string;
|
|
508
|
+
mockId?: string;
|
|
509
|
+
postId?: string;
|
|
510
|
+
afterSeq?: number;
|
|
511
|
+
}
|
|
512
|
+
export interface CommitReplyInput {
|
|
513
|
+
mockId: string;
|
|
514
|
+
sessionId: string;
|
|
515
|
+
text: string;
|
|
516
|
+
payload: Reply;
|
|
517
|
+
asks: Ask[];
|
|
518
|
+
accept: string[];
|
|
519
|
+
archive: string[];
|
|
520
|
+
}
|
|
521
|
+
export interface PostQuery {
|
|
522
|
+
mockId?: string;
|
|
523
|
+
sessionId?: string;
|
|
524
|
+
}
|
|
525
|
+
export interface Store {
|
|
526
|
+
listSessions(): Promise<Session[]>;
|
|
527
|
+
getSession(id: string): Promise<Session | null>;
|
|
528
|
+
getSessionByKey(key: string): Promise<Session | null>;
|
|
529
|
+
createSession(input: CreateSessionInput): Promise<Session>;
|
|
530
|
+
renameSession(id: string, title: string): Promise<Session | null>;
|
|
531
|
+
removeSession(id: string): Promise<boolean>;
|
|
532
|
+
markAgentSeen(sessionId: string, seq: number): Promise<void>;
|
|
533
|
+
getSetting(key: string): Promise<string | null>;
|
|
534
|
+
setSetting(key: string, value: string): Promise<void>;
|
|
535
|
+
listProjects(): Promise<ProjectSummary[]>;
|
|
536
|
+
listMocks(project?: string): Promise<Mock[]>;
|
|
537
|
+
getMock(id: string): Promise<Mock | null>;
|
|
538
|
+
findMock(project: string, slug: string): Promise<Mock | null>;
|
|
539
|
+
createMock(input: CreateMockInput): Promise<Mock>;
|
|
540
|
+
updateMock(id: string, patch: UpdateMockInput): Promise<Mock | null>;
|
|
541
|
+
removeMock(id: string): Promise<boolean>;
|
|
542
|
+
putDraft(mockId: string, draft: Draft | null): Promise<Mock | null>;
|
|
543
|
+
listPosts(query?: PostQuery): Promise<Post[]>;
|
|
544
|
+
countPostsBySession(): Promise<Map<string, number>>;
|
|
545
|
+
getPost(id: string): Promise<Post | null>;
|
|
546
|
+
findPost(mockId: string, state: string | null, variant: string): Promise<Post | null>;
|
|
547
|
+
createPost(input: CreatePostInput): Promise<Post | null>;
|
|
548
|
+
updatePost(id: string, patch: UpdatePostInput): Promise<Post | null>;
|
|
549
|
+
removePost(id: string): Promise<boolean>;
|
|
550
|
+
setPostStatus(id: string, status: PostStatus): Promise<Post | null>;
|
|
551
|
+
listComments(query: CommentQuery): Promise<Comment[]>;
|
|
552
|
+
createComment(input: CreateCommentInput): Promise<Comment | null>;
|
|
553
|
+
removeComment(id: string): Promise<Comment | null>;
|
|
554
|
+
commitReply(input: CommitReplyInput): Promise<Comment | null>;
|
|
555
|
+
putAsset(input: CreateAssetInput): Promise<Asset | null>;
|
|
556
|
+
getAsset(id: string): Promise<Asset | null>;
|
|
557
|
+
touchAsset(id: string): Promise<void>;
|
|
558
|
+
listAssets(sessionId: string): Promise<Asset[]>;
|
|
559
|
+
removeAsset(id: string): Promise<boolean>;
|
|
560
|
+
isAssetReferenced(id: string): Promise<boolean>;
|
|
561
|
+
}
|
|
562
|
+
export type SqlStorageValue = ArrayBuffer | string | number | null;
|
|
563
|
+
export interface SqlStorageCursor {
|
|
564
|
+
toArray(): Record<string, SqlStorageValue>[];
|
|
565
|
+
one(): Record<string, SqlStorageValue>;
|
|
566
|
+
}
|
|
567
|
+
export interface SqlStorage {
|
|
568
|
+
exec(query: string, ...bindings: SqlStorageValue[]): SqlStorageCursor;
|
|
569
|
+
transactionSync?<T>(fn: () => T): T;
|
|
570
|
+
}
|
|
571
|
+
export declare const HISTORY_LIMIT = 20;
|
|
572
|
+
export declare function reservedAgent(name: string): string;
|
|
573
|
+
export declare function stripNul<T extends string | null | undefined>(s: T): T;
|
|
574
|
+
export declare const MAX_ASSET_BYTES: number;
|
|
575
|
+
export declare const MAX_WORKSPACE_ASSET_BYTES: number;
|
|
576
|
+
export declare const newId: () => string;
|
|
577
|
+
export declare function hashAssetId(data: Uint8Array): Promise<string>;
|
|
578
|
+
export declare function normalizeSurfaceIds(surfaces: Surface[]): Surface[];
|
|
579
|
+
export declare const DEFAULT_PROJECT = "workspace";
|
|
580
|
+
export declare const DEFAULT_VARIANT = "default";
|
|
581
|
+
export declare function slugify(input: string): string;
|
|
582
|
+
export declare function projectFromCwd(cwd: string | null | undefined): string | null;
|
|
583
|
+
export declare const htmlSurface: (html: string, kits?: unknown) => HtmlSurface;
|
|
584
|
+
export declare const askAnswered: (a: Pick<Ask, "answer" | "other" | "note">) => boolean;
|
|
585
|
+
export declare const openAsks: (mock: Pick<Mock, "asks">) => Ask[];
|
|
586
|
+
export declare function builtinAskCount(mock: Pick<Mock, "asks" | "states">, posts: Pick<Post, "mock" | "state" | "variant" | "status">[], mockId: string): number;
|
|
587
|
+
export declare const openCount: (mock: Pick<Mock, "id" | "asks" | "states">, posts: Pick<Post, "mock" | "state" | "variant" | "status">[]) => number;
|
|
588
|
+
export declare const BUILTIN_ASK_ID = "variant";
|
|
589
|
+
export declare function builtinAsk(mock: Pick<Mock, "states">, posts: Pick<Post, "state" | "variant">[], id: string): Ask | undefined;
|
|
590
|
+
export declare function summarizeProjects(mocks: Mock[], sessions: Session[], posts?: Post[]): ProjectSummary[];
|
|
591
|
+
export declare function surfacesByteLength(surfaces: Surface[]): number;
|
|
592
|
+
export declare function collectAssetIds(surfaces: Surface[], out: Set<string>): void;
|
|
593
|
+
export interface EvictionCandidate {
|
|
594
|
+
id: string;
|
|
595
|
+
byteLength: number;
|
|
596
|
+
lastAccessedAt: string;
|
|
597
|
+
referenced: boolean;
|
|
598
|
+
}
|
|
599
|
+
export declare function selectEvictions(candidates: EvictionCandidate[], incomingBytes: number, budget: number): string[];
|