@mindstudio-ai/agent 0.1.176 → 0.1.177
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/CHANGELOG.md +7 -0
- package/dist/analytics/index.d.ts +384 -0
- package/dist/auth/index.d.ts +113 -0
- package/dist/browser/index.d.ts +332 -0
- package/dist/cli.js +27 -27
- package/dist/client.d.ts +767 -0
- package/dist/config.d.ts +13 -0
- package/dist/context.d.ts +125 -0
- package/dist/datasources/index.d.ts +52 -0
- package/dist/datasources/source.d.ts +1074 -0
- package/dist/db/aggregate.d.ts +101 -0
- package/dist/db/index.d.ts +280 -0
- package/dist/db/mutation.d.ts +65 -0
- package/dist/db/predicate.d.ts +85 -0
- package/dist/db/query.d.ts +233 -0
- package/dist/db/raw.d.ts +36 -0
- package/dist/db/readBatching.d.ts +36 -0
- package/dist/db/scanHints.d.ts +8 -0
- package/dist/db/sql.d.ts +136 -0
- package/dist/db/table.d.ts +146 -0
- package/dist/db/time.d.ts +17 -0
- package/dist/db/types.d.ts +237 -0
- package/dist/db-ws.d.ts +35 -0
- package/dist/email/index.d.ts +396 -0
- package/dist/errors.d.ts +34 -0
- package/dist/events/index.d.ts +127 -0
- package/dist/files/index.d.ts +62 -0
- package/dist/files/store.d.ts +244 -0
- package/dist/generated/metadata.d.ts +8 -0
- package/dist/generated/snippets.d.ts +8 -0
- package/dist/generated/steps.d.ts +2745 -0
- package/dist/generated/types.d.ts +4234 -0
- package/dist/http.d.ts +22 -0
- package/dist/index.d.ts +59 -13329
- package/dist/index.js +15 -15
- package/dist/index.js.map +7 -1
- package/dist/jewel/index.d.ts +325 -0
- package/dist/mapper/index.d.ts +229 -0
- package/dist/rate-limit.d.ts +25 -0
- package/dist/reader/index.d.ts +170 -0
- package/dist/respond.d.ts +68 -0
- package/dist/task/index.d.ts +18 -0
- package/dist/task/local.d.ts +48 -0
- package/dist/task/schema.d.ts +120 -0
- package/dist/task/types.d.ts +203 -0
- package/dist/types.d.ts +591 -0
- package/dist/voice/index.d.ts +87 -0
- package/package.json +6 -12
- package/dist/postinstall.js +0 -12115
|
@@ -0,0 +1,332 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `browser` namespace — a real Chrome your app drives.
|
|
3
|
+
*
|
|
4
|
+
* `browser.open()` starts a session: one browser with one page, which stays
|
|
5
|
+
* open while you use it. It closes itself after `idleTimeoutSeconds` with no
|
|
6
|
+
* action (5 minutes by default), and at most an hour after it opens. Every
|
|
7
|
+
* action answers with the page as it is afterward: its URL, its title, and a
|
|
8
|
+
* snapshot, a compact outline of the page in which everything you can act on
|
|
9
|
+
* carries a ref (`[ref=e12]`) to name it by next.
|
|
10
|
+
*
|
|
11
|
+
* ```ts
|
|
12
|
+
* import { browser } from '@mindstudio-ai/agent';
|
|
13
|
+
* import { Shots } from './files/shots';
|
|
14
|
+
*
|
|
15
|
+
* export async function captureDashboard() {
|
|
16
|
+
* const session = await browser.open({ url: 'https://app.example.com/login' });
|
|
17
|
+
* await session.type({ label: 'Email' }, process.env.DEMO_EMAIL!);
|
|
18
|
+
* await session.type({ label: 'Password' }, process.env.DEMO_PASSWORD!, { submit: true });
|
|
19
|
+
* await session.waitFor('Dashboard');
|
|
20
|
+
* const shot = await session.screenshot();
|
|
21
|
+
* const file = await Shots.put(shot.data, { contentType: shot.contentType });
|
|
22
|
+
* await session.close();
|
|
23
|
+
* return { url: file.url };
|
|
24
|
+
* }
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* To let a model drive instead, hand a task agent the session's tools:
|
|
28
|
+
* `mindstudio.runTask({ ..., tools: session.tools() })`.
|
|
29
|
+
*
|
|
30
|
+
* Elements are named by a ref from the latest snapshot, or by how a person
|
|
31
|
+
* would describe them: `{ text: 'Sign in' }`, `{ role: 'button', text: 'Save' }`,
|
|
32
|
+
* `{ label: 'Email' }`, or a CSS `{ selector }`. A ref is only good until the
|
|
33
|
+
* next snapshot; every action takes one, so use the refs from the latest.
|
|
34
|
+
*
|
|
35
|
+
* Clicks, taps and typing are the browser's own input events, as a person's
|
|
36
|
+
* would be. A password field's value never appears in a snapshot.
|
|
37
|
+
*/
|
|
38
|
+
import type { Store, StoredFile } from '../files/store.js';
|
|
39
|
+
import type { TaskToolConfig } from '../task/types.js';
|
|
40
|
+
/** @internal Transport provided by the client (POST /_internal/v2/browser/<op>). */
|
|
41
|
+
export type BrowserTransport = (op: string, body: unknown) => Promise<any>;
|
|
42
|
+
/** @internal The client's `executeStep`, for the screenshot tool's description (`analyzeImage`). */
|
|
43
|
+
export type BrowserStepRunner = (stepType: string, step: Record<string, unknown>) => Promise<any>;
|
|
44
|
+
/**
|
|
45
|
+
* Which element an action is about: a ref from the latest snapshot (`'e12'`),
|
|
46
|
+
* or a description of it.
|
|
47
|
+
*/
|
|
48
|
+
export type BrowserTarget = string | {
|
|
49
|
+
/** A ref from the latest snapshot. */
|
|
50
|
+
ref?: string;
|
|
51
|
+
/** The element's accessible name or visible text. */
|
|
52
|
+
text?: string;
|
|
53
|
+
/** With `text`, only elements of this role (`button`, `link`, `textbox`…). */
|
|
54
|
+
role?: string;
|
|
55
|
+
/** A form control, by its label. */
|
|
56
|
+
label?: string;
|
|
57
|
+
/** A CSS selector, for when nothing else names it. */
|
|
58
|
+
selector?: string;
|
|
59
|
+
};
|
|
60
|
+
export interface BrowserViewport {
|
|
61
|
+
width: number;
|
|
62
|
+
height: number;
|
|
63
|
+
deviceScaleFactor: number;
|
|
64
|
+
mobile: boolean;
|
|
65
|
+
}
|
|
66
|
+
export interface BrowserOpenOptions {
|
|
67
|
+
/** A page to open straight away, as `goto(url)` would. */
|
|
68
|
+
url?: string;
|
|
69
|
+
/**
|
|
70
|
+
* `'desktop'` (1280×800, the default), `'mobile'` (390×844 at 2×, with a
|
|
71
|
+
* phone's user agent, touch, and taps for clicks), or an exact size in
|
|
72
|
+
* pixels.
|
|
73
|
+
*/
|
|
74
|
+
viewport?: 'desktop' | 'mobile' | {
|
|
75
|
+
width: number;
|
|
76
|
+
height: number;
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* How long the session waits for its next action before closing itself.
|
|
80
|
+
* 5 minutes by default; at least 30 seconds, at most 30 minutes.
|
|
81
|
+
*/
|
|
82
|
+
idleTimeoutSeconds?: number;
|
|
83
|
+
}
|
|
84
|
+
/** The page after an action. */
|
|
85
|
+
export interface BrowserPage {
|
|
86
|
+
url: string;
|
|
87
|
+
title: string;
|
|
88
|
+
/**
|
|
89
|
+
* The page as a compact outline: one line per element worth knowing about
|
|
90
|
+
* (`button "Sign in" [ref=e4]`), indented by nesting, with a ref on
|
|
91
|
+
* everything that can be acted on.
|
|
92
|
+
*/
|
|
93
|
+
snapshot: string;
|
|
94
|
+
/** Alerts and confirms the page opened since the last action. Each was accepted. */
|
|
95
|
+
dialogs?: {
|
|
96
|
+
type: string;
|
|
97
|
+
message: string;
|
|
98
|
+
}[];
|
|
99
|
+
}
|
|
100
|
+
/** Where an element is, in CSS pixels: of the viewport for an action, of the shot for a screenshot's `boxes`. */
|
|
101
|
+
export interface BrowserBox {
|
|
102
|
+
x: number;
|
|
103
|
+
y: number;
|
|
104
|
+
width: number;
|
|
105
|
+
height: number;
|
|
106
|
+
}
|
|
107
|
+
/** The page after an action on an element, and which element it was. */
|
|
108
|
+
export interface BrowserElementResult extends BrowserPage {
|
|
109
|
+
/** The element as the snapshot names it (`button "Sign in" [ref=e4]`). */
|
|
110
|
+
matched: string;
|
|
111
|
+
/**
|
|
112
|
+
* Where it was in the viewport when the action landed. A page can move after
|
|
113
|
+
* (a banner arriving pushes everything down), so to highlight an element on
|
|
114
|
+
* a screenshot, ask the screenshot where it is (`boxes`).
|
|
115
|
+
*/
|
|
116
|
+
box: BrowserBox;
|
|
117
|
+
}
|
|
118
|
+
export interface BrowserScreenshot {
|
|
119
|
+
data: Buffer;
|
|
120
|
+
contentType: 'image/png';
|
|
121
|
+
/** In CSS pixels. The image is `deviceScaleFactor` times this. */
|
|
122
|
+
width: number;
|
|
123
|
+
height: number;
|
|
124
|
+
deviceScaleFactor: number;
|
|
125
|
+
/**
|
|
126
|
+
* With `boxes`, where each element named is in the shot, in its CSS pixels,
|
|
127
|
+
* in the order named: `null` for one the page didn't have. Absent on older
|
|
128
|
+
* platform versions.
|
|
129
|
+
*/
|
|
130
|
+
boxes?: (BrowserBox | null)[];
|
|
131
|
+
}
|
|
132
|
+
/** A screenshot saved straight into a store: the stored file, and the page's size it was taken at. */
|
|
133
|
+
export type BrowserStoredScreenshot = StoredFile & {
|
|
134
|
+
/** In CSS pixels. The image is `deviceScaleFactor` times this. */
|
|
135
|
+
width: number;
|
|
136
|
+
height: number;
|
|
137
|
+
deviceScaleFactor: number;
|
|
138
|
+
/**
|
|
139
|
+
* With `boxes`, where each element named is in the shot, in its CSS pixels,
|
|
140
|
+
* in the order named: `null` for one the page didn't have. Absent on older
|
|
141
|
+
* platform versions.
|
|
142
|
+
*/
|
|
143
|
+
boxes?: (BrowserBox | null)[];
|
|
144
|
+
};
|
|
145
|
+
export interface BrowserToolsOptions {
|
|
146
|
+
/**
|
|
147
|
+
* Values the model may type without ever seeing them, by name:
|
|
148
|
+
* `{ password: process.env.APP_PASSWORD! }` lets a `type` step name
|
|
149
|
+
* "password" for a field it chooses, in place of the text.
|
|
150
|
+
*/
|
|
151
|
+
secrets?: Record<string, string>;
|
|
152
|
+
/**
|
|
153
|
+
* A store for the screenshots the model takes. With one, the model also
|
|
154
|
+
* gets `browser_screenshot`, which saves a screenshot here and answers with
|
|
155
|
+
* a written description of it (an `analyzeImage` call), so it can see what
|
|
156
|
+
* the page's outline doesn't say. Every shot is kept, and its key is in the
|
|
157
|
+
* answer.
|
|
158
|
+
*/
|
|
159
|
+
screenshots?: Store;
|
|
160
|
+
}
|
|
161
|
+
interface SessionInfo {
|
|
162
|
+
id: string;
|
|
163
|
+
viewport: BrowserViewport;
|
|
164
|
+
expiresAt: number;
|
|
165
|
+
}
|
|
166
|
+
/** One open browser session. Get one from `browser.open()` or `browser.session(id)`. */
|
|
167
|
+
export declare class BrowserSession {
|
|
168
|
+
private readonly call;
|
|
169
|
+
private readonly steps;
|
|
170
|
+
/** Pass to `browser.session(id)` from a later call to pick this session up again. */
|
|
171
|
+
readonly id: string;
|
|
172
|
+
readonly viewport: BrowserViewport;
|
|
173
|
+
/** When the session closes, however busy it is. Milliseconds since epoch. */
|
|
174
|
+
readonly expiresAt: number;
|
|
175
|
+
/** @internal Use `browser.open()`. */
|
|
176
|
+
constructor(info: SessionInfo, call: BrowserTransport, steps: BrowserStepRunner);
|
|
177
|
+
/** Every action so far, chained: see `run`. */
|
|
178
|
+
private queue;
|
|
179
|
+
/**
|
|
180
|
+
* One action at a time, in the order they were called. A session has one
|
|
181
|
+
* page, so actions started together (a `Promise.all`, or a task agent's
|
|
182
|
+
* tools from one turn, which run concurrently) would otherwise reach it in
|
|
183
|
+
* whatever order their requests landed: a click on Submit before the field
|
|
184
|
+
* it submits was typed.
|
|
185
|
+
*/
|
|
186
|
+
private run;
|
|
187
|
+
/**
|
|
188
|
+
* One action's request, asked again under the same id when the answer
|
|
189
|
+
* didn't get back (a dropped connection, an api pod rolling). The platform
|
|
190
|
+
* runs an id once, so asking again waits on the action already under way
|
|
191
|
+
* rather than clicking twice.
|
|
192
|
+
*/
|
|
193
|
+
private send;
|
|
194
|
+
/** Open a URL and wait for it to load. */
|
|
195
|
+
goto(url: string): Promise<BrowserPage>;
|
|
196
|
+
/** The page as it is now. */
|
|
197
|
+
snapshot(): Promise<BrowserPage>;
|
|
198
|
+
/** Click an element (tap, on a mobile viewport), and wait for what it started to settle. */
|
|
199
|
+
click(target: BrowserTarget): Promise<BrowserElementResult>;
|
|
200
|
+
/**
|
|
201
|
+
* Click into a field and type. `clear` replaces what's there; `submit`
|
|
202
|
+
* presses Enter after.
|
|
203
|
+
*/
|
|
204
|
+
type(target: BrowserTarget, text: string, options?: {
|
|
205
|
+
clear?: boolean;
|
|
206
|
+
submit?: boolean;
|
|
207
|
+
}): Promise<BrowserElementResult>;
|
|
208
|
+
/** Choose an option of a `<select>`, by its text, value or label. */
|
|
209
|
+
select(target: BrowserTarget, option: string): Promise<BrowserElementResult>;
|
|
210
|
+
/**
|
|
211
|
+
* Press a key on whatever has focus: `Enter`, `Tab`, `Escape`, `Backspace`,
|
|
212
|
+
* `Delete`, the arrows, `PageUp`, `PageDown`, `Home`, `End`, `' '`, or any
|
|
213
|
+
* single character.
|
|
214
|
+
*/
|
|
215
|
+
press(key: string): Promise<BrowserPage>;
|
|
216
|
+
/** Scroll an element into view, or the page by `by` pixels (most of a screen, by default). */
|
|
217
|
+
scroll(options?: {
|
|
218
|
+
to?: BrowserTarget;
|
|
219
|
+
by?: number;
|
|
220
|
+
}): Promise<BrowserPage>;
|
|
221
|
+
/** Wait for text to appear on the page. Throws once `timeoutSeconds` (15 by default) pass without it. */
|
|
222
|
+
waitFor(text: string, options?: {
|
|
223
|
+
timeoutSeconds?: number;
|
|
224
|
+
}): Promise<BrowserPage>;
|
|
225
|
+
/**
|
|
226
|
+
* A PNG of the viewport, or of the whole page with `fullPage`. With a
|
|
227
|
+
* `store` it goes straight into that store, under `key` or a new one, and
|
|
228
|
+
* you get the stored file back; without, you get the bytes, which a full
|
|
229
|
+
* page past a few megabytes is too large for. The cursor is left out unless
|
|
230
|
+
* `cursor` keeps it in, for a shot that shows where the last action landed.
|
|
231
|
+
* `boxes` names elements, as an action does, and the shot says where each
|
|
232
|
+
* one is in it, measured as it's taken, for drawing highlights on it.
|
|
233
|
+
*
|
|
234
|
+
* ```ts
|
|
235
|
+
* const shot = await session.screenshot({ store: Shots, boxes: ['e12'] });
|
|
236
|
+
* await Steps.push({ screenshot: shot.key, highlight: shot.boxes?.[0] });
|
|
237
|
+
* await session.click('e12');
|
|
238
|
+
* ```
|
|
239
|
+
*/
|
|
240
|
+
screenshot(options?: {
|
|
241
|
+
fullPage?: boolean;
|
|
242
|
+
cursor?: boolean;
|
|
243
|
+
boxes?: BrowserTarget[];
|
|
244
|
+
}): Promise<BrowserScreenshot>;
|
|
245
|
+
screenshot(options: {
|
|
246
|
+
fullPage?: boolean;
|
|
247
|
+
cursor?: boolean;
|
|
248
|
+
boxes?: BrowserTarget[];
|
|
249
|
+
store: Store;
|
|
250
|
+
key?: string;
|
|
251
|
+
}): Promise<BrowserStoredScreenshot>;
|
|
252
|
+
/**
|
|
253
|
+
* Run a function in the page and get back what it returns (as JSON). The
|
|
254
|
+
* function is sent as source, so it can't use variables from your code:
|
|
255
|
+
* pass what it needs as `arg`.
|
|
256
|
+
*
|
|
257
|
+
* ```ts
|
|
258
|
+
* const prices = await session.evaluate(
|
|
259
|
+
* (selector) => [...document.querySelectorAll(selector)].map((el) => el.textContent),
|
|
260
|
+
* '.price',
|
|
261
|
+
* );
|
|
262
|
+
* ```
|
|
263
|
+
*/
|
|
264
|
+
evaluate<R, A = undefined>(fn: (arg: A) => R, arg?: A): Promise<Awaited<R>>;
|
|
265
|
+
/**
|
|
266
|
+
* A tool for `mindstudio.runTask()` that drives this session, so a model can
|
|
267
|
+
* browse. It takes a list of steps (open a URL, read the page, click, type,
|
|
268
|
+
* choose an option, press a key, scroll, wait for text), runs them in order,
|
|
269
|
+
* stops at the first that fails, and answers with each step's outcome and
|
|
270
|
+
* the page after the last one. A model plans "fill the form and submit it"
|
|
271
|
+
* as one call rather than one turn a field. Only the latest page stays in
|
|
272
|
+
* the task's transcript (`supersedes`), so a long walk doesn't fill it.
|
|
273
|
+
*
|
|
274
|
+
* With `screenshots`, a second tool, `browser_screenshot`, lets the model
|
|
275
|
+
* see the page: each shot goes into that store and the model reads a
|
|
276
|
+
* description of it. Those answers all stay in the transcript, since each
|
|
277
|
+
* names a kept file.
|
|
278
|
+
*/
|
|
279
|
+
tools(options?: BrowserToolsOptions): TaskToolConfig[];
|
|
280
|
+
/**
|
|
281
|
+
* The screenshot tool: the shot into the store, then a vision model's
|
|
282
|
+
* description of it. A description that fails still answers with the kept
|
|
283
|
+
* shot's key, so the model can name it.
|
|
284
|
+
*/
|
|
285
|
+
private describeScreen;
|
|
286
|
+
/** The tool's steps, in order, stopping at the first that fails. */
|
|
287
|
+
private runSteps;
|
|
288
|
+
private runStep;
|
|
289
|
+
/**
|
|
290
|
+
* A grant to watch this session live, for your frontend: return it from a
|
|
291
|
+
* method and hand its `token` to `browser.view()` in
|
|
292
|
+
* `@mindstudio-ai/interface`. Whoever holds it sees the page until it
|
|
293
|
+
* expires, so check your own access first, as for `events.grant()`.
|
|
294
|
+
* `ttlSeconds` is clamped to 60 through 3600 (900 by default); the frontend
|
|
295
|
+
* asks again through your method when it runs out.
|
|
296
|
+
*
|
|
297
|
+
* ```ts
|
|
298
|
+
* export async function watchRun({ runId }: { runId: string }) {
|
|
299
|
+
* auth.requireRole('admin');
|
|
300
|
+
* const run = await Runs.get(runId);
|
|
301
|
+
* const session = await browser.session(run.browserSessionId);
|
|
302
|
+
* return session.grantView();
|
|
303
|
+
* }
|
|
304
|
+
* ```
|
|
305
|
+
*/
|
|
306
|
+
grantView(options?: {
|
|
307
|
+
ttlSeconds?: number;
|
|
308
|
+
}): Promise<{
|
|
309
|
+
token: string;
|
|
310
|
+
expiresAt: number;
|
|
311
|
+
ttlSeconds: number;
|
|
312
|
+
}>;
|
|
313
|
+
/** Close the session and its browser. */
|
|
314
|
+
close(): Promise<void>;
|
|
315
|
+
}
|
|
316
|
+
/** The `browser` namespace object. */
|
|
317
|
+
export interface Browser {
|
|
318
|
+
/**
|
|
319
|
+
* Start a browser session, and wait for its browser to be ready: seconds
|
|
320
|
+
* when one starts on a warm host, longer when it's the first in a while.
|
|
321
|
+
*/
|
|
322
|
+
open(options?: BrowserOpenOptions): Promise<BrowserSession>;
|
|
323
|
+
/**
|
|
324
|
+
* Pick up a session an earlier call opened, by its `id`: a run that spans
|
|
325
|
+
* several calls, or a cron that resumes where the last one stopped. Throws
|
|
326
|
+
* `browser_session_not_found` once it has closed.
|
|
327
|
+
*/
|
|
328
|
+
session(id: string): Promise<BrowserSession>;
|
|
329
|
+
}
|
|
330
|
+
/** @internal Factory used by the client; import the `browser` singleton instead. */
|
|
331
|
+
export declare function createBrowser(call: BrowserTransport, steps: BrowserStepRunner): Browser;
|
|
332
|
+
export {};
|
package/dist/cli.js
CHANGED
|
@@ -15,7 +15,7 @@ var __export = (target, all) => {
|
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
// src/usageLog.ts
|
|
18
|
-
import { appendFileSync } from "fs";
|
|
18
|
+
import { appendFileSync } from "node:fs";
|
|
19
19
|
function logUsage(entry) {
|
|
20
20
|
const file = process.env.MINDSTUDIO_USAGE_LOG;
|
|
21
21
|
if (!file || typeof entry.billingCost !== "number") {
|
|
@@ -1360,7 +1360,7 @@ var init_context = __esm({
|
|
|
1360
1360
|
als = noopAls;
|
|
1361
1361
|
try {
|
|
1362
1362
|
if (typeof process !== "undefined" && process.versions?.node) {
|
|
1363
|
-
const mod = await import("async_hooks");
|
|
1363
|
+
const mod = await import("node:async_hooks");
|
|
1364
1364
|
als = new mod.AsyncLocalStorage();
|
|
1365
1365
|
}
|
|
1366
1366
|
} catch {
|
|
@@ -1746,9 +1746,9 @@ __export(config_exports, {
|
|
|
1746
1746
|
loadConfig: () => loadConfig,
|
|
1747
1747
|
saveConfig: () => saveConfig
|
|
1748
1748
|
});
|
|
1749
|
-
import { readFileSync, writeFileSync, mkdirSync } from "fs";
|
|
1750
|
-
import { join } from "path";
|
|
1751
|
-
import { homedir } from "os";
|
|
1749
|
+
import { readFileSync, writeFileSync, mkdirSync } from "node:fs";
|
|
1750
|
+
import { join } from "node:path";
|
|
1751
|
+
import { homedir } from "node:os";
|
|
1752
1752
|
function configPaths() {
|
|
1753
1753
|
const dir = join(homedir(), ".mindstudio");
|
|
1754
1754
|
return { dir, file: join(dir, "config.json") };
|
|
@@ -4492,12 +4492,12 @@ var init_readBatching = __esm({
|
|
|
4492
4492
|
});
|
|
4493
4493
|
|
|
4494
4494
|
// src/files/store.ts
|
|
4495
|
-
import { createHash, randomUUID } from "crypto";
|
|
4496
|
-
import { createReadStream, createWriteStream } from "fs";
|
|
4497
|
-
import { readFile, stat, writeFile } from "fs/promises";
|
|
4498
|
-
import { basename } from "path";
|
|
4499
|
-
import { Readable } from "stream";
|
|
4500
|
-
import { pipeline } from "stream/promises";
|
|
4495
|
+
import { createHash, randomUUID } from "node:crypto";
|
|
4496
|
+
import { createReadStream, createWriteStream } from "node:fs";
|
|
4497
|
+
import { readFile, stat, writeFile } from "node:fs/promises";
|
|
4498
|
+
import { basename } from "node:path";
|
|
4499
|
+
import { Readable } from "node:stream";
|
|
4500
|
+
import { pipeline } from "node:stream/promises";
|
|
4501
4501
|
function fileUrl(access, store, key) {
|
|
4502
4502
|
const path = key.split("/").map(encodeURIComponent).join("/");
|
|
4503
4503
|
return `/_/files/${access}/${store}/${path}`;
|
|
@@ -5058,7 +5058,7 @@ var init_files = __esm({
|
|
|
5058
5058
|
});
|
|
5059
5059
|
|
|
5060
5060
|
// src/datasources/source.ts
|
|
5061
|
-
import { createHash as createHash2 } from "crypto";
|
|
5061
|
+
import { createHash as createHash2 } from "node:crypto";
|
|
5062
5062
|
var DICTIONARY_PAGE_ENTRIES, DICTIONARY_PAGE_BYTES, REMOVE_WHERE_MAX_PAGES, DataSource;
|
|
5063
5063
|
var init_source = __esm({
|
|
5064
5064
|
"src/datasources/source.ts"() {
|
|
@@ -5770,7 +5770,7 @@ var init_events = __esm({
|
|
|
5770
5770
|
});
|
|
5771
5771
|
|
|
5772
5772
|
// src/browser/index.ts
|
|
5773
|
-
import { randomUUID as randomUUID2 } from "crypto";
|
|
5773
|
+
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
5774
5774
|
function createBrowser(call, steps) {
|
|
5775
5775
|
return {
|
|
5776
5776
|
async open(options = {}) {
|
|
@@ -6495,7 +6495,7 @@ var init_schema = __esm({
|
|
|
6495
6495
|
});
|
|
6496
6496
|
|
|
6497
6497
|
// src/task/local.ts
|
|
6498
|
-
import { randomUUID as randomUUID3 } from "crypto";
|
|
6498
|
+
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
6499
6499
|
function isPlainObject(value) {
|
|
6500
6500
|
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
6501
6501
|
return false;
|
|
@@ -10031,9 +10031,9 @@ var mcp_exports = {};
|
|
|
10031
10031
|
__export(mcp_exports, {
|
|
10032
10032
|
startMcpServer: () => startMcpServer
|
|
10033
10033
|
});
|
|
10034
|
-
import { createInterface } from "readline";
|
|
10035
|
-
import { readFileSync as readFileSync2 } from "fs";
|
|
10036
|
-
import { basename as basename2, extname } from "path";
|
|
10034
|
+
import { createInterface } from "node:readline";
|
|
10035
|
+
import { readFileSync as readFileSync2 } from "node:fs";
|
|
10036
|
+
import { basename as basename2, extname } from "node:path";
|
|
10037
10037
|
function send(message) {
|
|
10038
10038
|
process.stdout.write(JSON.stringify(message) + "\n");
|
|
10039
10039
|
}
|
|
@@ -10086,7 +10086,7 @@ async function startMcpServer(options) {
|
|
|
10086
10086
|
capabilities: { tools: {} },
|
|
10087
10087
|
serverInfo: {
|
|
10088
10088
|
name: "mindstudio-agent",
|
|
10089
|
-
version: "0.1.
|
|
10089
|
+
version: "0.1.177"
|
|
10090
10090
|
},
|
|
10091
10091
|
instructions: 'Welcome to MindStudio \u2014 a platform with 200+ AI models, 850+ third-party integrations, and pre-built agents.\n\nGetting started:\n1. Call `ask` with any question about the SDK \u2014 it knows every action, model, and connector and returns working code with real model IDs and config options. Examples: ask("generate an image with FLUX"), ask("what models support vision?"), ask("how do I send a Slack message?").\n2. Call `changeName` to set your display name \u2014 use your name or whatever your user calls you. This is how you\'ll appear in MindStudio request logs.\n3. If you have a profile picture, pass its public image URL to `changeProfilePicture`.\n4. For manual browsing, call `listActions` to discover all available actions.\n\nThen use the tools to generate text, images, video, audio, search the web, work with data sources, run agents, and more.\n\nImportant:\n- AI-powered actions (text generation, image generation, video, audio, etc.) cost money. Before running these, call `estimateActionCost` and confirm with the user before proceeding \u2014 unless they\'ve explicitly told you to go ahead.\n- Not all agents from `listAgents` are configured for API use. Do not try to run an agent just because it appears in the list \u2014 it will likely fail. Only run agents the user specifically asks you to run.'
|
|
10092
10092
|
});
|
|
@@ -10538,10 +10538,10 @@ var init_mcp = __esm({
|
|
|
10538
10538
|
|
|
10539
10539
|
// src/cli.ts
|
|
10540
10540
|
init_usageLog();
|
|
10541
|
-
import { parseArgs } from "util";
|
|
10542
|
-
import { execSync } from "child_process";
|
|
10543
|
-
import { readFileSync as readFileSync3 } from "fs";
|
|
10544
|
-
import { basename as basename3, extname as extname2 } from "path";
|
|
10541
|
+
import { parseArgs } from "node:util";
|
|
10542
|
+
import { execSync } from "node:child_process";
|
|
10543
|
+
import { readFileSync as readFileSync3 } from "node:fs";
|
|
10544
|
+
import { basename as basename3, extname as extname2 } from "node:path";
|
|
10545
10545
|
var HELP = `Usage: mindstudio <command> [options]
|
|
10546
10546
|
|
|
10547
10547
|
Ask:
|
|
@@ -11126,7 +11126,7 @@ function isNewerVersion(current, latest) {
|
|
|
11126
11126
|
return false;
|
|
11127
11127
|
}
|
|
11128
11128
|
async function checkForUpdate() {
|
|
11129
|
-
const currentVersion = "0.1.
|
|
11129
|
+
const currentVersion = "0.1.177";
|
|
11130
11130
|
if (!currentVersion || process.env.MINDSTUDIO_NO_UPDATE_CHECK) {
|
|
11131
11131
|
return null;
|
|
11132
11132
|
}
|
|
@@ -11161,7 +11161,7 @@ async function checkForUpdate() {
|
|
|
11161
11161
|
}
|
|
11162
11162
|
}
|
|
11163
11163
|
function printUpdateNotice(latestVersion) {
|
|
11164
|
-
const currentVersion = "0.1.
|
|
11164
|
+
const currentVersion = "0.1.177";
|
|
11165
11165
|
process.stderr.write(
|
|
11166
11166
|
`
|
|
11167
11167
|
${ansi2.cyanBright("Update available")} ${ansi2.gray(currentVersion + " \u2192")} ${ansi2.cyanBold(latestVersion)}
|
|
@@ -11174,7 +11174,7 @@ function isStandaloneBinary() {
|
|
|
11174
11174
|
return !argv1.includes("node_modules");
|
|
11175
11175
|
}
|
|
11176
11176
|
async function cmdUpdate() {
|
|
11177
|
-
const currentVersion = "0.1.
|
|
11177
|
+
const currentVersion = "0.1.177";
|
|
11178
11178
|
process.stderr.write(
|
|
11179
11179
|
` ${ansi2.gray("Current version:")} ${currentVersion}
|
|
11180
11180
|
`
|
|
@@ -11315,7 +11315,7 @@ async function cmdLogin(options) {
|
|
|
11315
11315
|
process.stderr.write("\n");
|
|
11316
11316
|
printLogo();
|
|
11317
11317
|
process.stderr.write("\n");
|
|
11318
|
-
const ver = "0.1.
|
|
11318
|
+
const ver = "0.1.177";
|
|
11319
11319
|
process.stderr.write(
|
|
11320
11320
|
` ${ansi2.bold("MindStudio Agent")} ${ver ? " " + ansi2.gray("v" + ver) : ""}
|
|
11321
11321
|
`
|
|
@@ -11643,7 +11643,7 @@ async function main() {
|
|
|
11643
11643
|
const updatePromise = command !== "mcp" && command !== "login" && command !== "update" ? checkForUpdate() : Promise.resolve(null);
|
|
11644
11644
|
try {
|
|
11645
11645
|
if (command === "version" || command === "-v") {
|
|
11646
|
-
process.stdout.write("0.1.
|
|
11646
|
+
process.stdout.write("0.1.177\n");
|
|
11647
11647
|
return;
|
|
11648
11648
|
}
|
|
11649
11649
|
if (command === "login") {
|