@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/index.js
CHANGED
|
@@ -125,6 +125,21 @@ function runWithContext(ctx, fn) {
|
|
|
125
125
|
return als.run(ctx, fn);
|
|
126
126
|
}
|
|
127
127
|
|
|
128
|
+
// src/db/scanHints.ts
|
|
129
|
+
function warnTableScans(scans) {
|
|
130
|
+
if (!Array.isArray(scans)) {
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
for (const scan of scans) {
|
|
134
|
+
if (typeof scan?.table !== "string" || typeof scan?.ms !== "number" || !Number.isFinite(scan.ms)) {
|
|
135
|
+
continue;
|
|
136
|
+
}
|
|
137
|
+
console.warn(
|
|
138
|
+
`[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.`
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
128
143
|
// src/db-ws.ts
|
|
129
144
|
var DB_WS_SUBPROTOCOL = "ms-db-v2";
|
|
130
145
|
var WS_ACK_TIMEOUT_MS = 2e4;
|
|
@@ -210,6 +225,7 @@ function deliver(self, msg) {
|
|
|
210
225
|
)
|
|
211
226
|
);
|
|
212
227
|
} else {
|
|
228
|
+
warnTableScans(msg.scans);
|
|
213
229
|
p.resolve(msg.results);
|
|
214
230
|
}
|
|
215
231
|
}
|
|
@@ -4212,6 +4228,12 @@ function createAnalytics(call) {
|
|
|
4212
4228
|
const res = await call("query-batch", { queries: specs });
|
|
4213
4229
|
return res.results;
|
|
4214
4230
|
},
|
|
4231
|
+
funnel(options) {
|
|
4232
|
+
return call("funnel", options);
|
|
4233
|
+
},
|
|
4234
|
+
paths(options) {
|
|
4235
|
+
return call("paths", options ?? {});
|
|
4236
|
+
},
|
|
4215
4237
|
live() {
|
|
4216
4238
|
return call("live", {});
|
|
4217
4239
|
},
|
|
@@ -8349,10 +8371,11 @@ var MindStudioAgent = class {
|
|
|
8349
8371
|
}
|
|
8350
8372
|
/**
|
|
8351
8373
|
* The `analytics` namespace — read the app's own traffic + event analytics
|
|
8352
|
-
* (auto-tracked pageviews, `analytics.track()` events). One
|
|
8353
|
-
* `query()` (metrics × dimensions × filters × time) plus
|
|
8354
|
-
* `
|
|
8355
|
-
* for the lifetime-rollup vs
|
|
8374
|
+
* (auto-tracked pageviews and engagement, `analytics.track()` events). One
|
|
8375
|
+
* general `query()` (metrics × dimensions × filters × time) plus
|
|
8376
|
+
* `funnel()`, `paths()`, `live()`, `sources()`, `map()`, `aiSources()`,
|
|
8377
|
+
* `crawlers.*`. See {@link Analytics} for the lifetime-rollup vs
|
|
8378
|
+
* 90-day-events split.
|
|
8356
8379
|
*
|
|
8357
8380
|
* @example
|
|
8358
8381
|
* ```ts
|
|
@@ -8736,6 +8759,7 @@ var MindStudioAgent = class {
|
|
|
8736
8759
|
throw new MindStudioError(`[db] ${message}`, code, res.status);
|
|
8737
8760
|
}
|
|
8738
8761
|
const data = await res.json();
|
|
8762
|
+
warnTableScans(data.scans);
|
|
8739
8763
|
return data.results;
|
|
8740
8764
|
}
|
|
8741
8765
|
/**
|
|
@@ -9000,10 +9024,11 @@ var MindStudioAgent = class {
|
|
|
9000
9024
|
* page changes (e.g. a short URL's target). Omit `paths` (or pass an empty
|
|
9001
9025
|
* array) to purge every snapshot for the app.
|
|
9002
9026
|
*
|
|
9003
|
-
* `paths` are this app's OWN route paths (`/u/abc`),
|
|
9004
|
-
*
|
|
9005
|
-
*
|
|
9006
|
-
* path
|
|
9027
|
+
* `paths` are this app's OWN route paths (`/u/abc`), which purge the page
|
|
9028
|
+
* whatever host it is served on, or full URLs (`https://site-a.com/u/abc`),
|
|
9029
|
+
* which purge it on that host only. If another app mounts this one under a
|
|
9030
|
+
* path prefix, the copies cached at that prefix are purged too — no need to
|
|
9031
|
+
* know or pass the mount path.
|
|
9007
9032
|
*
|
|
9008
9033
|
* Raw hook-token call (mirrors `reportIssue`) — the appId comes from the
|
|
9009
9034
|
* token. Backend / managed-context only.
|