@yeyuan98/opencode-bioresearcher-plugin 1.5.1 → 1.5.2-alpha.3

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.
Files changed (53) hide show
  1. package/dist/agents/bioresearcher/prompt.d.ts +1 -1
  2. package/dist/agents/bioresearcher/prompt.js +235 -27
  3. package/dist/agents/bioresearcherDR/prompt.d.ts +1 -1
  4. package/dist/agents/bioresearcherDR/prompt.js +8 -8
  5. package/dist/agents/bioresearcherDR_worker/prompt.d.ts +3 -2
  6. package/dist/agents/bioresearcherDR_worker/prompt.js +37 -12
  7. package/dist/shared/tool-restrictions.d.ts +2 -2
  8. package/dist/shared/tool-restrictions.js +4 -3
  9. package/dist/skills/bioresearcher-core/SKILL.md +58 -1
  10. package/dist/skills/bioresearcher-core/patterns/bioresearcher/analysis-methods.md +551 -0
  11. package/dist/skills/bioresearcher-core/patterns/bioresearcher/best-practices.md +647 -0
  12. package/dist/skills/bioresearcher-core/patterns/bioresearcher/python-standards.md +944 -0
  13. package/dist/skills/bioresearcher-core/patterns/bioresearcher/report-template.md +613 -0
  14. package/dist/skills/bioresearcher-core/patterns/bioresearcher/tool-selection.md +481 -0
  15. package/dist/skills/bioresearcher-core/patterns/citations.md +234 -0
  16. package/dist/skills/bioresearcher-core/patterns/rate-limiting.md +167 -0
  17. package/dist/skills/bioresearcher-tests/README.md +90 -90
  18. package/dist/skills/bioresearcher-tests/SKILL.md +255 -255
  19. package/dist/skills/bioresearcher-tests/pyproject.toml +6 -6
  20. package/dist/skills/bioresearcher-tests/test_cases/json_tests.md +137 -137
  21. package/dist/skills/bioresearcher-tests/test_cases/misc_tests.md +141 -141
  22. package/dist/skills/bioresearcher-tests/test_cases/parser_tests.md +80 -80
  23. package/dist/skills/bioresearcher-tests/test_cases/skill_tests.md +59 -59
  24. package/dist/skills/bioresearcher-tests/test_cases/table_tests.md +194 -194
  25. package/dist/skills/bioresearcher-tests/test_runner.py +607 -607
  26. package/dist/skills/long-table-summary/SKILL.md +224 -224
  27. package/dist/tools/sandbox/bash-parser.d.ts +17 -0
  28. package/dist/tools/sandbox/bash-parser.js +166 -0
  29. package/dist/tools/sandbox/escape-scenarios.test.d.ts +7 -0
  30. package/dist/tools/sandbox/escape-scenarios.test.js +182 -0
  31. package/dist/tools/sandbox/expander.d.ts +30 -0
  32. package/dist/tools/sandbox/expander.js +57 -0
  33. package/dist/tools/sandbox/final-verification.test.d.ts +6 -0
  34. package/dist/tools/sandbox/final-verification.test.js +70 -0
  35. package/dist/tools/sandbox/hooks.d.ts +25 -0
  36. package/dist/tools/sandbox/hooks.js +217 -0
  37. package/dist/tools/sandbox/index.d.ts +19 -0
  38. package/dist/tools/sandbox/index.js +24 -0
  39. package/dist/tools/sandbox/manager.d.ts +60 -0
  40. package/dist/tools/sandbox/manager.js +113 -0
  41. package/dist/tools/sandbox/sandbox.integration.test.d.ts +7 -0
  42. package/dist/tools/sandbox/sandbox.integration.test.js +106 -0
  43. package/dist/tools/sandbox/sandbox.test.d.ts +6 -0
  44. package/dist/tools/sandbox/sandbox.test.js +160 -0
  45. package/dist/tools/sandbox/tool.d.ts +66 -0
  46. package/dist/tools/sandbox/tool.js +163 -0
  47. package/dist/tools/sandbox/types.d.ts +38 -0
  48. package/dist/tools/sandbox/types.js +6 -0
  49. package/dist/tools/sandbox/validator.d.ts +33 -0
  50. package/dist/tools/sandbox/validator.js +150 -0
  51. package/dist/tools/skill/registry.js +0 -1
  52. package/dist/tools/table/utils.js +4 -4
  53. package/package.json +1 -1
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Sandbox Tool Types
3
+ *
4
+ * TypeScript interfaces for the sandbox system.
5
+ */
6
+ /**
7
+ * Represents the active sandbox state for a session.
8
+ */
9
+ export interface SandboxState {
10
+ sessionID: string;
11
+ sessionName: string;
12
+ sandboxPath: string;
13
+ projectRoot: string;
14
+ enabled: boolean;
15
+ enabledAt: number;
16
+ }
17
+ /**
18
+ * Result of path validation and transformation.
19
+ */
20
+ export interface PathValidationResult {
21
+ allowed: boolean;
22
+ originalPath: string;
23
+ transformedPath: string;
24
+ error?: string;
25
+ }
26
+ /**
27
+ * Result of bash command path extraction.
28
+ */
29
+ export interface BashPathExtractionResult {
30
+ paths: string[];
31
+ hasAbsolutePath: boolean;
32
+ absolutePaths: string[];
33
+ }
34
+ /**
35
+ * Tool path argument configuration.
36
+ * Maps tool names to their path-containing argument names.
37
+ */
38
+ export type ToolPathArgsMap = Record<string, string[]>;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Sandbox Tool Types
3
+ *
4
+ * TypeScript interfaces for the sandbox system.
5
+ */
6
+ export {};
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Sandbox Path Validator
3
+ *
4
+ * Validates and transforms file paths for sandbox containment.
5
+ * Handles cross-platform path operations (Windows, macOS, Linux).
6
+ */
7
+ import type { PathValidationResult } from './types';
8
+ /**
9
+ * Check if a string is an absolute path (cross-platform).
10
+ */
11
+ export declare function isAbsolutePath(inputPath: string): boolean;
12
+ /**
13
+ * Check if a resolved path is within the sandbox directory.
14
+ * Handles cross-platform case sensitivity.
15
+ */
16
+ export declare function isPathWithinSandbox(resolvedPath: string, sandboxPath: string): boolean;
17
+ /**
18
+ * Validate and transform a path for sandbox containment.
19
+ *
20
+ * - Rejects absolute paths
21
+ * - Resolves relative paths against sandbox
22
+ * - Detects path traversal attempts that escape sandbox
23
+ */
24
+ export declare function validateAndTransformPath(inputPath: string, sandboxPath: string): PathValidationResult;
25
+ /**
26
+ * Normalize a path for display/comparison purposes.
27
+ */
28
+ export declare function normalizePathForDisplay(inputPath: string): string;
29
+ /**
30
+ * Check if a path string looks like it could be a file path.
31
+ * Used for bash command parsing heuristics.
32
+ */
33
+ export declare function looksLikePath(str: string): boolean;
@@ -0,0 +1,150 @@
1
+ /**
2
+ * Sandbox Path Validator
3
+ *
4
+ * Validates and transforms file paths for sandbox containment.
5
+ * Handles cross-platform path operations (Windows, macOS, Linux).
6
+ */
7
+ import path from 'path';
8
+ /**
9
+ * Check if a string is an absolute path (cross-platform).
10
+ */
11
+ export function isAbsolutePath(inputPath) {
12
+ if (path.isAbsolute(inputPath)) {
13
+ return true;
14
+ }
15
+ // Windows UNC paths: \\server\share
16
+ if (process.platform === 'win32') {
17
+ if (inputPath.startsWith('\\\\') || inputPath.startsWith('//')) {
18
+ return true;
19
+ }
20
+ // Windows extended-length path: \\?\C:\...
21
+ if (inputPath.startsWith('\\\\?\\') || inputPath.startsWith('\\\\??\\')) {
22
+ return true;
23
+ }
24
+ }
25
+ return false;
26
+ }
27
+ /**
28
+ * Check if a resolved path is within the sandbox directory.
29
+ * Handles cross-platform case sensitivity.
30
+ */
31
+ export function isPathWithinSandbox(resolvedPath, sandboxPath) {
32
+ // Normalize both paths
33
+ const normalizedSandbox = path.normalize(sandboxPath);
34
+ const normalizedTarget = path.normalize(resolvedPath);
35
+ // Both must be absolute for comparison
36
+ if (!path.isAbsolute(normalizedSandbox) || !path.isAbsolute(normalizedTarget)) {
37
+ return false;
38
+ }
39
+ // Platform-specific case handling
40
+ // Windows: case-insensitive comparison
41
+ // POSIX (macOS/Linux): case-sensitive comparison
42
+ let compareSandbox;
43
+ let compareTarget;
44
+ if (process.platform === 'win32') {
45
+ compareSandbox = normalizedSandbox.toLowerCase();
46
+ compareTarget = normalizedTarget.toLowerCase();
47
+ }
48
+ else {
49
+ compareSandbox = normalizedSandbox;
50
+ compareTarget = normalizedTarget;
51
+ }
52
+ // Ensure sandbox path ends with separator for proper prefix matching
53
+ // This prevents /sandbox from matching /sandboxescape
54
+ const sep = path.sep;
55
+ const sandboxWithSep = compareSandbox.endsWith(sep)
56
+ ? compareSandbox
57
+ : compareSandbox + sep;
58
+ // Check if target is within sandbox:
59
+ // - Target starts with sandbox + separator (nested file/folder)
60
+ // - Target equals sandbox exactly (sandbox folder itself)
61
+ return compareTarget.startsWith(sandboxWithSep) || compareTarget === compareSandbox;
62
+ }
63
+ /**
64
+ * Validate and transform a path for sandbox containment.
65
+ *
66
+ * - Rejects absolute paths
67
+ * - Resolves relative paths against sandbox
68
+ * - Detects path traversal attempts that escape sandbox
69
+ */
70
+ export function validateAndTransformPath(inputPath, sandboxPath) {
71
+ // STEP 1: Check for absolute path - REJECT
72
+ if (isAbsolutePath(inputPath)) {
73
+ let errorMsg = `ABSOLUTE PATH REJECTED: "${inputPath}"\n`;
74
+ errorMsg += `When sandbox is enabled, you must use relative paths.\n`;
75
+ errorMsg += `Example: Use "./data/file.txt" instead of an absolute path.`;
76
+ // Special message for UNC paths on Windows
77
+ if (process.platform === 'win32' && (inputPath.startsWith('\\\\') || inputPath.startsWith('//'))) {
78
+ errorMsg = `UNC PATH REJECTED: "${inputPath}"\n`;
79
+ errorMsg += `Network paths are not allowed when sandbox is enabled.\n`;
80
+ errorMsg += `Use relative paths instead.`;
81
+ }
82
+ return {
83
+ allowed: false,
84
+ originalPath: inputPath,
85
+ transformedPath: inputPath,
86
+ error: errorMsg
87
+ };
88
+ }
89
+ // STEP 2: Resolve the relative path against sandbox
90
+ // This normalizes the path and resolves all ../ and ./ components
91
+ const resolvedPath = path.resolve(sandboxPath, inputPath);
92
+ // STEP 3: Check if resolved path is within sandbox
93
+ if (!isPathWithinSandbox(resolvedPath, sandboxPath)) {
94
+ const errorMsg = `PATH ESCAPE DETECTED: "${inputPath}"\n` +
95
+ `Resolved to: "${resolvedPath}"\n` +
96
+ `Sandbox boundary: "${sandboxPath}"\n` +
97
+ `Paths cannot escape the sandbox folder.`;
98
+ return {
99
+ allowed: false,
100
+ originalPath: inputPath,
101
+ transformedPath: inputPath,
102
+ error: errorMsg
103
+ };
104
+ }
105
+ // STEP 4: Return the resolved absolute path for tool use
106
+ return {
107
+ allowed: true,
108
+ originalPath: inputPath,
109
+ transformedPath: resolvedPath
110
+ };
111
+ }
112
+ /**
113
+ * Normalize a path for display/comparison purposes.
114
+ */
115
+ export function normalizePathForDisplay(inputPath) {
116
+ return path.normalize(inputPath);
117
+ }
118
+ /**
119
+ * Check if a path string looks like it could be a file path.
120
+ * Used for bash command parsing heuristics.
121
+ */
122
+ export function looksLikePath(str) {
123
+ if (!str || str.length === 0)
124
+ return false;
125
+ // Skip command flags/options
126
+ if (str.startsWith('-'))
127
+ return false;
128
+ // Skip shell operators and special characters
129
+ if (/^[|&;<>()$`\\]/.test(str))
130
+ return false;
131
+ // Skip common shell keywords
132
+ const shellKeywords = [
133
+ 'then', 'else', 'fi', 'do', 'done', 'if', 'elif', 'while', 'for',
134
+ 'in', 'case', 'esac', 'function', 'select', 'until', 'time',
135
+ 'true', 'false', 'exit', 'break', 'continue', 'return'
136
+ ];
137
+ if (shellKeywords.includes(str.toLowerCase()))
138
+ return false;
139
+ // Likely a path if:
140
+ // - Contains path separators
141
+ // - Starts with ./ or ../
142
+ // - Has a common file extension
143
+ // - Contains dots (for relative paths)
144
+ return str.includes('/') ||
145
+ str.includes('\\') ||
146
+ str.startsWith('./') ||
147
+ str.startsWith('../') ||
148
+ str.startsWith('.') ||
149
+ /\.[a-zA-Z0-9]{1,4}$/.test(str);
150
+ }
@@ -119,7 +119,6 @@ export async function getAllSkills(directory) {
119
119
  ...plugin,
120
120
  ].filter((skill) => {
121
121
  if (seen.has(skill.name)) {
122
- console.warn(`[skill] Duplicate skill "${skill.name}" - using higher priority version`);
123
122
  return false;
124
123
  }
125
124
  seen.add(skill.name);
@@ -19,10 +19,10 @@ function processCellValue(cell) {
19
19
  }
20
20
  }
21
21
  function formatError(context) {
22
- return `Error: ${context.error.message || 'Unknown error'}
23
- Details:
24
- - File: ${context.file_path}
25
- ${context.sheet_name ? `- Sheet: ${context.sheet_name}` : ''}
22
+ return `Error: ${context.error.message || 'Unknown error'}
23
+ Details:
24
+ - File: ${context.file_path}
25
+ ${context.sheet_name ? `- Sheet: ${context.sheet_name}` : ''}
26
26
  - Operation: ${context.operation}`;
27
27
  }
28
28
  function resolvePath(filePath, workingDir) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yeyuan98/opencode-bioresearcher-plugin",
3
- "version": "1.5.1",
3
+ "version": "1.5.2-alpha.3",
4
4
  "description": "OpenCode plugin that adds a bioresearcher agent",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",