@yeyuan98/opencode-bioresearcher-plugin 1.4.0 → 1.5.0-alpha.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 +35 -20
- package/dist/db-tools/backends/index.d.ts +11 -0
- package/dist/db-tools/backends/index.js +48 -0
- package/dist/db-tools/backends/mongodb/backend.d.ts +15 -0
- package/dist/db-tools/backends/mongodb/backend.js +76 -0
- package/dist/db-tools/backends/mongodb/connection.d.ts +27 -0
- package/dist/db-tools/backends/mongodb/connection.js +107 -0
- package/dist/db-tools/backends/mongodb/index.d.ts +4 -0
- package/dist/db-tools/backends/mongodb/index.js +3 -0
- package/dist/db-tools/backends/mongodb/translator.d.ts +30 -0
- package/dist/db-tools/backends/mongodb/translator.js +407 -0
- package/dist/db-tools/backends/mysql/backend.d.ts +15 -0
- package/dist/db-tools/backends/mysql/backend.js +57 -0
- package/dist/db-tools/backends/mysql/connection.d.ts +25 -0
- package/dist/db-tools/backends/mysql/connection.js +83 -0
- package/dist/db-tools/backends/mysql/index.d.ts +3 -0
- package/dist/db-tools/backends/mysql/index.js +2 -0
- package/dist/db-tools/backends/mysql/translator.d.ts +7 -0
- package/dist/db-tools/backends/mysql/translator.js +67 -0
- package/dist/db-tools/core/base.d.ts +17 -0
- package/dist/db-tools/core/base.js +51 -0
- package/dist/db-tools/core/config-loader.d.ts +3 -0
- package/dist/db-tools/core/config-loader.js +46 -0
- package/dist/db-tools/core/index.d.ts +2 -0
- package/dist/db-tools/core/index.js +2 -0
- package/dist/db-tools/core/jsonc-parser.d.ts +2 -0
- package/dist/db-tools/core/jsonc-parser.js +77 -0
- package/dist/db-tools/core/validator.d.ts +16 -0
- package/dist/db-tools/core/validator.js +118 -0
- package/dist/db-tools/executor.d.ts +13 -0
- package/dist/db-tools/executor.js +54 -0
- package/dist/db-tools/index.d.ts +51 -0
- package/dist/db-tools/index.js +27 -0
- package/dist/db-tools/interface/backend.d.ts +24 -0
- package/dist/db-tools/interface/backend.js +1 -0
- package/dist/db-tools/interface/connection.d.ts +21 -0
- package/dist/db-tools/interface/connection.js +11 -0
- package/dist/db-tools/interface/index.d.ts +4 -0
- package/dist/db-tools/interface/index.js +4 -0
- package/dist/db-tools/interface/query.d.ts +60 -0
- package/dist/db-tools/interface/query.js +1 -0
- package/dist/db-tools/interface/schema.d.ts +22 -0
- package/dist/db-tools/interface/schema.js +1 -0
- package/dist/db-tools/pool.d.ts +8 -0
- package/dist/db-tools/pool.js +49 -0
- package/dist/db-tools/tools/index.d.ts +27 -0
- package/dist/db-tools/tools/index.js +191 -0
- package/dist/db-tools/tools.d.ts +27 -0
- package/dist/db-tools/tools.js +111 -0
- package/dist/db-tools/types.d.ts +94 -0
- package/dist/db-tools/types.js +40 -0
- package/dist/db-tools/utils.d.ts +33 -0
- package/dist/db-tools/utils.js +94 -0
- package/dist/index.js +2 -0
- package/dist/skills/bioresearcher-core/README.md +210 -210
- package/dist/skills/bioresearcher-core/SKILL.md +128 -128
- package/dist/skills/bioresearcher-core/examples/contexts.json +29 -29
- package/dist/skills/bioresearcher-core/examples/data-exchange-example.md +303 -303
- package/dist/skills/bioresearcher-core/examples/template.md +49 -49
- package/dist/skills/bioresearcher-core/patterns/calculator.md +215 -215
- package/dist/skills/bioresearcher-core/patterns/data-exchange.md +406 -406
- package/dist/skills/bioresearcher-core/patterns/json-tools.md +263 -263
- package/dist/skills/bioresearcher-core/patterns/progress.md +127 -127
- package/dist/skills/bioresearcher-core/patterns/retry.md +110 -110
- package/dist/skills/bioresearcher-core/patterns/shell-commands.md +79 -79
- package/dist/skills/bioresearcher-core/patterns/subagent-waves.md +186 -186
- package/dist/skills/bioresearcher-core/patterns/table-tools.md +260 -260
- package/dist/skills/bioresearcher-core/patterns/user-confirmation.md +187 -187
- package/dist/skills/bioresearcher-core/python/template.md +273 -273
- package/dist/skills/bioresearcher-core/python/template.py +323 -323
- package/dist/skills/env-jsonc-setup/SKILL.md +206 -0
- package/package.json +3 -1
|
@@ -1,187 +1,187 @@
|
|
|
1
|
-
# User Confirmation Pattern
|
|
2
|
-
|
|
3
|
-
Request user confirmation before destructive or significant operations.
|
|
4
|
-
|
|
5
|
-
## Overview
|
|
6
|
-
|
|
7
|
-
Use this pattern before operations that:
|
|
8
|
-
- Delete or modify files
|
|
9
|
-
- Make network requests
|
|
10
|
-
- Incur costs (API calls, cloud resources)
|
|
11
|
-
- Take significant time
|
|
12
|
-
- Cannot be easily undone
|
|
13
|
-
|
|
14
|
-
## Tool: question
|
|
15
|
-
|
|
16
|
-
> **Note:** The tool is invoked as `question` (lowercase). Some documentation may reference `Question` (capitalized) but both refer to the same tool.
|
|
17
|
-
|
|
18
|
-
```
|
|
19
|
-
question(questions: [{
|
|
20
|
-
header: string, // Short label (max 30 chars)
|
|
21
|
-
question: string, // Complete question
|
|
22
|
-
options: [{
|
|
23
|
-
label: string, // Display text (1-5 words)
|
|
24
|
-
description: string // Explanation of choice
|
|
25
|
-
}],
|
|
26
|
-
multiple: boolean // Allow multiple selections (default: false)
|
|
27
|
-
}])
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
## Example: Before Destructive Operation
|
|
31
|
-
|
|
32
|
-
```
|
|
33
|
-
question(questions=[{
|
|
34
|
-
"header": "Delete files",
|
|
35
|
-
"question": "This will delete 15 files in ./temp/. Continue?",
|
|
36
|
-
"options": [
|
|
37
|
-
{"label": "Yes, delete", "description": "Permanently delete all 15 files"},
|
|
38
|
-
{"label": "No, cancel", "description": "Keep files and stop this operation"}
|
|
39
|
-
]
|
|
40
|
-
}])
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
## Example: Continue After Failures
|
|
44
|
-
|
|
45
|
-
```
|
|
46
|
-
question(questions=[{
|
|
47
|
-
"header": "Retry failed",
|
|
48
|
-
"question": "3 batches failed after all retry attempts. How would you like to proceed?",
|
|
49
|
-
"options": [
|
|
50
|
-
{"label": "Continue", "description": "Skip failed batches and continue with remaining"},
|
|
51
|
-
{"label": "Retry now", "description": "Try failed batches one more time"},
|
|
52
|
-
{"label": "Abort", "description": "Stop the entire workflow"}
|
|
53
|
-
]
|
|
54
|
-
}])
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
## Example: Configuration Choice
|
|
58
|
-
|
|
59
|
-
```
|
|
60
|
-
question(questions=[{
|
|
61
|
-
"header": "Batch size",
|
|
62
|
-
"question": "How many rows should each batch contain?",
|
|
63
|
-
"options": [
|
|
64
|
-
{"label": "30 rows (Recommended)", "description": "Balanced for most use cases"},
|
|
65
|
-
{"label": "50 rows", "description": "Fewer batches, larger context per subagent"},
|
|
66
|
-
{"label": "10 rows", "description": "More batches, smaller context per subagent"}
|
|
67
|
-
]
|
|
68
|
-
}])
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
## Example: Multiple Selection
|
|
72
|
-
|
|
73
|
-
```
|
|
74
|
-
question(questions=[{
|
|
75
|
-
"header": "Select sheets",
|
|
76
|
-
"question": "Which sheets should be processed?",
|
|
77
|
-
"options": [
|
|
78
|
-
{"label": "Sheet1", "description": "Main data sheet (1000 rows)"},
|
|
79
|
-
{"label": "Sheet2", "description": "Secondary data (500 rows)"},
|
|
80
|
-
{"label": "Summary", "description": "Pre-computed summaries (50 rows)"}
|
|
81
|
-
],
|
|
82
|
-
"multiple": true
|
|
83
|
-
}])
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
## When to Ask for Confirmation
|
|
87
|
-
|
|
88
|
-
| Operation Type | Confirmation Needed |
|
|
89
|
-
|---------------|---------------------|
|
|
90
|
-
| Read file | No |
|
|
91
|
-
| Write new file | No |
|
|
92
|
-
| Overwrite existing file | Yes |
|
|
93
|
-
| Delete file | Yes |
|
|
94
|
-
| Delete directory | Yes |
|
|
95
|
-
| API call (free) | No |
|
|
96
|
-
| API call (paid) | Yes |
|
|
97
|
-
| Long operation (>5 min) | Yes |
|
|
98
|
-
| Network upload | Yes |
|
|
99
|
-
| Network download | No (usually) |
|
|
100
|
-
|
|
101
|
-
## Response Handling
|
|
102
|
-
|
|
103
|
-
The question tool returns selected option labels as an array:
|
|
104
|
-
|
|
105
|
-
```
|
|
106
|
-
# Single selection
|
|
107
|
-
response = question(...)
|
|
108
|
-
if response[0] == "Yes, delete":
|
|
109
|
-
proceed_with_deletion()
|
|
110
|
-
else:
|
|
111
|
-
cancel_operation()
|
|
112
|
-
|
|
113
|
-
# Multiple selection
|
|
114
|
-
response = question(..., multiple=true)
|
|
115
|
-
selected_sheets = response # ["Sheet1", "Sheet2"]
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
## Example: Conditional Logic Flow
|
|
119
|
-
|
|
120
|
-
```
|
|
121
|
-
# Ask for confirmation
|
|
122
|
-
response = question(questions=[{
|
|
123
|
-
"header": "Overwrite",
|
|
124
|
-
"question": "File 'output.xlsx' already exists. Overwrite?",
|
|
125
|
-
"options": [
|
|
126
|
-
{"label": "Overwrite", "description": "Replace existing file"},
|
|
127
|
-
{"label": "Append", "description": "Add to existing file"},
|
|
128
|
-
{"label": "Cancel", "description": "Don't modify the file"}
|
|
129
|
-
]
|
|
130
|
-
}])
|
|
131
|
-
|
|
132
|
-
# Handle response
|
|
133
|
-
if response[0] == "Overwrite":
|
|
134
|
-
write_file(mode="write")
|
|
135
|
-
elif response[0] == "Append":
|
|
136
|
-
write_file(mode="append")
|
|
137
|
-
else:
|
|
138
|
-
report("Operation cancelled by user")
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
## Best Practices
|
|
142
|
-
|
|
143
|
-
1. **Clear header**: Max 30 chars, summarize the decision
|
|
144
|
-
2. **Descriptive question**: Explain what will happen
|
|
145
|
-
3. **Helpful options**: Include descriptions that guide the user
|
|
146
|
-
4. **Recommended option**: Mark with "(Recommended)" in label
|
|
147
|
-
5. **Safe default**: Put safer option first
|
|
148
|
-
6. **Cancel option**: Always include a way to abort
|
|
149
|
-
|
|
150
|
-
## Timeout and No-Response Handling
|
|
151
|
-
|
|
152
|
-
When users don't respond to confirmation prompts, implement a default behavior:
|
|
153
|
-
|
|
154
|
-
### Default After Timeout
|
|
155
|
-
|
|
156
|
-
```python
|
|
157
|
-
# If no response after reasonable time, default to safe option
|
|
158
|
-
# Most patterns should default to "cancel" for safety
|
|
159
|
-
|
|
160
|
-
if no_response_after(timeout=60):
|
|
161
|
-
log("No user response, defaulting to cancel")
|
|
162
|
-
cancel_operation()
|
|
163
|
-
```
|
|
164
|
-
|
|
165
|
-
### Integration with Retry Pattern
|
|
166
|
-
|
|
167
|
-
For critical operations requiring user input:
|
|
168
|
-
1. Ask for confirmation
|
|
169
|
-
2. If no response, wait and retry with `blockingTimer`
|
|
170
|
-
3. After N attempts, use safe default or abort
|
|
171
|
-
|
|
172
|
-
```python
|
|
173
|
-
attempts = 0
|
|
174
|
-
max_attempts = 3
|
|
175
|
-
while attempts < max_attempts:
|
|
176
|
-
response = question(...)
|
|
177
|
-
if response:
|
|
178
|
-
handle_response(response)
|
|
179
|
-
break
|
|
180
|
-
attempts += 1
|
|
181
|
-
if attempts < max_attempts:
|
|
182
|
-
blockingTimer(delay=10) # Wait before re-prompting
|
|
183
|
-
|
|
184
|
-
# Default to safe option if no response
|
|
185
|
-
if attempts >= max_attempts:
|
|
186
|
-
cancel_operation()
|
|
187
|
-
```
|
|
1
|
+
# User Confirmation Pattern
|
|
2
|
+
|
|
3
|
+
Request user confirmation before destructive or significant operations.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
Use this pattern before operations that:
|
|
8
|
+
- Delete or modify files
|
|
9
|
+
- Make network requests
|
|
10
|
+
- Incur costs (API calls, cloud resources)
|
|
11
|
+
- Take significant time
|
|
12
|
+
- Cannot be easily undone
|
|
13
|
+
|
|
14
|
+
## Tool: question
|
|
15
|
+
|
|
16
|
+
> **Note:** The tool is invoked as `question` (lowercase). Some documentation may reference `Question` (capitalized) but both refer to the same tool.
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
question(questions: [{
|
|
20
|
+
header: string, // Short label (max 30 chars)
|
|
21
|
+
question: string, // Complete question
|
|
22
|
+
options: [{
|
|
23
|
+
label: string, // Display text (1-5 words)
|
|
24
|
+
description: string // Explanation of choice
|
|
25
|
+
}],
|
|
26
|
+
multiple: boolean // Allow multiple selections (default: false)
|
|
27
|
+
}])
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Example: Before Destructive Operation
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
question(questions=[{
|
|
34
|
+
"header": "Delete files",
|
|
35
|
+
"question": "This will delete 15 files in ./temp/. Continue?",
|
|
36
|
+
"options": [
|
|
37
|
+
{"label": "Yes, delete", "description": "Permanently delete all 15 files"},
|
|
38
|
+
{"label": "No, cancel", "description": "Keep files and stop this operation"}
|
|
39
|
+
]
|
|
40
|
+
}])
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Example: Continue After Failures
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
question(questions=[{
|
|
47
|
+
"header": "Retry failed",
|
|
48
|
+
"question": "3 batches failed after all retry attempts. How would you like to proceed?",
|
|
49
|
+
"options": [
|
|
50
|
+
{"label": "Continue", "description": "Skip failed batches and continue with remaining"},
|
|
51
|
+
{"label": "Retry now", "description": "Try failed batches one more time"},
|
|
52
|
+
{"label": "Abort", "description": "Stop the entire workflow"}
|
|
53
|
+
]
|
|
54
|
+
}])
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Example: Configuration Choice
|
|
58
|
+
|
|
59
|
+
```
|
|
60
|
+
question(questions=[{
|
|
61
|
+
"header": "Batch size",
|
|
62
|
+
"question": "How many rows should each batch contain?",
|
|
63
|
+
"options": [
|
|
64
|
+
{"label": "30 rows (Recommended)", "description": "Balanced for most use cases"},
|
|
65
|
+
{"label": "50 rows", "description": "Fewer batches, larger context per subagent"},
|
|
66
|
+
{"label": "10 rows", "description": "More batches, smaller context per subagent"}
|
|
67
|
+
]
|
|
68
|
+
}])
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Example: Multiple Selection
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
question(questions=[{
|
|
75
|
+
"header": "Select sheets",
|
|
76
|
+
"question": "Which sheets should be processed?",
|
|
77
|
+
"options": [
|
|
78
|
+
{"label": "Sheet1", "description": "Main data sheet (1000 rows)"},
|
|
79
|
+
{"label": "Sheet2", "description": "Secondary data (500 rows)"},
|
|
80
|
+
{"label": "Summary", "description": "Pre-computed summaries (50 rows)"}
|
|
81
|
+
],
|
|
82
|
+
"multiple": true
|
|
83
|
+
}])
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## When to Ask for Confirmation
|
|
87
|
+
|
|
88
|
+
| Operation Type | Confirmation Needed |
|
|
89
|
+
|---------------|---------------------|
|
|
90
|
+
| Read file | No |
|
|
91
|
+
| Write new file | No |
|
|
92
|
+
| Overwrite existing file | Yes |
|
|
93
|
+
| Delete file | Yes |
|
|
94
|
+
| Delete directory | Yes |
|
|
95
|
+
| API call (free) | No |
|
|
96
|
+
| API call (paid) | Yes |
|
|
97
|
+
| Long operation (>5 min) | Yes |
|
|
98
|
+
| Network upload | Yes |
|
|
99
|
+
| Network download | No (usually) |
|
|
100
|
+
|
|
101
|
+
## Response Handling
|
|
102
|
+
|
|
103
|
+
The question tool returns selected option labels as an array:
|
|
104
|
+
|
|
105
|
+
```
|
|
106
|
+
# Single selection
|
|
107
|
+
response = question(...)
|
|
108
|
+
if response[0] == "Yes, delete":
|
|
109
|
+
proceed_with_deletion()
|
|
110
|
+
else:
|
|
111
|
+
cancel_operation()
|
|
112
|
+
|
|
113
|
+
# Multiple selection
|
|
114
|
+
response = question(..., multiple=true)
|
|
115
|
+
selected_sheets = response # ["Sheet1", "Sheet2"]
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## Example: Conditional Logic Flow
|
|
119
|
+
|
|
120
|
+
```
|
|
121
|
+
# Ask for confirmation
|
|
122
|
+
response = question(questions=[{
|
|
123
|
+
"header": "Overwrite",
|
|
124
|
+
"question": "File 'output.xlsx' already exists. Overwrite?",
|
|
125
|
+
"options": [
|
|
126
|
+
{"label": "Overwrite", "description": "Replace existing file"},
|
|
127
|
+
{"label": "Append", "description": "Add to existing file"},
|
|
128
|
+
{"label": "Cancel", "description": "Don't modify the file"}
|
|
129
|
+
]
|
|
130
|
+
}])
|
|
131
|
+
|
|
132
|
+
# Handle response
|
|
133
|
+
if response[0] == "Overwrite":
|
|
134
|
+
write_file(mode="write")
|
|
135
|
+
elif response[0] == "Append":
|
|
136
|
+
write_file(mode="append")
|
|
137
|
+
else:
|
|
138
|
+
report("Operation cancelled by user")
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## Best Practices
|
|
142
|
+
|
|
143
|
+
1. **Clear header**: Max 30 chars, summarize the decision
|
|
144
|
+
2. **Descriptive question**: Explain what will happen
|
|
145
|
+
3. **Helpful options**: Include descriptions that guide the user
|
|
146
|
+
4. **Recommended option**: Mark with "(Recommended)" in label
|
|
147
|
+
5. **Safe default**: Put safer option first
|
|
148
|
+
6. **Cancel option**: Always include a way to abort
|
|
149
|
+
|
|
150
|
+
## Timeout and No-Response Handling
|
|
151
|
+
|
|
152
|
+
When users don't respond to confirmation prompts, implement a default behavior:
|
|
153
|
+
|
|
154
|
+
### Default After Timeout
|
|
155
|
+
|
|
156
|
+
```python
|
|
157
|
+
# If no response after reasonable time, default to safe option
|
|
158
|
+
# Most patterns should default to "cancel" for safety
|
|
159
|
+
|
|
160
|
+
if no_response_after(timeout=60):
|
|
161
|
+
log("No user response, defaulting to cancel")
|
|
162
|
+
cancel_operation()
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### Integration with Retry Pattern
|
|
166
|
+
|
|
167
|
+
For critical operations requiring user input:
|
|
168
|
+
1. Ask for confirmation
|
|
169
|
+
2. If no response, wait and retry with `blockingTimer`
|
|
170
|
+
3. After N attempts, use safe default or abort
|
|
171
|
+
|
|
172
|
+
```python
|
|
173
|
+
attempts = 0
|
|
174
|
+
max_attempts = 3
|
|
175
|
+
while attempts < max_attempts:
|
|
176
|
+
response = question(...)
|
|
177
|
+
if response:
|
|
178
|
+
handle_response(response)
|
|
179
|
+
break
|
|
180
|
+
attempts += 1
|
|
181
|
+
if attempts < max_attempts:
|
|
182
|
+
blockingTimer(delay=10) # Wait before re-prompting
|
|
183
|
+
|
|
184
|
+
# Default to safe option if no response
|
|
185
|
+
if attempts >= max_attempts:
|
|
186
|
+
cancel_operation()
|
|
187
|
+
```
|