@telemai/sdk 0.2.6 → 0.3.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/README.md +2 -5
- package/dist/index.cjs +4 -11
- package/dist/index.d.cts +4 -15
- package/dist/index.d.ts +4 -15
- package/dist/index.js +4 -11
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -204,17 +204,14 @@ A monitor runs a query on a schedule. Poll it to get the results that are new si
|
|
|
204
204
|
your last poll. `poll` returns a `SearchResponse`:
|
|
205
205
|
|
|
206
206
|
```ts
|
|
207
|
-
const monitor = await telem.monitors.create("Nvidia files a new 8-K with the SEC", {
|
|
208
|
-
providers: ["exa", "parallel"],
|
|
209
|
-
frequency: "1h",
|
|
210
|
-
})
|
|
207
|
+
const monitor = await telem.monitors.create("Nvidia files a new 8-K with the SEC", { frequency: "1h" })
|
|
211
208
|
const response = await telem.monitors.poll(monitor.id)
|
|
212
209
|
await telem.monitors.update(monitor.id, { status: "paused" })
|
|
213
210
|
await telem.monitors.delete(monitor.id)
|
|
214
211
|
```
|
|
215
212
|
|
|
216
213
|
`telem.monitors` also has `get` and `list`. See [Monitors](https://docs.telem.ai/resources/monitors/)
|
|
217
|
-
for the fields
|
|
214
|
+
for the fields and the errors.
|
|
218
215
|
|
|
219
216
|
## Vercel AI SDK
|
|
220
217
|
|
package/dist/index.cjs
CHANGED
|
@@ -60,7 +60,7 @@ var TimeoutError = class extends TelemError {
|
|
|
60
60
|
};
|
|
61
61
|
|
|
62
62
|
// src/version.ts
|
|
63
|
-
var VERSION = "0.
|
|
63
|
+
var VERSION = "0.3.0";
|
|
64
64
|
|
|
65
65
|
// src/config.ts
|
|
66
66
|
var DEFAULT_BASE_URL = "https://router.telem.ai";
|
|
@@ -703,7 +703,7 @@ function monitorFrom(body) {
|
|
|
703
703
|
id: String(data.id ?? ""),
|
|
704
704
|
query: data.query ?? "",
|
|
705
705
|
frequency: data.frequency ?? "",
|
|
706
|
-
|
|
706
|
+
status: String(data.status ?? ""),
|
|
707
707
|
sessionId: String(data.session_id ?? ""),
|
|
708
708
|
createdAt: data.created_at ?? "",
|
|
709
709
|
lastPolledAt: data.last_polled_at ?? null,
|
|
@@ -718,15 +718,9 @@ function createMonitors(config) {
|
|
|
718
718
|
return `/v1/monitors/${encodeURIComponent(monitorId)}${suffix}`;
|
|
719
719
|
};
|
|
720
720
|
return {
|
|
721
|
-
/** Create a monitor.
|
|
721
|
+
/** Create a monitor. Telem runs `query` on the schedule. */
|
|
722
722
|
async create(query, options) {
|
|
723
|
-
const body = {
|
|
724
|
-
query,
|
|
725
|
-
options: { providers: { include: options.providers }, frequency: options.frequency }
|
|
726
|
-
};
|
|
727
|
-
if (options.providerOverrides !== void 0) {
|
|
728
|
-
body.options.provider_overrides = options.providerOverrides;
|
|
729
|
-
}
|
|
723
|
+
const body = { query, options: { frequency: options.frequency } };
|
|
730
724
|
if (options.metadata !== void 0) body.metadata = options.metadata;
|
|
731
725
|
if (options.webhookUrl !== void 0) body.webhook_url = options.webhookUrl;
|
|
732
726
|
const data = await request(config, "POST", "/v1/monitors", body, options.signal, "rate_limit");
|
|
@@ -747,7 +741,6 @@ function createMonitors(config) {
|
|
|
747
741
|
const body = {};
|
|
748
742
|
if (options.status !== void 0) body.status = options.status;
|
|
749
743
|
if (options.frequency !== void 0) body.frequency = options.frequency;
|
|
750
|
-
if (options.providerOverrides !== void 0) body.provider_overrides = options.providerOverrides;
|
|
751
744
|
if (options.webhookUrl !== void 0) body.webhook_url = options.webhookUrl;
|
|
752
745
|
const route = path(monitorId);
|
|
753
746
|
return monitorFrom(await request(config, "PATCH", route, body, options.signal));
|
package/dist/index.d.cts
CHANGED
|
@@ -224,12 +224,8 @@ type SessionsResource = {
|
|
|
224
224
|
};
|
|
225
225
|
/** Options for `monitors.create`. */
|
|
226
226
|
type MonitorCreateOptions = {
|
|
227
|
-
/** One or more provider names, for example `["exa", "parallel"]`. */
|
|
228
|
-
providers: string[];
|
|
229
227
|
/** `"1h"`, `"6h"`, `"1d"` or `"7d"`. */
|
|
230
228
|
frequency: string;
|
|
231
|
-
/** Per-provider create fields, keyed by provider name. */
|
|
232
|
-
providerOverrides?: Record<string, Json>;
|
|
233
229
|
/** Request metadata (query lineage keys), sent as given. */
|
|
234
230
|
metadata?: Json;
|
|
235
231
|
/** An `https` URL that receives the new results. */
|
|
@@ -241,8 +237,6 @@ type MonitorUpdateOptions = {
|
|
|
241
237
|
/** `"paused"` or `"active"`. */
|
|
242
238
|
status?: string;
|
|
243
239
|
frequency?: string;
|
|
244
|
-
/** New overrides for the providers named. They replace the ones sent before. */
|
|
245
|
-
providerOverrides?: Record<string, Json>;
|
|
246
240
|
/** A new webhook URL, with a new `webhookSecret` in the response. `null` removes it. */
|
|
247
241
|
webhookUrl?: string | null;
|
|
248
242
|
signal?: AbortSignal;
|
|
@@ -255,18 +249,13 @@ type MonitorPollOptions = {
|
|
|
255
249
|
metadata?: Json;
|
|
256
250
|
signal?: AbortSignal;
|
|
257
251
|
};
|
|
258
|
-
/**
|
|
259
|
-
* `idle` (paused because nobody polled; the next poll resumes it). */
|
|
260
|
-
type MonitorProvider = {
|
|
261
|
-
name: string;
|
|
262
|
-
status: string;
|
|
263
|
-
};
|
|
264
|
-
/** A monitor: a query that providers run on a schedule. */
|
|
252
|
+
/** A monitor: a query that Telem runs on a schedule. */
|
|
265
253
|
type Monitor = {
|
|
266
254
|
id: string;
|
|
267
255
|
query: string;
|
|
268
256
|
frequency: string;
|
|
269
|
-
|
|
257
|
+
/** `active` or `paused` (you paused it). */
|
|
258
|
+
status: string;
|
|
270
259
|
sessionId: string;
|
|
271
260
|
createdAt: string;
|
|
272
261
|
lastPolledAt: string | null;
|
|
@@ -466,4 +455,4 @@ declare class Telem {
|
|
|
466
455
|
providers(): Promise<ProviderInfo[]>;
|
|
467
456
|
}
|
|
468
457
|
|
|
469
|
-
export { type FetchOptions, type FetchResponse, type FetchResult, type Json, type Monitor, type MonitorCreateOptions, type MonitorPollOptions, type
|
|
458
|
+
export { type FetchOptions, type FetchResponse, type FetchResult, type Json, type Monitor, type MonitorCreateOptions, type MonitorPollOptions, type MonitorUpdateOptions, type MonitorsResource, type ProviderInfo, type ProviderRun, RESERVED_METADATA, type SearchDefaults, type SearchOptions, type SearchResponse, type SearchResult, type SessionResults, type SessionSummary, type SessionsResource, type SnapshotArgs, Telem, type TelemClientErrorCode, TelemError, type TelemErrorOptions, type TelemOptions, TimeoutError, type TrajectoryArgs, type TrajectoryEnvelope, type TrajectorySnapshot, buildMetadata, buildSnapshot, contentAnchor, Telem as default, eventNodeKey, fingerprint, sessionKey, snapshotNodeKey, toolMarker, verifyWebhook, windowAnchor, withTrajectory };
|
package/dist/index.d.ts
CHANGED
|
@@ -224,12 +224,8 @@ type SessionsResource = {
|
|
|
224
224
|
};
|
|
225
225
|
/** Options for `monitors.create`. */
|
|
226
226
|
type MonitorCreateOptions = {
|
|
227
|
-
/** One or more provider names, for example `["exa", "parallel"]`. */
|
|
228
|
-
providers: string[];
|
|
229
227
|
/** `"1h"`, `"6h"`, `"1d"` or `"7d"`. */
|
|
230
228
|
frequency: string;
|
|
231
|
-
/** Per-provider create fields, keyed by provider name. */
|
|
232
|
-
providerOverrides?: Record<string, Json>;
|
|
233
229
|
/** Request metadata (query lineage keys), sent as given. */
|
|
234
230
|
metadata?: Json;
|
|
235
231
|
/** An `https` URL that receives the new results. */
|
|
@@ -241,8 +237,6 @@ type MonitorUpdateOptions = {
|
|
|
241
237
|
/** `"paused"` or `"active"`. */
|
|
242
238
|
status?: string;
|
|
243
239
|
frequency?: string;
|
|
244
|
-
/** New overrides for the providers named. They replace the ones sent before. */
|
|
245
|
-
providerOverrides?: Record<string, Json>;
|
|
246
240
|
/** A new webhook URL, with a new `webhookSecret` in the response. `null` removes it. */
|
|
247
241
|
webhookUrl?: string | null;
|
|
248
242
|
signal?: AbortSignal;
|
|
@@ -255,18 +249,13 @@ type MonitorPollOptions = {
|
|
|
255
249
|
metadata?: Json;
|
|
256
250
|
signal?: AbortSignal;
|
|
257
251
|
};
|
|
258
|
-
/**
|
|
259
|
-
* `idle` (paused because nobody polled; the next poll resumes it). */
|
|
260
|
-
type MonitorProvider = {
|
|
261
|
-
name: string;
|
|
262
|
-
status: string;
|
|
263
|
-
};
|
|
264
|
-
/** A monitor: a query that providers run on a schedule. */
|
|
252
|
+
/** A monitor: a query that Telem runs on a schedule. */
|
|
265
253
|
type Monitor = {
|
|
266
254
|
id: string;
|
|
267
255
|
query: string;
|
|
268
256
|
frequency: string;
|
|
269
|
-
|
|
257
|
+
/** `active` or `paused` (you paused it). */
|
|
258
|
+
status: string;
|
|
270
259
|
sessionId: string;
|
|
271
260
|
createdAt: string;
|
|
272
261
|
lastPolledAt: string | null;
|
|
@@ -466,4 +455,4 @@ declare class Telem {
|
|
|
466
455
|
providers(): Promise<ProviderInfo[]>;
|
|
467
456
|
}
|
|
468
457
|
|
|
469
|
-
export { type FetchOptions, type FetchResponse, type FetchResult, type Json, type Monitor, type MonitorCreateOptions, type MonitorPollOptions, type
|
|
458
|
+
export { type FetchOptions, type FetchResponse, type FetchResult, type Json, type Monitor, type MonitorCreateOptions, type MonitorPollOptions, type MonitorUpdateOptions, type MonitorsResource, type ProviderInfo, type ProviderRun, RESERVED_METADATA, type SearchDefaults, type SearchOptions, type SearchResponse, type SearchResult, type SessionResults, type SessionSummary, type SessionsResource, type SnapshotArgs, Telem, type TelemClientErrorCode, TelemError, type TelemErrorOptions, type TelemOptions, TimeoutError, type TrajectoryArgs, type TrajectoryEnvelope, type TrajectorySnapshot, buildMetadata, buildSnapshot, contentAnchor, Telem as default, eventNodeKey, fingerprint, sessionKey, snapshotNodeKey, toolMarker, verifyWebhook, windowAnchor, withTrajectory };
|
package/dist/index.js
CHANGED
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
} from "./chunk-DKTEG7EY.js";
|
|
23
23
|
|
|
24
24
|
// src/version.ts
|
|
25
|
-
var VERSION = "0.
|
|
25
|
+
var VERSION = "0.3.0";
|
|
26
26
|
|
|
27
27
|
// src/config.ts
|
|
28
28
|
var DEFAULT_BASE_URL = "https://router.telem.ai";
|
|
@@ -336,7 +336,7 @@ function monitorFrom(body) {
|
|
|
336
336
|
id: String(data.id ?? ""),
|
|
337
337
|
query: data.query ?? "",
|
|
338
338
|
frequency: data.frequency ?? "",
|
|
339
|
-
|
|
339
|
+
status: String(data.status ?? ""),
|
|
340
340
|
sessionId: String(data.session_id ?? ""),
|
|
341
341
|
createdAt: data.created_at ?? "",
|
|
342
342
|
lastPolledAt: data.last_polled_at ?? null,
|
|
@@ -351,15 +351,9 @@ function createMonitors(config) {
|
|
|
351
351
|
return `/v1/monitors/${encodeURIComponent(monitorId)}${suffix}`;
|
|
352
352
|
};
|
|
353
353
|
return {
|
|
354
|
-
/** Create a monitor.
|
|
354
|
+
/** Create a monitor. Telem runs `query` on the schedule. */
|
|
355
355
|
async create(query, options) {
|
|
356
|
-
const body = {
|
|
357
|
-
query,
|
|
358
|
-
options: { providers: { include: options.providers }, frequency: options.frequency }
|
|
359
|
-
};
|
|
360
|
-
if (options.providerOverrides !== void 0) {
|
|
361
|
-
body.options.provider_overrides = options.providerOverrides;
|
|
362
|
-
}
|
|
356
|
+
const body = { query, options: { frequency: options.frequency } };
|
|
363
357
|
if (options.metadata !== void 0) body.metadata = options.metadata;
|
|
364
358
|
if (options.webhookUrl !== void 0) body.webhook_url = options.webhookUrl;
|
|
365
359
|
const data = await request(config, "POST", "/v1/monitors", body, options.signal, "rate_limit");
|
|
@@ -380,7 +374,6 @@ function createMonitors(config) {
|
|
|
380
374
|
const body = {};
|
|
381
375
|
if (options.status !== void 0) body.status = options.status;
|
|
382
376
|
if (options.frequency !== void 0) body.frequency = options.frequency;
|
|
383
|
-
if (options.providerOverrides !== void 0) body.provider_overrides = options.providerOverrides;
|
|
384
377
|
if (options.webhookUrl !== void 0) body.webhook_url = options.webhookUrl;
|
|
385
378
|
const route = path(monitorId);
|
|
386
379
|
return monitorFrom(await request(config, "PATCH", route, body, options.signal));
|