@mindstudio-ai/agent 0.1.173 → 0.1.175
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 +26 -0
- package/dist/cli.js +46 -14
- package/dist/index.d.ts +196 -28
- package/dist/index.js +33 -8
- package/dist/index.js.map +1 -1
- package/dist/postinstall.js +46 -14
- package/llms.txt +4 -4
- package/package.json +1 -1
package/dist/postinstall.js
CHANGED
|
@@ -1368,6 +1368,26 @@ var init_context = __esm({
|
|
|
1368
1368
|
}
|
|
1369
1369
|
});
|
|
1370
1370
|
|
|
1371
|
+
// src/db/scanHints.ts
|
|
1372
|
+
function warnTableScans(scans) {
|
|
1373
|
+
if (!Array.isArray(scans)) {
|
|
1374
|
+
return;
|
|
1375
|
+
}
|
|
1376
|
+
for (const scan of scans) {
|
|
1377
|
+
if (typeof scan?.table !== "string" || typeof scan?.ms !== "number" || !Number.isFinite(scan.ms)) {
|
|
1378
|
+
continue;
|
|
1379
|
+
}
|
|
1380
|
+
console.warn(
|
|
1381
|
+
`[mindstudio] A query read every row of '${scan.table}' (${Math.round(scan.ms)} ms). An index on the columns it filters or sorts by (defineTable's indexes) would make it a lookup.`
|
|
1382
|
+
);
|
|
1383
|
+
}
|
|
1384
|
+
}
|
|
1385
|
+
var init_scanHints = __esm({
|
|
1386
|
+
"src/db/scanHints.ts"() {
|
|
1387
|
+
"use strict";
|
|
1388
|
+
}
|
|
1389
|
+
});
|
|
1390
|
+
|
|
1371
1391
|
// src/db-ws.ts
|
|
1372
1392
|
function isReadOnlySql(sql) {
|
|
1373
1393
|
const head = sql.trimStart().slice(0, 8).toUpperCase();
|
|
@@ -1435,6 +1455,7 @@ function deliver(self, msg) {
|
|
|
1435
1455
|
)
|
|
1436
1456
|
);
|
|
1437
1457
|
} else {
|
|
1458
|
+
warnTableScans(msg.scans);
|
|
1438
1459
|
p.resolve(msg.results);
|
|
1439
1460
|
}
|
|
1440
1461
|
}
|
|
@@ -1629,6 +1650,7 @@ var DB_WS_SUBPROTOCOL, WS_ACK_TIMEOUT_MS, WS_IDLE_TIMEOUT_MS, WS_OPEN_TIMEOUT_MS
|
|
|
1629
1650
|
var init_db_ws = __esm({
|
|
1630
1651
|
"src/db-ws.ts"() {
|
|
1631
1652
|
"use strict";
|
|
1653
|
+
init_scanHints();
|
|
1632
1654
|
init_errors();
|
|
1633
1655
|
DB_WS_SUBPROTOCOL = "ms-db-v2";
|
|
1634
1656
|
WS_ACK_TIMEOUT_MS = 2e4;
|
|
@@ -5613,6 +5635,12 @@ function createAnalytics(call) {
|
|
|
5613
5635
|
const res = await call("query-batch", { queries: specs });
|
|
5614
5636
|
return res.results;
|
|
5615
5637
|
},
|
|
5638
|
+
funnel(options) {
|
|
5639
|
+
return call("funnel", options);
|
|
5640
|
+
},
|
|
5641
|
+
paths(options) {
|
|
5642
|
+
return call("paths", options ?? {});
|
|
5643
|
+
},
|
|
5616
5644
|
live() {
|
|
5617
5645
|
return call("live", {});
|
|
5618
5646
|
},
|
|
@@ -7598,6 +7626,7 @@ var init_client = __esm({
|
|
|
7598
7626
|
init_sql();
|
|
7599
7627
|
init_time();
|
|
7600
7628
|
init_readBatching();
|
|
7629
|
+
init_scanHints();
|
|
7601
7630
|
init_files();
|
|
7602
7631
|
init_datasources();
|
|
7603
7632
|
init_voice();
|
|
@@ -8690,10 +8719,11 @@ var init_client = __esm({
|
|
|
8690
8719
|
}
|
|
8691
8720
|
/**
|
|
8692
8721
|
* The `analytics` namespace — read the app's own traffic + event analytics
|
|
8693
|
-
* (auto-tracked pageviews, `analytics.track()` events). One
|
|
8694
|
-
* `query()` (metrics × dimensions × filters × time) plus
|
|
8695
|
-
* `
|
|
8696
|
-
* for the lifetime-rollup vs
|
|
8722
|
+
* (auto-tracked pageviews and engagement, `analytics.track()` events). One
|
|
8723
|
+
* general `query()` (metrics × dimensions × filters × time) plus
|
|
8724
|
+
* `funnel()`, `paths()`, `live()`, `sources()`, `map()`, `aiSources()`,
|
|
8725
|
+
* `crawlers.*`. See {@link Analytics} for the lifetime-rollup vs
|
|
8726
|
+
* 90-day-events split.
|
|
8697
8727
|
*
|
|
8698
8728
|
* @example
|
|
8699
8729
|
* ```ts
|
|
@@ -9077,6 +9107,7 @@ var init_client = __esm({
|
|
|
9077
9107
|
throw new MindStudioError(`[db] ${message}`, code, res.status);
|
|
9078
9108
|
}
|
|
9079
9109
|
const data = await res.json();
|
|
9110
|
+
warnTableScans(data.scans);
|
|
9080
9111
|
return data.results;
|
|
9081
9112
|
}
|
|
9082
9113
|
/**
|
|
@@ -9341,10 +9372,11 @@ var init_client = __esm({
|
|
|
9341
9372
|
* page changes (e.g. a short URL's target). Omit `paths` (or pass an empty
|
|
9342
9373
|
* array) to purge every snapshot for the app.
|
|
9343
9374
|
*
|
|
9344
|
-
* `paths` are this app's OWN route paths (`/u/abc`),
|
|
9345
|
-
*
|
|
9346
|
-
*
|
|
9347
|
-
* path
|
|
9375
|
+
* `paths` are this app's OWN route paths (`/u/abc`), which purge the page
|
|
9376
|
+
* whatever host it is served on, or full URLs (`https://site-a.com/u/abc`),
|
|
9377
|
+
* which purge it on that host only. If another app mounts this one under a
|
|
9378
|
+
* path prefix, the copies cached at that prefix are purged too — no need to
|
|
9379
|
+
* know or pass the mount path.
|
|
9348
9380
|
*
|
|
9349
9381
|
* Raw hook-token call (mirrors `reportIssue`) — the appId comes from the
|
|
9350
9382
|
* token. Backend / managed-context only.
|
|
@@ -10035,7 +10067,7 @@ async function startMcpServer(options) {
|
|
|
10035
10067
|
capabilities: { tools: {} },
|
|
10036
10068
|
serverInfo: {
|
|
10037
10069
|
name: "mindstudio-agent",
|
|
10038
|
-
version: "0.1.
|
|
10070
|
+
version: "0.1.175"
|
|
10039
10071
|
},
|
|
10040
10072
|
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.'
|
|
10041
10073
|
});
|
|
@@ -10977,7 +11009,7 @@ function isNewerVersion(current, latest) {
|
|
|
10977
11009
|
return false;
|
|
10978
11010
|
}
|
|
10979
11011
|
async function checkForUpdate() {
|
|
10980
|
-
const currentVersion = "0.1.
|
|
11012
|
+
const currentVersion = "0.1.175";
|
|
10981
11013
|
if (!currentVersion || process.env.MINDSTUDIO_NO_UPDATE_CHECK) {
|
|
10982
11014
|
return null;
|
|
10983
11015
|
}
|
|
@@ -11012,7 +11044,7 @@ async function checkForUpdate() {
|
|
|
11012
11044
|
}
|
|
11013
11045
|
}
|
|
11014
11046
|
function printUpdateNotice(latestVersion) {
|
|
11015
|
-
const currentVersion = "0.1.
|
|
11047
|
+
const currentVersion = "0.1.175";
|
|
11016
11048
|
process.stderr.write(
|
|
11017
11049
|
`
|
|
11018
11050
|
${ansi2.cyanBright("Update available")} ${ansi2.gray(currentVersion + " \u2192")} ${ansi2.cyanBold(latestVersion)}
|
|
@@ -11025,7 +11057,7 @@ function isStandaloneBinary() {
|
|
|
11025
11057
|
return !argv1.includes("node_modules");
|
|
11026
11058
|
}
|
|
11027
11059
|
async function cmdUpdate() {
|
|
11028
|
-
const currentVersion = "0.1.
|
|
11060
|
+
const currentVersion = "0.1.175";
|
|
11029
11061
|
process.stderr.write(
|
|
11030
11062
|
` ${ansi2.gray("Current version:")} ${currentVersion}
|
|
11031
11063
|
`
|
|
@@ -11146,7 +11178,7 @@ async function cmdLogin(options) {
|
|
|
11146
11178
|
process.stderr.write("\n");
|
|
11147
11179
|
printLogo();
|
|
11148
11180
|
process.stderr.write("\n");
|
|
11149
|
-
const ver = "0.1.
|
|
11181
|
+
const ver = "0.1.175";
|
|
11150
11182
|
process.stderr.write(
|
|
11151
11183
|
` ${ansi2.bold("MindStudio Agent")} ${ver ? " " + ansi2.gray("v" + ver) : ""}
|
|
11152
11184
|
`
|
|
@@ -11458,7 +11490,7 @@ async function main() {
|
|
|
11458
11490
|
const updatePromise = command !== "mcp" && command !== "login" && command !== "update" ? checkForUpdate() : Promise.resolve(null);
|
|
11459
11491
|
try {
|
|
11460
11492
|
if (command === "version" || command === "-v") {
|
|
11461
|
-
process.stdout.write("0.1.
|
|
11493
|
+
process.stdout.write("0.1.175\n");
|
|
11462
11494
|
return;
|
|
11463
11495
|
}
|
|
11464
11496
|
if (command === "login") {
|
package/llms.txt
CHANGED
|
@@ -1961,7 +1961,7 @@ Everything in `SearchOptions` — `mode`, `filter`, `rerank`, `hybrid`, `maxPerD
|
|
|
1961
1961
|
|
|
1962
1962
|
#### `analytics` — read the app's own traffic + event analytics
|
|
1963
1963
|
|
|
1964
|
-
The platform auto-tracks pageviews (and custom events via the frontend's `analytics.track()`); the backend `analytics` namespace is the read side, so app code can correlate real traffic with its own data — lifetime views next to each blog post, "N people reading now", conversions beside the records that produced them. Backend only (hook token); reads the LIVE app's real traffic even from a dev sandbox. Rate limited per app (600 reads/min; the SDK auto-retries one 429). For pages composed of several reads, use `analytics.batch([spec, ...])` — up to 10 queries in one round trip, one rate token each, results in request order — instead of a parallel burst of `query()` calls competing with each other. NEVER swallow `rate_limited` errors into empty data: a page silently rendering zeros is worse than surfacing a retry state.
|
|
1964
|
+
The platform auto-tracks pageviews, each page's engagement (active reading time and scroll depth) and visits (and custom events via the frontend's `analytics.track()`); the backend `analytics` namespace is the read side, so app code can correlate real traffic with its own data — lifetime views next to each blog post, "N people reading now", conversions beside the records that produced them. Backend only (hook token); reads the LIVE app's real traffic even from a dev sandbox. Rate limited per app (600 reads/min; the SDK auto-retries one 429). For pages composed of several reads, use `analytics.batch([spec, ...])` — up to 10 queries in one round trip, one rate token each, results in request order — instead of a parallel burst of `query()` calls competing with each other. NEVER swallow `rate_limited` errors into empty data: a page silently rendering zeros is worse than surfacing a retry state.
|
|
1965
1965
|
|
|
1966
1966
|
One general read, `query()`, shaped like the Plausible/GA4 query APIs:
|
|
1967
1967
|
|
|
@@ -1987,11 +1987,11 @@ const series = await analytics.query({
|
|
|
1987
1987
|
});
|
|
1988
1988
|
```
|
|
1989
1989
|
|
|
1990
|
-
Grammar: `metrics` from `pageviews | visitors | visits | events
|
|
1990
|
+
Grammar: `metrics` from `pageviews | visitors | visits | events` (counts) and `timeOnPage | scrollDepth | visitDuration | bounceRate` (averages: seconds actively read per page, % of the page scrolled, seconds actively read per visit, % of visits with one pageview, no custom event and under 10s active; `null` when there's nothing to average); `dimensions` is at most ONE entity dimension (`path`, `referrerHost`, `sourceCategory`, `country`, `city`, `deviceType`, `browser`, `os`, `language`, `visitorType`, `utmSource`…`utmContent`, `eventName`; the visit's own `entryPath`, `exitPath`, `visitReferrerHost`, `visitSourceCategory`, `visitUtmSource`…`visitUtmContent`; or a custom event's property `prop:<key>`) OR `'time'` (with `granularity: '5m'|'hour'|'day'|'week'|'month'` and optional IANA `timezone`); `filters` are `[op, dimension, values]` triples with ops `is | is_not | contains`, plus the filter-only `visitEvent` (the visit fired that event: `[['is', 'visitEvent', ['signup']]]` grouped by `path` is the pages that led to signups); `dateRange` is a shorthand (`'1h'|'24h'|'7d'|'30d'|'90d'|'all'`) or `[startISO, endISO]`; `orderBy` (grouped only) accepts `pageviews`, `events` or `visits` where the shape carries it. With `dateRange: 'all'`, granularity is a minimum — the server coarsens as history grows. `city` filter values are plain city names (any country) and always read the 90-day event detail.
|
|
1991
1991
|
|
|
1992
|
-
**Retention split — the one thing to get right:** queries whose filters are all `is` and touch at most one dimension read a rollup kept forever (full lifetime history, exact unique visitors). Cross-dimension intersections, `is_not`, and `
|
|
1992
|
+
**Retention split — the one thing to get right:** queries whose filters are all `is` and touch at most one dimension read a rollup kept forever (full lifetime history, exact unique visitors, and time on page and scroll depth app-wide or per page). Cross-dimension intersections, `is_not`, `contains`, properties and anything about whole visits (visit dimensions, `visitDuration`, `bounceRate`) scan raw events retained for 90 days; the server clamps the window and reports it. Check `meta`: `source` (`rollup` vs `events`), `clamped`, `window.served`, and `metricsOmitted` — metrics a shape can't carry (e.g. `visits` on grouped reads that aren't about visits, `bounceRate` by `path`) are omitted there, never returned as silent zeros. `meta.total` carries the unpaginated group count for paging.
|
|
1993
1993
|
|
|
1994
|
-
Specials (same `dateRange`/filter-triple grammar): `analytics.live()` → `{count, countries, sparkline}` right now; `analytics.sources(opts?)` → per-session first-source ranking (UTM > referrer > direct) classified by category/vendor incl. AI assistants; `analytics.map(opts?)` → city lat/lon points; `analytics.aiSources(opts?)` → AI-assistant referrals per vendor; `analytics.crawlers.overview()/timeseries()/recent()` → bot/AI-crawler ingestion of the app's pages.
|
|
1994
|
+
Specials (same `dateRange`/filter-triple grammar): `analytics.funnel({ steps, breakdown? })` → visits reaching each step in order and the drop-off, steps being `{ page, match?: 'is'|'contains' }` or `{ event, props? }` (2-8), with filters picking visits; `analytics.paths({ from?, depth?, limit? })` → where visits went after `from` (null = left) and their commonest opening routes; both follow a visitor across the apps sharing the host (mounts) and count as 5 reads; `analytics.live()` → `{count, countries, sparkline}` right now; `analytics.sources(opts?)` → per-session first-source ranking (UTM > referrer > direct) classified by category/vendor incl. AI assistants; `analytics.map(opts?)` → city lat/lon points; `analytics.aiSources(opts?)` → AI-assistant referrals per vendor; `analytics.crawlers.overview()/timeseries()/recent()` → bot/AI-crawler ingestion of the app's pages.
|
|
1995
1995
|
|
|
1996
1996
|
#### `events` — realtime over named channels (publish/subscribe)
|
|
1997
1997
|
|