@mindstudio-ai/agent 0.1.105 → 0.1.106
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/dist/cli.js +30 -9
- package/dist/index.d.ts +15 -0
- package/dist/index.js +22 -1
- package/dist/index.js.map +1 -1
- package/dist/postinstall.js +30 -9
- package/llms.txt +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -2811,6 +2811,15 @@ interface CrawlerHit {
|
|
|
2811
2811
|
interface Analytics {
|
|
2812
2812
|
/** The general read: metrics × dimensions × filters × time. */
|
|
2813
2813
|
query(spec: AnalyticsQuerySpec): Promise<AnalyticsQueryResponse>;
|
|
2814
|
+
/**
|
|
2815
|
+
* Up to 10 queries in one round trip, results in request order — the right
|
|
2816
|
+
* shape for a page composed of several reads (KPIs + timeseries + a few
|
|
2817
|
+
* breakdowns), instead of a parallel burst of `query()` calls competing
|
|
2818
|
+
* with each other against the per-app rate limit. Each query in the batch
|
|
2819
|
+
* counts as one read against the limit. One invalid query fails the whole
|
|
2820
|
+
* batch (the error names its index).
|
|
2821
|
+
*/
|
|
2822
|
+
batch(specs: AnalyticsQuerySpec[]): Promise<AnalyticsQueryResponse[]>;
|
|
2814
2823
|
/** Who's on the app right now (Redis presence, no time window). */
|
|
2815
2824
|
live(): Promise<LiveNow>;
|
|
2816
2825
|
/**
|
|
@@ -3534,6 +3543,12 @@ declare class MindStudioAgent$1 {
|
|
|
3534
3543
|
/**
|
|
3535
3544
|
* @internal Transport for the `analytics` namespace —
|
|
3536
3545
|
* POST /_internal/v2/analytics/<op> with the raw hook token.
|
|
3546
|
+
*
|
|
3547
|
+
* Retries a single 429 after a short jittered backoff: analytics reads are
|
|
3548
|
+
* idempotent and a 429 means the read never executed, so one retry lets a
|
|
3549
|
+
* momentary burst (a page's fan-out racing a live poller) self-heal instead
|
|
3550
|
+
* of surfacing as empty data. Deliberately single-shot and scoped to this
|
|
3551
|
+
* namespace — the other brokered transports keep their semantics.
|
|
3537
3552
|
*/
|
|
3538
3553
|
private _analyticsRequest;
|
|
3539
3554
|
/**
|
package/dist/index.js
CHANGED
|
@@ -2784,6 +2784,10 @@ function createAnalytics(call) {
|
|
|
2784
2784
|
query(spec) {
|
|
2785
2785
|
return call("query", spec);
|
|
2786
2786
|
},
|
|
2787
|
+
async batch(specs) {
|
|
2788
|
+
const res = await call("query-batch", { queries: specs });
|
|
2789
|
+
return res.results;
|
|
2790
|
+
},
|
|
2787
2791
|
live() {
|
|
2788
2792
|
return call("live", {});
|
|
2789
2793
|
},
|
|
@@ -6655,12 +6659,29 @@ var MindStudioAgent = class {
|
|
|
6655
6659
|
/**
|
|
6656
6660
|
* @internal Transport for the `analytics` namespace —
|
|
6657
6661
|
* POST /_internal/v2/analytics/<op> with the raw hook token.
|
|
6662
|
+
*
|
|
6663
|
+
* Retries a single 429 after a short jittered backoff: analytics reads are
|
|
6664
|
+
* idempotent and a 429 means the read never executed, so one retry lets a
|
|
6665
|
+
* momentary burst (a page's fan-out racing a live poller) self-heal instead
|
|
6666
|
+
* of surfacing as empty data. Deliberately single-shot and scoped to this
|
|
6667
|
+
* namespace — the other brokered transports keep their semantics.
|
|
6658
6668
|
*/
|
|
6659
6669
|
async _analyticsRequest(op, body) {
|
|
6660
|
-
|
|
6670
|
+
const call = () => this._brokeredRequest("analytics", op, body, {
|
|
6661
6671
|
fallbackMessage: "Analytics read failed",
|
|
6662
6672
|
fallbackCode: "analytics_error"
|
|
6663
6673
|
});
|
|
6674
|
+
try {
|
|
6675
|
+
return await call();
|
|
6676
|
+
} catch (err) {
|
|
6677
|
+
if (err instanceof MindStudioError && err.status === 429) {
|
|
6678
|
+
await new Promise(
|
|
6679
|
+
(resolve) => setTimeout(resolve, 750 + Math.random() * 750)
|
|
6680
|
+
);
|
|
6681
|
+
return call();
|
|
6682
|
+
}
|
|
6683
|
+
throw err;
|
|
6684
|
+
}
|
|
6664
6685
|
}
|
|
6665
6686
|
/**
|
|
6666
6687
|
* @internal Shared shape for the brokered `/_internal/v2/<ns>/<op>` data
|