@stackfactor/agent-utils 1.13.4 → 1.33.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 +688 -23
- package/dist/cjs/agentProto.d.ts +13 -3
- package/dist/cjs/agentProto.d.ts.map +1 -1
- package/dist/cjs/agentProto.js +25 -4
- package/dist/cjs/backoff.d.ts +17 -0
- package/dist/cjs/backoff.d.ts.map +1 -0
- package/dist/cjs/backoff.js +26 -0
- package/dist/cjs/cancellation.d.ts +22 -0
- package/dist/cjs/cancellation.d.ts.map +1 -0
- package/dist/cjs/cancellation.js +36 -0
- package/dist/cjs/cli.d.ts +3 -0
- package/dist/cjs/cli.d.ts.map +1 -0
- package/dist/cjs/cli.js +85 -0
- package/dist/cjs/client.d.ts +11 -0
- package/dist/cjs/client.d.ts.map +1 -1
- package/dist/cjs/client.js +27 -0
- package/dist/cjs/const.d.ts +23 -0
- package/dist/cjs/const.d.ts.map +1 -1
- package/dist/cjs/const.js +23 -0
- package/dist/cjs/daemon.d.ts +94 -0
- package/dist/cjs/daemon.d.ts.map +1 -0
- package/dist/cjs/daemon.js +507 -0
- package/dist/cjs/daemonConfig.d.ts +45 -0
- package/dist/cjs/daemonConfig.d.ts.map +1 -0
- package/dist/cjs/daemonConfig.js +148 -0
- package/dist/cjs/daemonEnv.d.ts +10 -0
- package/dist/cjs/daemonEnv.d.ts.map +1 -0
- package/dist/cjs/daemonEnv.js +12 -0
- package/dist/cjs/durable/clientTool.d.ts +39 -0
- package/dist/cjs/durable/clientTool.d.ts.map +1 -0
- package/dist/cjs/durable/clientTool.js +90 -0
- package/dist/cjs/durable/index.d.ts +9 -0
- package/dist/cjs/durable/index.d.ts.map +1 -0
- package/dist/cjs/durable/index.js +16 -0
- package/dist/cjs/durable/journal.d.ts +218 -0
- package/dist/cjs/durable/journal.d.ts.map +1 -0
- package/dist/cjs/durable/journal.js +392 -0
- package/dist/cjs/durable/pause.d.ts +84 -0
- package/dist/cjs/durable/pause.d.ts.map +1 -0
- package/dist/cjs/durable/pause.js +241 -0
- package/dist/cjs/durable/resume.d.ts +27 -0
- package/dist/cjs/durable/resume.d.ts.map +1 -0
- package/dist/cjs/durable/resume.js +80 -0
- package/dist/cjs/durable/snapshotSaver.d.ts +38 -0
- package/dist/cjs/durable/snapshotSaver.d.ts.map +1 -0
- package/dist/cjs/durable/snapshotSaver.js +81 -0
- package/dist/cjs/durable/step.d.ts +28 -0
- package/dist/cjs/durable/step.d.ts.map +1 -0
- package/dist/cjs/durable/step.js +43 -0
- package/dist/cjs/index.d.ts +30 -7
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +28 -1
- package/dist/cjs/infrastructure.d.ts +50 -0
- package/dist/cjs/infrastructure.d.ts.map +1 -0
- package/dist/cjs/infrastructure.js +163 -0
- package/dist/cjs/langChain.d.ts +15 -3
- package/dist/cjs/langChain.d.ts.map +1 -1
- package/dist/cjs/langChain.js +986 -180
- package/dist/cjs/learningActivityMedia.d.ts +196 -0
- package/dist/cjs/learningActivityMedia.d.ts.map +1 -0
- package/dist/cjs/learningActivityMedia.js +861 -0
- package/dist/cjs/learningContentPlan.d.ts +117 -0
- package/dist/cjs/learningContentPlan.d.ts.map +1 -0
- package/dist/cjs/learningContentPlan.js +327 -0
- package/dist/cjs/learningContentThread.d.ts +213 -0
- package/dist/cjs/learningContentThread.d.ts.map +1 -0
- package/dist/cjs/learningContentThread.js +448 -0
- package/dist/cjs/logger.d.ts +1 -0
- package/dist/cjs/logger.d.ts.map +1 -1
- package/dist/cjs/logger.js +17 -3
- package/dist/cjs/modelRates.d.ts +40 -0
- package/dist/cjs/modelRates.d.ts.map +1 -0
- package/dist/cjs/modelRates.js +76 -0
- package/dist/cjs/referenceContext.d.ts +4 -145
- package/dist/cjs/referenceContext.d.ts.map +1 -1
- package/dist/cjs/referenceContext.js +16 -251
- package/dist/cjs/retry.d.ts +64 -0
- package/dist/cjs/retry.d.ts.map +1 -0
- package/dist/cjs/retry.js +138 -0
- package/dist/cjs/runtimeContext.d.ts +8 -1
- package/dist/cjs/runtimeContext.d.ts.map +1 -1
- package/dist/cjs/runtimeContext.js +3 -1
- package/dist/cjs/serve.d.ts +3 -2
- package/dist/cjs/serve.d.ts.map +1 -1
- package/dist/cjs/serve.js +32 -2
- package/dist/cjs/sourceStore.d.ts +378 -0
- package/dist/cjs/sourceStore.d.ts.map +1 -0
- package/dist/cjs/sourceStore.js +872 -0
- package/dist/cjs/stackfactorKnowledge.d.ts +91 -7
- package/dist/cjs/stackfactorKnowledge.d.ts.map +1 -1
- package/dist/cjs/stackfactorKnowledge.js +108 -44
- package/dist/cjs/tavily.d.ts +108 -4
- package/dist/cjs/tavily.d.ts.map +1 -1
- package/dist/cjs/tavily.js +242 -21
- package/dist/cjs/usage.d.ts.map +1 -1
- package/dist/cjs/usage.js +9 -15
- package/dist/cjs/version.d.ts +3 -0
- package/dist/cjs/version.d.ts.map +1 -0
- package/dist/cjs/version.js +5 -0
- package/dist/cjs/workflow/bookkeeping.d.ts +78 -0
- package/dist/cjs/workflow/bookkeeping.d.ts.map +1 -0
- package/dist/cjs/workflow/bookkeeping.js +75 -0
- package/dist/cjs/workflow/index.d.ts +13 -0
- package/dist/cjs/workflow/index.d.ts.map +1 -0
- package/dist/cjs/workflow/index.js +51 -0
- package/dist/cjs/workflow/limits.d.ts +52 -0
- package/dist/cjs/workflow/limits.d.ts.map +1 -0
- package/dist/cjs/workflow/limits.js +62 -0
- package/dist/cjs/workflow/platformTransport.d.ts +39 -0
- package/dist/cjs/workflow/platformTransport.d.ts.map +1 -0
- package/dist/cjs/workflow/platformTransport.js +115 -0
- package/dist/cjs/workflow/retrying.d.ts +44 -0
- package/dist/cjs/workflow/retrying.d.ts.map +1 -0
- package/dist/cjs/workflow/retrying.js +82 -0
- package/dist/cjs/workflow/run.d.ts +195 -0
- package/dist/cjs/workflow/run.d.ts.map +1 -0
- package/dist/cjs/workflow/run.js +858 -0
- package/dist/cjs/workflow/testing/index.d.ts +3 -0
- package/dist/cjs/workflow/testing/index.d.ts.map +1 -0
- package/dist/cjs/workflow/testing/index.js +6 -0
- package/dist/cjs/workflow/testing/memoryTransport.d.ts +203 -0
- package/dist/cjs/workflow/testing/memoryTransport.d.ts.map +1 -0
- package/dist/cjs/workflow/testing/memoryTransport.js +1171 -0
- package/dist/cjs/workflow/transport.d.ts +219 -0
- package/dist/cjs/workflow/transport.d.ts.map +1 -0
- package/dist/cjs/workflow/transport.js +19 -0
- package/dist/esm/agentProto.d.ts +13 -3
- package/dist/esm/agentProto.d.ts.map +1 -1
- package/dist/esm/agentProto.js +23 -3
- package/dist/esm/backoff.d.ts +17 -0
- package/dist/esm/backoff.d.ts.map +1 -0
- package/dist/esm/backoff.js +22 -0
- package/dist/esm/cancellation.d.ts +22 -0
- package/dist/esm/cancellation.d.ts.map +1 -0
- package/dist/esm/cancellation.js +27 -0
- package/dist/esm/cli.d.ts +3 -0
- package/dist/esm/cli.d.ts.map +1 -0
- package/dist/esm/cli.js +80 -0
- package/dist/esm/client.d.ts +11 -0
- package/dist/esm/client.d.ts.map +1 -1
- package/dist/esm/client.js +25 -1
- package/dist/esm/const.d.ts +23 -0
- package/dist/esm/const.d.ts.map +1 -1
- package/dist/esm/const.js +23 -0
- package/dist/esm/daemon.d.ts +94 -0
- package/dist/esm/daemon.d.ts.map +1 -0
- package/dist/esm/daemon.js +499 -0
- package/dist/esm/daemonConfig.d.ts +45 -0
- package/dist/esm/daemonConfig.d.ts.map +1 -0
- package/dist/esm/daemonConfig.js +142 -0
- package/dist/esm/daemonEnv.d.ts +10 -0
- package/dist/esm/daemonEnv.d.ts.map +1 -0
- package/dist/esm/daemonEnv.js +9 -0
- package/dist/esm/durable/clientTool.d.ts +39 -0
- package/dist/esm/durable/clientTool.d.ts.map +1 -0
- package/dist/esm/durable/clientTool.js +82 -0
- package/dist/esm/durable/index.d.ts +9 -0
- package/dist/esm/durable/index.d.ts.map +1 -0
- package/dist/esm/durable/index.js +8 -0
- package/dist/esm/durable/journal.d.ts +218 -0
- package/dist/esm/durable/journal.d.ts.map +1 -0
- package/dist/esm/durable/journal.js +374 -0
- package/dist/esm/durable/pause.d.ts +84 -0
- package/dist/esm/durable/pause.d.ts.map +1 -0
- package/dist/esm/durable/pause.js +226 -0
- package/dist/esm/durable/resume.d.ts +27 -0
- package/dist/esm/durable/resume.d.ts.map +1 -0
- package/dist/esm/durable/resume.js +72 -0
- package/dist/esm/durable/snapshotSaver.d.ts +38 -0
- package/dist/esm/durable/snapshotSaver.d.ts.map +1 -0
- package/dist/esm/durable/snapshotSaver.js +77 -0
- package/dist/esm/durable/step.d.ts +28 -0
- package/dist/esm/durable/step.d.ts.map +1 -0
- package/dist/esm/durable/step.js +36 -0
- package/dist/esm/index.d.ts +30 -7
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +20 -4
- package/dist/esm/infrastructure.d.ts +50 -0
- package/dist/esm/infrastructure.d.ts.map +1 -0
- package/dist/esm/infrastructure.js +156 -0
- package/dist/esm/langChain.d.ts +15 -3
- package/dist/esm/langChain.d.ts.map +1 -1
- package/dist/esm/langChain.js +984 -179
- package/dist/esm/learningActivityMedia.d.ts +196 -0
- package/dist/esm/learningActivityMedia.d.ts.map +1 -0
- package/dist/esm/learningActivityMedia.js +807 -0
- package/dist/esm/learningContentPlan.d.ts +117 -0
- package/dist/esm/learningContentPlan.d.ts.map +1 -0
- package/dist/esm/learningContentPlan.js +320 -0
- package/dist/esm/learningContentThread.d.ts +213 -0
- package/dist/esm/learningContentThread.d.ts.map +1 -0
- package/dist/esm/learningContentThread.js +403 -0
- package/dist/esm/logger.d.ts +1 -0
- package/dist/esm/logger.d.ts.map +1 -1
- package/dist/esm/logger.js +17 -3
- package/dist/esm/modelRates.d.ts +40 -0
- package/dist/esm/modelRates.d.ts.map +1 -0
- package/dist/esm/modelRates.js +68 -0
- package/dist/esm/referenceContext.d.ts +4 -145
- package/dist/esm/referenceContext.d.ts.map +1 -1
- package/dist/esm/referenceContext.js +16 -243
- package/dist/esm/retry.d.ts +64 -0
- package/dist/esm/retry.d.ts.map +1 -0
- package/dist/esm/retry.js +127 -0
- package/dist/esm/runtimeContext.d.ts +8 -1
- package/dist/esm/runtimeContext.d.ts.map +1 -1
- package/dist/esm/runtimeContext.js +3 -1
- package/dist/esm/serve.d.ts +3 -2
- package/dist/esm/serve.d.ts.map +1 -1
- package/dist/esm/serve.js +33 -3
- package/dist/esm/sourceStore.d.ts +378 -0
- package/dist/esm/sourceStore.d.ts.map +1 -0
- package/dist/esm/sourceStore.js +855 -0
- package/dist/esm/stackfactorKnowledge.d.ts +91 -7
- package/dist/esm/stackfactorKnowledge.d.ts.map +1 -1
- package/dist/esm/stackfactorKnowledge.js +101 -41
- package/dist/esm/tavily.d.ts +108 -4
- package/dist/esm/tavily.d.ts.map +1 -1
- package/dist/esm/tavily.js +237 -20
- package/dist/esm/usage.d.ts.map +1 -1
- package/dist/esm/usage.js +9 -15
- package/dist/esm/version.d.ts +3 -0
- package/dist/esm/version.d.ts.map +1 -0
- package/dist/esm/version.js +2 -0
- package/dist/esm/workflow/bookkeeping.d.ts +78 -0
- package/dist/esm/workflow/bookkeeping.d.ts.map +1 -0
- package/dist/esm/workflow/bookkeeping.js +67 -0
- package/dist/esm/workflow/index.d.ts +13 -0
- package/dist/esm/workflow/index.d.ts.map +1 -0
- package/dist/esm/workflow/index.js +10 -0
- package/dist/esm/workflow/limits.d.ts +52 -0
- package/dist/esm/workflow/limits.d.ts.map +1 -0
- package/dist/esm/workflow/limits.js +59 -0
- package/dist/esm/workflow/platformTransport.d.ts +39 -0
- package/dist/esm/workflow/platformTransport.d.ts.map +1 -0
- package/dist/esm/workflow/platformTransport.js +110 -0
- package/dist/esm/workflow/retrying.d.ts +44 -0
- package/dist/esm/workflow/retrying.d.ts.map +1 -0
- package/dist/esm/workflow/retrying.js +73 -0
- package/dist/esm/workflow/run.d.ts +195 -0
- package/dist/esm/workflow/run.d.ts.map +1 -0
- package/dist/esm/workflow/run.js +850 -0
- package/dist/esm/workflow/testing/index.d.ts +3 -0
- package/dist/esm/workflow/testing/index.d.ts.map +1 -0
- package/dist/esm/workflow/testing/index.js +2 -0
- package/dist/esm/workflow/testing/memoryTransport.d.ts +203 -0
- package/dist/esm/workflow/testing/memoryTransport.d.ts.map +1 -0
- package/dist/esm/workflow/testing/memoryTransport.js +1167 -0
- package/dist/esm/workflow/transport.d.ts +219 -0
- package/dist/esm/workflow/transport.d.ts.map +1 -0
- package/dist/esm/workflow/transport.js +16 -0
- package/package.json +8 -7
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { RetryOptions } from "./retry.js";
|
|
1
2
|
/** What a STACKFACTOR reference to a knowledge base document carries (backend-core REFERENCE). */
|
|
2
3
|
export declare const STACKFACTOR_REFERENCE: Readonly<{
|
|
3
4
|
KIND: "STACKFACTOR";
|
|
@@ -22,6 +23,10 @@ export interface KnowledgeChunk {
|
|
|
22
23
|
/** The document's page at its source (sent by the platform's search since backend-core #630). */
|
|
23
24
|
documentUrl?: string | null;
|
|
24
25
|
sectionTitle?: string | null;
|
|
26
|
+
/** A line written from the passage's content at ingestion (backend-core #1058); null when it has none. */
|
|
27
|
+
passageTitle?: string | null;
|
|
28
|
+
/** What the passage is for, as ingestion labelled it: "teaching" or "logistics"; null when it was never said. */
|
|
29
|
+
passageRole?: string | null;
|
|
25
30
|
pageNumber?: number | null;
|
|
26
31
|
text?: string;
|
|
27
32
|
skills?: {
|
|
@@ -29,12 +34,16 @@ export interface KnowledgeChunk {
|
|
|
29
34
|
microSkills?: string[];
|
|
30
35
|
}[];
|
|
31
36
|
score?: number | null;
|
|
37
|
+
/** Whether it is labelled with a microskill the search named (backend-core #1072); such a passage may have no score. */
|
|
38
|
+
labelled?: boolean;
|
|
32
39
|
[field: string]: unknown;
|
|
33
40
|
}
|
|
34
41
|
/** The platform's search, as client-api's `knowledgeBaseAgent.search` is called. */
|
|
35
42
|
export type KnowledgeSearch = (knowledgeBaseId: string, query: string, options: {
|
|
36
43
|
topK?: number;
|
|
37
44
|
documentIds?: string[];
|
|
45
|
+
excludePassageRoles?: PassageRole[];
|
|
46
|
+
microSkills?: string[];
|
|
38
47
|
}, token: string) => Promise<{
|
|
39
48
|
chunks: KnowledgeChunk[];
|
|
40
49
|
}>;
|
|
@@ -44,6 +53,17 @@ export interface KnowledgeSource {
|
|
|
44
53
|
/** Only these documents; omitted, the whole knowledge base. */
|
|
45
54
|
documentIds?: string[];
|
|
46
55
|
}
|
|
56
|
+
/**
|
|
57
|
+
* What a passage is for, as ingestion labels it (backend-core
|
|
58
|
+
* `KNOWLEDGE_BASE.PASSAGE_ROLE`). A logistics passage only organizes the
|
|
59
|
+
* material or the people (an agenda, a schedule, a syllabus, a title slide,
|
|
60
|
+
* introductions) and teaches nothing by itself.
|
|
61
|
+
*/
|
|
62
|
+
export type PassageRole = "teaching" | "logistics";
|
|
63
|
+
export declare const PASSAGE_ROLE: Readonly<{
|
|
64
|
+
readonly TEACHING: "teaching";
|
|
65
|
+
readonly LOGISTICS: "logistics";
|
|
66
|
+
}>;
|
|
47
67
|
/** A passage handed to the model, tagged so it can cite it. */
|
|
48
68
|
export interface GroundingPassage {
|
|
49
69
|
/** "k1", "k2"… in the order they rank. */
|
|
@@ -56,7 +76,12 @@ export interface GroundingPassage {
|
|
|
56
76
|
documentTitle?: string | null;
|
|
57
77
|
/** The document's page at its source, an http(s) address; null when the platform has none. */
|
|
58
78
|
documentUrl?: string | null;
|
|
79
|
+
/** The heading the document carries above the passage: on a slide, often a time allowance or the heading of the slide before. */
|
|
59
80
|
sectionTitle: string | null;
|
|
81
|
+
/** A line written from the passage's content at ingestion; null when the platform has none. */
|
|
82
|
+
passageTitle?: string | null;
|
|
83
|
+
/** What the passage is for: "teaching", "logistics", or null when ingestion never said. */
|
|
84
|
+
passageRole?: PassageRole | null;
|
|
60
85
|
pageNumber: number | null;
|
|
61
86
|
text: string;
|
|
62
87
|
/** The skills its passage teaches, as labelling named them. */
|
|
@@ -65,6 +90,12 @@ export interface GroundingPassage {
|
|
|
65
90
|
microSkills: string[];
|
|
66
91
|
}[];
|
|
67
92
|
score: number | null;
|
|
93
|
+
/**
|
|
94
|
+
* Whether ingestion labelled it with a microskill the search named
|
|
95
|
+
* (`retrievePassages` `microSkills`): the knowledge base itself says it
|
|
96
|
+
* teaches that microskill. Such passages rank first.
|
|
97
|
+
*/
|
|
98
|
+
labelled?: boolean;
|
|
68
99
|
}
|
|
69
100
|
/** A knowledge base that could not be searched, and why. */
|
|
70
101
|
export interface SkippedSource {
|
|
@@ -125,14 +156,41 @@ export declare const sourcesFromCoverage: (coverage: unknown) => KnowledgeSource
|
|
|
125
156
|
* model to cite. A source with documents is searched within them (in batches of
|
|
126
157
|
* SEARCH_DOCUMENT_IDS_MAX); one without, whole. A source the person may not
|
|
127
158
|
* read (401, 403, 404) is skipped: none of its passages are used and no more of
|
|
128
|
-
* its searches are made. A search that fails
|
|
129
|
-
*
|
|
130
|
-
*
|
|
131
|
-
*
|
|
132
|
-
*
|
|
159
|
+
* its searches are made. A search that fails for a reason that may pass (a
|
|
160
|
+
* timeout, a rate limit, a 5xx, the network) is made again (retryTransient:
|
|
161
|
+
* after 2 s, then 6 s, under `retry.breaker` when the caller shares one
|
|
162
|
+
* across its searches); one that still fails, or failed for a reason that
|
|
163
|
+
* will not pass (a 422), is reported and the passages its other searches
|
|
164
|
+
* found stand. A refusal is never tried again, and a search is not retried
|
|
165
|
+
* once its knowledge base refused the person meanwhile. Either way it is in
|
|
166
|
+
* `skipped`, once per knowledge base, and the passages of the others stand;
|
|
167
|
+
* whether a skip is an error is the caller's to say.
|
|
168
|
+
*
|
|
169
|
+
* A passage ingestion labelled as logistics is left out: an agenda or a
|
|
170
|
+
* syllabus slide matches any query on the course's subject and teaches
|
|
171
|
+
* nothing, and one was cited as the source of a micro-skill (prod,
|
|
172
|
+
* 2026-11-16). The search is asked to leave them out itself
|
|
173
|
+
* (`excludePassageRoles`, backend-core #1065), so it still answers `topK`
|
|
174
|
+
* passages: dropped only after the search, they took more than half of each
|
|
175
|
+
* answer with them, and 7 of 10 searches of 8 kept none (the same day). A
|
|
176
|
+
* platform that does not know the option answers them all the same, so any
|
|
177
|
+
* that come back are dropped here, and the count is logged. `includeLogistics`
|
|
178
|
+
* keeps them, for a reader that must see what a reference cites whatever it
|
|
179
|
+
* is. A passage with no label is kept.
|
|
180
|
+
*
|
|
181
|
+
* `microSkills` names microskills of the knowledge bases, as their microskill
|
|
182
|
+
* lists name them: every search is asked to put the passages ingestion
|
|
183
|
+
* labelled with one of them first (backend-core #1072), and they rank first
|
|
184
|
+
* here too, in the searches' own order, ahead of every other passage whatever
|
|
185
|
+
* its score. Asked for by name through the search alone, a microskill's own
|
|
186
|
+
* passages lost to ones sharing words with the skill's name, and the wrong
|
|
187
|
+
* passage was cited (prod, 2026-11-17). A platform that does not know the
|
|
188
|
+
* option answers as before, and nothing is marked.
|
|
133
189
|
* @param options `sources`, `queries`, `search` (client-api
|
|
134
190
|
* `knowledgeBaseAgent.search`), `token` (the run's AGENT token), `topK`
|
|
135
|
-
* per search (default DEFAULT_TOP_K)
|
|
191
|
+
* per search (default DEFAULT_TOP_K), `retry` (`waits`, `breaker`, `sleep`
|
|
192
|
+
* for retryTransient; default: RETRY_WAITS, no breaker), `includeLogistics`
|
|
193
|
+
* (default false), `microSkills` (default none)
|
|
136
194
|
* @returns `{ passages, skipped }`
|
|
137
195
|
*/
|
|
138
196
|
export declare const retrievePassages: (options: {
|
|
@@ -141,12 +199,26 @@ export declare const retrievePassages: (options: {
|
|
|
141
199
|
search: KnowledgeSearch;
|
|
142
200
|
token: string;
|
|
143
201
|
topK?: number;
|
|
202
|
+
retry?: Pick<RetryOptions, "waits" | "breaker" | "sleep">;
|
|
203
|
+
includeLogistics?: boolean;
|
|
204
|
+
microSkills?: string[];
|
|
144
205
|
}) => Promise<{
|
|
145
206
|
passages: GroundingPassage[];
|
|
146
207
|
skipped: SkippedSource[];
|
|
147
208
|
}>;
|
|
148
209
|
/**
|
|
149
|
-
*
|
|
210
|
+
* What a passage is headed by, for a reader: the title ingestion wrote from
|
|
211
|
+
* its content, else the heading its document carries. A slide's own heading
|
|
212
|
+
* is often a time allowance ("Total Time: 40 minutes") or the heading of the
|
|
213
|
+
* slide before, over a passage that teaches something else.
|
|
214
|
+
* @param passage A passage, as `retrievePassages` answers it
|
|
215
|
+
* @returns The heading, or null when the passage has neither
|
|
216
|
+
*/
|
|
217
|
+
export declare const passageHeading: (passage: Pick<GroundingPassage, "sectionTitle" | "passageTitle">) => string | null;
|
|
218
|
+
/**
|
|
219
|
+
* The passages as a prompt shows them: tag, where each came from, and its
|
|
220
|
+
* text. `section` is the passage's heading (`passageHeading`), which is also
|
|
221
|
+
* its reference's description, so a reader can match one to the other.
|
|
150
222
|
* @param passages From `retrievePassages`
|
|
151
223
|
* @returns `[{ tag, document, section, text }]`, for the model's input
|
|
152
224
|
*/
|
|
@@ -163,6 +235,10 @@ export declare const passagesForPrompt: (passages: GroundingPassage[]) => {
|
|
|
163
235
|
* page at the source (`url`) when the passage has one. Each is titled by its
|
|
164
236
|
* document's title, else its name, else its section; its pointer keeps the
|
|
165
237
|
* document's name (`knowledgeBase.documentName`) when the passage has one.
|
|
238
|
+
* Its `description` is the passage's heading (`passageHeading`: the title
|
|
239
|
+
* written from its content, else the document's own heading), while its
|
|
240
|
+
* pointer's `sectionTitle` stays the document's heading: that is what tells
|
|
241
|
+
* two passages of one section apart from two sections.
|
|
166
242
|
* @param passages From `retrievePassages`
|
|
167
243
|
* @param tags The tags the model cited ("k3", "K3" and " k3 " alike)
|
|
168
244
|
* @returns The references, ready for a skill's, a microskill's or a question's `references`
|
|
@@ -172,12 +248,17 @@ declare const _default: {
|
|
|
172
248
|
DEFAULT_TOP_K: number;
|
|
173
249
|
QUERY_MAX_LENGTH: number;
|
|
174
250
|
SEARCH_DOCUMENT_IDS_MAX: number;
|
|
251
|
+
PASSAGE_ROLE: Readonly<{
|
|
252
|
+
readonly TEACHING: "teaching";
|
|
253
|
+
readonly LOGISTICS: "logistics";
|
|
254
|
+
}>;
|
|
175
255
|
STACKFACTOR_REFERENCE: Readonly<{
|
|
176
256
|
KIND: "STACKFACTOR";
|
|
177
257
|
TARGET_ELEMENT_TYPE: "KNOWLEDGE_BASE_DOCUMENT";
|
|
178
258
|
ORIGIN: "KB_EXTRACTION";
|
|
179
259
|
VISIBILITY: "EDIT";
|
|
180
260
|
}>;
|
|
261
|
+
passageHeading: (passage: Pick<GroundingPassage, "sectionTitle" | "passageTitle">) => string | null;
|
|
181
262
|
passagesForPrompt: (passages: GroundingPassage[]) => {
|
|
182
263
|
tag: string;
|
|
183
264
|
document: string | null;
|
|
@@ -191,6 +272,9 @@ declare const _default: {
|
|
|
191
272
|
search: KnowledgeSearch;
|
|
192
273
|
token: string;
|
|
193
274
|
topK?: number;
|
|
275
|
+
retry?: Pick<RetryOptions, "waits" | "breaker" | "sleep">;
|
|
276
|
+
includeLogistics?: boolean;
|
|
277
|
+
microSkills?: string[];
|
|
194
278
|
}) => Promise<{
|
|
195
279
|
passages: GroundingPassage[];
|
|
196
280
|
skipped: SkippedSource[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stackfactorKnowledge.d.ts","sourceRoot":"","sources":["../../src/stackfactorKnowledge.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"stackfactorKnowledge.d.ts","sourceRoot":"","sources":["../../src/stackfactorKnowledge.ts"],"names":[],"mappings":"AAyCA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C,kGAAkG;AAClG,eAAO,MAAM,qBAAqB;;;;;EAKhC,CAAC;AAEH,0FAA0F;AAC1F,eAAO,MAAM,uBAAuB,MAAM,CAAC;AAE3C,0EAA0E;AAC1E,eAAO,MAAM,gBAAgB,OAAO,CAAC;AAErC,0EAA0E;AAC1E,eAAO,MAAM,aAAa,IAAI,CAAC;AAQ/B,iFAAiF;AACjF,MAAM,WAAW,cAAc;IAC7B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AO,CAAC,CAAC;QAC1D,gBAAgB,CAAC,EAAE,OAAO,CAAC;QAC3B,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;KACxB,KAAG,OAAO,CAAC;QAAE,QAAQ,EAAE,gBAAgB,EAAE,CAAC;QAAC,OAAO,EAAE,aAAa,EAAE,CAAA;KAAE,CAAC;oCAvFzB,OAAO,KAAG,eAAe,EAAE;wCA5BvB,OAAO,KAAG,eAAe,EAAE;;AAqU7E,wBAYE"}
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
// run reads only what that person may open. A knowledge base the person
|
|
17
17
|
// cannot read is skipped and reported (`retrievePassages`): grounding from
|
|
18
18
|
// skill coverage generates without it. A knowledge base that references
|
|
19
|
-
// cite is another matter (Candin, 2026-10-13): the
|
|
20
|
-
// (
|
|
19
|
+
// cite is another matter (Candin, 2026-10-13): the source store
|
|
20
|
+
// (`sourceStore.prepareSources`) stops the run with a
|
|
21
21
|
// KnowledgeAccessError instead.
|
|
22
22
|
//
|
|
23
23
|
// A reference points at the content and never copies it: the passage is
|
|
@@ -33,8 +33,12 @@
|
|
|
33
33
|
//
|
|
34
34
|
// The search itself is the caller's (`search`: client-api
|
|
35
35
|
// `knowledgeBaseAgent.search`, 1.11 or later for `documentIds`), so this
|
|
36
|
-
// module needs no particular client-api.
|
|
36
|
+
// module needs no particular client-api. A search that fails for a reason
|
|
37
|
+
// that may pass is made again (retry.ts: 2 s, then 6 s; never a refusal);
|
|
38
|
+
// one that still fails is reported, not hidden.
|
|
37
39
|
//
|
|
40
|
+
import logger from "./logger.js";
|
|
41
|
+
import { retryTransient, statusOf } from "./retry.js";
|
|
38
42
|
/** What a STACKFACTOR reference to a knowledge base document carries (backend-core REFERENCE). */
|
|
39
43
|
export const STACKFACTOR_REFERENCE = Object.freeze({
|
|
40
44
|
KIND: "STACKFACTOR",
|
|
@@ -52,8 +56,7 @@ export const DEFAULT_TOP_K = 8;
|
|
|
52
56
|
const CONCURRENCY = 4;
|
|
53
57
|
/** Statuses that mean the person may not read the knowledge base, or it is gone. */
|
|
54
58
|
const NO_ACCESS = new Set([401, 403, 404]);
|
|
55
|
-
|
|
56
|
-
const RETRY_DELAY_MS = 200;
|
|
59
|
+
export const PASSAGE_ROLE = Object.freeze({ TEACHING: "teaching", LOGISTICS: "logistics" });
|
|
57
60
|
const text = (value) => (typeof value === "string" ? value.trim() : "");
|
|
58
61
|
/** An http(s) address, or null: a reference's url lands in an `href`. */
|
|
59
62
|
const webUrl = (value) => (/^https?:\/\//i.test(text(value)) ? text(value) : null);
|
|
@@ -128,26 +131,47 @@ const inPool = async (items, limit, worker) => {
|
|
|
128
131
|
};
|
|
129
132
|
await Promise.all(Array.from({ length: Math.min(limit, items.length) }, run));
|
|
130
133
|
};
|
|
131
|
-
/** The status of a failed platform call, from an axios error or one shaped like it. */
|
|
132
|
-
const statusOf = (error) => {
|
|
133
|
-
const status = error?.response?.status ?? error?.status;
|
|
134
|
-
return typeof status === "number" ? status : null;
|
|
135
|
-
};
|
|
136
|
-
const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
137
134
|
/**
|
|
138
135
|
* Searches every source for every query, under the person's access, and hands
|
|
139
136
|
* back the passages found, best first, each once, tagged "k1", "k2"… for the
|
|
140
137
|
* model to cite. A source with documents is searched within them (in batches of
|
|
141
138
|
* SEARCH_DOCUMENT_IDS_MAX); one without, whole. A source the person may not
|
|
142
139
|
* read (401, 403, 404) is skipped: none of its passages are used and no more of
|
|
143
|
-
* its searches are made. A search that fails
|
|
144
|
-
*
|
|
145
|
-
*
|
|
146
|
-
*
|
|
147
|
-
*
|
|
140
|
+
* its searches are made. A search that fails for a reason that may pass (a
|
|
141
|
+
* timeout, a rate limit, a 5xx, the network) is made again (retryTransient:
|
|
142
|
+
* after 2 s, then 6 s, under `retry.breaker` when the caller shares one
|
|
143
|
+
* across its searches); one that still fails, or failed for a reason that
|
|
144
|
+
* will not pass (a 422), is reported and the passages its other searches
|
|
145
|
+
* found stand. A refusal is never tried again, and a search is not retried
|
|
146
|
+
* once its knowledge base refused the person meanwhile. Either way it is in
|
|
147
|
+
* `skipped`, once per knowledge base, and the passages of the others stand;
|
|
148
|
+
* whether a skip is an error is the caller's to say.
|
|
149
|
+
*
|
|
150
|
+
* A passage ingestion labelled as logistics is left out: an agenda or a
|
|
151
|
+
* syllabus slide matches any query on the course's subject and teaches
|
|
152
|
+
* nothing, and one was cited as the source of a micro-skill (prod,
|
|
153
|
+
* 2026-11-16). The search is asked to leave them out itself
|
|
154
|
+
* (`excludePassageRoles`, backend-core #1065), so it still answers `topK`
|
|
155
|
+
* passages: dropped only after the search, they took more than half of each
|
|
156
|
+
* answer with them, and 7 of 10 searches of 8 kept none (the same day). A
|
|
157
|
+
* platform that does not know the option answers them all the same, so any
|
|
158
|
+
* that come back are dropped here, and the count is logged. `includeLogistics`
|
|
159
|
+
* keeps them, for a reader that must see what a reference cites whatever it
|
|
160
|
+
* is. A passage with no label is kept.
|
|
161
|
+
*
|
|
162
|
+
* `microSkills` names microskills of the knowledge bases, as their microskill
|
|
163
|
+
* lists name them: every search is asked to put the passages ingestion
|
|
164
|
+
* labelled with one of them first (backend-core #1072), and they rank first
|
|
165
|
+
* here too, in the searches' own order, ahead of every other passage whatever
|
|
166
|
+
* its score. Asked for by name through the search alone, a microskill's own
|
|
167
|
+
* passages lost to ones sharing words with the skill's name, and the wrong
|
|
168
|
+
* passage was cited (prod, 2026-11-17). A platform that does not know the
|
|
169
|
+
* option answers as before, and nothing is marked.
|
|
148
170
|
* @param options `sources`, `queries`, `search` (client-api
|
|
149
171
|
* `knowledgeBaseAgent.search`), `token` (the run's AGENT token), `topK`
|
|
150
|
-
* per search (default DEFAULT_TOP_K)
|
|
172
|
+
* per search (default DEFAULT_TOP_K), `retry` (`waits`, `breaker`, `sleep`
|
|
173
|
+
* for retryTransient; default: RETRY_WAITS, no breaker), `includeLogistics`
|
|
174
|
+
* (default false), `microSkills` (default none)
|
|
151
175
|
* @returns `{ passages, skipped }`
|
|
152
176
|
*/
|
|
153
177
|
export const retrievePassages = async (options) => {
|
|
@@ -168,29 +192,30 @@ export const retrievePassages = async (options) => {
|
|
|
168
192
|
}
|
|
169
193
|
}
|
|
170
194
|
}
|
|
195
|
+
// What every search is asked to leave out: nothing, for a reader of what a
|
|
196
|
+
// reference cites.
|
|
197
|
+
const leftOut = options.includeLogistics
|
|
198
|
+
? {}
|
|
199
|
+
: { excludePassageRoles: [PASSAGE_ROLE.LOGISTICS] };
|
|
200
|
+
const microSkills = [
|
|
201
|
+
...new Set((Array.isArray(options.microSkills) ? options.microSkills : []).map(text).filter(Boolean)),
|
|
202
|
+
];
|
|
203
|
+
const named = microSkills.length > 0 ? { microSkills } : {};
|
|
171
204
|
const found = new Map();
|
|
172
205
|
const skipped = new Map();
|
|
173
206
|
await inPool(searches, CONCURRENCY, async ({ source, query, documentIds, order }) => {
|
|
174
207
|
if (skipped.get(source.knowledgeBaseId)?.noAccess)
|
|
175
208
|
return;
|
|
176
|
-
const searchOnce = () => options.search(source.knowledgeBaseId, query, documentIds ? {
|
|
209
|
+
const searchOnce = () => options.search(source.knowledgeBaseId, query, { topK, ...(documentIds ? { documentIds } : {}), ...leftOut, ...named }, options.token);
|
|
177
210
|
try {
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
// unless the base refused the person meanwhile.
|
|
187
|
-
if (NO_ACCESS.has(statusOf(error)))
|
|
188
|
-
throw error;
|
|
189
|
-
await delay(RETRY_DELAY_MS);
|
|
190
|
-
if (skipped.get(source.knowledgeBaseId)?.noAccess)
|
|
191
|
-
return;
|
|
192
|
-
answer = await searchOnce();
|
|
193
|
-
}
|
|
211
|
+
// A refusal is the platform's answer and is not asked again (it is not
|
|
212
|
+
// transient). A failure that may pass is made again after its waits —
|
|
213
|
+
// unless the base refused the person meanwhile.
|
|
214
|
+
const answer = await retryTransient(`search "${query}" in knowledge base ${source.knowledgeBaseId}`, searchOnce, {
|
|
215
|
+
...options.retry,
|
|
216
|
+
key: source.knowledgeBaseId,
|
|
217
|
+
stopWhen: () => Boolean(skipped.get(source.knowledgeBaseId)?.noAccess),
|
|
218
|
+
});
|
|
194
219
|
(Array.isArray(answer?.chunks) ? answer.chunks : []).forEach((chunk, rank) => {
|
|
195
220
|
const chunkId = id(chunk?._id);
|
|
196
221
|
if (!chunkId || !id(chunk?.documentId))
|
|
@@ -201,6 +226,8 @@ export const retrievePassages = async (options) => {
|
|
|
201
226
|
found.set(chunkId, {
|
|
202
227
|
chunk: better ? chunk : known.chunk,
|
|
203
228
|
knowledgeBaseId: source.knowledgeBaseId,
|
|
229
|
+
// Labelled in any search is labelled: the mark is the passage's, not the query's.
|
|
230
|
+
labelled: chunk.labelled === true || known?.labelled === true,
|
|
204
231
|
order: known ? Math.min(known.order, order * 1000 + rank) : order * 1000 + rank,
|
|
205
232
|
});
|
|
206
233
|
});
|
|
@@ -219,10 +246,21 @@ export const retrievePassages = async (options) => {
|
|
|
219
246
|
});
|
|
220
247
|
}
|
|
221
248
|
});
|
|
222
|
-
const
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
.
|
|
249
|
+
const readable = [...found.entries()].filter(([, entry]) => !skipped.get(entry.knowledgeBaseId)?.noAccess);
|
|
250
|
+
const kept = options.includeLogistics
|
|
251
|
+
? readable
|
|
252
|
+
: readable.filter(([, entry]) => passageRoleOf(entry.chunk.passageRole) !== PASSAGE_ROLE.LOGISTICS);
|
|
253
|
+
if (kept.length < readable.length) {
|
|
254
|
+
logger.log(null, logger.levels.info, `[Knowledge Base] ${readable.length - kept.length} logistics passage(s) the search answered were left out: an agenda, a schedule or a title slide teaches nothing`);
|
|
255
|
+
}
|
|
256
|
+
const passages = kept
|
|
257
|
+
.sort(
|
|
258
|
+
// Labelled first, in the searches' own order: one the search's two legs
|
|
259
|
+
// missed has no score to rank by.
|
|
260
|
+
([, a], [, b]) => Number(b.labelled) - Number(a.labelled) ||
|
|
261
|
+
(a.labelled ? 0 : (b.chunk.score ?? 0) - (a.chunk.score ?? 0)) ||
|
|
262
|
+
a.order - b.order)
|
|
263
|
+
.map(([chunkId, { chunk, knowledgeBaseId, labelled }], index) => ({
|
|
226
264
|
chunkId,
|
|
227
265
|
documentId: id(chunk.documentId),
|
|
228
266
|
documentName: text(chunk.documentName) || null,
|
|
@@ -231,6 +269,9 @@ export const retrievePassages = async (options) => {
|
|
|
231
269
|
knowledgeBaseId: id(chunk.knowledgeBaseId) || knowledgeBaseId,
|
|
232
270
|
pageNumber: typeof chunk.pageNumber === "number" ? chunk.pageNumber : null,
|
|
233
271
|
score: typeof chunk.score === "number" ? chunk.score : null,
|
|
272
|
+
...(labelled ? { labelled: true } : {}),
|
|
273
|
+
passageRole: passageRoleOf(chunk.passageRole),
|
|
274
|
+
passageTitle: text(chunk.passageTitle) || null,
|
|
234
275
|
sectionTitle: text(chunk.sectionTitle) || null,
|
|
235
276
|
skills: (Array.isArray(chunk.skills) ? chunk.skills : []).map((skill) => ({
|
|
236
277
|
microSkills: (Array.isArray(skill?.microSkills) ? skill.microSkills : []).filter((name) => typeof name === "string"),
|
|
@@ -241,14 +282,27 @@ export const retrievePassages = async (options) => {
|
|
|
241
282
|
}));
|
|
242
283
|
return { passages, skipped: [...skipped.values()] };
|
|
243
284
|
};
|
|
285
|
+
/** A passage's role as the platform sent it: one of PASSAGE_ROLE, else null. */
|
|
286
|
+
const passageRoleOf = (value) => value === PASSAGE_ROLE.TEACHING || value === PASSAGE_ROLE.LOGISTICS ? value : null;
|
|
287
|
+
/**
|
|
288
|
+
* What a passage is headed by, for a reader: the title ingestion wrote from
|
|
289
|
+
* its content, else the heading its document carries. A slide's own heading
|
|
290
|
+
* is often a time allowance ("Total Time: 40 minutes") or the heading of the
|
|
291
|
+
* slide before, over a passage that teaches something else.
|
|
292
|
+
* @param passage A passage, as `retrievePassages` answers it
|
|
293
|
+
* @returns The heading, or null when the passage has neither
|
|
294
|
+
*/
|
|
295
|
+
export const passageHeading = (passage) => text(passage.passageTitle) || passage.sectionTitle || null;
|
|
244
296
|
/**
|
|
245
|
-
* The passages as a prompt shows them: tag, where each came from, and its
|
|
297
|
+
* The passages as a prompt shows them: tag, where each came from, and its
|
|
298
|
+
* text. `section` is the passage's heading (`passageHeading`), which is also
|
|
299
|
+
* its reference's description, so a reader can match one to the other.
|
|
246
300
|
* @param passages From `retrievePassages`
|
|
247
301
|
* @returns `[{ tag, document, section, text }]`, for the model's input
|
|
248
302
|
*/
|
|
249
303
|
export const passagesForPrompt = (passages) => (Array.isArray(passages) ? passages : []).map((passage) => ({
|
|
250
304
|
document: passage.documentName,
|
|
251
|
-
section: passage
|
|
305
|
+
section: passageHeading(passage),
|
|
252
306
|
tag: passage.tag,
|
|
253
307
|
text: passage.text,
|
|
254
308
|
}));
|
|
@@ -259,6 +313,10 @@ export const passagesForPrompt = (passages) => (Array.isArray(passages) ? passag
|
|
|
259
313
|
* page at the source (`url`) when the passage has one. Each is titled by its
|
|
260
314
|
* document's title, else its name, else its section; its pointer keeps the
|
|
261
315
|
* document's name (`knowledgeBase.documentName`) when the passage has one.
|
|
316
|
+
* Its `description` is the passage's heading (`passageHeading`: the title
|
|
317
|
+
* written from its content, else the document's own heading), while its
|
|
318
|
+
* pointer's `sectionTitle` stays the document's heading: that is what tells
|
|
319
|
+
* two passages of one section apart from two sections.
|
|
262
320
|
* @param passages From `retrievePassages`
|
|
263
321
|
* @param tags The tags the model cited ("k3", "K3" and " k3 " alike)
|
|
264
322
|
* @returns The references, ready for a skill's, a microskill's or a question's `references`
|
|
@@ -274,7 +332,7 @@ export const referencesFor = (passages, tags) => {
|
|
|
274
332
|
const url = webUrl(passage.documentUrl);
|
|
275
333
|
const documentName = text(passage.documentName);
|
|
276
334
|
return {
|
|
277
|
-
description: passage
|
|
335
|
+
description: passageHeading(passage),
|
|
278
336
|
kind: STACKFACTOR_REFERENCE.KIND,
|
|
279
337
|
knowledgeBase: {
|
|
280
338
|
chunkId: passage.chunkId,
|
|
@@ -299,7 +357,9 @@ export default {
|
|
|
299
357
|
DEFAULT_TOP_K,
|
|
300
358
|
QUERY_MAX_LENGTH,
|
|
301
359
|
SEARCH_DOCUMENT_IDS_MAX,
|
|
360
|
+
PASSAGE_ROLE,
|
|
302
361
|
STACKFACTOR_REFERENCE,
|
|
362
|
+
passageHeading,
|
|
303
363
|
passagesForPrompt,
|
|
304
364
|
referencesFor,
|
|
305
365
|
retrievePassages,
|
package/dist/esm/tavily.d.ts
CHANGED
|
@@ -51,7 +51,7 @@ export type TavilyConfig = {
|
|
|
51
51
|
* trailing slash, and sent as listed). Any other URL is never sent to
|
|
52
52
|
* Tavily: the tool answers the model with an error line for it and never
|
|
53
53
|
* throws. Unset, any URL may be read. Only `web_extract` reads it, so a run
|
|
54
|
-
* kept to its pages enables `extract` alone
|
|
54
|
+
* kept to its pages enables `extract` alone.
|
|
55
55
|
*/
|
|
56
56
|
allowedUrls?: string[];
|
|
57
57
|
};
|
|
@@ -90,6 +90,15 @@ export declare const assertTavilyUsable: (config: any, options: TavilyConfig) =>
|
|
|
90
90
|
* @returns LangChain tool instances to append to the agent's tool list
|
|
91
91
|
*/
|
|
92
92
|
export declare const buildTavilyTools: (config: any, options: TavilyConfig, usageTracker?: UsageTracker | null) => any[];
|
|
93
|
+
/** What a link check found, each URL exactly as it was passed. */
|
|
94
|
+
export interface UrlCheck {
|
|
95
|
+
/** Tavily fetched it. */
|
|
96
|
+
reachable: Set<string>;
|
|
97
|
+
/** Tavily could not fetch it, or it is no `http:` or `https:` URL. */
|
|
98
|
+
unreachable: Set<string>;
|
|
99
|
+
/** The check itself did not run for it: nothing is known about the link. */
|
|
100
|
+
unchecked: Set<string>;
|
|
101
|
+
}
|
|
93
102
|
/**
|
|
94
103
|
* Which of these URLs resolve, judged by Tavily fetching them rather than by
|
|
95
104
|
* this process connecting to them.
|
|
@@ -111,10 +120,102 @@ export declare const buildTavilyTools: (config: any, options: TavilyConfig, usag
|
|
|
111
120
|
* fetch under `failed_results`. So a URL listed there is unreachable, and every
|
|
112
121
|
* other URL of a batch Tavily answered is reachable (the results may name a
|
|
113
122
|
* URL by its address after a redirect, which is why they are not matched). A
|
|
114
|
-
* batch whose call fails outright, or a config without `tavilyAPIKey`,
|
|
115
|
-
*
|
|
123
|
+
* batch whose call fails outright, or a config without `tavilyAPIKey`, says
|
|
124
|
+
* nothing about its URLs: they are `unchecked`, which is not `unreachable`.
|
|
125
|
+
* The caller decides what an unchecked link is worth; dropping it as dead
|
|
126
|
+
* loses every citation to one failed call.
|
|
116
127
|
*
|
|
117
|
-
* @param urls - The URLs to check; a URL given twice is checked once
|
|
128
|
+
* @param urls - The URLs to check; a URL given twice is checked once. A value
|
|
129
|
+
* that is no string is in no set
|
|
130
|
+
* @param config - The integration config; supplies `tavilyAPIKey`
|
|
131
|
+
* @param usageTracker - Optional accumulator the credits are counted into
|
|
132
|
+
* @returns The given URLs, exactly as passed, each in one of the three sets
|
|
133
|
+
*/
|
|
134
|
+
export declare const checkUrls: (urls: readonly string[], config: any, usageTracker?: UsageTracker | null) => Promise<UrlCheck>;
|
|
135
|
+
/** What reading one URL in full gave: its text, or why there is none. */
|
|
136
|
+
export interface UrlRead {
|
|
137
|
+
/** The URL exactly as it was passed. */
|
|
138
|
+
url: string;
|
|
139
|
+
/** The page's text as markdown; absent when it could not be read. */
|
|
140
|
+
text?: string;
|
|
141
|
+
/** The page's own title, when Tavily gave one. */
|
|
142
|
+
title?: string;
|
|
143
|
+
/** Why it could not be read; absent when it was. */
|
|
144
|
+
error?: string;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Reads URLs in full, without a model: each page's whole text as markdown, or
|
|
148
|
+
* why it could not be read. What a run's source store holds of the pages its
|
|
149
|
+
* references point at (`sourceStore.prepareSources`).
|
|
150
|
+
*
|
|
151
|
+
* Nothing is trimmed here: Tavily returns whatever the page holds, which for a
|
|
152
|
+
* long PDF is over a million characters. The caller holds the text outside the
|
|
153
|
+
* model's context and hands it over a page at a time.
|
|
154
|
+
*
|
|
155
|
+
* They go in batches of 20, Tavily's limit, and are billed and recorded like
|
|
156
|
+
* every other Tavily call (`tavilyCredits`, `webSearchSources`,
|
|
157
|
+
* `attemptedUrls`). A URL Tavily could not fetch is asked for once more: its
|
|
158
|
+
* answer does not tell a page that is gone from one that failed for a moment.
|
|
159
|
+
* Tavily may name a result by the address it was redirected to, so a URL it
|
|
160
|
+
* neither returned under its own address nor listed as failed is asked for
|
|
161
|
+
* again on its own, where the one result is its.
|
|
162
|
+
*
|
|
163
|
+
* @param urls - The URLs to read; a URL given twice is read once. A value
|
|
164
|
+
* that is no string is left out
|
|
165
|
+
* @param config - The integration config; supplies `tavilyAPIKey`
|
|
166
|
+
* @param usageTracker - Optional accumulator the credits are counted into
|
|
167
|
+
* @returns One entry per distinct URL, in the order given
|
|
168
|
+
*/
|
|
169
|
+
export declare const readUrls: (urls: readonly string[], config: any, usageTracker?: UsageTracker | null) => Promise<UrlRead[]>;
|
|
170
|
+
/**
|
|
171
|
+
* A cited link's check did not run, after the retries: Tavily's call for it
|
|
172
|
+
* failed, or no key was configured. Such a link is not dead, so nothing is
|
|
173
|
+
* dropped for it; the person is asked to try again. Its message is the coded
|
|
174
|
+
* JSON an agent's failure carries (`{ code, message }`, 503), so `serve`
|
|
175
|
+
* answers the person with the sentence, not a 500.
|
|
176
|
+
*/
|
|
177
|
+
export declare class LinksNotCheckedError extends Error {
|
|
178
|
+
readonly code = 503;
|
|
179
|
+
/** How many of the links went unchecked. */
|
|
180
|
+
readonly unchecked: number;
|
|
181
|
+
/** How many links were checked, each once. */
|
|
182
|
+
readonly total: number;
|
|
183
|
+
/**
|
|
184
|
+
* @param unchecked How many of the links went unchecked
|
|
185
|
+
* @param total How many links were checked, each once
|
|
186
|
+
*/
|
|
187
|
+
constructor(unchecked: number, total: number);
|
|
188
|
+
}
|
|
189
|
+
/** How `unreachableUrls` waits between its checks. */
|
|
190
|
+
export interface UnreachableUrlsOptions {
|
|
191
|
+
/** How long to wait before each check of the links still unchecked, in milliseconds. Default RETRY_WAITS. */
|
|
192
|
+
waits?: readonly number[];
|
|
193
|
+
/** How to wait; swappable in tests. */
|
|
194
|
+
sleep?: (ms: number) => Promise<void>;
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* The cited links that are dead: the ones Tavily could not fetch, and any
|
|
198
|
+
* that is no web link (`checkUrls`). A link whose check did not run (one
|
|
199
|
+
* dropped connection fails the 20 links of its call) is checked again, with
|
|
200
|
+
* the others like it and no link already settled, after each of the waits.
|
|
201
|
+
* One still unchecked after them is not called dead: the call throws, so the
|
|
202
|
+
* caller drops nothing for a check that did not run.
|
|
203
|
+
*
|
|
204
|
+
* @param urls - The links; a link given twice is checked once
|
|
205
|
+
* @param config - The integration config; supplies `tavilyAPIKey`
|
|
206
|
+
* @param usageTracker - Optional accumulator the credits are counted into
|
|
207
|
+
* @param options - `waits` (default RETRY_WAITS) and `sleep`
|
|
208
|
+
* @returns The dead links, each exactly as passed
|
|
209
|
+
* @throws {LinksNotCheckedError} When a link is still unchecked after the waits
|
|
210
|
+
*/
|
|
211
|
+
export declare const unreachableUrls: (urls: readonly string[], config: any, usageTracker?: UsageTracker | null, options?: UnreachableUrlsOptions) => Promise<Set<string>>;
|
|
212
|
+
/**
|
|
213
|
+
* The URLs of `checkUrls` that Tavily fetched, and nothing about the rest.
|
|
214
|
+
*
|
|
215
|
+
* @deprecated Use `checkUrls`. This answer cannot tell a dead link from one
|
|
216
|
+
* whose check did not run, so a caller that drops what is missing from it
|
|
217
|
+
* drops every link when one call fails.
|
|
218
|
+
* @param urls - The URLs to check
|
|
118
219
|
* @param config - The integration config; supplies `tavilyAPIKey`
|
|
119
220
|
* @param usageTracker - Optional accumulator the credits are counted into
|
|
120
221
|
* @returns The given URLs, exactly as passed, that resolve
|
|
@@ -123,7 +224,10 @@ export declare const checkUrlsReachable: (urls: readonly string[], config: any,
|
|
|
123
224
|
declare const _default: {
|
|
124
225
|
assertTavilyUsable: (config: any, options: TavilyConfig) => void;
|
|
125
226
|
buildTavilyTools: (config: any, options: TavilyConfig, usageTracker?: UsageTracker | null) => any[];
|
|
227
|
+
checkUrls: (urls: readonly string[], config: any, usageTracker?: UsageTracker | null) => Promise<UrlCheck>;
|
|
126
228
|
checkUrlsReachable: (urls: readonly string[], config: any, usageTracker?: UsageTracker | null) => Promise<Set<string>>;
|
|
229
|
+
readUrls: (urls: readonly string[], config: any, usageTracker?: UsageTracker | null) => Promise<UrlRead[]>;
|
|
230
|
+
unreachableUrls: (urls: readonly string[], config: any, usageTracker?: UsageTracker | null, options?: UnreachableUrlsOptions) => Promise<Set<string>>;
|
|
127
231
|
getTavilyOptions: (config: any) => TavilyConfig | null;
|
|
128
232
|
recordTavilyUsage: (tracker: UsageTracker | null | undefined, _config: any, credits: number, sources: {
|
|
129
233
|
url: string;
|
package/dist/esm/tavily.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tavily.d.ts","sourceRoot":"","sources":["../../src/tavily.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tavily.d.ts","sourceRoot":"","sources":["../../src/tavily.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AA0BnD,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,SAAS,GAAG,OAAO,GAAG,KAAK,CAAC;AAEpE;;;;;;;;;GASG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,cAAc,EAAE,CAAC;IACzB,iEAAiE;IACjE,WAAW,CAAC,EAAE,OAAO,GAAG,UAAU,GAAG,MAAM,GAAG,YAAY,CAAC;IAC3D,kFAAkF;IAClF,YAAY,CAAC,EAAE,OAAO,GAAG,UAAU,CAAC;IACpC,2CAA2C;IAC3C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,eAAe,CAAC,EAAE,M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