@savantoai/ai-sdk 2.1.0 → 3.0.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/CHANGELOG.md +141 -0
- package/README.md +10 -0
- package/dist/index.cjs +190 -120
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +404 -103
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +404 -103
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +186 -121
- package/dist/index.mjs.map +1 -1
- package/package.json +11 -9
package/dist/index.mjs
CHANGED
|
@@ -3,7 +3,7 @@ const jsonBodySerializer = { bodySerializer: (body) => JSON.stringify(body, (_ke
|
|
|
3
3
|
|
|
4
4
|
//#endregion
|
|
5
5
|
//#region src/generated/core/serverSentEvents.gen.ts
|
|
6
|
-
|
|
6
|
+
function createSseClient({ onRequest, onSseError, onSseEvent, responseTransformer, responseValidator, sseDefaultRetryDelay, sseMaxRetryAttempts, sseMaxRetryDelay, sseSleepFn, url, ...options }) {
|
|
7
7
|
let lastEventId;
|
|
8
8
|
const sleep = sseSleepFn ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
|
|
9
9
|
const createStream = async function* () {
|
|
@@ -41,7 +41,7 @@ const createSseClient = ({ onRequest, onSseError, onSseEvent, responseTransforme
|
|
|
41
41
|
const { done, value } = await reader.read();
|
|
42
42
|
if (done) break;
|
|
43
43
|
buffer += value;
|
|
44
|
-
buffer = buffer.replace(/\r\n
|
|
44
|
+
buffer = buffer.replace(/\r\n?/g, "\n");
|
|
45
45
|
const chunks = buffer.split("\n\n");
|
|
46
46
|
buffer = chunks.pop() ?? "";
|
|
47
47
|
for (const chunk of chunks) {
|
|
@@ -92,7 +92,7 @@ const createSseClient = ({ onRequest, onSseError, onSseEvent, responseTransforme
|
|
|
92
92
|
}
|
|
93
93
|
};
|
|
94
94
|
return { stream: createStream() };
|
|
95
|
-
}
|
|
95
|
+
}
|
|
96
96
|
|
|
97
97
|
//#endregion
|
|
98
98
|
//#region src/generated/core/pathSerializer.gen.ts
|
|
@@ -122,12 +122,12 @@ const separatorObjectExplode = (style) => {
|
|
|
122
122
|
};
|
|
123
123
|
const serializeArrayParam = ({ allowReserved, explode, name, style, value }) => {
|
|
124
124
|
if (!explode) {
|
|
125
|
-
const joinedValues
|
|
125
|
+
const joinedValues = (allowReserved ? value : value.map((v) => encodeURIComponent(v))).join(separatorArrayNoExplode(style));
|
|
126
126
|
switch (style) {
|
|
127
|
-
case "label": return `.${joinedValues
|
|
128
|
-
case "matrix": return `;${name}=${joinedValues
|
|
129
|
-
case "simple": return joinedValues
|
|
130
|
-
default: return `${name}=${joinedValues
|
|
127
|
+
case "label": return `.${joinedValues}`;
|
|
128
|
+
case "matrix": return `;${name}=${joinedValues}`;
|
|
129
|
+
case "simple": return joinedValues;
|
|
130
|
+
default: return `${name}=${joinedValues}`;
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
133
|
const separator = separatorArrayExplode(style);
|
|
@@ -157,12 +157,12 @@ const serializeObjectParam = ({ allowReserved, explode, name, style, value, valu
|
|
|
157
157
|
allowReserved ? v : encodeURIComponent(v)
|
|
158
158
|
];
|
|
159
159
|
});
|
|
160
|
-
const joinedValues
|
|
160
|
+
const joinedValues = values.join(",");
|
|
161
161
|
switch (style) {
|
|
162
|
-
case "form": return `${name}=${joinedValues
|
|
163
|
-
case "label": return `.${joinedValues
|
|
164
|
-
case "matrix": return `;${name}=${joinedValues
|
|
165
|
-
default: return joinedValues
|
|
162
|
+
case "form": return `${name}=${joinedValues}`;
|
|
163
|
+
case "label": return `.${joinedValues}`;
|
|
164
|
+
case "matrix": return `;${name}=${joinedValues}`;
|
|
165
|
+
default: return joinedValues;
|
|
166
166
|
}
|
|
167
167
|
}
|
|
168
168
|
const separator = separatorObjectExplode(style);
|
|
@@ -337,7 +337,6 @@ const setAuthParams = async ({ security, ...options }) => {
|
|
|
337
337
|
case "cookie":
|
|
338
338
|
options.headers.append("Cookie", `${name}=${token}`);
|
|
339
339
|
break;
|
|
340
|
-
case "header":
|
|
341
340
|
default:
|
|
342
341
|
options.headers.set(name, token);
|
|
343
342
|
break;
|
|
@@ -440,8 +439,8 @@ const createConfig = (override = {}) => ({
|
|
|
440
439
|
const createClient = (config = {}) => {
|
|
441
440
|
let _config = mergeConfigs(createConfig(), config);
|
|
442
441
|
const getConfig = () => ({ ..._config });
|
|
443
|
-
const setConfig = (config
|
|
444
|
-
_config = mergeConfigs(_config, config
|
|
442
|
+
const setConfig = (config) => {
|
|
443
|
+
_config = mergeConfigs(_config, config);
|
|
445
444
|
return getConfig();
|
|
446
445
|
};
|
|
447
446
|
const interceptors = createInterceptors();
|
|
@@ -460,107 +459,102 @@ const createClient = (config = {}) => {
|
|
|
460
459
|
if (opts.requestValidator) await opts.requestValidator(opts);
|
|
461
460
|
if (opts.body !== void 0 && opts.bodySerializer) opts.serializedBody = opts.bodySerializer(opts.body);
|
|
462
461
|
if (opts.body === void 0 || opts.serializedBody === "") opts.headers.delete("Content-Type");
|
|
462
|
+
const resolvedOpts = opts;
|
|
463
463
|
return {
|
|
464
|
-
opts,
|
|
465
|
-
url: buildUrl(
|
|
464
|
+
opts: resolvedOpts,
|
|
465
|
+
url: buildUrl(resolvedOpts)
|
|
466
466
|
};
|
|
467
467
|
};
|
|
468
468
|
const request = async (options) => {
|
|
469
|
-
const
|
|
470
|
-
const
|
|
471
|
-
|
|
472
|
-
...opts,
|
|
473
|
-
body: getValidRequestBody(opts)
|
|
474
|
-
};
|
|
475
|
-
let request$1 = new Request(url, requestInit);
|
|
476
|
-
for (const fn of interceptors.request.fns) if (fn) request$1 = await fn(request$1, opts);
|
|
477
|
-
const _fetch = opts.fetch;
|
|
469
|
+
const throwOnError = options.throwOnError ?? _config.throwOnError;
|
|
470
|
+
const responseStyle = options.responseStyle ?? _config.responseStyle;
|
|
471
|
+
let request;
|
|
478
472
|
let response;
|
|
479
473
|
try {
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
if (opts.throwOnError) throw finalError$1;
|
|
486
|
-
return opts.responseStyle === "data" ? void 0 : {
|
|
487
|
-
error: finalError$1,
|
|
488
|
-
request: request$1,
|
|
489
|
-
response: void 0
|
|
474
|
+
const { opts, url } = await beforeRequest(options);
|
|
475
|
+
const requestInit = {
|
|
476
|
+
redirect: "follow",
|
|
477
|
+
...opts,
|
|
478
|
+
body: getValidRequestBody(opts)
|
|
490
479
|
};
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
response
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
480
|
+
request = new Request(url, requestInit);
|
|
481
|
+
for (const fn of interceptors.request.fns) if (fn) request = await fn(request, opts);
|
|
482
|
+
const _fetch = opts.fetch;
|
|
483
|
+
response = await _fetch(request);
|
|
484
|
+
for (const fn of interceptors.response.fns) if (fn) response = await fn(response, request, opts);
|
|
485
|
+
const result = {
|
|
486
|
+
request,
|
|
487
|
+
response
|
|
488
|
+
};
|
|
489
|
+
if (response.ok) {
|
|
490
|
+
const parseAs = (opts.parseAs === "auto" ? getParseAs(response.headers.get("Content-Type")) : opts.parseAs) ?? "json";
|
|
491
|
+
if (response.status === 204 || response.headers.get("Content-Length") === "0") {
|
|
492
|
+
let emptyData;
|
|
493
|
+
switch (parseAs) {
|
|
494
|
+
case "arrayBuffer":
|
|
495
|
+
case "blob":
|
|
496
|
+
case "text":
|
|
497
|
+
emptyData = await response[parseAs]();
|
|
498
|
+
break;
|
|
499
|
+
case "formData":
|
|
500
|
+
emptyData = new FormData();
|
|
501
|
+
break;
|
|
502
|
+
case "stream":
|
|
503
|
+
emptyData = response.body;
|
|
504
|
+
break;
|
|
505
|
+
default:
|
|
506
|
+
emptyData = {};
|
|
507
|
+
break;
|
|
508
|
+
}
|
|
509
|
+
return opts.responseStyle === "data" ? emptyData : {
|
|
510
|
+
data: emptyData,
|
|
511
|
+
...result
|
|
512
|
+
};
|
|
513
|
+
}
|
|
514
|
+
let data;
|
|
501
515
|
switch (parseAs) {
|
|
502
516
|
case "arrayBuffer":
|
|
503
517
|
case "blob":
|
|
504
|
-
case "text":
|
|
505
|
-
emptyData = await response[parseAs]();
|
|
506
|
-
break;
|
|
507
518
|
case "formData":
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
case "stream":
|
|
511
|
-
emptyData = response.body;
|
|
519
|
+
case "text":
|
|
520
|
+
data = await response[parseAs]();
|
|
512
521
|
break;
|
|
513
|
-
case "json":
|
|
514
|
-
|
|
515
|
-
|
|
522
|
+
case "json": {
|
|
523
|
+
const text = await response.text();
|
|
524
|
+
data = text ? JSON.parse(text) : {};
|
|
516
525
|
break;
|
|
526
|
+
}
|
|
527
|
+
case "stream": return opts.responseStyle === "data" ? response.body : {
|
|
528
|
+
data: response.body,
|
|
529
|
+
...result
|
|
530
|
+
};
|
|
517
531
|
}
|
|
518
|
-
|
|
519
|
-
data
|
|
520
|
-
|
|
521
|
-
};
|
|
522
|
-
}
|
|
523
|
-
let data;
|
|
524
|
-
switch (parseAs) {
|
|
525
|
-
case "arrayBuffer":
|
|
526
|
-
case "blob":
|
|
527
|
-
case "formData":
|
|
528
|
-
case "text":
|
|
529
|
-
data = await response[parseAs]();
|
|
530
|
-
break;
|
|
531
|
-
case "json": {
|
|
532
|
-
const text = await response.text();
|
|
533
|
-
data = text ? JSON.parse(text) : {};
|
|
534
|
-
break;
|
|
532
|
+
if (parseAs === "json") {
|
|
533
|
+
if (opts.responseValidator) await opts.responseValidator(data);
|
|
534
|
+
if (opts.responseTransformer) data = await opts.responseTransformer(data);
|
|
535
535
|
}
|
|
536
|
-
|
|
537
|
-
data
|
|
536
|
+
return opts.responseStyle === "data" ? data : {
|
|
537
|
+
data,
|
|
538
538
|
...result
|
|
539
539
|
};
|
|
540
540
|
}
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
541
|
+
const textError = await response.text();
|
|
542
|
+
let jsonError;
|
|
543
|
+
try {
|
|
544
|
+
jsonError = JSON.parse(textError);
|
|
545
|
+
} catch {}
|
|
546
|
+
throw jsonError ?? textError;
|
|
547
|
+
} catch (error) {
|
|
548
|
+
let finalError = error;
|
|
549
|
+
for (const fn of interceptors.error.fns) if (fn) finalError = await fn(finalError, response, request, options);
|
|
550
|
+
finalError = finalError || {};
|
|
551
|
+
if (throwOnError) throw finalError;
|
|
552
|
+
return responseStyle === "data" ? void 0 : {
|
|
553
|
+
error: finalError,
|
|
554
|
+
request,
|
|
555
|
+
response
|
|
548
556
|
};
|
|
549
557
|
}
|
|
550
|
-
const textError = await response.text();
|
|
551
|
-
let jsonError;
|
|
552
|
-
try {
|
|
553
|
-
jsonError = JSON.parse(textError);
|
|
554
|
-
} catch {}
|
|
555
|
-
const error = jsonError ?? textError;
|
|
556
|
-
let finalError = error;
|
|
557
|
-
for (const fn of interceptors.error.fns) if (fn) finalError = await fn(error, response, request$1, opts);
|
|
558
|
-
finalError = finalError || {};
|
|
559
|
-
if (opts.throwOnError) throw finalError;
|
|
560
|
-
return opts.responseStyle === "data" ? void 0 : {
|
|
561
|
-
error: finalError,
|
|
562
|
-
...result
|
|
563
|
-
};
|
|
564
558
|
};
|
|
565
559
|
const makeMethodFn = (method) => (options) => request({
|
|
566
560
|
...options,
|
|
@@ -571,12 +565,11 @@ const createClient = (config = {}) => {
|
|
|
571
565
|
return createSseClient({
|
|
572
566
|
...opts,
|
|
573
567
|
body: opts.body,
|
|
574
|
-
headers: opts.headers,
|
|
575
568
|
method,
|
|
576
|
-
onRequest: async (url
|
|
577
|
-
let request
|
|
578
|
-
for (const fn of interceptors.request.fns) if (fn) request
|
|
579
|
-
return request
|
|
569
|
+
onRequest: async (url, init) => {
|
|
570
|
+
let request = new Request(url, init);
|
|
571
|
+
for (const fn of interceptors.request.fns) if (fn) request = await fn(request, opts);
|
|
572
|
+
return request;
|
|
580
573
|
},
|
|
581
574
|
serializedBody: getValidRequestBody(opts),
|
|
582
575
|
url
|
|
@@ -624,7 +617,7 @@ const client = createClient(createConfig({ baseUrl: "https://api.savanto.ai" }))
|
|
|
624
617
|
/**
|
|
625
618
|
* Send a chat message
|
|
626
619
|
*
|
|
627
|
-
* Send a message and
|
|
620
|
+
* Send a visitor message through the full multi-agent pipeline: triage classifies intent, query agents retrieve grounded context from the product / post indexes (plus any custom domain agents), and response agents synthesise a grounded answer with product cards or cited content. The response is streamed as NDJSON when `stream: true` (each line is one of `{ type: "token", ... }`, `{ type: "product", ... }`, `{ type: "done" }`), or returned as a single JSON object when `stream: false`. Pass `threadId` to continue a conversation (memories and prior turns are loaded); omit it for a fresh one. Respects the workspace's active persona / system-prompt configuration.
|
|
628
621
|
*/
|
|
629
622
|
const chat = (options) => (options?.client ?? client).post({
|
|
630
623
|
security: [{
|
|
@@ -641,7 +634,7 @@ const chat = (options) => (options?.client ?? client).post({
|
|
|
641
634
|
/**
|
|
642
635
|
* Start a website crawl
|
|
643
636
|
*
|
|
644
|
-
*
|
|
637
|
+
* Enqueue a crawl of the given root URL for the workspace in `X-Workspace-ID`. The crawler discovers pages via sitemap + link graph, classifies each page (product, product listing, or general content), and indexes products into `savanto-products` and content into `savanto-posts`. This call is asynchronous and returns immediately with a `crawlId`; poll `GET /crawl/{crawlId}/status` to track progress or subscribe to the email notification endpoint to be pinged when it completes. Starting a new crawl while one is already running for the same workspace will be rejected with 409 — cancel the running one first.
|
|
645
638
|
*/
|
|
646
639
|
const startCrawl = (options) => (options?.client ?? client).post({
|
|
647
640
|
security: [{
|
|
@@ -675,7 +668,7 @@ const scrapeSinglePage = (options) => (options?.client ?? client).post({
|
|
|
675
668
|
/**
|
|
676
669
|
* Get crawl configuration
|
|
677
670
|
*
|
|
678
|
-
*
|
|
671
|
+
* Return the persisted crawl configuration for the workspace (strategy, schedule, include / exclude URL patterns, max-pages budget, user-agent override). Use before a crawl to verify the active rules, or before an `update_crawl_config` call to preserve fields you are not changing.
|
|
679
672
|
*/
|
|
680
673
|
const getCrawlConfig = (options) => (options?.client ?? client).get({
|
|
681
674
|
security: [{
|
|
@@ -688,7 +681,7 @@ const getCrawlConfig = (options) => (options?.client ?? client).get({
|
|
|
688
681
|
/**
|
|
689
682
|
* Update crawl configuration
|
|
690
683
|
*
|
|
691
|
-
*
|
|
684
|
+
* Replace the crawl configuration for the workspace. Common fields: `strategy` (`full` reindexes everything, `smart` skips pages whose content hash matches the previous crawl), `schedule` (cron-like), `includePatterns` / `excludePatterns` (glob URL filters), `maxPages` (safety cap). Omitted fields are set to their defaults — if you only want to tweak one setting, `GET /crawl/config` first and merge. Changes take effect on the next crawl run.
|
|
692
685
|
*/
|
|
693
686
|
const updateCrawlConfig = (options) => (options?.client ?? client).put({
|
|
694
687
|
security: [{
|
|
@@ -705,7 +698,7 @@ const updateCrawlConfig = (options) => (options?.client ?? client).put({
|
|
|
705
698
|
/**
|
|
706
699
|
* Get crawl history
|
|
707
700
|
*
|
|
708
|
-
*
|
|
701
|
+
* Return a list of recent crawls for the tenant (or the workspace when `X-Workspace-ID` is set), newest first. Each entry has its final status (`completed`, `failed`, `cancelled`), page counts, duration, and any error summary — useful for diagnosing why a site's content is stale.
|
|
709
702
|
*/
|
|
710
703
|
const getCrawlHistory = (options) => (options?.client ?? client).get({
|
|
711
704
|
security: [{
|
|
@@ -718,7 +711,7 @@ const getCrawlHistory = (options) => (options?.client ?? client).get({
|
|
|
718
711
|
/**
|
|
719
712
|
* Get crawl status
|
|
720
713
|
*
|
|
721
|
-
*
|
|
714
|
+
* Return live status for a specific crawl id: `status` (`running`, `completed`, `failed`, `cancelled`), pages discovered / indexed / skipped / failed, elapsed time, and the current URL being processed. Poll every 3–10 seconds while `running`; stop polling once status is terminal. Returns 404 if the crawl id does not belong to the caller's tenant.
|
|
722
715
|
*/
|
|
723
716
|
const getCrawlStatus = (options) => (options.client ?? client).get({
|
|
724
717
|
security: [{
|
|
@@ -742,6 +735,23 @@ const cancelCrawl = (options) => (options.client ?? client).post({
|
|
|
742
735
|
...options
|
|
743
736
|
});
|
|
744
737
|
/**
|
|
738
|
+
* Enroll for a crawl-complete email
|
|
739
|
+
*
|
|
740
|
+
* Requests an email notification when this crawl reaches a terminal state (completed or failed). Intended for the dashboard "continue onboarding, email me when done" CTA. Rejects crawls that have already finished. **Admin-only endpoint.** The `email` in the body is treated as opaque and persisted verbatim; the cloud API does NOT authenticate ownership of that address. Callers holding the admin bearer are trusted to have derived the recipient from an authoritative source (e.g. the signed-in user session on the Next.js proxy). Do NOT expose this route via license-key / public scopes.
|
|
741
|
+
*/
|
|
742
|
+
const enrollCrawlNotification = (options) => (options.client ?? client).post({
|
|
743
|
+
security: [{
|
|
744
|
+
scheme: "bearer",
|
|
745
|
+
type: "http"
|
|
746
|
+
}],
|
|
747
|
+
url: "/crawl/{id}/notifications",
|
|
748
|
+
...options,
|
|
749
|
+
headers: {
|
|
750
|
+
"Content-Type": "application/json",
|
|
751
|
+
...options.headers
|
|
752
|
+
}
|
|
753
|
+
});
|
|
754
|
+
/**
|
|
745
755
|
* Scrape or delete a single page
|
|
746
756
|
*
|
|
747
757
|
* Scrape a URL and index it into the knowledge base, or delete a previously scraped page.
|
|
@@ -774,7 +784,7 @@ const listProducts = (options) => (options?.client ?? client).get({
|
|
|
774
784
|
/**
|
|
775
785
|
* Upsert a product
|
|
776
786
|
*
|
|
777
|
-
* Create or update
|
|
787
|
+
* Create a new product or update the existing one whose `externalId` matches the body. Embeddings for the product's searchable text are generated and persisted as part of the call, so the product becomes searchable immediately after a successful response. Required fields: `externalId`, `name`. Optional: `description`, `price` (in cents), `priceMin` / `priceMax`, `stockStatus` (`in_stock` | `out_of_stock` | `limited`), `images` (array of URLs), `brand`, `category`, `attributes` (key/value). Workspaces with native Shopify / WooCommerce sync should normally rely on the plugin rather than calling this endpoint directly. Idempotent on `externalId`.
|
|
778
788
|
*/
|
|
779
789
|
const upsertProduct = (options) => (options?.client ?? client).post({
|
|
780
790
|
security: [{
|
|
@@ -825,7 +835,7 @@ const bulkUpsertProducts = (options) => (options?.client ?? client).post({
|
|
|
825
835
|
/**
|
|
826
836
|
* Search products
|
|
827
837
|
*
|
|
828
|
-
*
|
|
838
|
+
* Hybrid (BM25 + k-NN vector) search across the workspace's product catalog. Pass a natural-language `query` — the backend expands and filters it with an agent when that improves recall. Optional `filters` support `priceMin` / `priceMax`, `stockStatus`, `brand`, `category`, and arbitrary `attributes` equality. Optional `facets` returns aggregate counts for the requested fields. Use for "find X" style requests; use the chat endpoint instead if you want a conversational answer that cites the products.
|
|
829
839
|
*/
|
|
830
840
|
const searchProducts = (options) => (options?.client ?? client).post({
|
|
831
841
|
security: [{
|
|
@@ -915,7 +925,7 @@ const patchProduct = (options) => (options.client ?? client).patch({
|
|
|
915
925
|
/**
|
|
916
926
|
* Upsert a post
|
|
917
927
|
*
|
|
918
|
-
* Create or update
|
|
928
|
+
* Create a new post / knowledge article or update the existing one whose `externalId` matches the body. Embeddings are generated synchronously so the post is immediately retrievable by chat and search. Required: `externalId`, `title`, `content` (markdown or plain text). Optional: `author`, `publishedAt` (ISO 8601), `url`, `tags`, `category`. Use this for help-center articles, FAQ entries, or arbitrary brand content that should be answerable via chat. For bulk backfills prefer `POST /posts/bulk`. Idempotent on `externalId`.
|
|
919
929
|
*/
|
|
920
930
|
const upsertPost = (options) => (options?.client ?? client).post({
|
|
921
931
|
security: [{
|
|
@@ -966,7 +976,7 @@ const bulkUpsertPosts = (options) => (options?.client ?? client).post({
|
|
|
966
976
|
/**
|
|
967
977
|
* Search posts
|
|
968
978
|
*
|
|
969
|
-
*
|
|
979
|
+
* Hybrid semantic + lexical search across the workspace's indexed posts / knowledge articles. Pass a natural-language `query`; the response returns the top-matching posts with excerpts, scores, and URLs. Use when you need raw passages to feed another agent; use the chat endpoint when you want a cited, synthesised answer rather than a list of hits.
|
|
970
980
|
*/
|
|
971
981
|
const searchPosts = (options) => (options?.client ?? client).post({
|
|
972
982
|
security: [{
|
|
@@ -1696,6 +1706,19 @@ const getTenantStatus = (options) => (options?.client ?? client).get({
|
|
|
1696
1706
|
...options
|
|
1697
1707
|
});
|
|
1698
1708
|
/**
|
|
1709
|
+
* Identity probe (tenant, scopes, key type)
|
|
1710
|
+
*
|
|
1711
|
+
* Return the tenant ID, tier, API key ID, key type, and scope list for the current caller. Designed for agent / MCP bootstrapping so clients can decide which operations are available before issuing them. Does NOT return any secret material.
|
|
1712
|
+
*/
|
|
1713
|
+
const getTenantWhoami = (options) => (options?.client ?? client).get({
|
|
1714
|
+
security: [{
|
|
1715
|
+
scheme: "bearer",
|
|
1716
|
+
type: "http"
|
|
1717
|
+
}],
|
|
1718
|
+
url: "/tenant/whoami",
|
|
1719
|
+
...options
|
|
1720
|
+
});
|
|
1721
|
+
/**
|
|
1699
1722
|
* Update tenant feature flags
|
|
1700
1723
|
*/
|
|
1701
1724
|
const updateTenantFeatures = (options) => (options?.client ?? client).patch({
|
|
@@ -1712,6 +1735,8 @@ const updateTenantFeatures = (options) => (options?.client ?? client).patch({
|
|
|
1712
1735
|
});
|
|
1713
1736
|
/**
|
|
1714
1737
|
* Get usage summary
|
|
1738
|
+
*
|
|
1739
|
+
* Return the authenticated tenant's current-period usage against plan limits: chat messages sent, products indexed, posts indexed, crawl pages processed, and the dates of the billing window. Use for quota-aware UX or to warn a user that the next operation would trip an overage.
|
|
1715
1740
|
*/
|
|
1716
1741
|
const getTenantUsage = (options) => (options?.client ?? client).get({
|
|
1717
1742
|
security: [{
|
|
@@ -1735,7 +1760,7 @@ const getTenantUsageHistory = (options) => (options?.client ?? client).get({
|
|
|
1735
1760
|
/**
|
|
1736
1761
|
* List workspaces
|
|
1737
1762
|
*
|
|
1738
|
-
*
|
|
1763
|
+
* Return every workspace owned by the authenticated tenant, with each workspace's id, name, platform (wordpress | shopify | custom | none), and domain. Use this before calling any workspace-scoped endpoint (crawl, products, posts, chat) to discover the correct `workspaceId` to pass via the `X-Workspace-ID` header. Always cheap and safe to call repeatedly.
|
|
1739
1764
|
*/
|
|
1740
1765
|
const listTenantWorkspaces = (options) => (options?.client ?? client).get({
|
|
1741
1766
|
security: [{
|
|
@@ -1748,7 +1773,7 @@ const listTenantWorkspaces = (options) => (options?.client ?? client).get({
|
|
|
1748
1773
|
/**
|
|
1749
1774
|
* Create a workspace
|
|
1750
1775
|
*
|
|
1751
|
-
* Create a new workspace under the authenticated tenant.
|
|
1776
|
+
* Create a new workspace (a distinct site / storefront) under the authenticated tenant. Returns the workspace id you will pass as `X-Workspace-ID` on every subsequent content, crawl, and chat request. Typical onboarding flow: create → (optionally set platform) → start crawl → ingest products/posts. Creation does NOT enqueue a crawl — call `POST /crawl` separately.
|
|
1752
1777
|
*/
|
|
1753
1778
|
const createTenantWorkspace = (options) => (options?.client ?? client).post({
|
|
1754
1779
|
security: [{
|
|
@@ -1764,6 +1789,8 @@ const createTenantWorkspace = (options) => (options?.client ?? client).post({
|
|
|
1764
1789
|
});
|
|
1765
1790
|
/**
|
|
1766
1791
|
* Delete a workspace
|
|
1792
|
+
*
|
|
1793
|
+
* Permanently delete a workspace and every document indexed under it (products, posts, taxonomies, chat threads, crawl history). This is NOT recoverable — prefer `POST /workspaces` to create a new one rather than delete + recreate for routine cleanup. Returns 404 if the id does not belong to the caller's tenant.
|
|
1767
1794
|
*/
|
|
1768
1795
|
const deleteWorkspace = (options) => (options.client ?? client).delete({
|
|
1769
1796
|
security: [{
|
|
@@ -1775,6 +1802,8 @@ const deleteWorkspace = (options) => (options.client ?? client).delete({
|
|
|
1775
1802
|
});
|
|
1776
1803
|
/**
|
|
1777
1804
|
* Update a workspace
|
|
1805
|
+
*
|
|
1806
|
+
* Patch name, platform, or metadata on an existing workspace. Accepts a partial body; omitted fields are left untouched. Changing `platform` from `none` to `wordpress` / `shopify` signals the ingestion pipeline to prefer native sync over crawl-derived content on subsequent operations.
|
|
1778
1807
|
*/
|
|
1779
1808
|
const updateWorkspace = (options) => (options.client ?? client).put({
|
|
1780
1809
|
security: [{
|
|
@@ -1872,7 +1901,7 @@ const getCredentialStatus = (options) => (options?.client ?? client).get({
|
|
|
1872
1901
|
scheme: "bearer",
|
|
1873
1902
|
type: "http"
|
|
1874
1903
|
}],
|
|
1875
|
-
url: "/tenant/credentials/status",
|
|
1904
|
+
url: "/tenant/live-agent/credentials/status",
|
|
1876
1905
|
...options
|
|
1877
1906
|
});
|
|
1878
1907
|
/**
|
|
@@ -1883,7 +1912,7 @@ const deleteCredentials = (options) => (options?.client ?? client).delete({
|
|
|
1883
1912
|
scheme: "bearer",
|
|
1884
1913
|
type: "http"
|
|
1885
1914
|
}],
|
|
1886
|
-
url: "/tenant/credentials",
|
|
1915
|
+
url: "/tenant/live-agent/credentials",
|
|
1887
1916
|
...options
|
|
1888
1917
|
});
|
|
1889
1918
|
/**
|
|
@@ -1894,7 +1923,7 @@ const storeCredentials = (options) => (options?.client ?? client).post({
|
|
|
1894
1923
|
scheme: "bearer",
|
|
1895
1924
|
type: "http"
|
|
1896
1925
|
}],
|
|
1897
|
-
url: "/tenant/credentials",
|
|
1926
|
+
url: "/tenant/live-agent/credentials",
|
|
1898
1927
|
...options,
|
|
1899
1928
|
headers: {
|
|
1900
1929
|
"Content-Type": "application/json",
|
|
@@ -1909,7 +1938,7 @@ const deleteLiveAgentSchedule = (options) => (options?.client ?? client).delete(
|
|
|
1909
1938
|
scheme: "bearer",
|
|
1910
1939
|
type: "http"
|
|
1911
1940
|
}],
|
|
1912
|
-
url: "/tenant/schedule",
|
|
1941
|
+
url: "/tenant/live-agent/schedule",
|
|
1913
1942
|
...options
|
|
1914
1943
|
});
|
|
1915
1944
|
/**
|
|
@@ -1920,7 +1949,7 @@ const getLiveAgentSchedule = (options) => (options?.client ?? client).get({
|
|
|
1920
1949
|
scheme: "bearer",
|
|
1921
1950
|
type: "http"
|
|
1922
1951
|
}],
|
|
1923
|
-
url: "/tenant/schedule",
|
|
1952
|
+
url: "/tenant/live-agent/schedule",
|
|
1924
1953
|
...options
|
|
1925
1954
|
});
|
|
1926
1955
|
/**
|
|
@@ -1931,7 +1960,7 @@ const updateLiveAgentSchedule = (options) => (options?.client ?? client).put({
|
|
|
1931
1960
|
scheme: "bearer",
|
|
1932
1961
|
type: "http"
|
|
1933
1962
|
}],
|
|
1934
|
-
url: "/tenant/schedule",
|
|
1963
|
+
url: "/tenant/live-agent/schedule",
|
|
1935
1964
|
...options,
|
|
1936
1965
|
headers: {
|
|
1937
1966
|
"Content-Type": "application/json",
|
|
@@ -2163,6 +2192,8 @@ const testDomainConnection = (options) => (options.client ?? client).post({
|
|
|
2163
2192
|
});
|
|
2164
2193
|
/**
|
|
2165
2194
|
* Get workspace details
|
|
2195
|
+
*
|
|
2196
|
+
* Return the full configuration for a workspace: platform, domain, crawl config, widget settings, chat persona, live-agent handoff, custom domains, and document counts. Preferred read for agent bootstrap because it returns every knob in one call.
|
|
2166
2197
|
*/
|
|
2167
2198
|
const getWorkspaceDetails = (options) => (options.client ?? client).get({
|
|
2168
2199
|
security: [{
|
|
@@ -2459,6 +2490,40 @@ const adminResetCrawls = (options) => (options.client ?? client).post({
|
|
|
2459
2490
|
url: "/admin/tenant/{tenantId}/crawls/reset",
|
|
2460
2491
|
...options
|
|
2461
2492
|
});
|
|
2493
|
+
/**
|
|
2494
|
+
* Redact a customer across all stored PII
|
|
2495
|
+
*
|
|
2496
|
+
* Hard-deletes every thread document and memory document within the caller tenant that matches the supplied customer identifiers. Runs as async OpenSearch tasks; the response contains task IDs for reconciliation. Idempotent when `caller.externalId` is supplied.
|
|
2497
|
+
*/
|
|
2498
|
+
const complianceCustomerRedact = (options) => (options?.client ?? client).post({
|
|
2499
|
+
security: [{
|
|
2500
|
+
scheme: "bearer",
|
|
2501
|
+
type: "http"
|
|
2502
|
+
}],
|
|
2503
|
+
url: "/compliance/customer-redact",
|
|
2504
|
+
...options,
|
|
2505
|
+
headers: {
|
|
2506
|
+
"Content-Type": "application/json",
|
|
2507
|
+
...options?.headers
|
|
2508
|
+
}
|
|
2509
|
+
});
|
|
2510
|
+
/**
|
|
2511
|
+
* Record a customer data-export request
|
|
2512
|
+
*
|
|
2513
|
+
* Queues a customer data-export request and notifies ops to fulfill it within Shopify's 30-day SLA. Idempotent when `caller.externalId` is supplied.
|
|
2514
|
+
*/
|
|
2515
|
+
const complianceCustomerDataRequest = (options) => (options?.client ?? client).post({
|
|
2516
|
+
security: [{
|
|
2517
|
+
scheme: "bearer",
|
|
2518
|
+
type: "http"
|
|
2519
|
+
}],
|
|
2520
|
+
url: "/compliance/customer-data-request",
|
|
2521
|
+
...options,
|
|
2522
|
+
headers: {
|
|
2523
|
+
"Content-Type": "application/json",
|
|
2524
|
+
...options?.headers
|
|
2525
|
+
}
|
|
2526
|
+
});
|
|
2462
2527
|
|
|
2463
2528
|
//#endregion
|
|
2464
2529
|
//#region src/util.ts
|
|
@@ -2480,5 +2545,5 @@ function workspaceIdFromUrl(url) {
|
|
|
2480
2545
|
}
|
|
2481
2546
|
|
|
2482
2547
|
//#endregion
|
|
2483
|
-
export { adminClaimTenant, adminDeleteTenant, adminFindByEmail, adminFindByOwner, adminGetTenant, adminGetUsage, adminReactivateTenant, adminResetCrawls, adminUpdateOwnerEmail, adminUpdateSubscription, adminUpdateTier, adminUpdateUsage, bulkDeletePosts, bulkDeleteProducts, bulkDeletePrompts, bulkDeleteTaxonomies, bulkDeleteThreads, bulkUpdateWebhookStatus, bulkUpsertPosts, bulkUpsertProducts, bulkUpsertPrompts, bulkUpsertTaxonomies, cancelCrawl, chat, clearDomainErrors, client, commitSearch, createApiKey, createClient, createConfig, createCustomDomain, createTenantWorkspace, createWebhook, deleteCredentials, deleteCustomDomain, deleteFeedback, deleteLiveAgentSchedule, deleteMcpConfig, deletePost, deletePostsByQuery, deleteProduct, deleteProductsByQuery, deletePrompt, deleteTaxonomiesByQuery, deleteTaxonomy, deleteTenant, deleteThread, deleteWebhook, deleteWorkspace, deprovision, discoverTools, endHandoff, exportThreads, generateDomainConfig, getAnalyticsFeedback, getChatAnalytics, getChatWidgetConfig, getCrawlConfig, getCrawlHistory, getCrawlStatus, getCredentialStatus, getDomainErrorSummary, getDomainErrors, getDomainTemplates, getFeedbackAnalytics, getKnowledge, getLiveAgentSchedule, getLiveAgentStatus, getMcpConfig, getPost, getProduct, getProductRecommendations, getPrompt, getSearchAnalytics, getSearchWidgetConfig, getTaxonomy, getTenantStatus, getTenantUsage, getTenantUsageHistory, getThread, getThreadAnalytics, getThreadFeedback, getThreadMessages, getUploadUrl, getWebhook, getWebhookStats, getWorkspaceDetails, getWorkspaceSettings, listApiKeys, listCustomDomains, listFeedback, listPostIds, listProductIds, listProducts, listPrompts, listSlackChannels, listTaxonomies, listTaxonomyIds, listTenantWorkspaces, listWebhooks, patchPost, patchProduct, provisionShopify, revokeApiKey, rotateApiKey, scrapePage, scrapeSinglePage, searchKnowledge, searchPosts, searchProducts, searchPrompts, searchSearches, searchThreads, startCrawl, storeCredentials, submitFeedback, testDomainConnection, testWebhook, updateChatWidgetConfig, updateCrawlConfig, updateCustomDomain, updateLiveAgentSchedule, updateMcpConfig, updateSearchWidgetConfig, updateTenantFeatures, updateWebhook, updateWorkspace, updateWorkspaceSettings, upsertPost, upsertProduct, upsertPrompt, upsertTaxonomy, validateCustomDomain, workspaceIdFromUrl };
|
|
2548
|
+
export { adminClaimTenant, adminDeleteTenant, adminFindByEmail, adminFindByOwner, adminGetTenant, adminGetUsage, adminReactivateTenant, adminResetCrawls, adminUpdateOwnerEmail, adminUpdateSubscription, adminUpdateTier, adminUpdateUsage, bulkDeletePosts, bulkDeleteProducts, bulkDeletePrompts, bulkDeleteTaxonomies, bulkDeleteThreads, bulkUpdateWebhookStatus, bulkUpsertPosts, bulkUpsertProducts, bulkUpsertPrompts, bulkUpsertTaxonomies, cancelCrawl, chat, clearDomainErrors, client, commitSearch, complianceCustomerDataRequest, complianceCustomerRedact, createApiKey, createClient, createConfig, createCustomDomain, createTenantWorkspace, createWebhook, deleteCredentials, deleteCustomDomain, deleteFeedback, deleteLiveAgentSchedule, deleteMcpConfig, deletePost, deletePostsByQuery, deleteProduct, deleteProductsByQuery, deletePrompt, deleteTaxonomiesByQuery, deleteTaxonomy, deleteTenant, deleteThread, deleteWebhook, deleteWorkspace, deprovision, discoverTools, endHandoff, enrollCrawlNotification, exportThreads, generateDomainConfig, getAnalyticsFeedback, getChatAnalytics, getChatWidgetConfig, getCrawlConfig, getCrawlHistory, getCrawlStatus, getCredentialStatus, getDomainErrorSummary, getDomainErrors, getDomainTemplates, getFeedbackAnalytics, getKnowledge, getLiveAgentSchedule, getLiveAgentStatus, getMcpConfig, getPost, getProduct, getProductRecommendations, getPrompt, getSearchAnalytics, getSearchWidgetConfig, getTaxonomy, getTenantStatus, getTenantUsage, getTenantUsageHistory, getTenantWhoami, getThread, getThreadAnalytics, getThreadFeedback, getThreadMessages, getUploadUrl, getWebhook, getWebhookStats, getWorkspaceDetails, getWorkspaceSettings, listApiKeys, listCustomDomains, listFeedback, listPostIds, listProductIds, listProducts, listPrompts, listSlackChannels, listTaxonomies, listTaxonomyIds, listTenantWorkspaces, listWebhooks, patchPost, patchProduct, provisionShopify, revokeApiKey, rotateApiKey, scrapePage, scrapeSinglePage, searchKnowledge, searchPosts, searchProducts, searchPrompts, searchSearches, searchThreads, startCrawl, storeCredentials, submitFeedback, testDomainConnection, testWebhook, updateChatWidgetConfig, updateCrawlConfig, updateCustomDomain, updateLiveAgentSchedule, updateMcpConfig, updateSearchWidgetConfig, updateTenantFeatures, updateWebhook, updateWorkspace, updateWorkspaceSettings, upsertPost, upsertProduct, upsertPrompt, upsertTaxonomy, validateCustomDomain, workspaceIdFromUrl };
|
|
2484
2549
|
//# sourceMappingURL=index.mjs.map
|