@oh-my-pi/pi-coding-agent 3.30.0 → 3.31.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/CHANGELOG.md +71 -0
- package/package.json +5 -5
- package/src/cli/args.ts +4 -0
- package/src/core/agent-session.ts +29 -2
- package/src/core/bash-executor.ts +2 -1
- package/src/core/custom-commands/bundled/review/index.ts +369 -14
- package/src/core/custom-commands/bundled/wt/index.ts +1 -1
- package/src/core/session-manager.ts +158 -246
- package/src/core/session-storage.ts +379 -0
- package/src/core/settings-manager.ts +155 -4
- package/src/core/system-prompt.ts +62 -64
- package/src/core/tools/ask.ts +5 -4
- package/src/core/tools/bash-interceptor.ts +26 -61
- package/src/core/tools/bash.ts +13 -8
- package/src/core/tools/edit-diff.ts +11 -4
- package/src/core/tools/edit.ts +7 -13
- package/src/core/tools/find.ts +111 -50
- package/src/core/tools/gemini-image.ts +128 -147
- package/src/core/tools/grep.ts +397 -415
- package/src/core/tools/index.test.ts +5 -1
- package/src/core/tools/index.ts +6 -8
- package/src/core/tools/ls.ts +12 -10
- package/src/core/tools/lsp/client.ts +58 -9
- package/src/core/tools/lsp/config.ts +205 -656
- package/src/core/tools/lsp/defaults.json +465 -0
- package/src/core/tools/lsp/index.ts +55 -32
- package/src/core/tools/lsp/rust-analyzer.ts +49 -10
- package/src/core/tools/lsp/types.ts +1 -0
- package/src/core/tools/lsp/utils.ts +1 -1
- package/src/core/tools/read.ts +150 -74
- package/src/core/tools/render-utils.ts +70 -10
- package/src/core/tools/review.ts +38 -126
- package/src/core/tools/task/artifacts.ts +5 -4
- package/src/core/tools/task/executor.ts +94 -83
- package/src/core/tools/task/index.ts +129 -92
- package/src/core/tools/task/parallel.ts +30 -3
- package/src/core/tools/task/render.ts +85 -39
- package/src/core/tools/task/types.ts +15 -6
- package/src/core/tools/task/worker.ts +124 -89
- package/src/core/tools/web-fetch.ts +112 -377
- package/src/core/tools/{web-fetch-handlers → web-scrapers}/artifacthub.ts +6 -1
- package/src/core/tools/{web-fetch-handlers → web-scrapers}/arxiv.ts +8 -4
- package/src/core/tools/{web-fetch-handlers → web-scrapers}/aur.ts +6 -2
- package/src/core/tools/{web-fetch-handlers → web-scrapers}/biorxiv.ts +6 -1
- package/src/core/tools/{web-fetch-handlers → web-scrapers}/bluesky.ts +10 -3
- package/src/core/tools/{web-fetch-handlers → web-scrapers}/brew.ts +6 -2
- package/src/core/tools/{web-fetch-handlers → web-scrapers}/cheatsh.ts +6 -1
- package/src/core/tools/{web-fetch-handlers → web-scrapers}/chocolatey.ts +6 -1
- package/src/core/tools/web-scrapers/choosealicense.ts +110 -0
- package/src/core/tools/web-scrapers/cisa-kev.ts +100 -0
- package/src/core/tools/web-scrapers/clojars.ts +180 -0
- package/src/core/tools/{web-fetch-handlers → web-scrapers}/coingecko.ts +6 -1
- package/src/core/tools/{web-fetch-handlers → web-scrapers}/crates-io.ts +7 -2
- package/src/core/tools/web-scrapers/crossref.ts +149 -0
- package/src/core/tools/{web-fetch-handlers → web-scrapers}/devto.ts +8 -4
- package/src/core/tools/{web-fetch-handlers → web-scrapers}/discogs.ts +6 -1
- package/src/core/tools/web-scrapers/discourse.ts +221 -0
- package/src/core/tools/{web-fetch-handlers → web-scrapers}/dockerhub.ts +7 -3
- package/src/core/tools/web-scrapers/fdroid.ts +158 -0
- package/src/core/tools/web-scrapers/firefox-addons.ts +214 -0
- package/src/core/tools/web-scrapers/flathub.ts +239 -0
- package/src/core/tools/{web-fetch-handlers → web-scrapers}/github-gist.ts +6 -2
- package/src/core/tools/{web-fetch-handlers → web-scrapers}/github.ts +63 -32
- package/src/core/tools/{web-fetch-handlers → web-scrapers}/gitlab.ts +31 -19
- package/src/core/tools/{web-fetch-handlers → web-scrapers}/go-pkg.ts +8 -4
- package/src/core/tools/{web-fetch-handlers → web-scrapers}/hackage.ts +6 -1
- package/src/core/tools/{web-fetch-handlers → web-scrapers}/hackernews.ts +18 -18
- package/src/core/tools/{web-fetch-handlers → web-scrapers}/hex.ts +3 -3
- package/src/core/tools/{web-fetch-handlers → web-scrapers}/huggingface.ts +10 -10
- package/src/core/tools/{web-fetch-handlers → web-scrapers}/iacr.ts +8 -4
- package/src/core/tools/web-scrapers/index.ts +250 -0
- package/src/core/tools/web-scrapers/jetbrains-marketplace.ts +169 -0
- package/src/core/tools/web-scrapers/lemmy.ts +220 -0
- package/src/core/tools/{web-fetch-handlers → web-scrapers}/lobsters.ts +3 -3
- package/src/core/tools/{web-fetch-handlers → web-scrapers}/mastodon.ts +11 -3
- package/src/core/tools/{web-fetch-handlers → web-scrapers}/maven.ts +6 -1
- package/src/core/tools/{web-fetch-handlers → web-scrapers}/mdn.ts +2 -2
- package/src/core/tools/{web-fetch-handlers → web-scrapers}/metacpan.ts +13 -7
- package/src/core/tools/web-scrapers/musicbrainz.ts +273 -0
- package/src/core/tools/{web-fetch-handlers → web-scrapers}/npm.ts +12 -5
- package/src/core/tools/{web-fetch-handlers → web-scrapers}/nuget.ts +9 -5
- package/src/core/tools/{web-fetch-handlers → web-scrapers}/nvd.ts +6 -1
- package/src/core/tools/web-scrapers/ollama.ts +267 -0
- package/src/core/tools/web-scrapers/open-vsx.ts +119 -0
- package/src/core/tools/{web-fetch-handlers → web-scrapers}/opencorporates.ts +2 -0
- package/src/core/tools/{web-fetch-handlers → web-scrapers}/openlibrary.ts +18 -12
- package/src/core/tools/web-scrapers/orcid.ts +299 -0
- package/src/core/tools/{web-fetch-handlers → web-scrapers}/osv.ts +6 -1
- package/src/core/tools/{web-fetch-handlers → web-scrapers}/packagist.ts +6 -2
- package/src/core/tools/{web-fetch-handlers → web-scrapers}/pub-dev.ts +3 -3
- package/src/core/tools/{web-fetch-handlers → web-scrapers}/pubmed.ts +8 -4
- package/src/core/tools/{web-fetch-handlers → web-scrapers}/pypi.ts +7 -3
- package/src/core/tools/web-scrapers/rawg.ts +124 -0
- package/src/core/tools/{web-fetch-handlers → web-scrapers}/readthedocs.ts +7 -3
- package/src/core/tools/{web-fetch-handlers → web-scrapers}/reddit.ts +6 -2
- package/src/core/tools/{web-fetch-handlers → web-scrapers}/repology.ts +6 -1
- package/src/core/tools/{web-fetch-handlers → web-scrapers}/rfc.ts +7 -3
- package/src/core/tools/{web-fetch-handlers → web-scrapers}/rubygems.ts +6 -1
- package/src/core/tools/web-scrapers/searchcode.ts +217 -0
- package/src/core/tools/{web-fetch-handlers → web-scrapers}/sec-edgar.ts +6 -1
- package/src/core/tools/{web-fetch-handlers → web-scrapers}/semantic-scholar.ts +2 -2
- package/src/core/tools/web-scrapers/snapcraft.ts +200 -0
- package/src/core/tools/web-scrapers/sourcegraph.ts +373 -0
- package/src/core/tools/web-scrapers/spdx.ts +121 -0
- package/src/core/tools/{web-fetch-handlers → web-scrapers}/spotify.ts +3 -3
- package/src/core/tools/{web-fetch-handlers → web-scrapers}/stackoverflow.ts +3 -2
- package/src/core/tools/{web-fetch-handlers → web-scrapers}/terraform.ts +11 -3
- package/src/core/tools/{web-fetch-handlers → web-scrapers}/tldr.ts +6 -2
- package/src/core/tools/{web-fetch-handlers → web-scrapers}/twitter.ts +15 -3
- package/src/core/tools/{web-fetch-handlers → web-scrapers}/types.ts +98 -27
- package/src/core/tools/web-scrapers/utils.ts +162 -0
- package/src/core/tools/{web-fetch-handlers → web-scrapers}/vimeo.ts +3 -3
- package/src/core/tools/web-scrapers/vscode-marketplace.ts +195 -0
- package/src/core/tools/web-scrapers/w3c.ts +163 -0
- package/src/core/tools/{web-fetch-handlers → web-scrapers}/wikidata.ts +13 -5
- package/src/core/tools/{web-fetch-handlers → web-scrapers}/wikipedia.ts +7 -3
- package/src/core/tools/{web-fetch-handlers → web-scrapers}/youtube.ts +72 -20
- package/src/core/tools/write.ts +21 -18
- package/src/core/voice.ts +3 -2
- package/src/lib/worktree/collapse.ts +2 -1
- package/src/lib/worktree/git.ts +2 -18
- package/src/main.ts +59 -3
- package/src/modes/interactive/components/extensions/extension-dashboard.ts +33 -19
- package/src/modes/interactive/components/extensions/extension-list.ts +15 -8
- package/src/modes/interactive/components/hook-editor.ts +2 -1
- package/src/modes/interactive/components/model-selector.ts +19 -4
- package/src/modes/interactive/interactive-mode.ts +41 -38
- package/src/modes/interactive/theme/theme.ts +58 -58
- package/src/modes/rpc/rpc-mode.ts +10 -9
- package/src/prompts/review-request.md +27 -0
- package/src/prompts/reviewer.md +64 -68
- package/src/prompts/tools/output.md +22 -3
- package/src/prompts/tools/task.md +32 -33
- package/src/utils/clipboard.ts +2 -1
- package/examples/extensions/subagent/agents/reviewer.md +0 -35
- package/src/core/tools/web-fetch-handlers/index.ts +0 -69
- package/src/core/tools/web-fetch-handlers/utils.ts +0 -91
- /package/src/core/tools/{web-fetch-handlers → web-scrapers}/academic.test.ts +0 -0
- /package/src/core/tools/{web-fetch-handlers → web-scrapers}/business.test.ts +0 -0
- /package/src/core/tools/{web-fetch-handlers → web-scrapers}/dev-platforms.test.ts +0 -0
- /package/src/core/tools/{web-fetch-handlers → web-scrapers}/documentation.test.ts +0 -0
- /package/src/core/tools/{web-fetch-handlers → web-scrapers}/finance-media.test.ts +0 -0
- /package/src/core/tools/{web-fetch-handlers → web-scrapers}/git-hosting.test.ts +0 -0
- /package/src/core/tools/{web-fetch-handlers → web-scrapers}/media.test.ts +0 -0
- /package/src/core/tools/{web-fetch-handlers → web-scrapers}/package-managers-2.test.ts +0 -0
- /package/src/core/tools/{web-fetch-handlers → web-scrapers}/package-managers.test.ts +0 -0
- /package/src/core/tools/{web-fetch-handlers → web-scrapers}/package-registries.test.ts +0 -0
- /package/src/core/tools/{web-fetch-handlers → web-scrapers}/research.test.ts +0 -0
- /package/src/core/tools/{web-fetch-handlers → web-scrapers}/security.test.ts +0 -0
- /package/src/core/tools/{web-fetch-handlers → web-scrapers}/social-extended.test.ts +0 -0
- /package/src/core/tools/{web-fetch-handlers → web-scrapers}/social.test.ts +0 -0
- /package/src/core/tools/{web-fetch-handlers → web-scrapers}/stackexchange.test.ts +0 -0
- /package/src/core/tools/{web-fetch-handlers → web-scrapers}/standards.test.ts +0 -0
- /package/src/core/tools/{web-fetch-handlers → web-scrapers}/wikipedia.test.ts +0 -0
- /package/src/core/tools/{web-fetch-handlers → web-scrapers}/youtube.test.ts +0 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
## Code Review Request
|
|
2
|
+
|
|
3
|
+
### Mode
|
|
4
|
+
{MODE}
|
|
5
|
+
|
|
6
|
+
### Changed Files ({FILE_COUNT} files, +{LINES_ADDED}/-{LINES_REMOVED} lines)
|
|
7
|
+
|
|
8
|
+
{FILE_TABLE}
|
|
9
|
+
|
|
10
|
+
{EXCLUDED_SECTION}
|
|
11
|
+
|
|
12
|
+
### Distribution Guidelines
|
|
13
|
+
|
|
14
|
+
{DISTRIBUTION_GUIDANCE}
|
|
15
|
+
|
|
16
|
+
{GROUPING_GUIDANCE}
|
|
17
|
+
|
|
18
|
+
### Reviewer Instructions
|
|
19
|
+
|
|
20
|
+
Each reviewer agent should:
|
|
21
|
+
1. Focus ONLY on its assigned files
|
|
22
|
+
2. {DIFF_INSTRUCTION}
|
|
23
|
+
3. Read full file context as needed via the `read` tool
|
|
24
|
+
4. Call `report_finding` for each issue found
|
|
25
|
+
5. Call `complete` with verdict when done
|
|
26
|
+
|
|
27
|
+
{DIFF_SECTION}
|
package/src/prompts/reviewer.md
CHANGED
|
@@ -1,81 +1,77 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: reviewer
|
|
3
3
|
description: Code review specialist for quality and security analysis
|
|
4
|
-
tools: read, grep, find, ls, bash, report_finding
|
|
5
|
-
spawns: explore
|
|
4
|
+
tools: read, grep, find, ls, bash, report_finding
|
|
5
|
+
spawns: explore, task
|
|
6
6
|
model: pi/slow, gpt-5.2-codex, gpt-5.2, codex, gpt
|
|
7
7
|
---
|
|
8
8
|
|
|
9
|
-
You are
|
|
9
|
+
You are a senior engineer reviewing a proposed code change. Your goal: identify bugs that the author would want to fix before merging.
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
# Strategy
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
1. Run `git diff` (or `gh pr diff <number>`) to see the patch
|
|
14
|
+
2. Read modified files for full context
|
|
15
|
+
3. For large changes, spawn parallel `task` agents (one per module/concern)
|
|
16
|
+
4. Call `report_finding` for each issue
|
|
17
|
+
5. Call `complete` with your verdict — **review is incomplete until `complete` is called**
|
|
14
18
|
|
|
15
|
-
|
|
16
|
-
2. Read the modified files for full context
|
|
17
|
-
3. For large changes spanning multiple files/modules, use `task` with `explore` agents in parallel to gather context faster
|
|
18
|
-
4. Analyze for bugs, security issues, and code quality problems
|
|
19
|
-
5. Use `report_finding` for each issue found
|
|
20
|
-
6. Use `submit_review` to provide final verdict
|
|
19
|
+
Bash is read-only: `git diff`, `git log`, `git show`, `gh pr diff`. No file modifications or builds.
|
|
21
20
|
|
|
22
|
-
#
|
|
21
|
+
# What to Flag
|
|
23
22
|
|
|
24
|
-
|
|
25
|
-
- Each agent can investigate a different module or concern
|
|
26
|
-
- Example: one explores test coverage, another checks related implementations
|
|
27
|
-
- Gather their findings, then synthesize into your review
|
|
23
|
+
Report an issue only when ALL conditions hold:
|
|
28
24
|
|
|
29
|
-
|
|
25
|
+
- **Provable impact**: You can show specific code paths affected (no speculation)
|
|
26
|
+
- **Actionable**: Discrete fix, not a vague "consider improving X"
|
|
27
|
+
- **Unintentional**: Clearly not a deliberate design choice
|
|
28
|
+
- **Introduced in this patch**: Don't flag pre-existing bugs
|
|
29
|
+
- **No unstated assumptions**: Bug doesn't rely on assumptions about codebase or author's intent
|
|
30
|
+
- **Proportionate rigor**: Fix doesn't demand rigor not present elsewhere in the codebase
|
|
31
|
+
|
|
32
|
+
# Priority
|
|
33
|
+
|
|
34
|
+
| Level | Criteria | Example |
|
|
35
|
+
| ----- | ----------------------------------------------------------- | ---------------------------- |
|
|
36
|
+
| P0 | Blocks release/operations; universal (no input assumptions) | Data corruption, auth bypass |
|
|
37
|
+
| P1 | High; fix next cycle | Race condition under load |
|
|
38
|
+
| P2 | Medium; fix eventually | Edge case mishandling |
|
|
39
|
+
| P3 | Info; nice to have | Suboptimal but correct |
|
|
40
|
+
|
|
41
|
+
# Writing Findings
|
|
42
|
+
|
|
43
|
+
- **Title**: Imperative, ≤80 chars (e.g., `Handle null response from API`)
|
|
44
|
+
- **Body**: One paragraph. State the bug, trigger condition, and impact. Neutral tone.
|
|
45
|
+
- **Suggestion blocks**: Only for concrete replacement code. Preserve exact whitespace. No commentary inside.
|
|
46
|
+
|
|
47
|
+
<example>
|
|
48
|
+
<title>Validate input length before buffer copy</title>
|
|
49
|
+
<body>When `data.length > BUFFER_SIZE`, `memcpy` writes past the buffer boundary. This occurs if the API returns oversized payloads, causing heap corruption.</body>
|
|
50
|
+
```suggestion
|
|
51
|
+
if (data.length > BUFFER_SIZE) return -EINVAL;
|
|
52
|
+
memcpy(buf, data.ptr, data.length);
|
|
53
|
+
```
|
|
54
|
+
</example>
|
|
55
|
+
|
|
56
|
+
# Output Format
|
|
57
|
+
|
|
58
|
+
Each `report_finding` requires:
|
|
59
|
+
|
|
60
|
+
- `title`: ≤80 chars, imperative
|
|
61
|
+
- `body`: One paragraph
|
|
62
|
+
- `priority`: 0-3
|
|
63
|
+
- `confidence`: 0.0-1.0
|
|
64
|
+
- `file_path`: Absolute path
|
|
65
|
+
- `line_start`, `line_end`: Range ≤10 lines, must overlap the diff
|
|
66
|
+
|
|
67
|
+
Final `complete` call:
|
|
68
|
+
|
|
69
|
+
- `overall_correctness`: "correct" (no bugs/blockers) or "incorrect"
|
|
70
|
+
- `explanation`: 1-3 sentences
|
|
71
|
+
- `confidence`: 0.0-1.0
|
|
72
|
+
|
|
73
|
+
Correctness judgment ignores non-blocking issues (style, docs, nits).
|
|
74
|
+
|
|
75
|
+
# Critical Reminder
|
|
30
76
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
1. It meaningfully impacts the accuracy, performance, security, or maintainability of the code
|
|
34
|
-
2. The bug is discrete and actionable (not a general issue or combination of multiple issues)
|
|
35
|
-
3. Fixing it doesn't demand rigor not present elsewhere in the codebase
|
|
36
|
-
4. The bug was introduced in this commit (don't flag pre-existing bugs)
|
|
37
|
-
5. The author would likely fix the issue if made aware of it
|
|
38
|
-
6. The bug doesn't rely on unstated assumptions about the codebase or author's intent
|
|
39
|
-
7. You can identify specific code that is provably affected (speculation is not enough)
|
|
40
|
-
8. The issue is clearly not an intentional change by the author
|
|
41
|
-
|
|
42
|
-
# Priority Levels
|
|
43
|
-
|
|
44
|
-
- **P0**: Drop everything to fix. Blocking release, operations, or major usage. Only use for universal issues that do not depend on assumptions about inputs.
|
|
45
|
-
- **P1**: Urgent. Should be addressed in the next cycle.
|
|
46
|
-
- **P2**: Normal. To be fixed eventually.
|
|
47
|
-
- **P3**: Low. Nice to have.
|
|
48
|
-
|
|
49
|
-
# Comment Guidelines
|
|
50
|
-
|
|
51
|
-
1. Be clear about WHY the issue is a bug
|
|
52
|
-
2. Communicate severity appropriately - don't overstate
|
|
53
|
-
3. Keep body to one paragraph max
|
|
54
|
-
4. Code snippets should be ≤3 lines, wrapped in markdown code tags
|
|
55
|
-
5. Clearly state what conditions are necessary for the bug to arise
|
|
56
|
-
6. Tone: matter-of-fact, not accusatory or overly positive
|
|
57
|
-
7. Write so the author can immediately grasp the idea without close reading
|
|
58
|
-
8. Avoid flattery and phrases like "Great job...", "Thanks for..."
|
|
59
|
-
9. Use ```suggestion blocks ONLY for concrete replacement code (minimal lines; no commentary inside the block)
|
|
60
|
-
10. In every ```suggestion block, preserve the exact leading whitespace of the replaced lines (spaces vs tabs, number of spaces)
|
|
61
|
-
|
|
62
|
-
# CRITICAL
|
|
63
|
-
|
|
64
|
-
You MUST call `submit_review` before ending your response, even if you found no issues.
|
|
65
|
-
The review is only considered complete when `submit_review` is called.
|
|
66
|
-
Failure to call `submit_review` means the review was not submitted.
|
|
67
|
-
|
|
68
|
-
# Output
|
|
69
|
-
|
|
70
|
-
- Use `report_finding` for each issue. Continue until you've listed every qualifying finding.
|
|
71
|
-
- Each `report_finding` must include: title (<=80 chars, imperative, prefixed `[P0-P3]`), body (one paragraph), priority (0-3), confidence (0.0-1.0), absolute `file_path`, and `line_start`/`line_end` with a range <=10 lines.
|
|
72
|
-
- If there is no finding that a person would definitely want to fix, prefer outputting no findings.
|
|
73
|
-
- Every finding must be anchored to a specific diff hunk; the code location must overlap the patch. If you cannot anchor it to the patch, do not report it.
|
|
74
|
-
- Ignore trivial style unless it obscures meaning or violates documented standards.
|
|
75
|
-
- Use `submit_review` at the end with your overall verdict:
|
|
76
|
-
- **correct**: Existing code and tests will not break, patch is free of bugs and blocking issues
|
|
77
|
-
- **incorrect**: Has bugs or blocking issues that must be addressed
|
|
78
|
-
|
|
79
|
-
Ignore non-blocking issues (style, formatting, typos, documentation, nits) when determining correctness.
|
|
80
|
-
|
|
81
|
-
At the end of the review, double-check that every finding is evidence-backed and non-speculative.
|
|
77
|
+
Every finding must be anchored to the patch and evidence-backed. Before submitting, verify each finding is not speculative. Then call `complete`.
|
|
@@ -16,13 +16,32 @@ Do NOT use when:
|
|
|
16
16
|
|
|
17
17
|
## Parameters
|
|
18
18
|
|
|
19
|
-
- `ids`: Array of output IDs from Task results (e.g., `["
|
|
19
|
+
- `ids`: Array of output IDs from Task results (e.g., `["ApiAudit", "DbAudit"]`)
|
|
20
20
|
- `format` (optional):
|
|
21
21
|
- `"raw"` (default): Full output with ANSI codes preserved
|
|
22
22
|
- `"json"`: Structured object with metadata
|
|
23
23
|
- `"stripped"`: Plain text with ANSI codes removed for parsing
|
|
24
|
-
- `query` (optional): jq-like query for JSON outputs (e.g., `.
|
|
24
|
+
- `query` (optional): jq-like query for JSON outputs (e.g., `.endpoints[0].file`)
|
|
25
25
|
- `offset` (optional): Line number to start reading from (1-indexed)
|
|
26
26
|
- `limit` (optional): Maximum number of lines to read
|
|
27
27
|
|
|
28
|
-
Use offset/limit for line ranges to reduce context usage on large outputs. Use `query` for
|
|
28
|
+
Use offset/limit for line ranges to reduce context usage on large outputs. Use `query` for structured agent outputs (agents that call `complete` with `output`).
|
|
29
|
+
|
|
30
|
+
## Query Examples
|
|
31
|
+
|
|
32
|
+
For agents returning structured data via `complete`, use `query` to extract specific fields:
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
# Given output: { properties: { endpoints: { elements: { properties: { file, line, hasAuth } } } } }
|
|
36
|
+
|
|
37
|
+
.endpoints # Get all endpoints array
|
|
38
|
+
.endpoints[0] # First endpoint object
|
|
39
|
+
.endpoints[0].file # First endpoint's file path
|
|
40
|
+
.endpoints[0]["hasAuth"] # Bracket notation (equivalent to .hasAuth)
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Query paths:
|
|
44
|
+
- `.foo` - property access
|
|
45
|
+
- `[0]` - array index
|
|
46
|
+
- `.foo.bar[0].baz` - chained access
|
|
47
|
+
- `["special-key"]` - properties with special characters
|
|
@@ -16,9 +16,9 @@ The Task tool launches specialized agents (workers) that autonomously handle com
|
|
|
16
16
|
## Usage Notes
|
|
17
17
|
|
|
18
18
|
- Always include a short description of the task in the task parameter
|
|
19
|
-
- **Plan-then-execute**: Put shared constraints in `context`, keep each task focused, specify acceptance criteria; use `
|
|
19
|
+
- **Plan-then-execute**: Put shared constraints in `context`, keep each task focused, specify acceptance criteria; use `output` when you need structured output
|
|
20
20
|
- **Minimize tool chatter**: Avoid repeating large context; use Output tool with output ids for full logs
|
|
21
|
-
- **Structured completion**: If `
|
|
21
|
+
- **Structured completion**: If `output` is provided, subagents must call `complete` to finish
|
|
22
22
|
- **Parallelize**: Launch multiple agents concurrently whenever possible
|
|
23
23
|
- **Results are intermediate data**: Agent findings provide context for YOU to perform actual work. Do not treat agent reports as "task complete" signals.
|
|
24
24
|
- **Stateless invocations**: Each agent runs autonomously and returns a single final message. Include all necessary context and specify exactly what information to return.
|
|
@@ -28,43 +28,42 @@ The Task tool launches specialized agents (workers) that autonomously handle com
|
|
|
28
28
|
|
|
29
29
|
## Parameters
|
|
30
30
|
|
|
31
|
-
- `
|
|
32
|
-
|
|
33
|
-
- `
|
|
34
|
-
- `
|
|
31
|
+
- `agent`: Agent type to use for all tasks
|
|
32
|
+
- `context`: Shared context string prepended to all task prompts
|
|
33
|
+
- `model`: (optional) Model override (fuzzy matching, e.g., "sonnet", "opus")
|
|
34
|
+
- `tasks`: Array of `{id, task, description}` - tasks to run in parallel (max {{MAX_PARALLEL_TASKS}}, {{MAX_CONCURRENCY}} concurrent)
|
|
35
|
+
- `id`: Short CamelCase identifier for display (max 20 chars, e.g., "SessionStore", "LspRefactor")
|
|
36
|
+
- `task`: The task prompt for the agent
|
|
37
|
+
- `description`: Short human-readable description of what the task does
|
|
38
|
+
- `output`: (optional) JTD schema for structured subagent output (used by the complete tool)
|
|
35
39
|
|
|
36
|
-
##
|
|
40
|
+
## Example
|
|
37
41
|
|
|
38
42
|
<example>
|
|
39
|
-
user: "
|
|
40
|
-
assistant:
|
|
41
|
-
assistant: I'm going to use the Write tool to write the following code:
|
|
42
|
-
<code>
|
|
43
|
-
function isPrime(n) {
|
|
44
|
-
if (n <= 1) return false
|
|
45
|
-
for (let i = 2; i * i <= n; i++) {
|
|
46
|
-
if (n % i === 0) return false
|
|
47
|
-
}
|
|
48
|
-
return true
|
|
49
|
-
}
|
|
50
|
-
</code>
|
|
51
|
-
<commentary>
|
|
52
|
-
Since a significant piece of code was written and the task was completed, now use the code-reviewer agent to review the code
|
|
53
|
-
</commentary>
|
|
54
|
-
assistant: Now let me use the code-reviewer agent to review the code
|
|
55
|
-
assistant: Uses the Task tool: { tasks: [{ agent: "code-reviewer", task: "Review the isPrime function" }] }
|
|
56
|
-
</example>
|
|
57
|
-
|
|
58
|
-
<example>
|
|
59
|
-
user: "Find all TODO comments in the codebase"
|
|
60
|
-
assistant: I'll use multiple explore agents to search different directories in parallel
|
|
43
|
+
user: "Extract all hardcoded strings for i18n"
|
|
44
|
+
assistant: I'll scan UI components and return structured string locations for internationalization.
|
|
61
45
|
assistant: Uses the Task tool:
|
|
62
46
|
{
|
|
63
|
-
"
|
|
47
|
+
"agent": "explore",
|
|
48
|
+
"context": "Find hardcoded user-facing strings (labels, messages, errors). Ignore logs, comments, and internal identifiers.",
|
|
49
|
+
"output": {
|
|
50
|
+
"properties": {
|
|
51
|
+
"strings": {
|
|
52
|
+
"elements": {
|
|
53
|
+
"properties": {
|
|
54
|
+
"file": { "type": "string" },
|
|
55
|
+
"line": { "type": "uint32" },
|
|
56
|
+
"text": { "type": "string" },
|
|
57
|
+
"suggestedKey": { "type": "string" }
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
},
|
|
64
63
|
"tasks": [
|
|
65
|
-
{ "
|
|
66
|
-
{ "
|
|
67
|
-
{ "
|
|
64
|
+
{ "id": "Forms", "task": "Scan src/components/forms/", "description": "Extract form strings" },
|
|
65
|
+
{ "id": "Modals", "task": "Scan src/components/modals/", "description": "Extract modal strings" },
|
|
66
|
+
{ "id": "Pages", "task": "Scan src/pages/", "description": "Extract page strings" }
|
|
68
67
|
]
|
|
69
68
|
}
|
|
70
69
|
</example>
|
package/src/utils/clipboard.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { platform } from "node:os";
|
|
2
|
+
import { nanoid } from "nanoid";
|
|
2
3
|
|
|
3
4
|
async function spawnWithTimeout(cmd: string[], input: string, timeoutMs: number): Promise<void> {
|
|
4
5
|
const proc = Bun.spawn(cmd, { stdin: "pipe" });
|
|
@@ -199,7 +200,7 @@ async function readImageMacOS(timeout: number): Promise<ClipboardImage | null> {
|
|
|
199
200
|
|
|
200
201
|
// Read the actual image data using a temp file approach
|
|
201
202
|
// osascript can't output binary directly, so we write to a temp file
|
|
202
|
-
const tempFile = `/tmp/omp-clipboard-${
|
|
203
|
+
const tempFile = `/tmp/omp-clipboard-${nanoid()}.${imageType === "png" ? "png" : "jpg"}`;
|
|
203
204
|
const clipboardClass = imageType === "png" ? "«class PNGf»" : "«class JPEG»";
|
|
204
205
|
|
|
205
206
|
const readScript = `
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: reviewer
|
|
3
|
-
description: Code review specialist for quality and security analysis
|
|
4
|
-
tools: read, grep, find, ls, bash
|
|
5
|
-
model: claude-sonnet-4-5
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
You are a senior code reviewer. Analyze code for quality, security, and maintainability.
|
|
9
|
-
|
|
10
|
-
Bash is for read-only commands only: `git diff`, `git log`, `git show`. Do NOT modify files or run builds.
|
|
11
|
-
Assume tool permissions are not perfectly enforceable; keep all bash usage strictly read-only.
|
|
12
|
-
|
|
13
|
-
Strategy:
|
|
14
|
-
1. Run `git diff` to see recent changes (if applicable)
|
|
15
|
-
2. Read the modified files
|
|
16
|
-
3. Check for bugs, security issues, code smells
|
|
17
|
-
|
|
18
|
-
Output format:
|
|
19
|
-
|
|
20
|
-
## Files Reviewed
|
|
21
|
-
- `path/to/file.ts` (lines X-Y)
|
|
22
|
-
|
|
23
|
-
## Critical (must fix)
|
|
24
|
-
- `file.ts:42` - Issue description
|
|
25
|
-
|
|
26
|
-
## Warnings (should fix)
|
|
27
|
-
- `file.ts:100` - Issue description
|
|
28
|
-
|
|
29
|
-
## Suggestions (consider)
|
|
30
|
-
- `file.ts:150` - Improvement idea
|
|
31
|
-
|
|
32
|
-
## Summary
|
|
33
|
-
Overall assessment in 2-3 sentences.
|
|
34
|
-
|
|
35
|
-
Be specific with file paths and line numbers.
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Web Fetch Special Handlers Index
|
|
3
|
-
*
|
|
4
|
-
* Exports all special handlers for site-specific content extraction.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
export { handleArtifactHub } from "./artifacthub";
|
|
8
|
-
// Academic
|
|
9
|
-
export { handleArxiv } from "./arxiv";
|
|
10
|
-
export { handleAur } from "./aur";
|
|
11
|
-
export { handleBiorxiv } from "./biorxiv";
|
|
12
|
-
export { handleBluesky } from "./bluesky";
|
|
13
|
-
export { handleBrew } from "./brew";
|
|
14
|
-
export { handleCheatSh } from "./cheatsh";
|
|
15
|
-
export { handleChocolatey } from "./chocolatey";
|
|
16
|
-
export { handleCoinGecko } from "./coingecko";
|
|
17
|
-
export { handleCratesIo } from "./crates-io";
|
|
18
|
-
export { handleDevTo } from "./devto";
|
|
19
|
-
export { handleDiscogs } from "./discogs";
|
|
20
|
-
export { handleDockerHub } from "./dockerhub";
|
|
21
|
-
// Git hosting
|
|
22
|
-
export { fetchGitHubApi, handleGitHub } from "./github";
|
|
23
|
-
export { handleGitHubGist } from "./github-gist";
|
|
24
|
-
export { handleGitLab } from "./gitlab";
|
|
25
|
-
export { handleGoPkg } from "./go-pkg";
|
|
26
|
-
export { handleHackage } from "./hackage";
|
|
27
|
-
export { handleHackerNews } from "./hackernews";
|
|
28
|
-
export { handleHex } from "./hex";
|
|
29
|
-
// ML/AI
|
|
30
|
-
export { handleHuggingFace } from "./huggingface";
|
|
31
|
-
export { handleIacr } from "./iacr";
|
|
32
|
-
export { handleLobsters } from "./lobsters";
|
|
33
|
-
export { handleMastodon } from "./mastodon";
|
|
34
|
-
export { handleMaven } from "./maven";
|
|
35
|
-
export { handleMDN } from "./mdn";
|
|
36
|
-
export { handleMetaCPAN } from "./metacpan";
|
|
37
|
-
// Package registries
|
|
38
|
-
export { handleNpm } from "./npm";
|
|
39
|
-
export { handleNuGet } from "./nuget";
|
|
40
|
-
export { handleNvd } from "./nvd";
|
|
41
|
-
export { handleOpenCorporates } from "./opencorporates";
|
|
42
|
-
export { handleOpenLibrary } from "./openlibrary";
|
|
43
|
-
export { handleOsv } from "./osv";
|
|
44
|
-
export { handlePackagist } from "./packagist";
|
|
45
|
-
export { handlePubDev } from "./pub-dev";
|
|
46
|
-
export { handlePubMed } from "./pubmed";
|
|
47
|
-
export { handlePyPI } from "./pypi";
|
|
48
|
-
export { handleReadTheDocs } from "./readthedocs";
|
|
49
|
-
export { handleReddit } from "./reddit";
|
|
50
|
-
export { handleRepology } from "./repology";
|
|
51
|
-
export { handleRfc } from "./rfc";
|
|
52
|
-
export { handleRubyGems } from "./rubygems";
|
|
53
|
-
export { handleSecEdgar } from "./sec-edgar";
|
|
54
|
-
export { handleSemanticScholar } from "./semantic-scholar";
|
|
55
|
-
export { handleSpotify } from "./spotify";
|
|
56
|
-
// Developer content
|
|
57
|
-
export { handleStackOverflow } from "./stackoverflow";
|
|
58
|
-
export { handleTerraform } from "./terraform";
|
|
59
|
-
export { handleTldr } from "./tldr";
|
|
60
|
-
// Social/News
|
|
61
|
-
export { handleTwitter } from "./twitter";
|
|
62
|
-
export type { RenderResult, SpecialHandler } from "./types";
|
|
63
|
-
export { handleVimeo } from "./vimeo";
|
|
64
|
-
|
|
65
|
-
// Reference
|
|
66
|
-
export { handleWikidata } from "./wikidata";
|
|
67
|
-
export { handleWikipedia } from "./wikipedia";
|
|
68
|
-
// Video/Media
|
|
69
|
-
export { handleYouTube } from "./youtube";
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import { tmpdir } from "node:os";
|
|
2
|
-
import * as path from "node:path";
|
|
3
|
-
import { ensureTool } from "../../../utils/tools-manager";
|
|
4
|
-
|
|
5
|
-
const MAX_BYTES = 50 * 1024 * 1024; // 50MB for binary files
|
|
6
|
-
|
|
7
|
-
function exec(
|
|
8
|
-
cmd: string,
|
|
9
|
-
args: string[],
|
|
10
|
-
options?: { timeout?: number; input?: string | Buffer },
|
|
11
|
-
): { stdout: string; stderr: string; ok: boolean } {
|
|
12
|
-
const result = Bun.spawnSync([cmd, ...args], {
|
|
13
|
-
stdin: options?.input ? (options.input as any) : "ignore",
|
|
14
|
-
stdout: "pipe",
|
|
15
|
-
stderr: "pipe",
|
|
16
|
-
});
|
|
17
|
-
return {
|
|
18
|
-
stdout: result.stdout?.toString() ?? "",
|
|
19
|
-
stderr: result.stderr?.toString() ?? "",
|
|
20
|
-
ok: result.exitCode === 0,
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export async function convertWithMarkitdown(
|
|
25
|
-
content: Buffer,
|
|
26
|
-
extensionHint: string,
|
|
27
|
-
timeout: number,
|
|
28
|
-
): Promise<{ content: string; ok: boolean }> {
|
|
29
|
-
const markitdown = await ensureTool("markitdown", true);
|
|
30
|
-
if (!markitdown) {
|
|
31
|
-
return { content: "", ok: false };
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
// Write to temp file with extension hint
|
|
35
|
-
const ext = extensionHint || ".bin";
|
|
36
|
-
const tmpDir = tmpdir();
|
|
37
|
-
const tmpFile = path.join(tmpDir, `omp-convert-${Date.now()}${ext}`);
|
|
38
|
-
|
|
39
|
-
try {
|
|
40
|
-
await Bun.write(tmpFile, content);
|
|
41
|
-
const result = exec(markitdown, [tmpFile], { timeout });
|
|
42
|
-
return { content: result.stdout, ok: result.ok };
|
|
43
|
-
} finally {
|
|
44
|
-
try {
|
|
45
|
-
await Bun.$`rm ${tmpFile}`.quiet();
|
|
46
|
-
} catch {}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export async function fetchBinary(
|
|
51
|
-
url: string,
|
|
52
|
-
timeout: number,
|
|
53
|
-
): Promise<{ buffer: Buffer; contentType: string; contentDisposition?: string; ok: boolean }> {
|
|
54
|
-
try {
|
|
55
|
-
const controller = new AbortController();
|
|
56
|
-
const timeoutId = setTimeout(() => controller.abort(), timeout * 1000);
|
|
57
|
-
|
|
58
|
-
const response = await fetch(url, {
|
|
59
|
-
signal: controller.signal,
|
|
60
|
-
headers: {
|
|
61
|
-
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 Chrome/131.0.0.0",
|
|
62
|
-
},
|
|
63
|
-
redirect: "follow",
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
clearTimeout(timeoutId);
|
|
67
|
-
|
|
68
|
-
if (!response.ok) {
|
|
69
|
-
return { buffer: Buffer.alloc(0), contentType: "", ok: false };
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
const contentType = response.headers.get("content-type") ?? "";
|
|
73
|
-
const contentDisposition = response.headers.get("content-disposition") ?? undefined;
|
|
74
|
-
const contentLength = response.headers.get("content-length");
|
|
75
|
-
if (contentLength) {
|
|
76
|
-
const size = Number.parseInt(contentLength, 10);
|
|
77
|
-
if (Number.isFinite(size) && size > MAX_BYTES) {
|
|
78
|
-
return { buffer: Buffer.alloc(0), contentType, contentDisposition, ok: false };
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
const buffer = Buffer.from(await response.arrayBuffer());
|
|
83
|
-
if (buffer.length > MAX_BYTES) {
|
|
84
|
-
return { buffer: Buffer.alloc(0), contentType, contentDisposition, ok: false };
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
return { buffer, contentType, contentDisposition, ok: true };
|
|
88
|
-
} catch {
|
|
89
|
-
return { buffer: Buffer.alloc(0), contentType: "", ok: false };
|
|
90
|
-
}
|
|
91
|
-
}
|
|
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
|