@telemai/sdk 0.2.6 → 0.3.1
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 +6 -11
- package/dist/index.d.cts +8 -15
- package/dist/index.d.ts +8 -15
- package/dist/index.js +6 -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", ttl: "7d" })
|
|
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.1";
|
|
64
64
|
|
|
65
65
|
// src/config.ts
|
|
66
66
|
var DEFAULT_BASE_URL = "https://router.telem.ai";
|
|
@@ -703,10 +703,11 @@ 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,
|
|
710
|
+
expiresAt: data.expires_at ?? null,
|
|
710
711
|
webhookUrl: data.webhook_url ?? null,
|
|
711
712
|
webhookSecret: data.webhook_secret ?? null,
|
|
712
713
|
raw: data
|
|
@@ -718,17 +719,12 @@ function createMonitors(config) {
|
|
|
718
719
|
return `/v1/monitors/${encodeURIComponent(monitorId)}${suffix}`;
|
|
719
720
|
};
|
|
720
721
|
return {
|
|
721
|
-
/** Create a monitor.
|
|
722
|
+
/** Create a monitor. Telem runs `query` on the schedule. */
|
|
722
723
|
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
|
-
}
|
|
724
|
+
const body = { query, options: { frequency: options.frequency } };
|
|
730
725
|
if (options.metadata !== void 0) body.metadata = options.metadata;
|
|
731
726
|
if (options.webhookUrl !== void 0) body.webhook_url = options.webhookUrl;
|
|
727
|
+
if (options.ttl !== void 0) body.ttl = options.ttl;
|
|
732
728
|
const data = await request(config, "POST", "/v1/monitors", body, options.signal, "rate_limit");
|
|
733
729
|
return monitorFrom(data);
|
|
734
730
|
},
|
|
@@ -747,7 +743,6 @@ function createMonitors(config) {
|
|
|
747
743
|
const body = {};
|
|
748
744
|
if (options.status !== void 0) body.status = options.status;
|
|
749
745
|
if (options.frequency !== void 0) body.frequency = options.frequency;
|
|
750
|
-
if (options.providerOverrides !== void 0) body.provider_overrides = options.providerOverrides;
|
|
751
746
|
if (options.webhookUrl !== void 0) body.webhook_url = options.webhookUrl;
|
|
752
747
|
const route = path(monitorId);
|
|
753
748
|
return monitorFrom(await request(config, "PATCH", route, body, options.signal));
|
package/dist/index.d.cts
CHANGED
|
@@ -224,16 +224,14 @@ 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. */
|
|
236
232
|
webhookUrl?: string;
|
|
233
|
+
/** Delete the monitor after this long, such as `"12h"` or `"7d"` (at most `"30d"`). Without it, the monitor never expires. */
|
|
234
|
+
ttl?: string;
|
|
237
235
|
signal?: AbortSignal;
|
|
238
236
|
};
|
|
239
237
|
/** Options for `monitors.update`. Send at least one field. */
|
|
@@ -241,8 +239,6 @@ type MonitorUpdateOptions = {
|
|
|
241
239
|
/** `"paused"` or `"active"`. */
|
|
242
240
|
status?: string;
|
|
243
241
|
frequency?: string;
|
|
244
|
-
/** New overrides for the providers named. They replace the ones sent before. */
|
|
245
|
-
providerOverrides?: Record<string, Json>;
|
|
246
242
|
/** A new webhook URL, with a new `webhookSecret` in the response. `null` removes it. */
|
|
247
243
|
webhookUrl?: string | null;
|
|
248
244
|
signal?: AbortSignal;
|
|
@@ -255,21 +251,18 @@ type MonitorPollOptions = {
|
|
|
255
251
|
metadata?: Json;
|
|
256
252
|
signal?: AbortSignal;
|
|
257
253
|
};
|
|
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. */
|
|
254
|
+
/** A monitor: a query that Telem runs on a schedule. */
|
|
265
255
|
type Monitor = {
|
|
266
256
|
id: string;
|
|
267
257
|
query: string;
|
|
268
258
|
frequency: string;
|
|
269
|
-
|
|
259
|
+
/** `active` or `paused` (you paused it). */
|
|
260
|
+
status: string;
|
|
270
261
|
sessionId: string;
|
|
271
262
|
createdAt: string;
|
|
272
263
|
lastPolledAt: string | null;
|
|
264
|
+
/** When Telem deletes the monitor; `null`: never. */
|
|
265
|
+
expiresAt: string | null;
|
|
273
266
|
webhookUrl: string | null;
|
|
274
267
|
/** Signs the webhook deliveries. Only in the response that set `webhookUrl`. */
|
|
275
268
|
webhookSecret: string | null;
|
|
@@ -466,4 +459,4 @@ declare class Telem {
|
|
|
466
459
|
providers(): Promise<ProviderInfo[]>;
|
|
467
460
|
}
|
|
468
461
|
|
|
469
|
-
export { type FetchOptions, type FetchResponse, type FetchResult, type Json, type Monitor, type MonitorCreateOptions, type MonitorPollOptions, type
|
|
462
|
+
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,16 +224,14 @@ 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. */
|
|
236
232
|
webhookUrl?: string;
|
|
233
|
+
/** Delete the monitor after this long, such as `"12h"` or `"7d"` (at most `"30d"`). Without it, the monitor never expires. */
|
|
234
|
+
ttl?: string;
|
|
237
235
|
signal?: AbortSignal;
|
|
238
236
|
};
|
|
239
237
|
/** Options for `monitors.update`. Send at least one field. */
|
|
@@ -241,8 +239,6 @@ type MonitorUpdateOptions = {
|
|
|
241
239
|
/** `"paused"` or `"active"`. */
|
|
242
240
|
status?: string;
|
|
243
241
|
frequency?: string;
|
|
244
|
-
/** New overrides for the providers named. They replace the ones sent before. */
|
|
245
|
-
providerOverrides?: Record<string, Json>;
|
|
246
242
|
/** A new webhook URL, with a new `webhookSecret` in the response. `null` removes it. */
|
|
247
243
|
webhookUrl?: string | null;
|
|
248
244
|
signal?: AbortSignal;
|
|
@@ -255,21 +251,18 @@ type MonitorPollOptions = {
|
|
|
255
251
|
metadata?: Json;
|
|
256
252
|
signal?: AbortSignal;
|
|
257
253
|
};
|
|
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. */
|
|
254
|
+
/** A monitor: a query that Telem runs on a schedule. */
|
|
265
255
|
type Monitor = {
|
|
266
256
|
id: string;
|
|
267
257
|
query: string;
|
|
268
258
|
frequency: string;
|
|
269
|
-
|
|
259
|
+
/** `active` or `paused` (you paused it). */
|
|
260
|
+
status: string;
|
|
270
261
|
sessionId: string;
|
|
271
262
|
createdAt: string;
|
|
272
263
|
lastPolledAt: string | null;
|
|
264
|
+
/** When Telem deletes the monitor; `null`: never. */
|
|
265
|
+
expiresAt: string | null;
|
|
273
266
|
webhookUrl: string | null;
|
|
274
267
|
/** Signs the webhook deliveries. Only in the response that set `webhookUrl`. */
|
|
275
268
|
webhookSecret: string | null;
|
|
@@ -466,4 +459,4 @@ declare class Telem {
|
|
|
466
459
|
providers(): Promise<ProviderInfo[]>;
|
|
467
460
|
}
|
|
468
461
|
|
|
469
|
-
export { type FetchOptions, type FetchResponse, type FetchResult, type Json, type Monitor, type MonitorCreateOptions, type MonitorPollOptions, type
|
|
462
|
+
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.1";
|
|
26
26
|
|
|
27
27
|
// src/config.ts
|
|
28
28
|
var DEFAULT_BASE_URL = "https://router.telem.ai";
|
|
@@ -336,10 +336,11 @@ 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,
|
|
343
|
+
expiresAt: data.expires_at ?? null,
|
|
343
344
|
webhookUrl: data.webhook_url ?? null,
|
|
344
345
|
webhookSecret: data.webhook_secret ?? null,
|
|
345
346
|
raw: data
|
|
@@ -351,17 +352,12 @@ function createMonitors(config) {
|
|
|
351
352
|
return `/v1/monitors/${encodeURIComponent(monitorId)}${suffix}`;
|
|
352
353
|
};
|
|
353
354
|
return {
|
|
354
|
-
/** Create a monitor.
|
|
355
|
+
/** Create a monitor. Telem runs `query` on the schedule. */
|
|
355
356
|
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
|
-
}
|
|
357
|
+
const body = { query, options: { frequency: options.frequency } };
|
|
363
358
|
if (options.metadata !== void 0) body.metadata = options.metadata;
|
|
364
359
|
if (options.webhookUrl !== void 0) body.webhook_url = options.webhookUrl;
|
|
360
|
+
if (options.ttl !== void 0) body.ttl = options.ttl;
|
|
365
361
|
const data = await request(config, "POST", "/v1/monitors", body, options.signal, "rate_limit");
|
|
366
362
|
return monitorFrom(data);
|
|
367
363
|
},
|
|
@@ -380,7 +376,6 @@ function createMonitors(config) {
|
|
|
380
376
|
const body = {};
|
|
381
377
|
if (options.status !== void 0) body.status = options.status;
|
|
382
378
|
if (options.frequency !== void 0) body.frequency = options.frequency;
|
|
383
|
-
if (options.providerOverrides !== void 0) body.provider_overrides = options.providerOverrides;
|
|
384
379
|
if (options.webhookUrl !== void 0) body.webhook_url = options.webhookUrl;
|
|
385
380
|
const route = path(monitorId);
|
|
386
381
|
return monitorFrom(await request(config, "PATCH", route, body, options.signal));
|