ocsmarttools 0.1.8 → 0.1.10
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/CHANGELOG.md +19 -0
- package/README.md +93 -148
- package/package.json +1 -1
- package/src/lib/routing-guide.ts +27 -6
- package/src/lib/tool-catalog.ts +177 -23
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,25 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to `ocsmarttools` are documented here.
|
|
4
4
|
|
|
5
|
+
## [0.1.10] - 2026-02-22
|
|
6
|
+
|
|
7
|
+
### Changed
|
|
8
|
+
- Expanded auto-routing trigger intents in managed `AGENTS.md` policy to cover:
|
|
9
|
+
- research/evidence
|
|
10
|
+
- reporting/writing
|
|
11
|
+
- coding/engineering
|
|
12
|
+
- data/extraction
|
|
13
|
+
- risk/compliance
|
|
14
|
+
- Expanded built-in `tool_search` keyword coverage across runtime, filesystem, web, browser, and session tools for broader intent matching.
|
|
15
|
+
- Improved `tool_search` scoring tokenization so punctuation-heavy terms (for example `CI/CD`) match more reliably.
|
|
16
|
+
|
|
17
|
+
## [0.1.9] - 2026-02-22
|
|
18
|
+
|
|
19
|
+
### Changed
|
|
20
|
+
- Strengthened auto-managed routing policy so research/report prompts with sources/benchmarks must run retrieval tools before final output.
|
|
21
|
+
- Added explicit anti-fabrication guidance in routing policy: do not output citations that were not retrieved in the current run.
|
|
22
|
+
- Added failure behavior guidance: return clear retrieval gaps/partial result instead of fabricated evidence.
|
|
23
|
+
|
|
5
24
|
## [0.1.8] - 2026-02-22
|
|
6
25
|
|
|
7
26
|
### Changed
|
package/README.md
CHANGED
|
@@ -1,194 +1,139 @@
|
|
|
1
|
-
# OCSmartTools
|
|
1
|
+
# OCSmartTools
|
|
2
2
|
|
|
3
|
-
Provider-agnostic tool orchestration for
|
|
3
|
+
Provider-agnostic tool orchestration plugin for OpenClaw.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
OCSmartTools helps reduce latency and token cost by routing multi-step work through deterministic tool flows (`tool_dispatch` / `tool_batch`) and shaping large outputs.
|
|
6
6
|
|
|
7
|
-
##
|
|
7
|
+
## Highlights
|
|
8
8
|
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
- `
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
```mermaid
|
|
21
|
-
flowchart LR
|
|
22
|
-
A["Traditional"] --> B["Model -> tool -> model -> tool"] --> C["More turns + repeated context"]
|
|
23
|
-
D["ocsmarttools"] --> E["Batch + shaped results"] --> F["Fewer turns + smaller context"]
|
|
24
|
-
C --> G["Higher cost/latency"]
|
|
25
|
-
F --> H["Lower cost/latency"]
|
|
26
|
-
```
|
|
9
|
+
- Works with existing OpenClaw installs (`openclaw >= 2026.2.19`)
|
|
10
|
+
- Zero-touch startup (auto-bootstrap on install)
|
|
11
|
+
- Tools added:
|
|
12
|
+
- `tool_search`
|
|
13
|
+
- `tool_dispatch`
|
|
14
|
+
- `tool_batch`
|
|
15
|
+
- `tool_result_get`
|
|
16
|
+
- Built-in metrics for success/failure/timeout, latency, and estimated savings
|
|
17
|
+
- Skill-compatible (including browser/Playwright-style workflows)
|
|
18
|
+
- Auto-managed routing guidance for research/report/coding/data tasks (no per-prompt guardrails needed)
|
|
27
19
|
|
|
28
20
|
## Install
|
|
29
21
|
|
|
30
|
-
Compatibility:
|
|
31
|
-
- OpenClaw: `>=2026.2.19`
|
|
32
|
-
- Works with existing installed instances (no core patch required)
|
|
33
|
-
|
|
34
|
-
### npm
|
|
35
|
-
|
|
36
22
|
```bash
|
|
37
23
|
openclaw plugins install ocsmarttools --pin
|
|
38
24
|
openclaw plugins enable ocsmarttools
|
|
39
25
|
openclaw gateway restart
|
|
40
26
|
```
|
|
41
27
|
|
|
42
|
-
### Local folder
|
|
43
|
-
|
|
44
|
-
```bash
|
|
45
|
-
openclaw plugins install /absolute/path/to/OpenClaw-SmartToolCalls
|
|
46
|
-
openclaw plugins enable ocsmarttools
|
|
47
|
-
openclaw gateway restart
|
|
48
|
-
```
|
|
49
|
-
|
|
50
28
|
## Quick Start
|
|
51
29
|
|
|
52
|
-
1. Install + enable + restart.
|
|
53
|
-
2. Done. The plugin auto-bootstraps and starts working in background.
|
|
54
|
-
3. It also auto-manages an OCSmartTools routing block in `AGENTS.md` (unless disabled).
|
|
55
|
-
4. Enable strict plugin-managed routing (optional):
|
|
56
|
-
|
|
57
30
|
```text
|
|
31
|
+
/ocsmarttools status
|
|
58
32
|
/ocsmarttools strict on
|
|
33
|
+
/ocsmarttools stats
|
|
59
34
|
```
|
|
60
35
|
|
|
61
|
-
|
|
36
|
+
What these do:
|
|
37
|
+
- `status`: shows current mode, strict-routing state, and key limits
|
|
38
|
+
- `strict on`: enables strict plugin-managed routing guidance
|
|
39
|
+
- `stats`: shows usage, failures, latency, and savings
|
|
40
|
+
|
|
41
|
+
## Core Commands (Chat)
|
|
42
|
+
|
|
43
|
+
- `/ocsmarttools help` -> simple command guide
|
|
44
|
+
- `/ocsmarttools status` -> current state and limits
|
|
45
|
+
- `/ocsmarttools strict <on|off|status>` -> strict routing control
|
|
46
|
+
- `/ocsmarttools sync` -> re-apply managed routing block in `AGENTS.md`
|
|
47
|
+
- `/ocsmarttools stats` -> metrics summary
|
|
48
|
+
- `/ocsmarttools stats reset` -> reset metrics window
|
|
49
|
+
- `/ocsmarttools setup [safe|standard]` -> apply recommended defaults
|
|
50
|
+
- `/ocsmarttools mode <safe|standard>` -> change mode only
|
|
51
|
+
- `/ocsmarttools config` -> show effective config
|
|
52
|
+
- `/ocsmarttools config keys` -> list editable keys
|
|
53
|
+
- `/ocsmarttools config set <key> <value>` -> update one key
|
|
54
|
+
- `/ocsmarttools config reset [key]` -> reset one key or all
|
|
55
|
+
- `/ocsmarttools version` -> installed plugin version
|
|
56
|
+
|
|
57
|
+
## Core Commands (CLI)
|
|
58
|
+
|
|
59
|
+
- `openclaw ocsmarttools help`
|
|
60
|
+
- `openclaw ocsmarttools status`
|
|
61
|
+
- `openclaw ocsmarttools strict <on|off>`
|
|
62
|
+
- `openclaw ocsmarttools sync`
|
|
63
|
+
- `openclaw ocsmarttools stats`
|
|
64
|
+
- `openclaw ocsmarttools stats-reset`
|
|
65
|
+
- `openclaw ocsmarttools setup [safe|standard]`
|
|
66
|
+
- `openclaw ocsmarttools mode <safe|standard>`
|
|
67
|
+
- `openclaw ocsmarttools config`
|
|
68
|
+
- `openclaw ocsmarttools config-keys`
|
|
69
|
+
- `openclaw ocsmarttools config-set <key> <value>`
|
|
70
|
+
- `openclaw ocsmarttools config-reset [key]`
|
|
71
|
+
- `openclaw ocsmarttools version`
|
|
72
|
+
|
|
73
|
+
## Config
|
|
62
74
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
```
|
|
75
|
+
Config path:
|
|
76
|
+
- `plugins.entries.ocsmarttools.config`
|
|
66
77
|
|
|
67
|
-
|
|
68
|
-
-
|
|
69
|
-
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
| Command | What it does |
|
|
76
|
-
|---|---|
|
|
77
|
-
| `/ocsmarttools help` | Shows all commands in plain language |
|
|
78
|
-
| `/ocsmarttools status` | Shows mode and safety settings |
|
|
79
|
-
| `/ocsmarttools strict <on\|off\|status>` | Turns strict routing on/off or checks status |
|
|
80
|
-
| `/ocsmarttools sync` | Rewrites the managed routing block in `AGENTS.md` |
|
|
81
|
-
| `/ocsmarttools stats` | Shows calls, errors, timeouts, latency, and estimated savings |
|
|
82
|
-
| `/ocsmarttools stats reset` | Resets plugin stats |
|
|
83
|
-
| `/ocsmarttools setup [safe\|standard]` | Applies recommended defaults |
|
|
84
|
-
| `/ocsmarttools mode <safe\|standard>` | Changes mode only |
|
|
85
|
-
| `/ocsmarttools config` | Shows plugin config |
|
|
86
|
-
| `/ocsmarttools config keys` | Lists editable config keys |
|
|
87
|
-
| `/ocsmarttools config set <key> <value>` | Changes one config value |
|
|
88
|
-
| `/ocsmarttools config reset [key]` | Resets one key or all keys |
|
|
89
|
-
| `/ocsmarttools version` | Shows installed plugin version |
|
|
90
|
-
|
|
91
|
-
### CLI Commands
|
|
92
|
-
|
|
93
|
-
| Command | What it does |
|
|
94
|
-
|---|---|
|
|
95
|
-
| `openclaw ocsmarttools help` | Shows all commands in plain language |
|
|
96
|
-
| `openclaw ocsmarttools status` | Shows mode and safety settings |
|
|
97
|
-
| `openclaw ocsmarttools strict <on\|off>` | Turns strict routing on/off |
|
|
98
|
-
| `openclaw ocsmarttools sync` | Rewrites the managed routing block in `AGENTS.md` |
|
|
99
|
-
| `openclaw ocsmarttools stats` | Shows calls, errors, timeouts, latency, and estimated savings |
|
|
100
|
-
| `openclaw ocsmarttools stats-reset` | Resets plugin stats |
|
|
101
|
-
| `openclaw ocsmarttools setup [safe\|standard]` | Applies recommended defaults |
|
|
102
|
-
| `openclaw ocsmarttools mode <safe\|standard>` | Changes mode only |
|
|
103
|
-
| `openclaw ocsmarttools config` | Shows plugin config |
|
|
104
|
-
| `openclaw ocsmarttools config-keys` | Lists editable config keys |
|
|
105
|
-
| `openclaw ocsmarttools config-set <key> <value>` | Changes one config value |
|
|
106
|
-
| `openclaw ocsmarttools config-reset [key]` | Resets one key or all keys |
|
|
107
|
-
| `openclaw ocsmarttools version` | Shows installed plugin version |
|
|
108
|
-
|
|
109
|
-
## Common Config Actions
|
|
78
|
+
High-impact keys:
|
|
79
|
+
- `strictRouting` (`true|false`)
|
|
80
|
+
- `maxResultChars` (result shaping threshold)
|
|
81
|
+
- `maxSteps`, `maxForEach` (batch limits)
|
|
82
|
+
- `invokeTimeoutMs` (per-dispatch timeout)
|
|
83
|
+
- `toolSearch.useLiveRegistry` (`true|false`)
|
|
84
|
+
|
|
85
|
+
Example:
|
|
110
86
|
|
|
111
87
|
```text
|
|
112
|
-
/ocsmarttools config
|
|
113
|
-
/ocsmarttools config keys
|
|
114
|
-
/ocsmarttools config set maxResultChars 120000
|
|
115
|
-
/ocsmarttools config set storeLargeResults true
|
|
116
|
-
/ocsmarttools config set toolSearch.useLiveRegistry true
|
|
117
|
-
/ocsmarttools config set toolSearch.liveTimeoutMs 1500
|
|
118
88
|
/ocsmarttools config set strictRouting true
|
|
119
|
-
/ocsmarttools config set
|
|
120
|
-
/ocsmarttools config set
|
|
121
|
-
/ocsmarttools config reset maxResultChars
|
|
122
|
-
/ocsmarttools stats
|
|
89
|
+
/ocsmarttools config set maxResultChars 120000
|
|
90
|
+
/ocsmarttools config set invokeTimeoutMs 30000
|
|
123
91
|
```
|
|
124
92
|
|
|
125
|
-
Config path:
|
|
126
|
-
- `plugins.entries.ocsmarttools.config`
|
|
127
|
-
|
|
128
93
|
## Modes
|
|
129
94
|
|
|
130
|
-
- `standard` (default): zero-touch
|
|
131
|
-
- `safe`: requires
|
|
132
|
-
- `strictRouting=true`:
|
|
95
|
+
- `standard` (default): balanced, zero-touch
|
|
96
|
+
- `safe`: requires sandbox and blocks control-plane dispatch
|
|
97
|
+
- `strictRouting=true`: enforces plugin-managed routing guidance and keeps routing block synced
|
|
133
98
|
|
|
134
|
-
|
|
135
|
-
- `/ocsmarttools setup` and `openclaw ocsmarttools setup` default to `standard`.
|
|
99
|
+
## Auto Trigger Intents
|
|
136
100
|
|
|
137
|
-
|
|
101
|
+
When tools are needed, routing is auto-biased toward `tool_dispatch` / `tool_batch` for these intent families:
|
|
102
|
+
- research/evidence (sources, benchmarks, case studies, latest/news)
|
|
103
|
+
- reporting/writing (reports, briefs, proposals, plans, emails, docs/specs)
|
|
104
|
+
- coding/engineering (build, debug, fix, test, refactor, deploy, migration)
|
|
105
|
+
- data/extraction (scrape/fetch/parse/aggregate/rank/CSV/JSON/ETL)
|
|
106
|
+
- risk/compliance (security/privacy/legal/audit requests)
|
|
138
107
|
|
|
139
|
-
|
|
108
|
+
## Skills and Blocked Sites
|
|
140
109
|
|
|
141
|
-
|
|
142
|
-
- `storeLargeResults`: `true`
|
|
143
|
-
- `resultStoreTtlSec`: `3600`
|
|
144
|
-
- `resultSampleItems`: `10`
|
|
110
|
+
Skills in OpenClaw are instruction layers, not separate execution engines. OCSmartTools can still dispatch/batch the underlying tools used by skills.
|
|
145
111
|
|
|
146
|
-
|
|
112
|
+
For websites that block plain fetch, use browser-based flows via installed skills/plugins; OCSmartTools can orchestrate those tool calls with the same metrics and shaping behavior.
|
|
147
113
|
|
|
148
|
-
|
|
149
|
-
/ocsmarttools config set maxResultChars 120000
|
|
150
|
-
/ocsmarttools config set resultStoreTtlSec 3600
|
|
151
|
-
/ocsmarttools config set resultSampleItems 10
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
## Strict Policy Note
|
|
114
|
+
## Safety Notes
|
|
155
115
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
{
|
|
160
|
-
tools: {
|
|
161
|
-
allow: ["tool_search", "tool_dispatch", "tool_batch", "tool_result_get"]
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
```
|
|
116
|
+
- OCSmartTools does not bypass OpenClaw policy.
|
|
117
|
+
- Control-plane tools (`gateway`, `cron`) are blocked by default in dispatch/batch.
|
|
118
|
+
- Large result handles are in-memory and expire by TTL.
|
|
165
119
|
|
|
166
|
-
##
|
|
120
|
+
## Troubleshooting
|
|
167
121
|
|
|
168
|
-
-
|
|
169
|
-
-
|
|
170
|
-
- `
|
|
171
|
-
-
|
|
172
|
-
-
|
|
173
|
-
- `
|
|
174
|
-
- `tool_search` tries live registry endpoints first, then automatically falls back to policy/static catalog.
|
|
122
|
+
- If plugin commands do not appear, restart gateway:
|
|
123
|
+
- `openclaw gateway restart`
|
|
124
|
+
- If strict policy blocks tools, verify `tools.allow`/`tools.deny` in OpenClaw config.
|
|
125
|
+
- If discovery seems stale, run:
|
|
126
|
+
- `/ocsmarttools sync`
|
|
127
|
+
- `/ocsmarttools stats`
|
|
175
128
|
|
|
176
129
|
## Development
|
|
177
130
|
|
|
178
131
|
```bash
|
|
179
132
|
npm install
|
|
180
133
|
npm run typecheck
|
|
181
|
-
```
|
|
182
|
-
|
|
183
|
-
## Versioning
|
|
184
|
-
|
|
185
|
-
```bash
|
|
186
|
-
npm run version:show
|
|
187
|
-
npm run version:bump:patch
|
|
188
|
-
npm run version:bump:minor
|
|
189
|
-
npm run version:bump:major
|
|
190
134
|
npm run release:check
|
|
191
135
|
```
|
|
192
136
|
|
|
193
|
-
|
|
194
|
-
-
|
|
137
|
+
Version and release notes:
|
|
138
|
+
- Version source of truth: `package.json`
|
|
139
|
+
- Release notes: `CHANGELOG.md`
|
package/package.json
CHANGED
package/src/lib/routing-guide.ts
CHANGED
|
@@ -6,6 +6,15 @@ import type { OpenClawConfig, OpenClawPluginApi } from "openclaw/plugin-sdk";
|
|
|
6
6
|
const BLOCK_START = "<!-- OCSMARTTOOLS_ROUTING_START -->";
|
|
7
7
|
const BLOCK_END = "<!-- OCSMARTTOOLS_ROUTING_END -->";
|
|
8
8
|
|
|
9
|
+
const AUTO_TRIGGER_LINES = [
|
|
10
|
+
"Auto-route trigger intents (use routing tools by default when tools are needed):",
|
|
11
|
+
"- Research and evidence: research, investigate, analyze, benchmark, compare, evaluate, market intelligence, trends, latest, news, sources, citations, references, case study, due diligence.",
|
|
12
|
+
"- Reporting and writing: report, summary, brief, memo, presentation, plan, proposal, recommendation, email, RFC, PRD, specification, documentation, SOP.",
|
|
13
|
+
"- Coding and engineering: code, implement, build, website, app, script, debug, fix, bug, stack trace, test, lint, refactor, optimize, compile, deploy, CI/CD, migration, release notes.",
|
|
14
|
+
"- Data and extraction: scrape, crawl, fetch, parse, transform, aggregate, rank, classify, table, CSV, JSON, dataset, ETL.",
|
|
15
|
+
"- Risk and compliance: risk register, security review, privacy, legal, policy, SOC 2, GDPR, HIPAA, audit.",
|
|
16
|
+
];
|
|
17
|
+
|
|
9
18
|
function buildRoutingBlock(strictRouting: boolean): string {
|
|
10
19
|
const body = strictRouting
|
|
11
20
|
? [
|
|
@@ -16,11 +25,17 @@ function buildRoutingBlock(strictRouting: boolean): string {
|
|
|
16
25
|
"Mandatory rules in strict mode:",
|
|
17
26
|
"1. Route tool usage through `tool_dispatch` or `tool_batch`.",
|
|
18
27
|
"2. Use `tool_batch` for 2+ related calls, iterative steps, or map-style tasks.",
|
|
19
|
-
"3.
|
|
20
|
-
"4. Use `
|
|
21
|
-
"5.
|
|
28
|
+
"3. For research/report/benchmark/source requests, always run live tool retrieval before final output (typically `web_search` + `web_fetch`).",
|
|
29
|
+
"4. Use `tool_search` only when tool choice is unclear.",
|
|
30
|
+
"5. Use `tool_result_get` only when a stored handle needs more detail.",
|
|
31
|
+
"6. Avoid direct native tool calls unless routing tools are unavailable due to runtime/tool-policy constraints.",
|
|
32
|
+
"7. Do not present citations/sources unless they came from successful tool calls in the current run.",
|
|
33
|
+
"8. If required retrieval fails, return a clear partial/failure report instead of fabricated evidence.",
|
|
34
|
+
"9. Treat trigger intents below as routing-required unless the request is clearly a no-tool task.",
|
|
22
35
|
"",
|
|
23
36
|
"Common large/noisy tools: `web_fetch`, `read` (large files), `exec`, `process`, `browser`, `nodes`.",
|
|
37
|
+
"",
|
|
38
|
+
...AUTO_TRIGGER_LINES,
|
|
24
39
|
].join("\n")
|
|
25
40
|
: [
|
|
26
41
|
"## OCSmartTools Routing Policy (Auto-Managed)",
|
|
@@ -29,11 +44,17 @@ function buildRoutingBlock(strictRouting: boolean): string {
|
|
|
29
44
|
"",
|
|
30
45
|
"1. If tool usage is needed and result size is uncertain, use `tool_dispatch`.",
|
|
31
46
|
"2. If the task needs 2+ related tool calls, use `tool_batch`.",
|
|
32
|
-
"3.
|
|
33
|
-
"4.
|
|
34
|
-
"5.
|
|
47
|
+
"3. For research/report requests with sources or benchmarks, run retrieval tools first before final output.",
|
|
48
|
+
"4. Use `tool_search` only when tool choice is unclear.",
|
|
49
|
+
"5. Prefer compact/tool-shaped outputs; use `tool_result_get` only when more detail is required.",
|
|
50
|
+
"6. Use direct native tool calls only for simple one-shot small-output actions.",
|
|
51
|
+
"7. Do not include citations/sources that were not retrieved by tools in the current run.",
|
|
52
|
+
"8. If retrieval fails, explicitly report the gap.",
|
|
53
|
+
"9. Treat trigger intents below as strong routing signals unless the task is clearly no-tool.",
|
|
35
54
|
"",
|
|
36
55
|
"Common large/noisy tools: `web_fetch`, `read` (large files), `exec`, `process`, `browser`, `nodes`.",
|
|
56
|
+
"",
|
|
57
|
+
...AUTO_TRIGGER_LINES,
|
|
37
58
|
].join("\n");
|
|
38
59
|
|
|
39
60
|
return `${BLOCK_START}
|
package/src/lib/tool-catalog.ts
CHANGED
|
@@ -9,34 +9,184 @@ export type ToolEntry = {
|
|
|
9
9
|
source: "builtin" | "policy" | "live";
|
|
10
10
|
};
|
|
11
11
|
|
|
12
|
+
const RESEARCH_KEYWORDS = [
|
|
13
|
+
"research",
|
|
14
|
+
"investigate",
|
|
15
|
+
"analyze",
|
|
16
|
+
"analysis",
|
|
17
|
+
"benchmark",
|
|
18
|
+
"compare",
|
|
19
|
+
"evaluate",
|
|
20
|
+
"market intelligence",
|
|
21
|
+
"trend",
|
|
22
|
+
"latest",
|
|
23
|
+
"news",
|
|
24
|
+
"evidence",
|
|
25
|
+
"sources",
|
|
26
|
+
"citations",
|
|
27
|
+
"references",
|
|
28
|
+
"case study",
|
|
29
|
+
"due diligence",
|
|
30
|
+
];
|
|
31
|
+
|
|
32
|
+
const REPORT_KEYWORDS = [
|
|
33
|
+
"report",
|
|
34
|
+
"summary",
|
|
35
|
+
"brief",
|
|
36
|
+
"memo",
|
|
37
|
+
"recommendation",
|
|
38
|
+
"proposal",
|
|
39
|
+
"plan",
|
|
40
|
+
"writeup",
|
|
41
|
+
"presentation",
|
|
42
|
+
"email",
|
|
43
|
+
"documentation",
|
|
44
|
+
"spec",
|
|
45
|
+
"rfc",
|
|
46
|
+
"prd",
|
|
47
|
+
];
|
|
48
|
+
|
|
49
|
+
const CODING_KEYWORDS = [
|
|
50
|
+
"code",
|
|
51
|
+
"implement",
|
|
52
|
+
"build",
|
|
53
|
+
"website",
|
|
54
|
+
"app",
|
|
55
|
+
"script",
|
|
56
|
+
"debug",
|
|
57
|
+
"fix",
|
|
58
|
+
"bug",
|
|
59
|
+
"stack trace",
|
|
60
|
+
"test",
|
|
61
|
+
"lint",
|
|
62
|
+
"refactor",
|
|
63
|
+
"optimize",
|
|
64
|
+
"compile",
|
|
65
|
+
"deploy",
|
|
66
|
+
"ci",
|
|
67
|
+
"cd",
|
|
68
|
+
"migration",
|
|
69
|
+
];
|
|
70
|
+
|
|
71
|
+
const DATA_KEYWORDS = [
|
|
72
|
+
"extract",
|
|
73
|
+
"scrape",
|
|
74
|
+
"crawl",
|
|
75
|
+
"parse",
|
|
76
|
+
"transform",
|
|
77
|
+
"aggregate",
|
|
78
|
+
"rank",
|
|
79
|
+
"classify",
|
|
80
|
+
"csv",
|
|
81
|
+
"json",
|
|
82
|
+
"dataset",
|
|
83
|
+
"etl",
|
|
84
|
+
"table",
|
|
85
|
+
];
|
|
86
|
+
|
|
87
|
+
const BROWSER_KEYWORDS = [
|
|
88
|
+
"playwright",
|
|
89
|
+
"stealth",
|
|
90
|
+
"anti-bot",
|
|
91
|
+
"captcha",
|
|
92
|
+
"dynamic site",
|
|
93
|
+
"javascript page",
|
|
94
|
+
"login wall",
|
|
95
|
+
"rendered page",
|
|
96
|
+
"automation",
|
|
97
|
+
];
|
|
98
|
+
|
|
12
99
|
const BUILTIN: ToolEntry[] = [
|
|
13
100
|
{
|
|
14
101
|
name: "exec",
|
|
15
102
|
group: "runtime",
|
|
16
103
|
description: "Run shell commands.",
|
|
17
104
|
paramsHint: "{ command }",
|
|
18
|
-
keywords: [
|
|
105
|
+
keywords: [
|
|
106
|
+
"shell",
|
|
107
|
+
"terminal",
|
|
108
|
+
"command line",
|
|
109
|
+
"python",
|
|
110
|
+
"node",
|
|
111
|
+
"npm",
|
|
112
|
+
"git",
|
|
113
|
+
"build",
|
|
114
|
+
"run tests",
|
|
115
|
+
"start server",
|
|
116
|
+
...CODING_KEYWORDS,
|
|
117
|
+
...DATA_KEYWORDS,
|
|
118
|
+
...BROWSER_KEYWORDS,
|
|
119
|
+
],
|
|
120
|
+
source: "builtin",
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
name: "bash",
|
|
124
|
+
group: "runtime",
|
|
125
|
+
description: "Alias for exec in many contexts.",
|
|
126
|
+
paramsHint: "{ command }",
|
|
127
|
+
keywords: ["shell", "terminal", "script", ...CODING_KEYWORDS],
|
|
128
|
+
source: "builtin",
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
name: "process",
|
|
132
|
+
group: "runtime",
|
|
133
|
+
description: "Manage background command sessions.",
|
|
134
|
+
paramsHint: "{ action, sessionId? }",
|
|
135
|
+
keywords: ["long running", "background job", "watch logs", "daemon", "worker", "server process", "job status"],
|
|
136
|
+
source: "builtin",
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
name: "read",
|
|
140
|
+
group: "fs",
|
|
141
|
+
description: "Read files.",
|
|
142
|
+
paramsHint: "{ path }",
|
|
143
|
+
keywords: ["open file", "inspect file", "view logs", "read config", "read docs", "audit code", ...REPORT_KEYWORDS],
|
|
144
|
+
source: "builtin",
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
name: "write",
|
|
148
|
+
group: "fs",
|
|
149
|
+
description: "Write files.",
|
|
150
|
+
paramsHint: "{ path, content }",
|
|
151
|
+
keywords: ["create file", "save output", "generate report", "draft", "write docs", "export", ...REPORT_KEYWORDS],
|
|
152
|
+
source: "builtin",
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
name: "edit",
|
|
156
|
+
group: "fs",
|
|
157
|
+
description: "Patch file text by replacement.",
|
|
158
|
+
paramsHint: "{ path, oldText, newText }",
|
|
159
|
+
keywords: ["modify file", "update code", "refactor file", "fix snippet", ...CODING_KEYWORDS],
|
|
160
|
+
source: "builtin",
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
name: "apply_patch",
|
|
164
|
+
group: "fs",
|
|
165
|
+
description: "Apply unified-style file patch.",
|
|
166
|
+
paramsHint: "{ input }",
|
|
167
|
+
keywords: ["multi-file patch", "diff", "code patch", "batch edits", "surgical edit", ...CODING_KEYWORDS],
|
|
168
|
+
source: "builtin",
|
|
169
|
+
},
|
|
170
|
+
{ name: "sessions_list", group: "sessions", description: "List sessions.", paramsHint: "{ ... }", keywords: ["session", "agents", "workers"], source: "builtin" },
|
|
171
|
+
{ name: "sessions_history", group: "sessions", description: "Read session history.", paramsHint: "{ sessionKey? }", keywords: ["conversation history", "chat log", "audit trail"], source: "builtin" },
|
|
172
|
+
{ name: "sessions_send", group: "sessions", description: "Send to another session.", paramsHint: "{ ... }", keywords: ["delegate", "handoff", "subtask"], source: "builtin" },
|
|
173
|
+
{ name: "sessions_spawn", group: "sessions", description: "Spawn subagent session.", paramsHint: "{ prompt, ... }", keywords: ["spawn agent", "parallel agent", "subagent", "delegate"], source: "builtin" },
|
|
174
|
+
{ name: "session_status", group: "sessions", description: "Show current session status.", paramsHint: "{}", keywords: ["status", "health", "progress"], source: "builtin" },
|
|
175
|
+
{
|
|
176
|
+
name: "memory_search",
|
|
177
|
+
group: "memory",
|
|
178
|
+
description: "Search memory snippets.",
|
|
179
|
+
paramsHint: "{ query }",
|
|
180
|
+
keywords: ["recall", "memory", "previous notes", "past decisions", "context lookup"],
|
|
19
181
|
source: "builtin",
|
|
20
182
|
},
|
|
21
|
-
{ name: "
|
|
22
|
-
{ name: "process", group: "runtime", description: "Manage background command sessions.", paramsHint: "{ action, sessionId? }", source: "builtin" },
|
|
23
|
-
{ name: "read", group: "fs", description: "Read files.", paramsHint: "{ path }", source: "builtin" },
|
|
24
|
-
{ name: "write", group: "fs", description: "Write files.", paramsHint: "{ path, content }", source: "builtin" },
|
|
25
|
-
{ name: "edit", group: "fs", description: "Patch file text by replacement.", paramsHint: "{ path, oldText, newText }", source: "builtin" },
|
|
26
|
-
{ name: "apply_patch", group: "fs", description: "Apply unified-style file patch.", paramsHint: "{ input }", source: "builtin" },
|
|
27
|
-
{ name: "sessions_list", group: "sessions", description: "List sessions.", paramsHint: "{ ... }", source: "builtin" },
|
|
28
|
-
{ name: "sessions_history", group: "sessions", description: "Read session history.", paramsHint: "{ sessionKey? }", source: "builtin" },
|
|
29
|
-
{ name: "sessions_send", group: "sessions", description: "Send to another session.", paramsHint: "{ ... }", source: "builtin" },
|
|
30
|
-
{ name: "sessions_spawn", group: "sessions", description: "Spawn subagent session.", paramsHint: "{ prompt, ... }", source: "builtin" },
|
|
31
|
-
{ name: "session_status", group: "sessions", description: "Show current session status.", paramsHint: "{}", source: "builtin" },
|
|
32
|
-
{ name: "memory_search", group: "memory", description: "Search memory snippets.", paramsHint: "{ query }", source: "builtin" },
|
|
33
|
-
{ name: "memory_get", group: "memory", description: "Read memory entries.", paramsHint: "{ key }", source: "builtin" },
|
|
183
|
+
{ name: "memory_get", group: "memory", description: "Read memory entries.", paramsHint: "{ key }", keywords: ["memory key", "stored context", "knowledge"], source: "builtin" },
|
|
34
184
|
{
|
|
35
185
|
name: "web_search",
|
|
36
186
|
group: "web",
|
|
37
187
|
description: "Search the web.",
|
|
38
188
|
paramsHint: "{ query }",
|
|
39
|
-
keywords: ["
|
|
189
|
+
keywords: ["discover", "find", "lookup", ...RESEARCH_KEYWORDS, ...REPORT_KEYWORDS],
|
|
40
190
|
source: "builtin",
|
|
41
191
|
},
|
|
42
192
|
{
|
|
@@ -44,7 +194,7 @@ const BUILTIN: ToolEntry[] = [
|
|
|
44
194
|
group: "web",
|
|
45
195
|
description: "Fetch and extract web page content.",
|
|
46
196
|
paramsHint: "{ url }",
|
|
47
|
-
keywords: ["read page", "extract", "html"],
|
|
197
|
+
keywords: ["read page", "fetch url", "extract", "html", "article text", "content extraction", ...DATA_KEYWORDS, ...RESEARCH_KEYWORDS],
|
|
48
198
|
source: "builtin",
|
|
49
199
|
},
|
|
50
200
|
{
|
|
@@ -52,14 +202,14 @@ const BUILTIN: ToolEntry[] = [
|
|
|
52
202
|
group: "ui",
|
|
53
203
|
description: "Browser automation.",
|
|
54
204
|
paramsHint: "{ action, ... }",
|
|
55
|
-
keywords: [
|
|
205
|
+
keywords: [...BROWSER_KEYWORDS, "web navigation", "click", "form fill", "screenshot", "scrape dynamic"],
|
|
56
206
|
source: "builtin",
|
|
57
207
|
},
|
|
58
|
-
{ name: "canvas", group: "ui", description: "Canvas/artifact rendering actions.", paramsHint: "{ action, ... }", source: "builtin" },
|
|
59
|
-
{ name: "cron", group: "automation", description: "Manage scheduled jobs.", paramsHint: "{ action, ... }", source: "builtin" },
|
|
60
|
-
{ name: "gateway", group: "automation", description: "Gateway control-plane actions.", paramsHint: "{ action, ... }", source: "builtin" },
|
|
61
|
-
{ name: "message", group: "messaging", description: "Message actions across channels.", paramsHint: "{ action, ... }", source: "builtin" },
|
|
62
|
-
{ name: "nodes", group: "nodes", description: "Invoke node-side capabilities.", paramsHint: "{ action, ... }", source: "builtin" },
|
|
208
|
+
{ name: "canvas", group: "ui", description: "Canvas/artifact rendering actions.", paramsHint: "{ action, ... }", keywords: ["diagram", "visual", "chart", "artifact"], source: "builtin" },
|
|
209
|
+
{ name: "cron", group: "automation", description: "Manage scheduled jobs.", paramsHint: "{ action, ... }", keywords: ["schedule", "recurring", "automation", "job timer"], source: "builtin" },
|
|
210
|
+
{ name: "gateway", group: "automation", description: "Gateway control-plane actions.", paramsHint: "{ action, ... }", keywords: ["gateway control", "restart", "config patch", "service"], source: "builtin" },
|
|
211
|
+
{ name: "message", group: "messaging", description: "Message actions across channels.", paramsHint: "{ action, ... }", keywords: ["notify", "chat", "post update", "send message"], source: "builtin" },
|
|
212
|
+
{ name: "nodes", group: "nodes", description: "Invoke node-side capabilities.", paramsHint: "{ action, ... }", keywords: ["device", "camera", "screen", "location", "node action"], source: "builtin" },
|
|
63
213
|
];
|
|
64
214
|
|
|
65
215
|
const GROUP_NAMES = new Set([
|
|
@@ -328,6 +478,10 @@ function score(query: string, entry: ToolEntry): number {
|
|
|
328
478
|
const d = entry.description.toLowerCase();
|
|
329
479
|
const g = entry.group.toLowerCase();
|
|
330
480
|
const keywords = (entry.keywords ?? []).map((v) => v.toLowerCase());
|
|
481
|
+
const tokens = q
|
|
482
|
+
.split(/[^a-z0-9]+/)
|
|
483
|
+
.map((t) => t.trim())
|
|
484
|
+
.filter(Boolean);
|
|
331
485
|
|
|
332
486
|
let s = 0;
|
|
333
487
|
if (n === q) s += 100;
|
|
@@ -337,7 +491,7 @@ function score(query: string, entry: ToolEntry): number {
|
|
|
337
491
|
if (d.includes(q)) s += 10;
|
|
338
492
|
if (keywords.includes(q)) s += 25;
|
|
339
493
|
|
|
340
|
-
for (const token of
|
|
494
|
+
for (const token of tokens) {
|
|
341
495
|
if (n.includes(token)) s += 12;
|
|
342
496
|
if (d.includes(token)) s += 4;
|
|
343
497
|
if (g.includes(token)) s += 4;
|