@farming-labs/docs 0.1.71 → 0.1.73
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/{agent-BZ5t0H9t.mjs → agent-C3PhBE3t.mjs} +2 -1
- package/dist/{agent-BJxu7fth.mjs → agent-D94TCE7Q.mjs} +2 -2
- package/dist/cli/index.mjs +5 -5
- package/dist/{doctor-SBL9yJAm.mjs → doctor-BFq5YKLg.mjs} +3 -3
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +3 -3
- package/dist/{mcp-BCwCpF9Q.mjs → mcp-DaNntgC6.mjs} +1 -1
- package/dist/mcp.d.mts +2 -1
- package/dist/mcp.mjs +319 -93
- package/dist/{search-CiQhHxl4.mjs → search-BzavsA3i.mjs} +1 -1
- package/dist/{search-DQTtxgAV.mjs → search-DBZ6Tkij.mjs} +393 -6
- package/dist/search-DSKaQ2JH.d.mts +88 -0
- package/dist/server.d.mts +3 -3
- package/dist/server.mjs +2 -2
- package/dist/{types-BXgTvFFE.d.mts → types-D-OvczD4.d.mts} +156 -10
- package/package.json +1 -1
- package/dist/search-Gvi81BSo.d.mts +0 -41
|
@@ -633,15 +633,17 @@ interface PageActionsConfig {
|
|
|
633
633
|
alignment?: "left" | "right";
|
|
634
634
|
}
|
|
635
635
|
type DocsAnalyticsSource = "client" | "server" | "mcp";
|
|
636
|
-
type
|
|
636
|
+
type DocsAgentTraceStatus = "started" | "success" | "error" | "retry" | "timeout";
|
|
637
|
+
type DocsAgentTraceEventType = "run.start" | "run.end" | "run.error" | "user.input" | "prompt.build" | "retrieval.query" | "retrieval.result" | "retrieval.error" | "model.call" | "model.response" | "model.stream" | "model.error" | "tool.call" | "tool.result" | "tool.error" | "retry" | "timeout" | "error" | "agent.final";
|
|
638
|
+
type DocsAnalyticsEventType = "page_view" | "search_open" | "search_close" | "search_query" | "search_result_click" | "search_error" | "ai_open" | "ai_close" | "ai_question" | "ai_response" | "ai_feedback" | "ai_error" | "ai_clear" | "page_action_copy_markdown" | "page_action_open_docs_menu" | "page_action_open_docs" | "code_block_copy" | "feedback_select" | "feedback_submit" | "feedback_error" | "agent_read" | "agent_spec_request" | "agent_feedback_schema" | "agent_feedback_submit" | "agent_feedback_error" | "markdown_request" | "llms_request" | "skill_request" | "api_search" | "api_ai_request" | "api_ai_response" | "api_ai_error" | "mcp_request" | "mcp_tool";
|
|
637
639
|
interface DocsAnalyticsInput {
|
|
638
640
|
query?: string;
|
|
639
641
|
question?: string;
|
|
642
|
+
feedbackValue?: string;
|
|
640
643
|
feedbackComment?: string;
|
|
641
644
|
content?: string;
|
|
642
645
|
}
|
|
643
|
-
interface
|
|
644
|
-
type: DocsAnalyticsEventType | (string & {});
|
|
646
|
+
interface DocsEventBase {
|
|
645
647
|
timestamp: string;
|
|
646
648
|
source: DocsAnalyticsSource;
|
|
647
649
|
url?: string;
|
|
@@ -649,17 +651,42 @@ interface DocsAnalyticsEvent {
|
|
|
649
651
|
referrer?: string;
|
|
650
652
|
locale?: string;
|
|
651
653
|
input?: DocsAnalyticsInput;
|
|
654
|
+
metadata?: Record<string, unknown>;
|
|
652
655
|
properties?: Record<string, unknown>;
|
|
653
656
|
}
|
|
657
|
+
interface DocsAnalyticsEvent extends DocsEventBase {
|
|
658
|
+
type: DocsAnalyticsEventType | (string & {});
|
|
659
|
+
}
|
|
654
660
|
type DocsAnalyticsEventInput = Omit<DocsAnalyticsEvent, "timestamp" | "source"> & {
|
|
655
661
|
timestamp?: string;
|
|
656
662
|
source?: DocsAnalyticsSource;
|
|
657
663
|
};
|
|
664
|
+
interface DocsObservabilityEvent extends DocsEventBase {
|
|
665
|
+
type: DocsAgentTraceEventType | (string & {});
|
|
666
|
+
traceId?: string;
|
|
667
|
+
spanId?: string;
|
|
668
|
+
parentSpanId?: string;
|
|
669
|
+
name?: string;
|
|
670
|
+
startedAt?: string;
|
|
671
|
+
endedAt?: string;
|
|
672
|
+
durationMs?: number;
|
|
673
|
+
status?: DocsAgentTraceStatus;
|
|
674
|
+
inputPreview?: Record<string, unknown>;
|
|
675
|
+
outputPreview?: Record<string, unknown>;
|
|
676
|
+
}
|
|
677
|
+
type DocsObservabilityEventInput = Omit<DocsObservabilityEvent, "timestamp" | "source"> & {
|
|
678
|
+
timestamp?: string;
|
|
679
|
+
source?: DocsAnalyticsSource;
|
|
680
|
+
};
|
|
681
|
+
type DocsAgentTraceEventInput = Omit<DocsObservabilityEventInput, "type"> & {
|
|
682
|
+
type: DocsAgentTraceEventType;
|
|
683
|
+
name: string;
|
|
684
|
+
};
|
|
658
685
|
interface DocsAnalyticsConfig {
|
|
659
|
-
/** Enable
|
|
686
|
+
/** Enable event emission. Defaults to `true` when this object is provided. */
|
|
660
687
|
enabled?: boolean;
|
|
661
688
|
/**
|
|
662
|
-
* Log
|
|
689
|
+
* Log events to the console.
|
|
663
690
|
*
|
|
664
691
|
* `analytics: true` logs with `console.info`. When `onEvent` is provided,
|
|
665
692
|
* console logging is disabled unless this is set.
|
|
@@ -673,9 +700,30 @@ interface DocsAnalyticsConfig {
|
|
|
673
700
|
* counts, routes, status, and duration.
|
|
674
701
|
*/
|
|
675
702
|
includeInputs?: boolean;
|
|
676
|
-
/** Callback fired for every
|
|
703
|
+
/** Callback fired for every emitted event. */
|
|
677
704
|
onEvent?: (event: DocsAnalyticsEvent) => void | Promise<void>;
|
|
678
705
|
}
|
|
706
|
+
interface DocsObservabilityConfig {
|
|
707
|
+
/** Enable trace emission. Defaults to `true` when this object is provided. */
|
|
708
|
+
enabled?: boolean;
|
|
709
|
+
/**
|
|
710
|
+
* Log trace events to the console.
|
|
711
|
+
*
|
|
712
|
+
* `observability: true` logs with `console.info`. When `onEvent` is provided,
|
|
713
|
+
* console logging is disabled unless this is set.
|
|
714
|
+
*/
|
|
715
|
+
console?: boolean | "log" | "info" | "debug";
|
|
716
|
+
/**
|
|
717
|
+
* Include raw `input` fields on observability events.
|
|
718
|
+
*
|
|
719
|
+
* Defaults to `false`; events still include safe metadata such as lengths,
|
|
720
|
+
* counts, routes, status, and duration. Built-in trace events use previews
|
|
721
|
+
* instead of raw user-authored text.
|
|
722
|
+
*/
|
|
723
|
+
includeInputs?: boolean;
|
|
724
|
+
/** Callback fired for every emitted trace event. */
|
|
725
|
+
onEvent?: (event: DocsObservabilityEvent) => void | Promise<void>;
|
|
726
|
+
}
|
|
679
727
|
/**
|
|
680
728
|
* Configuration for the "Last updated" date display.
|
|
681
729
|
*
|
|
@@ -969,6 +1017,51 @@ interface GithubConfig {
|
|
|
969
1017
|
*/
|
|
970
1018
|
directory?: string;
|
|
971
1019
|
}
|
|
1020
|
+
type DocsAskAIFeedbackValue = "like" | "dislike";
|
|
1021
|
+
type DocsAskAIActionType = "copy" | DocsAskAIFeedbackValue;
|
|
1022
|
+
interface DocsAskAIFeedbackMessage {
|
|
1023
|
+
role: "user" | "assistant";
|
|
1024
|
+
content: string;
|
|
1025
|
+
}
|
|
1026
|
+
interface DocsAskAIActionData {
|
|
1027
|
+
type: DocsAskAIActionType;
|
|
1028
|
+
value?: DocsAskAIFeedbackValue;
|
|
1029
|
+
question: string;
|
|
1030
|
+
answer: string;
|
|
1031
|
+
messageId?: string;
|
|
1032
|
+
messageIndex?: number;
|
|
1033
|
+
model?: string;
|
|
1034
|
+
surface?: string;
|
|
1035
|
+
url?: string;
|
|
1036
|
+
path?: string;
|
|
1037
|
+
messages?: DocsAskAIFeedbackMessage[];
|
|
1038
|
+
copied?: boolean;
|
|
1039
|
+
}
|
|
1040
|
+
interface DocsAskAIFeedbackData {
|
|
1041
|
+
value: DocsAskAIFeedbackValue;
|
|
1042
|
+
question: string;
|
|
1043
|
+
answer: string;
|
|
1044
|
+
messageId?: string;
|
|
1045
|
+
messageIndex?: number;
|
|
1046
|
+
model?: string;
|
|
1047
|
+
surface?: string;
|
|
1048
|
+
url?: string;
|
|
1049
|
+
path?: string;
|
|
1050
|
+
messages?: DocsAskAIFeedbackMessage[];
|
|
1051
|
+
}
|
|
1052
|
+
interface DocsAskAIFeedbackConfig {
|
|
1053
|
+
/**
|
|
1054
|
+
* Whether to show response rating controls after each completed Ask AI answer.
|
|
1055
|
+
* @default true
|
|
1056
|
+
*/
|
|
1057
|
+
enabled?: boolean;
|
|
1058
|
+
/** Label for the positive rating button. @default "Helpful" */
|
|
1059
|
+
positiveLabel?: string;
|
|
1060
|
+
/** Label for the negative rating button. @default "Not helpful" */
|
|
1061
|
+
negativeLabel?: string;
|
|
1062
|
+
/** Called when a user rates an Ask AI response. */
|
|
1063
|
+
onFeedback?: (data: DocsAskAIFeedbackData) => void | Promise<void>;
|
|
1064
|
+
}
|
|
972
1065
|
/**
|
|
973
1066
|
* Configuration for "Ask AI" — a RAG-powered chat that lets users
|
|
974
1067
|
* ask questions about the documentation content.
|
|
@@ -1230,8 +1323,8 @@ interface AIConfig {
|
|
|
1230
1323
|
*/
|
|
1231
1324
|
aiLabel?: string;
|
|
1232
1325
|
/**
|
|
1233
|
-
*
|
|
1234
|
-
*
|
|
1326
|
+
* Optional npm package-name override used in import examples.
|
|
1327
|
+
* Ask AI normally infers package names and exact imports from retrieved docs context.
|
|
1235
1328
|
*
|
|
1236
1329
|
* @example
|
|
1237
1330
|
* ```ts
|
|
@@ -1305,6 +1398,45 @@ interface AIConfig {
|
|
|
1305
1398
|
loadingComponent?: (props: {
|
|
1306
1399
|
name: string;
|
|
1307
1400
|
}) => unknown;
|
|
1401
|
+
/**
|
|
1402
|
+
* Response rating controls for generated Ask AI answers.
|
|
1403
|
+
*
|
|
1404
|
+
* Set to `false` to hide the buttons. Pass an object to customize labels
|
|
1405
|
+
* and receive callback payloads with the question, answer, model, and UI surface.
|
|
1406
|
+
*
|
|
1407
|
+
* @default true
|
|
1408
|
+
*
|
|
1409
|
+
* @example
|
|
1410
|
+
* ```ts
|
|
1411
|
+
* ai: {
|
|
1412
|
+
* enabled: true,
|
|
1413
|
+
* feedback: {
|
|
1414
|
+
* onFeedback(data) {
|
|
1415
|
+
* console.log(data.value, data.question, data.answer);
|
|
1416
|
+
* },
|
|
1417
|
+
* },
|
|
1418
|
+
* }
|
|
1419
|
+
* ```
|
|
1420
|
+
*/
|
|
1421
|
+
feedback?: boolean | DocsAskAIFeedbackConfig;
|
|
1422
|
+
/**
|
|
1423
|
+
* Called when a user clicks an Ask AI response action.
|
|
1424
|
+
*
|
|
1425
|
+
* `data.type` is `"copy"`, `"like"`, or `"dislike"`.
|
|
1426
|
+
*
|
|
1427
|
+
* @example
|
|
1428
|
+
* ```ts
|
|
1429
|
+
* ai: {
|
|
1430
|
+
* enabled: true,
|
|
1431
|
+
* onActions(data) {
|
|
1432
|
+
* if (data.type === "copy") console.log("Copied", data.answer);
|
|
1433
|
+
* if (data.type === "like") console.log("Helpful", data.question);
|
|
1434
|
+
* if (data.type === "dislike") console.log("Not helpful", data.question);
|
|
1435
|
+
* },
|
|
1436
|
+
* }
|
|
1437
|
+
* ```
|
|
1438
|
+
*/
|
|
1439
|
+
onActions?: (data: DocsAskAIActionData) => void | Promise<void>;
|
|
1308
1440
|
}
|
|
1309
1441
|
/**
|
|
1310
1442
|
* A single item in the slug-based sidebar ordering.
|
|
@@ -1674,13 +1806,27 @@ interface DocsConfig {
|
|
|
1674
1806
|
* Built-in analytics event stream for docs interactions.
|
|
1675
1807
|
*
|
|
1676
1808
|
* - `false` or omitted -> analytics disabled (default)
|
|
1677
|
-
* - `true` -> log
|
|
1809
|
+
* - `true` -> log product/usage events to the console
|
|
1678
1810
|
* - `{ onEvent(event) { ... } }` -> send events to your analytics sink
|
|
1679
1811
|
*
|
|
1680
1812
|
* Raw queries, AI questions, feedback comments, and copied content are not
|
|
1681
1813
|
* included unless `includeInputs: true` is set.
|
|
1682
1814
|
*/
|
|
1683
1815
|
analytics?: boolean | DocsAnalyticsConfig;
|
|
1816
|
+
/**
|
|
1817
|
+
* Built-in observability stream for agent traces, timing, errors, and runtime debugging.
|
|
1818
|
+
* This is separate from `analytics`; it emits span-like Ask AI and MCP trace events.
|
|
1819
|
+
*
|
|
1820
|
+
* ```ts
|
|
1821
|
+
* observability: {
|
|
1822
|
+
* console: "debug",
|
|
1823
|
+
* onEvent(event) {
|
|
1824
|
+
* console.info(event.type, event.traceId, event.durationMs)
|
|
1825
|
+
* },
|
|
1826
|
+
* }
|
|
1827
|
+
* ```
|
|
1828
|
+
*/
|
|
1829
|
+
observability?: boolean | DocsObservabilityConfig;
|
|
1684
1830
|
/**
|
|
1685
1831
|
* GitHub repository URL or config. Enables "Edit on GitHub" links
|
|
1686
1832
|
* on each docs page footer, pointing to the source `.mdx` file.
|
|
@@ -2046,4 +2192,4 @@ interface DocsConfig {
|
|
|
2046
2192
|
og?: OGConfig;
|
|
2047
2193
|
}
|
|
2048
2194
|
//#endregion
|
|
2049
|
-
export {
|
|
2195
|
+
export { FeedbackConfig as $, DocsFeedbackData as A, DocsRelatedItem as B, DocsAskAIActionData as C, SidebarTree as Ct, DocsAskAIFeedbackMessage as D, TypographyConfig as Dt, DocsAskAIFeedbackData as E, TypesenseDocsSearchConfig as Et, DocsMetadata as F, DocsSearchConfig as G, DocsSearchAdapterContext as H, DocsNav as I, DocsSearchQuery as J, DocsSearchDocument as K, DocsObservabilityConfig as L, DocsI18nConfig as M, DocsMcpConfig as N, DocsAskAIFeedbackValue as O, UIConfig as Ot, DocsMcpToolsConfig as P, DocsTheme as Q, DocsObservabilityEvent as R, DocsAnalyticsSource as S, SidebarPageNode as St, DocsAskAIFeedbackConfig as T, ThemeToggleConfig as Tt, DocsSearchAdapterFactory as U, DocsSearchAdapter as V, DocsSearchChunkingConfig as W, DocsSearchResultType as X, DocsSearchResult as Y, DocsSearchSourcePage as Z, DocsAnalyticsConfig as _, SidebarComponentProps as _t, ApiReferenceRenderer as a, OGConfig as at, DocsAnalyticsEventType as b, SidebarFolderNode as bt, ChangelogFrontmatter as c, OpenGraphImage as ct, CustomDocsSearchConfig as d, PageFrontmatter as dt, FontStyle as et, DocsAgentFeedbackContext as f, PageOpenGraph as ft, DocsAgentTraceStatus as g, ResolvedDocsRelatedLink as gt, DocsAgentTraceEventType as h, ReadingTimeConfig as ht, ApiReferenceConfig as i, McpDocsSearchConfig as it, DocsFeedbackValue as j, DocsConfig as k, CodeBlockCopyData as l, OrderingItem as lt, DocsAgentTraceEventInput as m, PageTwitter as mt, AgentFeedbackConfig as n, LastUpdatedConfig as nt, BreadcrumbConfig as o, OpenDocsConfig as ot, DocsAgentFeedbackData as p, PageSidebarFrontmatter as pt, DocsSearchEmbeddingsConfig as q, AlgoliaDocsSearchConfig as r, LlmsTxtConfig as rt, ChangelogConfig as s, OpenDocsProvider as st, AIConfig as t, GithubConfig as tt, CopyMarkdownConfig as u, PageActionsConfig as ut, DocsAnalyticsEvent as v, SidebarConfig as vt, DocsAskAIActionType as w, SimpleDocsSearchConfig as wt, DocsAnalyticsInput as x, SidebarNode as xt, DocsAnalyticsEventInput as y, SidebarFolderIndexBehavior as yt, DocsObservabilityEventInput as z };
|
package/package.json
CHANGED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { K as McpDocsSearchConfig, L as DocsSearchResult, M as DocsSearchChunkingConfig, N as DocsSearchConfig, P as DocsSearchDocument, d as CustomDocsSearchConfig, g as DocsAnalyticsEventInput, h as DocsAnalyticsEvent, j as DocsSearchAdapterFactory, k as DocsSearchAdapter, m as DocsAnalyticsConfig, mt as TypesenseDocsSearchConfig, r as AlgoliaDocsSearchConfig, z as DocsSearchSourcePage } from "./types-BXgTvFFE.mjs";
|
|
2
|
-
|
|
3
|
-
//#region src/cloud-analytics.d.ts
|
|
4
|
-
interface DocsCloudAnalyticsOptions {
|
|
5
|
-
enabled?: boolean;
|
|
6
|
-
console?: DocsAnalyticsConfig["console"];
|
|
7
|
-
includeInputs?: boolean;
|
|
8
|
-
projectId?: string;
|
|
9
|
-
apiKey?: string;
|
|
10
|
-
}
|
|
11
|
-
declare function createDocsCloudAnalytics(options?: DocsCloudAnalyticsOptions): DocsAnalyticsConfig;
|
|
12
|
-
//#endregion
|
|
13
|
-
//#region src/analytics.d.ts
|
|
14
|
-
interface ResolvedDocsAnalyticsConfig {
|
|
15
|
-
enabled: boolean;
|
|
16
|
-
console: false | "log" | "info" | "debug";
|
|
17
|
-
includeInputs: boolean;
|
|
18
|
-
onEvent?: (event: DocsAnalyticsEvent) => void | Promise<void>;
|
|
19
|
-
}
|
|
20
|
-
declare function resolveDocsAnalyticsConfig(analytics?: boolean | DocsAnalyticsConfig): ResolvedDocsAnalyticsConfig;
|
|
21
|
-
declare function emitDocsAnalyticsEvent(analytics: boolean | DocsAnalyticsConfig | undefined, event: DocsAnalyticsEventInput): Promise<void>;
|
|
22
|
-
//#endregion
|
|
23
|
-
//#region src/search.d.ts
|
|
24
|
-
declare function buildDocsSearchDocuments(pages: DocsSearchSourcePage[], chunking?: DocsSearchChunkingConfig): DocsSearchDocument[];
|
|
25
|
-
declare function createSimpleSearchAdapter(): DocsSearchAdapter;
|
|
26
|
-
declare function createTypesenseSearchAdapter(config: TypesenseDocsSearchConfig): DocsSearchAdapter;
|
|
27
|
-
declare function resolveSearchRequestConfig(search: boolean | DocsSearchConfig | undefined, requestUrl?: string): boolean | DocsSearchConfig | undefined;
|
|
28
|
-
declare function createMcpSearchAdapter(config: McpDocsSearchConfig): DocsSearchAdapter;
|
|
29
|
-
declare function createAlgoliaSearchAdapter(config: AlgoliaDocsSearchConfig): DocsSearchAdapter;
|
|
30
|
-
declare function performDocsSearch(options: {
|
|
31
|
-
pages: DocsSearchSourcePage[];
|
|
32
|
-
query: string;
|
|
33
|
-
search?: boolean | DocsSearchConfig;
|
|
34
|
-
locale?: string;
|
|
35
|
-
pathname?: string;
|
|
36
|
-
siteTitle?: string;
|
|
37
|
-
limit?: number;
|
|
38
|
-
}): Promise<DocsSearchResult[]>;
|
|
39
|
-
declare function createCustomSearchAdapter(adapter: DocsSearchAdapter | DocsSearchAdapterFactory): CustomDocsSearchConfig;
|
|
40
|
-
//#endregion
|
|
41
|
-
export { createSimpleSearchAdapter as a, resolveSearchRequestConfig as c, resolveDocsAnalyticsConfig as d, DocsCloudAnalyticsOptions as f, createMcpSearchAdapter as i, ResolvedDocsAnalyticsConfig as l, createAlgoliaSearchAdapter as n, createTypesenseSearchAdapter as o, createDocsCloudAnalytics as p, createCustomSearchAdapter as r, performDocsSearch as s, buildDocsSearchDocuments as t, emitDocsAnalyticsEvent as u };
|