@biolibs/bionet-agent 0.1.4 → 0.1.6
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 +68 -2
- package/dist/index.d.ts +5 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/known.d.ts +28 -0
- package/dist/known.d.ts.map +1 -0
- package/dist/known.js +239 -0
- package/dist/known.js.map +1 -0
- package/dist/papers.d.ts +33 -0
- package/dist/papers.d.ts.map +1 -0
- package/dist/papers.js +273 -0
- package/dist/papers.js.map +1 -0
- package/dist/tools.d.ts +14 -3
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +201 -5
- package/dist/tools.js.map +1 -1
- package/package.json +6 -4
- package/src/index.ts +5 -1
- package/src/known.ts +241 -0
- package/src/papers.ts +271 -0
- package/src/tools.ts +204 -9
package/dist/papers.js
ADDED
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reading the literature: Europe PMC, through `@biolibs/europepmc`.
|
|
3
|
+
*
|
|
4
|
+
* Every other thing an adviser has either reads the lab or works something out from a sequence.
|
|
5
|
+
* These read what other people have published, and that is a different kind of knowing, so they
|
|
6
|
+
* are kept apart and say so in their own descriptions.
|
|
7
|
+
*
|
|
8
|
+
* It is worth being clear about why this exists at all. An adviser without it answers a question
|
|
9
|
+
* like "which host should we express casein in?" out of whatever it happens to know, and what it
|
|
10
|
+
* happens to know has no date on it and cannot be checked. With it, the answer can be a paper: this
|
|
11
|
+
* group used this host with this promoter and got this much, here is the section that says so, and
|
|
12
|
+
* here is where to read it. That is a different thing to hand a lab member, and the difference is
|
|
13
|
+
* the whole point.
|
|
14
|
+
*
|
|
15
|
+
* Three things follow from reaching outside, and all three are decided here rather than left to the
|
|
16
|
+
* agent:
|
|
17
|
+
*
|
|
18
|
+
* - **Nothing of the lab's goes out.** A query is words the agent writes, capped short enough that
|
|
19
|
+
* a sequence cannot be pasted into one. Nothing reads the freezer.
|
|
20
|
+
* - **A paper is somebody's claim.** What comes back is what a group reported, not something this
|
|
21
|
+
* lab has seen, and every answer says so rather than leaving it to be assumed.
|
|
22
|
+
* - **Only the open ones can be read.** Most papers are not open access, and for those there is the
|
|
23
|
+
* abstract and a link. Saying that plainly is better than an agent trying four ways to get at a
|
|
24
|
+
* full text that was never going to be there.
|
|
25
|
+
*/
|
|
26
|
+
import { EuropePmcError, citationsOf, findSection, fullTextOf, readArticle, referencesOf, searchArticles, settings, MOST_FOUND, SECTION_KINDS } from "@biolibs/europepmc";
|
|
27
|
+
/** The longest a query may be. Short enough that a sequence cannot be put in one. */
|
|
28
|
+
export const LONGEST_QUERY = 400;
|
|
29
|
+
/** The most characters of a paper handed back in one go. A section, not a book. */
|
|
30
|
+
export const MOST_READ = 24_000;
|
|
31
|
+
const text = (value, what) => {
|
|
32
|
+
if (typeof value !== "string" || value.trim() === "")
|
|
33
|
+
throw new Error(`${what} has to be given, as text.`);
|
|
34
|
+
return value.trim();
|
|
35
|
+
};
|
|
36
|
+
const whole = (value, what) => {
|
|
37
|
+
if (typeof value !== "number" || !Number.isSafeInteger(value))
|
|
38
|
+
throw new Error(`${what} has to be a whole number.`);
|
|
39
|
+
return value;
|
|
40
|
+
};
|
|
41
|
+
/** What Europe PMC said went wrong, in words the agent can do something about. */
|
|
42
|
+
const asTrouble = (cause) => {
|
|
43
|
+
if (cause instanceof EuropePmcError) {
|
|
44
|
+
if (cause.status === 429)
|
|
45
|
+
return new Error("Europe PMC is being asked too often just now. Wait a little and ask again.");
|
|
46
|
+
// Only a request that was actually sent and got no answer means the device may be offline. An
|
|
47
|
+
// ID of the wrong shape never leaves this machine, and saying "offline" would send somebody to
|
|
48
|
+
// check their network when what is wrong is what they typed.
|
|
49
|
+
if (cause.offline)
|
|
50
|
+
return new Error("Europe PMC could not be reached. This device may be offline.");
|
|
51
|
+
return new Error(cause.message);
|
|
52
|
+
}
|
|
53
|
+
return cause instanceof Error ? cause : new Error(String(cause));
|
|
54
|
+
};
|
|
55
|
+
/** As much of a section as fits, with what was left said rather than quietly dropped. */
|
|
56
|
+
function asMuchAs(pieces, room) {
|
|
57
|
+
const parts = [];
|
|
58
|
+
let left = room;
|
|
59
|
+
let cut = 0;
|
|
60
|
+
for (const piece of pieces) {
|
|
61
|
+
if (left <= 0) {
|
|
62
|
+
cut += 1;
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
if (piece.text.length <= left) {
|
|
66
|
+
parts.push(piece);
|
|
67
|
+
left -= piece.text.length;
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
parts.push({ heading: piece.heading, text: `${piece.text.slice(0, left)}…` });
|
|
71
|
+
left = 0;
|
|
72
|
+
}
|
|
73
|
+
return { parts, cut };
|
|
74
|
+
}
|
|
75
|
+
/** The most headings listed at once. A review nests forty of them, which as one sentence is a wall. */
|
|
76
|
+
const MOST_HEADINGS = 40;
|
|
77
|
+
/**
|
|
78
|
+
* What a paper's shape says it is worth asking for next.
|
|
79
|
+
*
|
|
80
|
+
* The headings go back as a list and not as a sentence. A review has forty of them nested four
|
|
81
|
+
* deep, and run together with semicolons they are unreadable by anything, which is the opposite of
|
|
82
|
+
* what this is for.
|
|
83
|
+
*/
|
|
84
|
+
function whatElse(article) {
|
|
85
|
+
const headings = article.sections.filter((one) => one.heading !== "");
|
|
86
|
+
const shown = headings.slice(0, MOST_HEADINGS);
|
|
87
|
+
return {
|
|
88
|
+
...(shown.length === 0 ? {} : { sections: shown.map((one) => ({ heading: one.heading, under: one.depth, characters: one.text.length })) }),
|
|
89
|
+
...(headings.length > shown.length ? { more_sections: headings.length - shown.length } : {}),
|
|
90
|
+
...(article.tables.length === 0 ? {} : { tables: article.tables.length, tables_note: "A yield is as often in a table as in a sentence. Ask for \"tables\"." }),
|
|
91
|
+
ask_for: "Any heading above, by name, or one of: " + [...SECTION_KINDS, "tables", "figures", "all"].join(", "),
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* The tools that read the literature.
|
|
96
|
+
*
|
|
97
|
+
* @param options - Whether to offer them, and what to tell Europe PMC about who is asking.
|
|
98
|
+
* @returns The tools, or none if a host asked for none.
|
|
99
|
+
*
|
|
100
|
+
* @example
|
|
101
|
+
* ```ts
|
|
102
|
+
* import { paperTools } from "@biolibs/bionet-agent";
|
|
103
|
+
*
|
|
104
|
+
* paperTools({ tool: "bionet-adviser" }).map((one) => one.name);
|
|
105
|
+
* // ["search_papers", "read_paper", "papers_around"]
|
|
106
|
+
* ```
|
|
107
|
+
*/
|
|
108
|
+
export function paperTools(options = {}) {
|
|
109
|
+
if (options.papers === false)
|
|
110
|
+
return [];
|
|
111
|
+
// Said once, before anything is asked. Europe PMC wants a client to name itself; it is told the
|
|
112
|
+
// software's name and nothing about the lab or the person at it.
|
|
113
|
+
settings.tool = options.tool ?? "bionet-adviser";
|
|
114
|
+
if (options.email !== undefined)
|
|
115
|
+
settings.email = options.email;
|
|
116
|
+
const query = (value) => {
|
|
117
|
+
const asked = text(value, "The query");
|
|
118
|
+
if (asked.length > LONGEST_QUERY)
|
|
119
|
+
throw new Error(`A query is at most ${LONGEST_QUERY} characters. This searches by words; a sequence is not something to put in one.`);
|
|
120
|
+
return asked;
|
|
121
|
+
};
|
|
122
|
+
return [
|
|
123
|
+
{
|
|
124
|
+
name: "search_papers", title: "Search the literature", readOnly: true,
|
|
125
|
+
description: [
|
|
126
|
+
"Search Europe PMC, which indexes PubMed, PubMed Central, preprints and patents together, for what has been published about something.",
|
|
127
|
+
"Use it when the question is what is known rather than what this lab holds: which host somebody expressed a protein in and what they got, whether a promoter works in a given organism, what a sensible yield looks like, whether an approach has already failed for somebody.",
|
|
128
|
+
"The query takes plain words, phrases in quotes, and fields: `TITLE:`, `ABSTRACT:`, `METHODS:` (which searches the methods sections of open papers and is the one to use for a technique), `AUTH:`, `JOURNAL:`, `PUB_YEAR:`. `AND`, `OR` and `NOT` join them. For example: `\"kappa-casein\" AND \"Pichia pastoris\"` or `METHODS:\"Gibson assembly\" AND casein`.",
|
|
129
|
+
"Each result says whether its full text can actually be read, which is what read_paper needs; most papers are not open, and for those there is the abstract and a link.",
|
|
130
|
+
"This reaches the internet. Only the query is sent, so write it yourself and do not put the lab's own sequences, part names or notes in it; nothing is read from the freezer.",
|
|
131
|
+
].join(" "),
|
|
132
|
+
input: { type: "object", required: ["query"], additionalProperties: false, properties: {
|
|
133
|
+
query: { type: "string", description: `What to look for, at most ${LONGEST_QUERY} characters.` },
|
|
134
|
+
corpus: { type: "string", enum: ["all", "open-access", "preprints", "reviews"],
|
|
135
|
+
description: "Narrow it: open-access for papers that can be read in full, preprints for the newest work, reviews for a way into a field. All of it if not given." },
|
|
136
|
+
sort: { type: "string", enum: ["relevance", "cited", "date"], description: "cited brings the papers others built on, which for a broad query means the famous rather than the fitting; date brings the newest. Relevance if not given, and usually what you want." },
|
|
137
|
+
abstracts: { type: "boolean", description: "Bring the abstracts too. Worth it for a few results, not for many." },
|
|
138
|
+
limit: { type: "integer", description: `How many, up to ${MOST_FOUND}. 10 if not given.` },
|
|
139
|
+
} },
|
|
140
|
+
run: async (args) => {
|
|
141
|
+
const asked = query(args["query"]);
|
|
142
|
+
try {
|
|
143
|
+
const found = await searchArticles(asked, {
|
|
144
|
+
...(args["corpus"] === undefined ? {} : { corpus: text(args["corpus"], "The corpus") }),
|
|
145
|
+
...(args["sort"] === undefined ? {} : { sort: text(args["sort"], "The sort") }),
|
|
146
|
+
...(args["abstracts"] === true ? { abstracts: true } : {}),
|
|
147
|
+
...(args["limit"] === undefined ? {} : { limit: whole(args["limit"], "The limit") }),
|
|
148
|
+
});
|
|
149
|
+
if (found.results.length === 0) {
|
|
150
|
+
return { query: found.query, matched: 0, results: [],
|
|
151
|
+
note: "Nothing matched. Try fewer words, or drop a quoted phrase: a phrase has to appear exactly as written." };
|
|
152
|
+
}
|
|
153
|
+
return {
|
|
154
|
+
query: found.query, matched: found.matched, showing: found.results.length,
|
|
155
|
+
results: found.results.map((one) => ({
|
|
156
|
+
id: one.id, source: one.source, title: one.title, authors: one.authors.slice(0, 6),
|
|
157
|
+
journal: one.journal, year: one.year, cited_by: one.citedBy,
|
|
158
|
+
...(one.pmcid === null ? {} : { pmcid: one.pmcid }), ...(one.doi === null ? {} : { doi: one.doi }),
|
|
159
|
+
can_read_in_full: one.fullText,
|
|
160
|
+
...(one.hasSupplement ? { has_supplementary_data: true } : {}),
|
|
161
|
+
look_at: one.lookAt,
|
|
162
|
+
...(one.abstract === null ? {} : { abstract: one.abstract }),
|
|
163
|
+
})),
|
|
164
|
+
...(found.matched > found.results.length
|
|
165
|
+
? { note: `${found.matched.toLocaleString("en-US")} matched in all; these are the first ${found.results.length}. Narrow the query rather than asking for many more.` }
|
|
166
|
+
: {}),
|
|
167
|
+
from_outside: "These are what other groups have published. Nothing here has been checked by this lab. Use read_paper on one whose full text can be read.",
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
catch (cause) {
|
|
171
|
+
throw asTrouble(cause);
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
name: "read_paper", title: "Read an open-access paper", readOnly: true,
|
|
177
|
+
description: [
|
|
178
|
+
"Read one open-access paper from Europe PMC: its abstract, a named section of it, or its tables.",
|
|
179
|
+
"This is the one that answers a real question. A paper's methods are where the recipe is — which strain, which plasmid, what the medium was, what it was induced with and for how long — and `section: \"methods\"` gives that section and everything under it. `section: \"results\"` gives what came of it. `section: \"tables\"` gives the tables as rows, which is where a yield usually is.",
|
|
180
|
+
"Ask for it by the PubMed Central ID that search_papers gives as `pmcid`, for a result whose `can_read_in_full` is true. A paper that is not open access cannot be read here however it is asked for; there is its abstract from search_papers, and its link.",
|
|
181
|
+
"Without a section it gives the abstract and the list of headings, which is the cheap way to see what is worth asking for. A section longer than what one read brings back is cut, and says it was.",
|
|
182
|
+
"What a paper says is what that group reported. It is not something this lab has seen, and a method that worked for them may not work here; say whose result it is when you use it.",
|
|
183
|
+
"This reaches the internet. Only the paper's ID is sent.",
|
|
184
|
+
].join(" "),
|
|
185
|
+
input: { type: "object", required: ["pmcid"], additionalProperties: false, properties: {
|
|
186
|
+
pmcid: { type: "string", description: "The PubMed Central ID, such as PMC11767299." },
|
|
187
|
+
section: { type: "string", description: `Which part: ${SECTION_KINDS.join(", ")}, "tables", "figures", "all", or any words to match a heading with, such as "yeast".` },
|
|
188
|
+
} },
|
|
189
|
+
run: async (args) => {
|
|
190
|
+
const pmcid = text(args["pmcid"], "The paper's ID");
|
|
191
|
+
const wanted = args["section"] === undefined ? null : text(args["section"], "The section").toLowerCase();
|
|
192
|
+
let paper;
|
|
193
|
+
try {
|
|
194
|
+
paper = readArticle(await fullTextOf(pmcid));
|
|
195
|
+
}
|
|
196
|
+
catch (cause) {
|
|
197
|
+
throw asTrouble(cause);
|
|
198
|
+
}
|
|
199
|
+
const about = {
|
|
200
|
+
pmcid: pmcid.toUpperCase(), title: paper.title, journal: paper.journal, year: paper.year,
|
|
201
|
+
authors: paper.authors.slice(0, 8), ...(paper.licence === null ? {} : { licence: paper.licence }),
|
|
202
|
+
from_outside: "This is what this group reported. It is not something this lab has seen.",
|
|
203
|
+
};
|
|
204
|
+
if (wanted === "tables") {
|
|
205
|
+
const { parts, cut } = asMuchAs(paper.tables.map((one) => ({ heading: `${one.label} ${one.caption}`.trim(), text: JSON.stringify({ headings: one.headings, rows: one.rows }) })), MOST_READ);
|
|
206
|
+
return { ...about, tables: paper.tables.slice(0, parts.length).map((one) => ({ label: one.label, caption: one.caption, headings: one.headings, rows: one.rows })),
|
|
207
|
+
...(cut === 0 ? {} : { note: `${cut} more ${cut === 1 ? "table is" : "tables are"} not shown: they would not fit in one read.` }) };
|
|
208
|
+
}
|
|
209
|
+
if (wanted === "figures")
|
|
210
|
+
return { ...about, figures: paper.figures };
|
|
211
|
+
if (wanted === null) {
|
|
212
|
+
return { ...about, abstract: paper.abstract, keywords: paper.keywords,
|
|
213
|
+
table_captions: paper.tables.map((one) => `${one.label}: ${one.caption}`),
|
|
214
|
+
what_else: whatElse(paper) };
|
|
215
|
+
}
|
|
216
|
+
const whole = wanted === "all";
|
|
217
|
+
const match = whole ? { sections: paper.sections.filter((one) => one.text !== ""), exact: true } : findSection(paper, wanted);
|
|
218
|
+
const sections = match.sections;
|
|
219
|
+
if (sections.length === 0) {
|
|
220
|
+
return { ...about, found_nothing: `This paper has no section matching ${JSON.stringify(wanted)}.`, what_else: whatElse(paper) };
|
|
221
|
+
}
|
|
222
|
+
const { parts, cut } = asMuchAs(sections.map((one) => ({ heading: one.heading, text: one.text })), MOST_READ);
|
|
223
|
+
return {
|
|
224
|
+
...about, section: wanted,
|
|
225
|
+
// A paper with no methods section still has headings with the word in them. Saying the
|
|
226
|
+
// match was loose is the difference between an answer and a wrong answer confidently given.
|
|
227
|
+
...(match.exact ? {} : { not_an_exact_match: `No heading of this paper is ${JSON.stringify(wanted)}. These merely contain the word, so they may not be what you are after. The headings are in what_else.`,
|
|
228
|
+
what_else: whatElse(paper) }),
|
|
229
|
+
parts: parts.filter((one) => one.text !== "" || one.heading !== ""),
|
|
230
|
+
...(cut === 0 ? {} : { note: `${cut} further ${cut === 1 ? "part" : "parts"} of this section would not fit in one read. Ask for one of them by its heading.` }),
|
|
231
|
+
};
|
|
232
|
+
},
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
name: "papers_around", title: "What a paper cited, and who cited it", readOnly: true,
|
|
236
|
+
description: [
|
|
237
|
+
"Walk a paper's reference list, or the papers that have cited it since.",
|
|
238
|
+
"This is how you get to a method that is not written down where you found it. A paper says it expressed the gene \"as described previously\" and gives a number; the number is the paper with the actual recipe, and `direction: \"back\"` finds it. Going the other way says whether anybody managed to repeat the work, and what they changed.",
|
|
239
|
+
"Ask by the `id` and `source` that search_papers gives for a result, not by the PMC ID.",
|
|
240
|
+
"This reaches the internet. Only the paper's ID is sent.",
|
|
241
|
+
].join(" "),
|
|
242
|
+
input: { type: "object", required: ["id", "source", "direction"], additionalProperties: false, properties: {
|
|
243
|
+
id: { type: "string", description: "The paper's ID, from search_papers." },
|
|
244
|
+
source: { type: "string", description: "Which index it is in, from search_papers: MED, PMC or PPR." },
|
|
245
|
+
direction: { type: "string", enum: ["back", "forward"], description: "back for what it cited; forward for what has cited it." },
|
|
246
|
+
page: { type: "integer", description: "Which page, counting from 1. The first if not given." },
|
|
247
|
+
limit: { type: "integer", description: "How many on a page. 25 if not given." },
|
|
248
|
+
} },
|
|
249
|
+
run: async (args) => {
|
|
250
|
+
const id = text(args["id"], "The paper's ID");
|
|
251
|
+
const source = text(args["source"], "The index");
|
|
252
|
+
const back = text(args["direction"], "The direction") === "back";
|
|
253
|
+
const page = args["page"] === undefined ? undefined : whole(args["page"], "The page");
|
|
254
|
+
const limit = args["limit"] === undefined ? undefined : whole(args["limit"], "The limit");
|
|
255
|
+
try {
|
|
256
|
+
const trail = await (back ? referencesOf : citationsOf)(source, id, {
|
|
257
|
+
...(page === undefined ? {} : { page }), ...(limit === undefined ? {} : { limit }),
|
|
258
|
+
});
|
|
259
|
+
return {
|
|
260
|
+
of: `${source}/${id}`, direction: back ? "what it cited" : "what has cited it",
|
|
261
|
+
count: trail.count, page: trail.page, more: trail.more,
|
|
262
|
+
papers: trail.papers.map((one) => ({ id: one.id, source: one.source, title: one.title, authors: one.authors, journal: one.journal, year: one.year, look_at: one.lookAt })),
|
|
263
|
+
...(trail.count === 0 ? { note: back ? "Europe PMC has no reference list for this one." : "Nothing has cited it yet, or Europe PMC does not know of it." } : {}),
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
catch (cause) {
|
|
267
|
+
throw asTrouble(cause);
|
|
268
|
+
}
|
|
269
|
+
},
|
|
270
|
+
},
|
|
271
|
+
];
|
|
272
|
+
}
|
|
273
|
+
//# sourceMappingURL=papers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"papers.js","sourceRoot":"","sources":["../src/papers.ts"],"names":[],"mappings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KACF,CAAC;AACJ,CAAC"}
|
package/dist/tools.d.ts
CHANGED
|
@@ -17,6 +17,8 @@
|
|
|
17
17
|
*/
|
|
18
18
|
import type { Lab } from "@biolibs/bionet-client";
|
|
19
19
|
import { type LookupOptions } from "./lookup.js";
|
|
20
|
+
import { type PaperOptions } from "./papers.js";
|
|
21
|
+
import { type KnownOptions } from "./known.js";
|
|
20
22
|
/** A JSON schema for what a tool takes: always an object, with these properties. */
|
|
21
23
|
export interface ToolInput {
|
|
22
24
|
type: "object";
|
|
@@ -63,6 +65,14 @@ export type AgentShows = {
|
|
|
63
65
|
view: "result" | "tube";
|
|
64
66
|
tubes: string[];
|
|
65
67
|
};
|
|
68
|
+
} | {
|
|
69
|
+
at: "induction";
|
|
70
|
+
start: {
|
|
71
|
+
view: "result" | "tube";
|
|
72
|
+
culture: string;
|
|
73
|
+
gene: string;
|
|
74
|
+
cds?: string;
|
|
75
|
+
};
|
|
66
76
|
};
|
|
67
77
|
/** One tool an adviser can use. */
|
|
68
78
|
export interface AgentTool {
|
|
@@ -99,8 +109,9 @@ export declare const MOST_BASES = 20000;
|
|
|
99
109
|
*
|
|
100
110
|
* @param lab - The lab, opened, on a device that hosts an adviser.
|
|
101
111
|
* @param options - `watch` is told of each use, with what it would look like in the lab, so that a
|
|
102
|
-
* window can show the adviser at work; `outside` says whether to offer the tools that
|
|
103
|
-
*
|
|
112
|
+
* window can show the adviser at work; `outside` says whether to offer the tools that reach past
|
|
113
|
+
* the lab — NCBI's databases and the literature at Europe PMC — and what to tell them about who
|
|
114
|
+
* is asking.
|
|
104
115
|
* @returns The tools, in the order to list them.
|
|
105
116
|
*
|
|
106
117
|
* @example
|
|
@@ -113,6 +124,6 @@ export declare const MOST_BASES = 20000;
|
|
|
113
124
|
*/
|
|
114
125
|
export declare function agentTools(lab: Lab, options?: {
|
|
115
126
|
watch?: (call: AgentCall) => void;
|
|
116
|
-
outside?: LookupOptions;
|
|
127
|
+
outside?: LookupOptions & PaperOptions & KnownOptions;
|
|
117
128
|
}): AgentTool[];
|
|
118
129
|
//# sourceMappingURL=tools.d.ts.map
|
package/dist/tools.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,KAAK,EAAE,GAAG,EAAW,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAe,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,KAAK,EAAE,GAAG,EAAW,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAe,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAc,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAc,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AAO3D,oFAAoF;AACpF,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,QAAQ,CAAC;IACf,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACpD,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,oBAAoB,EAAE,KAAK,CAAC;CAC7B;AAED;;;GAGG;AACH,MAAM,MAAM,UAAU,GAClB;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE;QAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,GAC7D;IAAE,EAAE,EAAE,WAAW,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACjC;IAAE,EAAE,EAAE,SAAS,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,I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