chat-agent-toolkit 1.2.425 → 1.2.427

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 CHANGED
@@ -24,6 +24,10 @@
24
24
  </p>
25
25
  <!-- template-git-repo:badges:end -->
26
26
 
27
+ <!-- skills:install:start -->
28
+ **🤖 Agent skill** — `npx skills@latest add https://github.com/OpenSourceAGI/qwksearch-research-agent --skill chat-agent-toolkit` ([what it covers](../../skills/chat-agent-toolkit/SKILL.md))
29
+ <!-- skills:install:end -->
30
+
27
31
  Multi-provider AI agent toolkit for generating language responses, searching the web, extracting page content, and managing long-term memory across 10+ LLM providers.
28
32
 
29
33
  Built on top of the [Vercel AI SDK](https://sdk.vercel.ai) and [Mastra](https://mastra.ai) framework, with a small registry of pre-tuned agent prompts (research, summarization, citation answering, query resolution, knowledge-graph extraction, etc.) and tool wrappers around the [QwkSearch](https://qwksearch.com) API.
@@ -81,8 +81,8 @@ export declare const AGENT_TOOLS: ({
81
81
  bypassCaptcha: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
82
82
  sessionId: z.ZodDefault<z.ZodOptional<z.ZodString>>;
83
83
  format: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
84
- html: "html";
85
84
  json: "json";
85
+ html: "html";
86
86
  }>>>;
87
87
  scraperUrl: z.ZodOptional<z.ZodString>;
88
88
  scraperApiKey: z.ZodOptional<z.ZodString>;
@@ -23,7 +23,12 @@ export interface DrainableEmitter extends EventEmitter {
23
23
  export interface MetaSearchAgentType {
24
24
  searchAndAnswer: (message: string, history: ChatTurnMessage[], llm: LanguageModel, optimizationMode: "speed" | "balanced" | "quality", fileIds: string[], systemInstructions: string, category?: string, sourceExtractionEnabled?: boolean, thinkingTimeLimit?: number,
25
25
  /** User-authored replacement for the focus mode's query-expansion prompt. */
26
- queryExpansionPrompt?: string) => Promise<DrainableEmitter>;
26
+ queryExpansionPrompt?: string,
27
+ /**
28
+ * Rephrase the message with the LLM before searching. Off by default: the
29
+ * message is searched as typed, which saves a model round trip.
30
+ */
31
+ queryExpansionEnabled?: boolean) => Promise<DrainableEmitter>;
27
32
  }
28
33
  /** Emitted on the EventEmitter data channel to report live search progress. */
29
34
  export interface SearchingEvent {
@@ -6,16 +6,35 @@ declare class MetaSearchAgent implements MetaSearchAgentType {
6
6
  private config;
7
7
  constructor(config: Config);
8
8
  /**
9
- * Rephrases the user's query into a standalone search question (and any
10
- * URLs to summarize), runs the web search, and returns the documents to
11
- * use as answer context.
9
+ * Asks the LLM to rephrase the message into a standalone search question,
10
+ * and to pick out any URLs to summarize. This is a full model round trip
11
+ * before the search can start, so it only runs when query expansion is on.
12
+ */
13
+ private expandQuery;
14
+ /**
15
+ * Runs the web search and returns its results as answer-context documents:
16
+ * each one the result's title and search snippet, nothing fetched yet.
17
+ *
18
+ * The message is searched as typed unless `queryExpansionEnabled` is set,
19
+ * in which case the LLM rephrases it first (see {@link expandQuery}).
20
+ * `fromLinks` marks documents built from URLs in the message rather than a
21
+ * search, which already carry their pages' text.
12
22
  */
13
23
  private retrieveSearchDocs;
24
+ /**
25
+ * Replaces the search snippets of the top web results with text fetched
26
+ * from their pages, in place, when the user has turned source extraction on
27
+ * or set a thinking-time budget. Uploaded files are left alone.
28
+ *
29
+ * This runs after the result list has been sent to the client, so the
30
+ * sources appear while the pages are still loading.
31
+ */
32
+ private extractTopSources;
14
33
  /**
15
34
  * Runs the full search-and-answer pipeline, emitting "sources",
16
35
  * "response", "searching", "end", and "error" events on the emitter.
17
36
  */
18
37
  private runPipeline;
19
- searchAndAnswer(message: string, history: ChatTurnMessage[], llm: LanguageModel, optimizationMode: "speed" | "balanced" | "quality", fileIds: string[], systemInstructions: string, category?: string, sourceExtractionEnabled?: boolean, thinkingTimeLimit?: number, queryExpansionPrompt?: string): Promise<EventEmitter<any>>;
38
+ searchAndAnswer(message: string, history: ChatTurnMessage[], llm: LanguageModel, optimizationMode: "speed" | "balanced" | "quality", fileIds: string[], systemInstructions: string, category?: string, sourceExtractionEnabled?: boolean, thinkingTimeLimit?: number, queryExpansionPrompt?: string, queryExpansionEnabled?: boolean): Promise<EventEmitter<any>>;
20
39
  }
21
40
  export default MetaSearchAgent;