@yeyuan98/opencode-bioresearcher-plugin 1.5.0-alpha.0 → 1.5.1
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 +48 -36
- package/dist/index.js +8 -6
- package/dist/skills/bioresearcher-tests/README.md +90 -0
- package/dist/skills/bioresearcher-tests/SKILL.md +255 -0
- package/dist/skills/bioresearcher-tests/pyproject.toml +6 -0
- package/dist/skills/bioresearcher-tests/resources/json_samples/in_markdown.md.gz +0 -0
- package/dist/skills/bioresearcher-tests/resources/json_samples/nested_object.json.gz +0 -0
- package/dist/skills/bioresearcher-tests/resources/json_samples/schema_draft7.json.gz +0 -0
- package/dist/skills/bioresearcher-tests/resources/json_samples/simple_array.json.gz +0 -0
- package/dist/skills/bioresearcher-tests/resources/json_samples/simple_object.json.gz +0 -0
- package/dist/skills/bioresearcher-tests/resources/obo_sample.obo.gz +0 -0
- package/dist/skills/bioresearcher-tests/resources/pubmed_sample.xml.gz +0 -0
- package/dist/skills/bioresearcher-tests/resources/table_sample.xlsx.gz +0 -0
- package/dist/skills/bioresearcher-tests/test_cases/json_tests.md +137 -0
- package/dist/skills/bioresearcher-tests/test_cases/misc_tests.md +141 -0
- package/dist/skills/bioresearcher-tests/test_cases/parser_tests.md +80 -0
- package/dist/skills/bioresearcher-tests/test_cases/skill_tests.md +59 -0
- package/dist/skills/bioresearcher-tests/test_cases/table_tests.md +194 -0
- package/dist/skills/bioresearcher-tests/test_runner.py +607 -0
- package/dist/skills/env-jsonc-setup/SKILL.md +206 -206
- package/dist/skills/long-table-summary/SKILL.md +224 -153
- package/dist/skills/long-table-summary/combine_outputs.py +55 -9
- package/dist/skills/long-table-summary/generate_prompts.py +9 -0
- package/dist/skills/pubmed-weekly/pubmed_weekly.py +130 -29
- package/dist/{db-tools → tools/db}/backends/mysql/translator.js +23 -23
- package/dist/{db-tools → tools/db}/tools.js +34 -34
- package/dist/{misc-tools → tools/misc}/json-validate.js +4 -5
- package/dist/tools/parser/obo/index.d.ts +2 -0
- package/dist/tools/parser/obo/index.js +2 -0
- package/dist/tools/parser/obo/obo.d.ts +17 -0
- package/dist/tools/parser/obo/obo.js +216 -0
- package/dist/tools/parser/obo/types.d.ts +166 -0
- package/dist/tools/parser/obo/utils.d.ts +21 -0
- package/dist/tools/parser/obo/utils.js +411 -0
- package/dist/tools/parser/pubmed/types.js +1 -0
- package/dist/{skill-tools → tools/skill}/registry.js +1 -1
- package/package.json +1 -1
- package/dist/db-tools/executor.d.ts +0 -13
- package/dist/db-tools/executor.js +0 -54
- package/dist/db-tools/pool.d.ts +0 -8
- package/dist/db-tools/pool.js +0 -49
- package/dist/db-tools/tools/index.d.ts +0 -27
- package/dist/db-tools/tools/index.js +0 -191
- package/dist/db-tools/types.d.ts +0 -94
- package/dist/db-tools/types.js +0 -40
- package/dist/misc-tools/json-tools.d.ts +0 -33
- package/dist/misc-tools/json-tools.js +0 -187
- package/dist/skill/frontmatter.d.ts +0 -2
- package/dist/skill/frontmatter.js +0 -65
- package/dist/skill/index.d.ts +0 -3
- package/dist/skill/index.js +0 -2
- package/dist/skill/registry.d.ts +0 -11
- package/dist/skill/registry.js +0 -64
- package/dist/skill/tool.d.ts +0 -9
- package/dist/skill/tool.js +0 -115
- package/dist/skill/types.d.ts +0 -22
- package/dist/skill/types.js +0 -7
- /package/dist/{db-tools → tools/db}/backends/index.d.ts +0 -0
- /package/dist/{db-tools → tools/db}/backends/index.js +0 -0
- /package/dist/{db-tools → tools/db}/backends/mongodb/backend.d.ts +0 -0
- /package/dist/{db-tools → tools/db}/backends/mongodb/backend.js +0 -0
- /package/dist/{db-tools → tools/db}/backends/mongodb/connection.d.ts +0 -0
- /package/dist/{db-tools → tools/db}/backends/mongodb/connection.js +0 -0
- /package/dist/{db-tools → tools/db}/backends/mongodb/index.d.ts +0 -0
- /package/dist/{db-tools → tools/db}/backends/mongodb/index.js +0 -0
- /package/dist/{db-tools → tools/db}/backends/mongodb/translator.d.ts +0 -0
- /package/dist/{db-tools → tools/db}/backends/mongodb/translator.js +0 -0
- /package/dist/{db-tools → tools/db}/backends/mysql/backend.d.ts +0 -0
- /package/dist/{db-tools → tools/db}/backends/mysql/backend.js +0 -0
- /package/dist/{db-tools → tools/db}/backends/mysql/connection.d.ts +0 -0
- /package/dist/{db-tools → tools/db}/backends/mysql/connection.js +0 -0
- /package/dist/{db-tools → tools/db}/backends/mysql/index.d.ts +0 -0
- /package/dist/{db-tools → tools/db}/backends/mysql/index.js +0 -0
- /package/dist/{db-tools → tools/db}/backends/mysql/translator.d.ts +0 -0
- /package/dist/{db-tools → tools/db}/core/base.d.ts +0 -0
- /package/dist/{db-tools → tools/db}/core/base.js +0 -0
- /package/dist/{db-tools → tools/db}/core/config-loader.d.ts +0 -0
- /package/dist/{db-tools → tools/db}/core/config-loader.js +0 -0
- /package/dist/{db-tools → tools/db}/core/index.d.ts +0 -0
- /package/dist/{db-tools → tools/db}/core/index.js +0 -0
- /package/dist/{db-tools → tools/db}/core/jsonc-parser.d.ts +0 -0
- /package/dist/{db-tools → tools/db}/core/jsonc-parser.js +0 -0
- /package/dist/{db-tools → tools/db}/core/validator.d.ts +0 -0
- /package/dist/{db-tools → tools/db}/core/validator.js +0 -0
- /package/dist/{db-tools → tools/db}/index.d.ts +0 -0
- /package/dist/{db-tools → tools/db}/index.js +0 -0
- /package/dist/{db-tools → tools/db}/interface/backend.d.ts +0 -0
- /package/dist/{db-tools → tools/db}/interface/backend.js +0 -0
- /package/dist/{db-tools → tools/db}/interface/connection.d.ts +0 -0
- /package/dist/{db-tools → tools/db}/interface/connection.js +0 -0
- /package/dist/{db-tools → tools/db}/interface/index.d.ts +0 -0
- /package/dist/{db-tools → tools/db}/interface/index.js +0 -0
- /package/dist/{db-tools → tools/db}/interface/query.d.ts +0 -0
- /package/dist/{db-tools → tools/db}/interface/query.js +0 -0
- /package/dist/{db-tools → tools/db}/interface/schema.d.ts +0 -0
- /package/dist/{db-tools → tools/db}/interface/schema.js +0 -0
- /package/dist/{db-tools → tools/db}/tools.d.ts +0 -0
- /package/dist/{db-tools → tools/db}/utils.d.ts +0 -0
- /package/dist/{db-tools → tools/db}/utils.js +0 -0
- /package/dist/{misc-tools → tools/misc}/calculator.d.ts +0 -0
- /package/dist/{misc-tools → tools/misc}/calculator.js +0 -0
- /package/dist/{misc-tools → tools/misc}/index.d.ts +0 -0
- /package/dist/{misc-tools → tools/misc}/index.js +0 -0
- /package/dist/{misc-tools → tools/misc}/json-extract.d.ts +0 -0
- /package/dist/{misc-tools → tools/misc}/json-extract.js +0 -0
- /package/dist/{misc-tools → tools/misc}/json-infer.d.ts +0 -0
- /package/dist/{misc-tools → tools/misc}/json-infer.js +0 -0
- /package/dist/{misc-tools → tools/misc}/json-validate.d.ts +0 -0
- /package/dist/{misc-tools → tools/misc}/timer.d.ts +0 -0
- /package/dist/{misc-tools → tools/misc}/timer.js +0 -0
- /package/dist/{parser-tools/pubmed → tools/parser/obo}/types.js +0 -0
- /package/dist/{parser-tools → tools/parser}/pubmed/index.d.ts +0 -0
- /package/dist/{parser-tools → tools/parser}/pubmed/index.js +0 -0
- /package/dist/{parser-tools → tools/parser}/pubmed/pubmed.d.ts +0 -0
- /package/dist/{parser-tools → tools/parser}/pubmed/pubmed.js +0 -0
- /package/dist/{parser-tools → tools/parser}/pubmed/types.d.ts +0 -0
- /package/dist/{parser-tools → tools/parser}/pubmed/utils.d.ts +0 -0
- /package/dist/{parser-tools → tools/parser}/pubmed/utils.js +0 -0
- /package/dist/{skill-tools → tools/skill}/frontmatter.d.ts +0 -0
- /package/dist/{skill-tools → tools/skill}/frontmatter.js +0 -0
- /package/dist/{skill-tools → tools/skill}/index.d.ts +0 -0
- /package/dist/{skill-tools → tools/skill}/index.js +0 -0
- /package/dist/{skill-tools → tools/skill}/registry.d.ts +0 -0
- /package/dist/{skill-tools → tools/skill}/tool.d.ts +0 -0
- /package/dist/{skill-tools → tools/skill}/tool.js +0 -0
- /package/dist/{skill-tools → tools/skill}/types.d.ts +0 -0
- /package/dist/{skill-tools → tools/skill}/types.js +0 -0
- /package/dist/{table-tools → tools/table}/index.d.ts +0 -0
- /package/dist/{table-tools → tools/table}/index.js +0 -0
- /package/dist/{table-tools → tools/table}/tools.d.ts +0 -0
- /package/dist/{table-tools → tools/table}/tools.js +0 -0
- /package/dist/{table-tools → tools/table}/utils.d.ts +0 -0
- /package/dist/{table-tools → tools/table}/utils.js +0 -0
package/dist/skill/index.d.ts
DELETED
package/dist/skill/index.js
DELETED
package/dist/skill/registry.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { ExtendedSkill } from "./types";
|
|
2
|
-
export declare class SkillConflictError extends Error {
|
|
3
|
-
skillName: string;
|
|
4
|
-
pluginLocation: string;
|
|
5
|
-
userLocation: string;
|
|
6
|
-
constructor(skillName: string, pluginLocation: string, userLocation: string);
|
|
7
|
-
}
|
|
8
|
-
export declare function loadPluginSkills(): Promise<ExtendedSkill[]>;
|
|
9
|
-
export declare function getAllSkills(): Promise<ExtendedSkill[]>;
|
|
10
|
-
export declare function getSkill(name: string): Promise<ExtendedSkill | undefined>;
|
|
11
|
-
export declare function clearCache(): void;
|
package/dist/skill/registry.js
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import path from "path";
|
|
2
|
-
import { fileURLToPath } from "url";
|
|
3
|
-
import { parseSkillFrontmatter } from "./frontmatter";
|
|
4
|
-
const SKILL_GLOB = new Bun.Glob("**/SKILL.md");
|
|
5
|
-
export class SkillConflictError extends Error {
|
|
6
|
-
skillName;
|
|
7
|
-
pluginLocation;
|
|
8
|
-
userLocation;
|
|
9
|
-
constructor(skillName, pluginLocation, userLocation) {
|
|
10
|
-
super(`Skill name conflict: "${skillName}" is reserved by the plugin. ` +
|
|
11
|
-
`Please rename your skill at ${userLocation}.`);
|
|
12
|
-
this.skillName = skillName;
|
|
13
|
-
this.pluginLocation = pluginLocation;
|
|
14
|
-
this.userLocation = userLocation;
|
|
15
|
-
this.name = "SkillConflictError";
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
function getPluginSkillsDir() {
|
|
19
|
-
const currentDir = path.dirname(fileURLToPath(import.meta.url));
|
|
20
|
-
return path.join(currentDir, "..", "skills");
|
|
21
|
-
}
|
|
22
|
-
export async function loadPluginSkills() {
|
|
23
|
-
const skillsDir = getPluginSkillsDir();
|
|
24
|
-
const skills = [];
|
|
25
|
-
try {
|
|
26
|
-
for await (const match of SKILL_GLOB.scan({
|
|
27
|
-
cwd: skillsDir,
|
|
28
|
-
absolute: true,
|
|
29
|
-
onlyFiles: true,
|
|
30
|
-
})) {
|
|
31
|
-
const parsed = await parseSkillFrontmatter(match);
|
|
32
|
-
if (!parsed)
|
|
33
|
-
continue;
|
|
34
|
-
skills.push({
|
|
35
|
-
name: parsed.frontmatter.name,
|
|
36
|
-
description: parsed.frontmatter.description,
|
|
37
|
-
location: parsed.location,
|
|
38
|
-
content: parsed.content,
|
|
39
|
-
agent: parsed.frontmatter.agent,
|
|
40
|
-
allowedTools: parsed.frontmatter.allowedTools,
|
|
41
|
-
source: "plugin",
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
catch {
|
|
46
|
-
// Plugin skills directory may not exist
|
|
47
|
-
}
|
|
48
|
-
return skills;
|
|
49
|
-
}
|
|
50
|
-
let cachedSkills = null;
|
|
51
|
-
export async function getAllSkills() {
|
|
52
|
-
if (cachedSkills)
|
|
53
|
-
return cachedSkills;
|
|
54
|
-
const pluginSkills = await loadPluginSkills();
|
|
55
|
-
cachedSkills = pluginSkills;
|
|
56
|
-
return pluginSkills;
|
|
57
|
-
}
|
|
58
|
-
export async function getSkill(name) {
|
|
59
|
-
const skills = await getAllSkills();
|
|
60
|
-
return skills.find((s) => s.name === name);
|
|
61
|
-
}
|
|
62
|
-
export function clearCache() {
|
|
63
|
-
cachedSkills = null;
|
|
64
|
-
}
|
package/dist/skill/tool.d.ts
DELETED
package/dist/skill/tool.js
DELETED
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
import path from "path";
|
|
2
|
-
import { pathToFileURL } from "url";
|
|
3
|
-
import { tool } from "@opencode-ai/plugin";
|
|
4
|
-
import { getAllSkills, getSkill } from "./registry";
|
|
5
|
-
function formatDescription(skills) {
|
|
6
|
-
if (skills.length === 0) {
|
|
7
|
-
return "Load a specialized skill that provides domain-specific instructions and workflows. No skills are currently available.";
|
|
8
|
-
}
|
|
9
|
-
return [
|
|
10
|
-
"Load a specialized skill that provides domain-specific instructions and workflows.",
|
|
11
|
-
"",
|
|
12
|
-
"When you recognize that a task matches one of the available skills listed below, use this tool to load the full skill instructions.",
|
|
13
|
-
"",
|
|
14
|
-
"The skill will inject detailed instructions, workflows, and access to bundled resources (scripts, references, templates) into the conversation context.",
|
|
15
|
-
"",
|
|
16
|
-
'Tool output includes a `<skill_content name="...">` block with the loaded content.',
|
|
17
|
-
"",
|
|
18
|
-
"The following skills provide specialized sets of instructions for particular tasks:",
|
|
19
|
-
"",
|
|
20
|
-
"<available_skills>",
|
|
21
|
-
...skills.flatMap((skill) => [
|
|
22
|
-
` <skill>`,
|
|
23
|
-
` <name>${skill.name}</name>`,
|
|
24
|
-
` <description>${skill.description}</description>`,
|
|
25
|
-
skill.agent ? ` <restricted_to_agent>${skill.agent}</restricted_to_agent>` : null,
|
|
26
|
-
` <location>${pathToFileURL(skill.location).href}</location>`,
|
|
27
|
-
` </skill>`,
|
|
28
|
-
].filter(Boolean)),
|
|
29
|
-
"</available_skills>",
|
|
30
|
-
].join("\n");
|
|
31
|
-
}
|
|
32
|
-
async function listSkillFiles(dir, signal) {
|
|
33
|
-
const limit = 10;
|
|
34
|
-
const files = [];
|
|
35
|
-
const glob = new Bun.Glob("*");
|
|
36
|
-
try {
|
|
37
|
-
for await (const file of glob.scan({ cwd: dir, onlyFiles: true })) {
|
|
38
|
-
if (file === "SKILL.md")
|
|
39
|
-
continue;
|
|
40
|
-
files.push(path.resolve(dir, file));
|
|
41
|
-
if (files.length >= limit)
|
|
42
|
-
break;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
catch {
|
|
46
|
-
// Directory may not exist
|
|
47
|
-
}
|
|
48
|
-
return files.map((f) => `<file>${f}</file>`).join("\n");
|
|
49
|
-
}
|
|
50
|
-
export const SkillTool = tool({
|
|
51
|
-
description: "", // Set dynamically below
|
|
52
|
-
args: {
|
|
53
|
-
name: tool.schema.string().describe("The name of the skill from available_skills"),
|
|
54
|
-
},
|
|
55
|
-
async execute(params, ctx) {
|
|
56
|
-
const skills = await getAllSkills();
|
|
57
|
-
const skill = await getSkill(params.name);
|
|
58
|
-
if (!skill) {
|
|
59
|
-
const available = skills.map((s) => s.name).join(", ");
|
|
60
|
-
throw new Error(`Skill "${params.name}" not found. Available skills: ${available || "none"}`);
|
|
61
|
-
}
|
|
62
|
-
// Agent routing enforcement
|
|
63
|
-
if (skill.agent && ctx.agent !== skill.agent) {
|
|
64
|
-
throw new Error(`Skill "${skill.name}" is restricted to agent "${skill.agent}". Current agent: "${ctx.agent || "unknown"}".`);
|
|
65
|
-
}
|
|
66
|
-
await ctx.ask({
|
|
67
|
-
permission: "skill",
|
|
68
|
-
patterns: [params.name],
|
|
69
|
-
always: [params.name],
|
|
70
|
-
metadata: {},
|
|
71
|
-
});
|
|
72
|
-
const dir = path.dirname(skill.location);
|
|
73
|
-
const base = pathToFileURL(dir).href;
|
|
74
|
-
const files = await listSkillFiles(dir, ctx.abort);
|
|
75
|
-
const allowedToolsSection = skill.allowedTools
|
|
76
|
-
? [
|
|
77
|
-
"",
|
|
78
|
-
"<allowed_tools>",
|
|
79
|
-
"This skill is designed to work with the following tools:",
|
|
80
|
-
...skill.allowedTools.map((t) => ` - ${t}`),
|
|
81
|
-
"</allowed_tools>",
|
|
82
|
-
].join("\n")
|
|
83
|
-
: "";
|
|
84
|
-
ctx.metadata({
|
|
85
|
-
title: `Loaded skill: ${skill.name}`,
|
|
86
|
-
metadata: {
|
|
87
|
-
name: skill.name,
|
|
88
|
-
dir,
|
|
89
|
-
allowedTools: skill.allowedTools,
|
|
90
|
-
agent: skill.agent,
|
|
91
|
-
},
|
|
92
|
-
});
|
|
93
|
-
return [
|
|
94
|
-
`<skill_content name="${skill.name}">`,
|
|
95
|
-
`# Skill: ${skill.name}`,
|
|
96
|
-
"",
|
|
97
|
-
skill.content.trim(),
|
|
98
|
-
"",
|
|
99
|
-
`Base directory for this skill: ${base}`,
|
|
100
|
-
"Relative paths in this skill (e.g., scripts/, reference/) are relative to this base directory.",
|
|
101
|
-
"Note: file list is sampled.",
|
|
102
|
-
"",
|
|
103
|
-
"<skill_files>",
|
|
104
|
-
files,
|
|
105
|
-
"</skill_files>",
|
|
106
|
-
allowedToolsSection,
|
|
107
|
-
"</skill_content>",
|
|
108
|
-
].join("\n");
|
|
109
|
-
},
|
|
110
|
-
});
|
|
111
|
-
// Set description dynamically based on available skills
|
|
112
|
-
getAllSkills().then((skills) => {
|
|
113
|
-
;
|
|
114
|
-
SkillTool.description = formatDescription(skills);
|
|
115
|
-
});
|
package/dist/skill/types.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import z from "zod";
|
|
2
|
-
export declare const ExtendedSkillFrontmatter: z.ZodObject<{
|
|
3
|
-
name: z.ZodString;
|
|
4
|
-
description: z.ZodString;
|
|
5
|
-
agent: z.ZodOptional<z.ZodString>;
|
|
6
|
-
allowedTools: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
7
|
-
}, z.core.$strip>;
|
|
8
|
-
export type ExtendedSkillFrontmatter = z.infer<typeof ExtendedSkillFrontmatter>;
|
|
9
|
-
export interface ExtendedSkill {
|
|
10
|
-
name: string;
|
|
11
|
-
description: string;
|
|
12
|
-
location: string;
|
|
13
|
-
content: string;
|
|
14
|
-
agent?: string;
|
|
15
|
-
allowedTools?: string[];
|
|
16
|
-
source: "plugin";
|
|
17
|
-
}
|
|
18
|
-
export interface ParsedSkill {
|
|
19
|
-
frontmatter: ExtendedSkillFrontmatter;
|
|
20
|
-
content: string;
|
|
21
|
-
location: string;
|
|
22
|
-
}
|
package/dist/skill/types.js
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|