@proveanything/smartlinks 2.1.39 → 2.1.40

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.
@@ -110,7 +110,7 @@ export interface DestinationInfo {
110
110
  /** The platform's screens any admin screen can open by name. */
111
111
  export declare const DESTINATIONS: DestinationInfo[];
112
112
  /** A destination name. Any string is accepted, so a newer host's names work on an older SDK. */
113
- export type Destination = 'contacts' | 'contact' | 'contact.messages' | 'contact.conversations' | 'conversation' | 'segment' | 'loyalty.scheme' | 'message.compose' | 'message.log' | 'campaign.new' | 'campaign' | 'templates' | 'template' | 'product' | 'proof' | 'interaction.type' | 'batch' | 'variant' | 'lot' | 'tags' | 'print' | 'form' | 'assets' | 'asset' | 'asset.history' | 'places' | 'settings.billing' | 'settings.integrations' | 'settings.guide' | 'settings.translationRules' | 'settings' | 'settings.address' | 'settings.domain' | 'settings.languages' | 'settings.translations' | 'settings.email' | 'settings.team' | 'settings.userGroups' | 'settings.setupLists' | 'settings.portal' | 'settings.hub' | 'settings.signIn' | 'media' | 'app' | (string & {});
113
+ export type Destination = 'contacts' | 'contact' | 'contact.messages' | 'contact.conversations' | 'conversation' | 'segment' | 'loyalty.scheme' | 'message.compose' | 'message.log' | 'campaign.new' | 'campaign' | 'templates' | 'template' | 'product' | 'proof' | 'interaction.type' | 'batch' | 'variant' | 'lot' | 'tags' | 'print' | 'form' | 'assets' | 'asset' | 'asset.history' | 'places' | 'settings.billing' | 'settings.addons' | 'settings.modules' | 'settings.integrations' | 'settings.guide' | 'settings.translationRules' | 'settings' | 'settings.address' | 'settings.domain' | 'settings.languages' | 'settings.translations' | 'settings.email' | 'settings.team' | 'settings.userGroups' | 'settings.setupLists' | 'settings.portal' | 'settings.hub' | 'settings.signIn' | 'media' | 'app' | (string & {});
114
114
  /** What a message is about (the same shape as `comms.sendTransactional`'s `about`). Ids only. */
115
115
  export interface DestinationAbout {
116
116
  appId?: string;
@@ -299,7 +299,9 @@ export const DESTINATIONS = [
299
299
  { name: 'settings.email', required: [], description: 'Email settings: the sending address and its look.' },
300
300
  { name: 'settings.team', required: [], description: 'The people who run the business in Studio.' },
301
301
  { name: 'settings.userGroups', required: [], description: 'User groups.' },
302
- { name: 'settings.billing', required: [], description: 'Billing: the plan, invoices and AI credits (top up when the allowance is used up).' },
302
+ { name: 'settings.billing', required: [], optional: ['intent'], description: 'Billing: the plan, invoices and AI credits (top up when the allowance is used up). intent=upgrade opens on the plans to move up to.' },
303
+ { name: 'settings.addons', required: [], description: 'Add-ons: features the account can switch on (on enterprise, each feature can be switched).' },
304
+ { name: 'settings.modules', required: [], description: 'Modules: install, reorder and remove the apps the account uses.' },
303
305
  { name: 'settings.integrations', required: [], description: 'Integrations: connections to other systems.' },
304
306
  { name: 'settings.guide', required: [], description: 'The customer guide: the assistant visitors talk to.' },
305
307
  { name: 'settings.translationRules', required: [], description: 'Translation rules: the brief, notes per language and terms to keep.' },
@@ -7,7 +7,7 @@ export interface BuiltinAiToolDescriptor {
7
7
  /** Capability tags the tool requires. */
8
8
  capabilities: AiToolCapability[];
9
9
  /** Grouping for tool-picker UIs. */
10
- group: 'web' | 'vision' | 'image' | 'media' | 'net' | 'text';
10
+ group: 'web' | 'vision' | 'image' | 'media' | 'net' | 'text' | 'knowledge';
11
11
  }
12
12
  /** Stable name constants — reference tools without stringly-typed literals. */
13
13
  export declare const AI_TOOL_NAMES: {
@@ -37,6 +37,7 @@ export declare const AI_TOOL_NAMES: {
37
37
  readonly PDF_PRINT_READY: "pdf.printReady";
38
38
  readonly HTTP_REQUEST: "http.request";
39
39
  readonly TRANSLATE: "translate";
40
+ readonly KNOWLEDGE_SEARCH: "knowledge.search";
40
41
  };
41
42
  /** The curated core toolset shipped with the SDK. */
42
43
  export declare const BUILTIN_AI_TOOLS: BuiltinAiToolDescriptor[];
package/dist/ai-tools.js CHANGED
@@ -34,9 +34,12 @@ export const AI_TOOL_NAMES = {
34
34
  PDF_PRINT_READY: 'pdf.printReady',
35
35
  HTTP_REQUEST: 'http.request',
36
36
  TRANSLATE: 'translate',
37
+ KNOWLEDGE_SEARCH: 'knowledge.search',
37
38
  };
38
39
  /** The curated core toolset shipped with the SDK. */
39
40
  export const BUILTIN_AI_TOOLS = [
41
+ { name: 'knowledge.search', group: 'knowledge', capabilities: ['knowledge:read'],
42
+ description: "Search the business's own knowledge (help articles, manuals, docs) by meaning and keywords; returns passages with links." },
40
43
  { name: 'web.search', group: 'web', capabilities: ['web:read'],
41
44
  description: 'Search the live web; returns candidate results (url/title/description) to then read.' },
42
45
  { name: 'web.fetchPage', group: 'web', capabilities: ['web:read'],
package/dist/api/ai.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { guide as guideApi, content as contentApi, startLive } from "./aiGuide.js";
2
- import type { ContentPart, FunctionCall, ToolCall, ChatMessage, ToolDefinition, ResponseTool, ResponseInputItem, ResponsesRequest, ResponsesResult, ResponsesStreamEvent, ChatCompletionRequest, ChatCompletionChoice, ChatCompletionResponse, ChatCompletionChunk, AIModel, AIModelListParams, AIModelListResponse, AgentRunRequest, AgentRunResult, AgentToolsQuery, AgentToolsResponse, ToolRunResult, AiToolName, AiToolArgsMap, PublicAgentRunRequest, ClientTool, RunWithClientToolsOptions, SkillsListResponse, CatalogResponse, DocumentChunk, IndexDocumentRequest, IndexDocumentResponse, ConfigureAssistantRequest, ConfigureAssistantResponse, PublicChatRequest, PublicChatResponse, Session, RateLimitStatus, SessionStatistics, AiSession, AiSessionCreate, AiUsageReport, VoiceSessionRequest, VoiceSessionResponse, EphemeralTokenRequest, EphemeralTokenResponse, TranscriptionResponse, TTSRequest, GeneratePodcastRequest, PodcastScript, GeneratePodcastResponse, PodcastStatus, AIGenerateContentRequest, AIGenerateContentCandidate, AIGenerateContentResponse, AIGenerateImageRequest, AIGenerateImageResponse, AIGeneratedImage, AISearchPhotosRequest, AISearchPhotosPhoto, AISearchPhotosResponse, AIUploadedFile, AICacheRef } from "../types/ai.js";
3
- export type { ContentPart, FunctionCall, ToolCall, ChatMessage, ToolDefinition, ResponseTool, ResponseInputItem, ResponsesRequest, ResponsesResult, ResponsesStreamEvent, ChatCompletionRequest, ChatCompletionChoice, ChatCompletionResponse, ChatCompletionChunk, AIModel, AIModelListParams, AIModelListResponse, DocumentChunk, IndexDocumentRequest, IndexDocumentResponse, ConfigureAssistantRequest, ConfigureAssistantResponse, PublicChatRequest, PublicChatResponse, Session, RateLimitStatus, SessionStatistics, AiSession, AiSessionCreate, AiUsageReport, VoiceSessionRequest, VoiceSessionResponse, EphemeralTokenRequest, EphemeralTokenResponse, TranscriptionResponse, TTSRequest, GeneratePodcastRequest, PodcastScript, GeneratePodcastResponse, PodcastStatus, AIGenerateContentRequest, AIGenerateContentCandidate, AIGenerateContentResponse, AIGenerateImageRequest, AIGenerateImageResponse, AIGeneratedImage, AISearchPhotosRequest, AISearchPhotosPhoto, AISearchPhotosResponse, AIUploadedFile, AICacheRef, };
2
+ import type { ContentPart, FunctionCall, ToolCall, ChatMessage, ToolDefinition, ResponseTool, ResponseInputItem, ResponsesRequest, ResponsesResult, ResponsesStreamEvent, ChatCompletionRequest, ChatCompletionChoice, ChatCompletionResponse, ChatCompletionChunk, AIModel, AIModelListParams, AIModelListResponse, AgentRunRequest, AgentRunResult, AgentToolsQuery, AgentToolsResponse, ToolRunResult, AiToolName, AiToolArgsMap, PublicAgentRunRequest, ClientTool, RunWithClientToolsOptions, SkillsListResponse, CatalogResponse, Session, RateLimitStatus, SessionStatistics, AiSession, AiSessionCreate, AiUsageReport, VoiceSessionRequest, VoiceSessionResponse, EphemeralTokenRequest, EphemeralTokenResponse, TranscriptionResponse, TTSRequest, GeneratePodcastRequest, PodcastScript, GeneratePodcastResponse, PodcastStatus, AIGenerateContentRequest, AIGenerateContentCandidate, AIGenerateContentResponse, AIGenerateImageRequest, AIGenerateImageResponse, AIGeneratedImage, AISearchPhotosRequest, AISearchPhotosPhoto, AISearchPhotosResponse, AIUploadedFile, AICacheRef } from "../types/ai.js";
3
+ export type { ContentPart, FunctionCall, ToolCall, ChatMessage, ToolDefinition, ResponseTool, ResponseInputItem, ResponsesRequest, ResponsesResult, ResponsesStreamEvent, ChatCompletionRequest, ChatCompletionChoice, ChatCompletionResponse, ChatCompletionChunk, AIModel, AIModelListParams, AIModelListResponse, Session, RateLimitStatus, SessionStatistics, AiSession, AiSessionCreate, AiUsageReport, VoiceSessionRequest, VoiceSessionResponse, EphemeralTokenRequest, EphemeralTokenResponse, TranscriptionResponse, TTSRequest, GeneratePodcastRequest, PodcastScript, GeneratePodcastResponse, PodcastStatus, AIGenerateContentRequest, AIGenerateContentCandidate, AIGenerateContentResponse, AIGenerateImageRequest, AIGenerateImageResponse, AIGeneratedImage, AISearchPhotosRequest, AISearchPhotosPhoto, AISearchPhotosResponse, AIUploadedFile, AICacheRef, };
4
4
  declare namespace aiInternal {
5
5
  namespace chat {
6
6
  namespace responses {
@@ -70,16 +70,6 @@ declare namespace aiInternal {
70
70
  */
71
71
  function get(collectionId: string, modelId: string): Promise<AIModel>;
72
72
  }
73
- namespace rag {
74
- /**
75
- * Index a document for RAG
76
- */
77
- function indexDocument(collectionId: string, request: IndexDocumentRequest): Promise<IndexDocumentResponse>;
78
- /**
79
- * Configure AI assistant behavior
80
- */
81
- function configureAssistant(collectionId: string, request: ConfigureAssistantRequest): Promise<ConfigureAssistantResponse>;
82
- }
83
73
  namespace sessions {
84
74
  /**
85
75
  * Get session statistics
@@ -146,10 +136,6 @@ declare namespace aiInternal {
146
136
  function generate(collectionId: string, request: TTSRequest): Promise<Blob>;
147
137
  }
148
138
  namespace publicClient {
149
- /**
150
- * Chat with product assistant (RAG)
151
- */
152
- function chat(collectionId: string, request: PublicChatRequest): Promise<PublicChatResponse>;
153
139
  /**
154
140
  * Public agent loop — run the orchestration-neutral tool loop on the consumer surface. Exposes an
155
141
  * app's PUBLIC server functions (`agent.tool:true`, `visibility:'public'`) to a consumer assistant;
@@ -268,10 +254,6 @@ export declare const ai: {
268
254
  list: typeof aiInternal.models.list;
269
255
  get: typeof aiInternal.models.get;
270
256
  };
271
- rag: {
272
- indexDocument: typeof aiInternal.rag.indexDocument;
273
- configureAssistant: typeof aiInternal.rag.configureAssistant;
274
- };
275
257
  sessions: {
276
258
  stats: typeof aiInternal.sessions.stats;
277
259
  };
@@ -286,7 +268,6 @@ export declare const ai: {
286
268
  generate: typeof aiInternal.tts.generate;
287
269
  };
288
270
  public: {
289
- chat: typeof aiInternal.publicClient.chat;
290
271
  agentRun: typeof aiInternal.publicClient.agentRun;
291
272
  getSession: typeof aiInternal.publicClient.getSession;
292
273
  clearSession: typeof aiInternal.publicClient.clearSession;
package/dist/api/ai.js CHANGED
@@ -151,28 +151,6 @@ var aiInternal;
151
151
  models.get = get;
152
152
  })(models = aiInternal.models || (aiInternal.models = {}));
153
153
  // ============================================================================
154
- // RAG API
155
- // ============================================================================
156
- let rag;
157
- (function (rag) {
158
- /**
159
- * Index a document for RAG
160
- */
161
- async function indexDocument(collectionId, request) {
162
- const path = `/admin/collection/${encodeURIComponent(collectionId)}/ai/indexDocument`;
163
- return post(path, request);
164
- }
165
- rag.indexDocument = indexDocument;
166
- /**
167
- * Configure AI assistant behavior
168
- */
169
- async function configureAssistant(collectionId, request) {
170
- const path = `/admin/collection/${encodeURIComponent(collectionId)}/ai/configureAssistant`;
171
- return post(path, request);
172
- }
173
- rag.configureAssistant = configureAssistant;
174
- })(rag = aiInternal.rag || (aiInternal.rag = {}));
175
- // ============================================================================
176
154
  // Sessions API
177
155
  // ============================================================================
178
156
  let sessions;
@@ -294,14 +272,6 @@ var aiInternal;
294
272
  // ============================================================================
295
273
  let publicClient;
296
274
  (function (publicClient) {
297
- /**
298
- * Chat with product assistant (RAG)
299
- */
300
- async function chat(collectionId, request) {
301
- const path = `/public/collection/${encodeURIComponent(collectionId)}/ai/chat`;
302
- return post(path, request);
303
- }
304
- publicClient.chat = chat;
305
275
  /**
306
276
  * Public agent loop — run the orchestration-neutral tool loop on the consumer surface. Exposes an
307
277
  * app's PUBLIC server functions (`agent.tool:true`, `visibility:'public'`) to a consumer assistant;
@@ -548,10 +518,6 @@ export const ai = {
548
518
  list: aiInternal.models.list,
549
519
  get: aiInternal.models.get,
550
520
  },
551
- rag: {
552
- indexDocument: aiInternal.rag.indexDocument,
553
- configureAssistant: aiInternal.rag.configureAssistant,
554
- },
555
521
  sessions: {
556
522
  stats: aiInternal.sessions.stats,
557
523
  },
@@ -566,7 +532,6 @@ export const ai = {
566
532
  generate: aiInternal.tts.generate,
567
533
  },
568
534
  public: {
569
- chat: aiInternal.publicClient.chat,
570
535
  agentRun: aiInternal.publicClient.agentRun,
571
536
  getSession: aiInternal.publicClient.getSession,
572
537
  clearSession: aiInternal.publicClient.clearSession,
@@ -29,6 +29,7 @@ export { userGroups } from "./userGroups.js";
29
29
  export { conditions } from "./conditions.js";
30
30
  export { wallet } from "./wallet.js";
31
31
  export { files } from "./files.js";
32
+ export { knowledge } from "./knowledge.js";
32
33
  export { operations } from "./operations.js";
33
34
  export { journeys } from "./journeys.js";
34
35
  export { journeysAnalytics } from "./journeysAnalytics.js";
package/dist/api/index.js CHANGED
@@ -31,6 +31,7 @@ export { userGroups } from "./userGroups.js";
31
31
  export { conditions } from "./conditions.js";
32
32
  export { wallet } from "./wallet.js";
33
33
  export { files } from "./files.js";
34
+ export { knowledge } from "./knowledge.js";
34
35
  export { operations } from "./operations.js";
35
36
  export { journeys } from "./journeys.js";
36
37
  export { journeysAnalytics } from "./journeysAnalytics.js";
@@ -0,0 +1,64 @@
1
+ import type { KnowledgeSet, SaveKnowledgeSetRequest, UpdateKnowledgeSetRequest, KnowledgeSource, AddKnowledgeSourceRequest, UpdateKnowledgeSourceRequest, KnowledgeDocument, KnowledgeSearchRequest, KnowledgeSearchResponse } from "../types/knowledge.js";
2
+ /**
3
+ * Knowledge search: make a collection's content searchable by meaning and keywords, for people and for AI.
4
+ *
5
+ * A collection has **sets** ("Product manuals", "Help articles"), each `public`, `customer` (signed-in
6
+ * people) or `staff`. A set points at **sources**: a Markdown feed, a web page, or documents your app pushes.
7
+ * The platform splits them into passages along their headings, keeps them in step as the sources change, and
8
+ * searches with meaning and keywords together, so exact terms (model numbers, error codes) are found too.
9
+ *
10
+ * - Admin calls (`listSets`, `saveSet`, `addSource`, `upsertDocuments`, `search`) need a collection admin.
11
+ * - `publicSearch` works from a website, Portal or Hub: anyone sees public sets, a signed-in person customer
12
+ * sets too. Staff sets are never searchable there.
13
+ * - AI agents get the `knowledge.search` tool.
14
+ *
15
+ * @example
16
+ * ```typescript
17
+ * await knowledge.saveSet('coll_123', { key: 'manuals', name: 'Product manuals', visibility: 'public' })
18
+ * const src = await knowledge.addSource('coll_123', 'manuals', { kind: 'documents' })
19
+ * await knowledge.upsertDocuments('coll_123', src.id, [
20
+ * { ref: 'kettle', title: 'Kettle manual', body: '## Descaling\n\nDescale monthly…', meta: { productId: 'p1' } },
21
+ * ])
22
+ * const { results } = await knowledge.publicSearch('coll_123', { query: 'how do I descale', filters: { productId: 'p1' } })
23
+ * ```
24
+ */
25
+ export declare namespace knowledge {
26
+ /** Every set, with its source and passage counts (admin). */
27
+ function listSets(collectionId: string): Promise<KnowledgeSet[]>;
28
+ /** Create a set, or update the one with this key (admin). */
29
+ function saveSet(collectionId: string, body: SaveKnowledgeSetRequest): Promise<KnowledgeSet>;
30
+ /** One set, by id or key (admin). */
31
+ function getSet(collectionId: string, set: string): Promise<KnowledgeSet>;
32
+ function updateSet(collectionId: string, set: string, body: UpdateKnowledgeSetRequest): Promise<KnowledgeSet>;
33
+ /** Delete a set with its sources and passages (admin). */
34
+ function deleteSet(collectionId: string, set: string): Promise<{
35
+ deleted: boolean;
36
+ }>;
37
+ /** A set's sources, with their status (admin). */
38
+ function listSources(collectionId: string, set: string): Promise<KnowledgeSource[]>;
39
+ /** Add a source; feeds and pages are read in the background (admin). */
40
+ function addSource(collectionId: string, set: string, body: AddKnowledgeSourceRequest): Promise<KnowledgeSource>;
41
+ function updateSource(collectionId: string, sourceId: string, body: UpdateKnowledgeSourceRequest): Promise<KnowledgeSource>;
42
+ function deleteSource(collectionId: string, sourceId: string): Promise<{
43
+ deleted: boolean;
44
+ }>;
45
+ /** Read a source again now (`force` re-splits even if it hasn't changed) (admin). */
46
+ function reindex(collectionId: string, sourceId: string, opts?: {
47
+ force?: boolean;
48
+ }): Promise<{
49
+ queued: boolean;
50
+ }>;
51
+ /** Push documents into a `documents` source; the same `ref` replaces its earlier version. Up to 500 at a time (admin). */
52
+ function upsertDocuments(collectionId: string, sourceId: string, documents: KnowledgeDocument[]): Promise<{
53
+ documents: number;
54
+ passages: number;
55
+ }>;
56
+ /** Remove pushed documents by `ref` (admin). */
57
+ function removeDocuments(collectionId: string, sourceId: string, refs: string[]): Promise<{
58
+ removed: number;
59
+ }>;
60
+ /** Search every set, staff ones included (admin). */
61
+ function search(collectionId: string, body: KnowledgeSearchRequest): Promise<KnowledgeSearchResponse>;
62
+ /** Search from a website, Portal or Hub: public sets, plus customer sets for a signed-in person. */
63
+ function publicSearch(collectionId: string, body: KnowledgeSearchRequest): Promise<KnowledgeSearchResponse>;
64
+ }
@@ -0,0 +1,97 @@
1
+ import { request, post, patch, del } from "../http.js";
2
+ /**
3
+ * Knowledge search: make a collection's content searchable by meaning and keywords, for people and for AI.
4
+ *
5
+ * A collection has **sets** ("Product manuals", "Help articles"), each `public`, `customer` (signed-in
6
+ * people) or `staff`. A set points at **sources**: a Markdown feed, a web page, or documents your app pushes.
7
+ * The platform splits them into passages along their headings, keeps them in step as the sources change, and
8
+ * searches with meaning and keywords together, so exact terms (model numbers, error codes) are found too.
9
+ *
10
+ * - Admin calls (`listSets`, `saveSet`, `addSource`, `upsertDocuments`, `search`) need a collection admin.
11
+ * - `publicSearch` works from a website, Portal or Hub: anyone sees public sets, a signed-in person customer
12
+ * sets too. Staff sets are never searchable there.
13
+ * - AI agents get the `knowledge.search` tool.
14
+ *
15
+ * @example
16
+ * ```typescript
17
+ * await knowledge.saveSet('coll_123', { key: 'manuals', name: 'Product manuals', visibility: 'public' })
18
+ * const src = await knowledge.addSource('coll_123', 'manuals', { kind: 'documents' })
19
+ * await knowledge.upsertDocuments('coll_123', src.id, [
20
+ * { ref: 'kettle', title: 'Kettle manual', body: '## Descaling\n\nDescale monthly…', meta: { productId: 'p1' } },
21
+ * ])
22
+ * const { results } = await knowledge.publicSearch('coll_123', { query: 'how do I descale', filters: { productId: 'p1' } })
23
+ * ```
24
+ */
25
+ export var knowledge;
26
+ (function (knowledge) {
27
+ const adm = (collectionId) => `/admin/collection/${encodeURIComponent(collectionId)}/knowledge`;
28
+ const pub = (collectionId) => `/public/collection/${encodeURIComponent(collectionId)}/knowledge`;
29
+ const enc = encodeURIComponent;
30
+ /** Every set, with its source and passage counts (admin). */
31
+ async function listSets(collectionId) {
32
+ return request(`${adm(collectionId)}/sets`);
33
+ }
34
+ knowledge.listSets = listSets;
35
+ /** Create a set, or update the one with this key (admin). */
36
+ async function saveSet(collectionId, body) {
37
+ return post(`${adm(collectionId)}/sets`, body);
38
+ }
39
+ knowledge.saveSet = saveSet;
40
+ /** One set, by id or key (admin). */
41
+ async function getSet(collectionId, set) {
42
+ return request(`${adm(collectionId)}/sets/${enc(set)}`);
43
+ }
44
+ knowledge.getSet = getSet;
45
+ async function updateSet(collectionId, set, body) {
46
+ return patch(`${adm(collectionId)}/sets/${enc(set)}`, body);
47
+ }
48
+ knowledge.updateSet = updateSet;
49
+ /** Delete a set with its sources and passages (admin). */
50
+ async function deleteSet(collectionId, set) {
51
+ return del(`${adm(collectionId)}/sets/${enc(set)}`);
52
+ }
53
+ knowledge.deleteSet = deleteSet;
54
+ /** A set's sources, with their status (admin). */
55
+ async function listSources(collectionId, set) {
56
+ return request(`${adm(collectionId)}/sets/${enc(set)}/sources`);
57
+ }
58
+ knowledge.listSources = listSources;
59
+ /** Add a source; feeds and pages are read in the background (admin). */
60
+ async function addSource(collectionId, set, body) {
61
+ return post(`${adm(collectionId)}/sets/${enc(set)}/sources`, body);
62
+ }
63
+ knowledge.addSource = addSource;
64
+ async function updateSource(collectionId, sourceId, body) {
65
+ return patch(`${adm(collectionId)}/sources/${enc(sourceId)}`, body);
66
+ }
67
+ knowledge.updateSource = updateSource;
68
+ async function deleteSource(collectionId, sourceId) {
69
+ return del(`${adm(collectionId)}/sources/${enc(sourceId)}`);
70
+ }
71
+ knowledge.deleteSource = deleteSource;
72
+ /** Read a source again now (`force` re-splits even if it hasn't changed) (admin). */
73
+ async function reindex(collectionId, sourceId, opts = {}) {
74
+ return post(`${adm(collectionId)}/sources/${enc(sourceId)}/reindex`, opts);
75
+ }
76
+ knowledge.reindex = reindex;
77
+ /** Push documents into a `documents` source; the same `ref` replaces its earlier version. Up to 500 at a time (admin). */
78
+ async function upsertDocuments(collectionId, sourceId, documents) {
79
+ return post(`${adm(collectionId)}/sources/${enc(sourceId)}/documents`, { documents });
80
+ }
81
+ knowledge.upsertDocuments = upsertDocuments;
82
+ /** Remove pushed documents by `ref` (admin). */
83
+ async function removeDocuments(collectionId, sourceId, refs) {
84
+ return post(`${adm(collectionId)}/sources/${enc(sourceId)}/documents/remove`, { refs });
85
+ }
86
+ knowledge.removeDocuments = removeDocuments;
87
+ /** Search every set, staff ones included (admin). */
88
+ async function search(collectionId, body) {
89
+ return post(`${adm(collectionId)}/search`, body);
90
+ }
91
+ knowledge.search = search;
92
+ /** Search from a website, Portal or Hub: public sets, plus customer sets for a signed-in person. */
93
+ async function publicSearch(collectionId, body) {
94
+ return post(`${pub(collectionId)}/search`, body);
95
+ }
96
+ knowledge.publicSearch = publicSearch;
97
+ })(knowledge || (knowledge = {}));