cursor-composer-in-claude 0.9.4 → 0.10.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/dist/lib/bundled-skills.d.ts +35 -0
- package/dist/lib/bundled-skills.js +314 -0
- package/dist/lib/bundled-skills.js.map +1 -0
- package/dist/lib/cli-stream-parser.d.ts +11 -0
- package/dist/lib/cli-stream-parser.js +57 -9
- package/dist/lib/cli-stream-parser.js.map +1 -1
- package/dist/lib/handlers/anthropic-messages.js +10 -0
- package/dist/lib/handlers/anthropic-messages.js.map +1 -1
- package/dist/lib/openai.d.ts +3 -2
- package/dist/lib/openai.js +43 -5
- package/dist/lib/openai.js.map +1 -1
- package/dist/lib/skill-materializer.d.ts +33 -0
- package/dist/lib/skill-materializer.js +86 -0
- package/dist/lib/skill-materializer.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bundled Anthropic Skill bodies — translated to cursor-agent `.cursor/rules/*.mdc`
|
|
3
|
+
* format.
|
|
4
|
+
*
|
|
5
|
+
* Proxied fast models (composer-2-fast et al.) can't invoke the Anthropic
|
|
6
|
+
* `Skill` tool that ships with the Agent SDK — cursor-agent has its own
|
|
7
|
+
* hardcoded tool loop and treats SDK-provided tools as text context only.
|
|
8
|
+
*
|
|
9
|
+
* Path D from `docs/PROXIED_FAST_MODEL_RESEARCH.md`: when the Agent SDK
|
|
10
|
+
* advertises a skill whose body we know, we materialise it as a `.cursor/rules/<name>.mdc`
|
|
11
|
+
* file in the per-request workspace. cursor-agent auto-discovers those and
|
|
12
|
+
* follows them verbatim — `/simplify`, `/review`, etc. work the same as on
|
|
13
|
+
* direct Anthropic endpoints.
|
|
14
|
+
*
|
|
15
|
+
* The bodies below were extracted from the current Claude Code bundle (cli.js
|
|
16
|
+
* of `@anthropic-ai/claude-code`). They are the authoritative prompts shipped
|
|
17
|
+
* by Anthropic for the `/init`, `/review`, `/simplify`, and `/security-review`
|
|
18
|
+
* skills. `${...}` JS template slots have been resolved to their runtime
|
|
19
|
+
* values.
|
|
20
|
+
*/
|
|
21
|
+
export type BundledSkill = {
|
|
22
|
+
/** Skill name — matches the slash-command invocation (`/simplify` etc.) */
|
|
23
|
+
name: string;
|
|
24
|
+
/** One-line description used by cursor-agent to decide when to apply the rule. */
|
|
25
|
+
description: string;
|
|
26
|
+
/** Skill body — the prompt cursor-agent will follow. */
|
|
27
|
+
body: string;
|
|
28
|
+
};
|
|
29
|
+
export declare const BUNDLED_SKILLS: Record<string, BundledSkill>;
|
|
30
|
+
/**
|
|
31
|
+
* Render a BundledSkill to the `.cursor/rules/<name>.mdc` on-disk format.
|
|
32
|
+
* `alwaysApply: false` — cursor-agent selects the rule based on the
|
|
33
|
+
* description when the user (or caller) invokes `/<skill-name>`.
|
|
34
|
+
*/
|
|
35
|
+
export declare function renderSkillAsMdc(skill: BundledSkill): string;
|
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bundled Anthropic Skill bodies — translated to cursor-agent `.cursor/rules/*.mdc`
|
|
3
|
+
* format.
|
|
4
|
+
*
|
|
5
|
+
* Proxied fast models (composer-2-fast et al.) can't invoke the Anthropic
|
|
6
|
+
* `Skill` tool that ships with the Agent SDK — cursor-agent has its own
|
|
7
|
+
* hardcoded tool loop and treats SDK-provided tools as text context only.
|
|
8
|
+
*
|
|
9
|
+
* Path D from `docs/PROXIED_FAST_MODEL_RESEARCH.md`: when the Agent SDK
|
|
10
|
+
* advertises a skill whose body we know, we materialise it as a `.cursor/rules/<name>.mdc`
|
|
11
|
+
* file in the per-request workspace. cursor-agent auto-discovers those and
|
|
12
|
+
* follows them verbatim — `/simplify`, `/review`, etc. work the same as on
|
|
13
|
+
* direct Anthropic endpoints.
|
|
14
|
+
*
|
|
15
|
+
* The bodies below were extracted from the current Claude Code bundle (cli.js
|
|
16
|
+
* of `@anthropic-ai/claude-code`). They are the authoritative prompts shipped
|
|
17
|
+
* by Anthropic for the `/init`, `/review`, `/simplify`, and `/security-review`
|
|
18
|
+
* skills. `${...}` JS template slots have been resolved to their runtime
|
|
19
|
+
* values.
|
|
20
|
+
*/
|
|
21
|
+
const INIT_BODY = `Please analyze this codebase and create a CLAUDE.md file, which will be given to future instances of Claude Code to operate in this repository.
|
|
22
|
+
|
|
23
|
+
What to add:
|
|
24
|
+
1. Commands that will be commonly used, such as how to build, lint, and run tests. Include the necessary commands to develop in this codebase, such as how to run a single test.
|
|
25
|
+
2. High-level code architecture and structure so that future instances can be productive more quickly. Focus on the "big picture" architecture that requires reading multiple files to understand.
|
|
26
|
+
|
|
27
|
+
Usage notes:
|
|
28
|
+
- If there's already a CLAUDE.md, suggest improvements to it.
|
|
29
|
+
- When you make the initial CLAUDE.md, do not repeat yourself and do not include obvious instructions like "Provide helpful error messages to users", "Write unit tests for all new utilities", "Never include sensitive information (API keys, tokens) in code or commits".
|
|
30
|
+
- Avoid listing every component or file structure that can be easily discovered.
|
|
31
|
+
- Don't include generic development practices.
|
|
32
|
+
- If there are Cursor rules (in .cursor/rules/ or .cursorrules) or Copilot rules (in .github/copilot-instructions.md), make sure to include the important parts.
|
|
33
|
+
- If there is a README.md, make sure to include the important parts.
|
|
34
|
+
- Do not make up information such as "Common Development Tasks", "Tips for Development", "Support and Documentation" unless this is expressly included in other files that you read.
|
|
35
|
+
- Be sure to prefix the file with the following text:
|
|
36
|
+
|
|
37
|
+
\\\`\\\`\\\`
|
|
38
|
+
# CLAUDE.md
|
|
39
|
+
|
|
40
|
+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
41
|
+
\\\`\\\`\\\``;
|
|
42
|
+
const REVIEW_BODY = `You are an expert code reviewer. Follow these steps:
|
|
43
|
+
|
|
44
|
+
1. If no PR number is provided in the args, run \\\`gh pr list\\\` to show open PRs
|
|
45
|
+
2. If a PR number is provided, run \\\`gh pr view <number>\\\` to get PR details
|
|
46
|
+
3. Run \\\`gh pr diff <number>\\\` to get the diff
|
|
47
|
+
4. Analyze the changes and provide a thorough code review that includes:
|
|
48
|
+
- Overview of what the PR does
|
|
49
|
+
- Analysis of code quality and style
|
|
50
|
+
- Specific suggestions for improvements
|
|
51
|
+
- Any potential issues or risks
|
|
52
|
+
|
|
53
|
+
Keep your review concise but thorough. Focus on:
|
|
54
|
+
- Code correctness
|
|
55
|
+
- Following project conventions
|
|
56
|
+
- Performance implications
|
|
57
|
+
- Test coverage
|
|
58
|
+
- Security considerations
|
|
59
|
+
|
|
60
|
+
Format your review with clear sections and bullet points.`;
|
|
61
|
+
const SIMPLIFY_BODY = `# Simplify: Code Review and Cleanup
|
|
62
|
+
|
|
63
|
+
Review all changed files for reuse, quality, and efficiency. Fix any issues found.
|
|
64
|
+
|
|
65
|
+
## Phase 1: Identify Changes
|
|
66
|
+
|
|
67
|
+
Run \\\`git diff\\\` (or \\\`git diff HEAD\\\` if there are staged changes) to see what changed. If there are no git changes, review the most recently modified files that the user mentioned or that you edited earlier in this conversation.
|
|
68
|
+
|
|
69
|
+
## Phase 2: Launch Three Review Agents in Parallel
|
|
70
|
+
|
|
71
|
+
Use the Task tool to launch all three agents concurrently in a single message. Pass each agent the full diff so it has the complete context.
|
|
72
|
+
|
|
73
|
+
### Agent 1: Code Reuse Review
|
|
74
|
+
|
|
75
|
+
For each change:
|
|
76
|
+
|
|
77
|
+
1. **Search for existing utilities and helpers** that could replace newly written code. Look for similar patterns elsewhere in the codebase — common locations are utility directories, shared modules, and files adjacent to the changed ones.
|
|
78
|
+
2. **Flag any new function that duplicates existing functionality.** Suggest the existing function to use instead.
|
|
79
|
+
3. **Flag any inline logic that could use an existing utility** — hand-rolled string manipulation, manual path handling, custom environment checks, ad-hoc type guards, and similar patterns are common candidates.
|
|
80
|
+
|
|
81
|
+
### Agent 2: Code Quality Review
|
|
82
|
+
|
|
83
|
+
Review the same changes for hacky patterns:
|
|
84
|
+
|
|
85
|
+
1. **Redundant state**: state that duplicates existing state, cached values that could be derived, observers/effects that could be direct calls
|
|
86
|
+
2. **Parameter sprawl**: adding new parameters to a function instead of generalizing or restructuring existing ones
|
|
87
|
+
3. **Copy-paste with slight variation**: near-duplicate code blocks that should be unified with a shared abstraction
|
|
88
|
+
4. **Leaky abstractions**: exposing internal details that should be encapsulated, or breaking existing abstraction boundaries
|
|
89
|
+
5. **Stringly-typed code**: using raw strings where constants, enums (string unions), or branded types already exist in the codebase
|
|
90
|
+
6. **Unnecessary JSX nesting**: wrapper Boxes/elements that add no layout value — check if inner component props (flexShrink, alignItems, etc.) already provide the needed behavior
|
|
91
|
+
7. **Unnecessary comments**: comments explaining WHAT the code does (well-named identifiers already do that), narrating the change, or referencing the task/caller — delete; keep only non-obvious WHY (hidden constraints, subtle invariants, workarounds)
|
|
92
|
+
|
|
93
|
+
### Agent 3: Efficiency Review
|
|
94
|
+
|
|
95
|
+
Review the same changes for efficiency:
|
|
96
|
+
|
|
97
|
+
1. **Unnecessary work**: redundant computations, repeated file reads, duplicate network/API calls, N+1 patterns
|
|
98
|
+
2. **Missed concurrency**: independent operations run sequentially when they could run in parallel
|
|
99
|
+
3. **Hot-path bloat**: new blocking work added to startup or per-request/per-render hot paths
|
|
100
|
+
4. **Recurring no-op updates**: state/store updates inside polling loops, intervals, or event handlers that fire unconditionally — add a change-detection guard so downstream consumers aren't notified when nothing changed. Also: if a wrapper function takes an updater/reducer callback, verify it honors same-reference returns (or whatever the "no change" signal is) — otherwise callers' early-return no-ops are silently defeated
|
|
101
|
+
5. **Unnecessary existence checks**: pre-checking file/resource existence before operating (TOCTOU anti-pattern) — operate directly and handle the error
|
|
102
|
+
6. **Memory**: unbounded data structures, missing cleanup, event listener leaks
|
|
103
|
+
7. **Overly broad operations**: reading entire files when only a portion is needed, loading all items when filtering for one
|
|
104
|
+
|
|
105
|
+
## Phase 3: Fix Issues
|
|
106
|
+
|
|
107
|
+
Wait for all three agents to complete. Aggregate their findings and fix each issue directly. If a finding is a false positive or not worth addressing, note it and move on — do not argue with the finding, just skip it.
|
|
108
|
+
|
|
109
|
+
When done, briefly summarize what was fixed (or confirm the code was already clean).`;
|
|
110
|
+
const SECURITY_REVIEW_BODY = `You are a senior security engineer conducting a focused security review of the changes on this branch.
|
|
111
|
+
|
|
112
|
+
Collect the diff context first:
|
|
113
|
+
|
|
114
|
+
- \\\`git status\\\`
|
|
115
|
+
- \\\`git diff --name-only origin/HEAD...\\\`
|
|
116
|
+
- \\\`git log --no-decorate origin/HEAD...\\\`
|
|
117
|
+
- \\\`git diff origin/HEAD...\\\`
|
|
118
|
+
|
|
119
|
+
Review the complete diff above. This contains all code changes in the PR.
|
|
120
|
+
|
|
121
|
+
OBJECTIVE:
|
|
122
|
+
Perform a security-focused code review to identify HIGH-CONFIDENCE security vulnerabilities that could have real exploitation potential. This is not a general code review - focus ONLY on security implications newly added by this PR. Do not comment on existing security concerns.
|
|
123
|
+
|
|
124
|
+
CRITICAL INSTRUCTIONS:
|
|
125
|
+
1. MINIMIZE FALSE POSITIVES: Only flag issues where you're >80% confident of actual exploitability
|
|
126
|
+
2. AVOID NOISE: Skip theoretical issues, style concerns, or low-impact findings
|
|
127
|
+
3. FOCUS ON IMPACT: Prioritize vulnerabilities that could lead to unauthorized access, data breaches, or system compromise
|
|
128
|
+
4. EXCLUSIONS: Do NOT report the following issue types:
|
|
129
|
+
- Denial of Service (DOS) vulnerabilities, even if they allow service disruption
|
|
130
|
+
- Secrets or sensitive data stored on disk (these are handled by other processes)
|
|
131
|
+
- Rate limiting or resource exhaustion issues
|
|
132
|
+
|
|
133
|
+
SECURITY CATEGORIES TO EXAMINE:
|
|
134
|
+
|
|
135
|
+
**Input Validation Vulnerabilities:**
|
|
136
|
+
- SQL injection via unsanitized user input
|
|
137
|
+
- Command injection in system calls or subprocesses
|
|
138
|
+
- XXE injection in XML parsing
|
|
139
|
+
- Template injection in templating engines
|
|
140
|
+
- NoSQL injection in database queries
|
|
141
|
+
- Path traversal in file operations
|
|
142
|
+
|
|
143
|
+
**Authentication & Authorization Issues:**
|
|
144
|
+
- Authentication bypass logic
|
|
145
|
+
- Privilege escalation paths
|
|
146
|
+
- Session management flaws
|
|
147
|
+
- JWT token vulnerabilities
|
|
148
|
+
- Authorization logic bypasses
|
|
149
|
+
|
|
150
|
+
**Crypto & Secrets Management:**
|
|
151
|
+
- Hardcoded API keys, passwords, or tokens
|
|
152
|
+
- Weak cryptographic algorithms or implementations
|
|
153
|
+
- Improper key storage or management
|
|
154
|
+
- Cryptographic randomness issues
|
|
155
|
+
- Certificate validation bypasses
|
|
156
|
+
|
|
157
|
+
**Injection & Code Execution:**
|
|
158
|
+
- Remote code execution via deserialization
|
|
159
|
+
- Pickle injection in Python
|
|
160
|
+
- YAML deserialization vulnerabilities
|
|
161
|
+
- Eval injection in dynamic code execution
|
|
162
|
+
- XSS vulnerabilities in web applications (reflected, stored, DOM-based)
|
|
163
|
+
|
|
164
|
+
**Data Exposure:**
|
|
165
|
+
- Sensitive data logging or storage
|
|
166
|
+
- PII handling violations
|
|
167
|
+
- API endpoint data leakage
|
|
168
|
+
- Debug information exposure
|
|
169
|
+
|
|
170
|
+
Additional notes:
|
|
171
|
+
- Even if something is only exploitable from the local network, it can still be a HIGH severity issue
|
|
172
|
+
|
|
173
|
+
ANALYSIS METHODOLOGY:
|
|
174
|
+
|
|
175
|
+
Phase 1 - Repository Context Research (Use file search tools):
|
|
176
|
+
- Identify existing security frameworks and libraries in use
|
|
177
|
+
- Look for established secure coding patterns in the codebase
|
|
178
|
+
- Examine existing sanitization and validation patterns
|
|
179
|
+
- Understand the project's security model and threat model
|
|
180
|
+
|
|
181
|
+
Phase 2 - Comparative Analysis:
|
|
182
|
+
- Compare new code changes against existing security patterns
|
|
183
|
+
- Identify deviations from established secure practices
|
|
184
|
+
- Look for inconsistent security implementations
|
|
185
|
+
- Flag code that introduces new attack surfaces
|
|
186
|
+
|
|
187
|
+
Phase 3 - Vulnerability Assessment:
|
|
188
|
+
- Examine each modified file for security implications
|
|
189
|
+
- Trace data flow from user inputs to sensitive operations
|
|
190
|
+
- Look for privilege boundaries being crossed unsafely
|
|
191
|
+
- Identify injection points and unsafe deserialization
|
|
192
|
+
|
|
193
|
+
REQUIRED OUTPUT FORMAT:
|
|
194
|
+
|
|
195
|
+
You MUST output your findings in markdown. The markdown output should contain the file, line number, severity, category (e.g. \\\`sql_injection\\\` or \\\`xss\\\`), description, exploit scenario, and fix recommendation.
|
|
196
|
+
|
|
197
|
+
For example:
|
|
198
|
+
|
|
199
|
+
# Vuln 1: XSS: \\\`foo.py:42\\\`
|
|
200
|
+
|
|
201
|
+
* Severity: High
|
|
202
|
+
* Description: User input from \\\`username\\\` parameter is directly interpolated into HTML without escaping, allowing reflected XSS attacks
|
|
203
|
+
* Exploit Scenario: Attacker crafts URL like /bar?q=<script>alert(document.cookie)</script> to execute JavaScript in victim's browser, enabling session hijacking or data theft
|
|
204
|
+
* Recommendation: Use Flask's escape() function or Jinja2 templates with auto-escaping enabled for all user inputs rendered in HTML
|
|
205
|
+
|
|
206
|
+
SEVERITY GUIDELINES:
|
|
207
|
+
- **HIGH**: Directly exploitable vulnerabilities leading to RCE, data breach, or authentication bypass
|
|
208
|
+
- **MEDIUM**: Vulnerabilities requiring specific conditions but with significant impact
|
|
209
|
+
- **LOW**: Defense-in-depth issues or lower-impact vulnerabilities
|
|
210
|
+
|
|
211
|
+
CONFIDENCE SCORING:
|
|
212
|
+
- 0.9-1.0: Certain exploit path identified, tested if possible
|
|
213
|
+
- 0.8-0.9: Clear vulnerability pattern with known exploitation methods
|
|
214
|
+
- 0.7-0.8: Suspicious pattern requiring specific conditions to exploit
|
|
215
|
+
- Below 0.7: Don't report (too speculative)
|
|
216
|
+
|
|
217
|
+
FINAL REMINDER:
|
|
218
|
+
Focus on HIGH and MEDIUM findings only. Better to miss some theoretical issues than flood the report with false positives. Each finding should be something a security engineer would confidently raise in a PR review.
|
|
219
|
+
|
|
220
|
+
FALSE POSITIVE FILTERING:
|
|
221
|
+
|
|
222
|
+
> You do not need to run commands to reproduce the vulnerability, just read the code to determine if it is a real vulnerability. Do not use the bash tool or write to any files.
|
|
223
|
+
>
|
|
224
|
+
> HARD EXCLUSIONS - Automatically exclude findings matching these patterns:
|
|
225
|
+
> 1. Denial of Service (DOS) vulnerabilities or resource exhaustion attacks.
|
|
226
|
+
> 2. Secrets or credentials stored on disk if they are otherwise secured.
|
|
227
|
+
> 3. Rate limiting concerns or service overload scenarios.
|
|
228
|
+
> 4. Memory consumption or CPU exhaustion issues.
|
|
229
|
+
> 5. Lack of input validation on non-security-critical fields without proven security impact.
|
|
230
|
+
> 6. Input sanitization concerns for GitHub Action workflows unless they are clearly triggerable via untrusted input.
|
|
231
|
+
> 7. A lack of hardening measures. Code is not expected to implement all security best practices, only flag concrete vulnerabilities.
|
|
232
|
+
> 8. Race conditions or timing attacks that are theoretical rather than practical issues. Only report a race condition if it is concretely problematic.
|
|
233
|
+
> 9. Vulnerabilities related to outdated third-party libraries. These are managed separately and should not be reported here.
|
|
234
|
+
> 10. Memory safety issues such as buffer overflows or use-after-free-vulnerabilities are impossible in rust. Do not report memory safety issues in rust or any other memory safe languages.
|
|
235
|
+
> 11. Files that are only unit tests or only used as part of running tests.
|
|
236
|
+
> 12. Log spoofing concerns. Outputting un-sanitized user input to logs is not a vulnerability.
|
|
237
|
+
> 13. SSRF vulnerabilities that only control the path. SSRF is only a concern if it can control the host or protocol.
|
|
238
|
+
> 14. Including user-controlled content in AI system prompts is not a vulnerability.
|
|
239
|
+
> 15. Regex injection. Injecting untrusted content into a regex is not a vulnerability.
|
|
240
|
+
> 16. Regex DOS concerns.
|
|
241
|
+
> 17. Insecure documentation. Do not report any findings in documentation files such as markdown files.
|
|
242
|
+
> 18. A lack of audit logs is not a vulnerability.
|
|
243
|
+
>
|
|
244
|
+
> PRECEDENTS -
|
|
245
|
+
> 1. Logging high value secrets in plaintext is a vulnerability. Logging URLs is assumed to be safe.
|
|
246
|
+
> 2. UUIDs can be assumed to be unguessable and do not need to be validated.
|
|
247
|
+
> 3. Environment variables and CLI flags are trusted values. Attackers are generally not able to modify them in a secure environment. Any attack that relies on controlling an environment variable is invalid.
|
|
248
|
+
> 4. Resource management issues such as memory or file descriptor leaks are not valid.
|
|
249
|
+
> 5. Subtle or low impact web vulnerabilities such as tabnabbing, XS-Leaks, prototype pollution, and open redirects should not be reported unless they are extremely high confidence.
|
|
250
|
+
> 6. React and Angular are generally secure against XSS. These frameworks do not need to sanitize or escape user input unless it is using dangerouslySetInnerHTML, bypassSecurityTrustHtml, or similar methods. Do not report XSS vulnerabilities in React or Angular components or tsx files unless they are using unsafe methods.
|
|
251
|
+
> 7. Most vulnerabilities in github action workflows are not exploitable in practice. Before validating a github action workflow vulnerability ensure it is concrete and has a very specific attack path.
|
|
252
|
+
> 8. A lack of permission checking or authentication in client-side JS/TS code is not a vulnerability. Client-side code is not trusted and does not need to implement these checks, they are handled on the server-side. The same applies to all flows that send untrusted data to the backend, the backend is responsible for validating and sanitizing all inputs.
|
|
253
|
+
> 9. Only include MEDIUM findings if they are obvious and concrete issues.
|
|
254
|
+
> 10. Most vulnerabilities in ipython notebooks (*.ipynb files) are not exploitable in practice. Before validating a notebook vulnerability ensure it is concrete and has a very specific attack path where untrusted input can trigger the vulnerability.
|
|
255
|
+
> 11. Logging non-PII data is not a vulnerability even if the data may be sensitive. Only report logging vulnerabilities if they expose sensitive information such as secrets, passwords, or personally identifiable information (PII).
|
|
256
|
+
> 12. Command injection vulnerabilities in shell scripts are generally not exploitable in practice since shell scripts generally do not run with untrusted user input. Only report command injection vulnerabilities in shell scripts if they are concrete and have a very specific attack path for untrusted input.
|
|
257
|
+
>
|
|
258
|
+
> SIGNAL QUALITY CRITERIA - For remaining findings, assess:
|
|
259
|
+
> 1. Is there a concrete, exploitable vulnerability with a clear attack path?
|
|
260
|
+
> 2. Does this represent a real security risk vs theoretical best practice?
|
|
261
|
+
> 3. Are there specific code locations and reproduction steps?
|
|
262
|
+
> 4. Would this finding be actionable for a security team?
|
|
263
|
+
>
|
|
264
|
+
> For each finding, assign a confidence score from 1-10:
|
|
265
|
+
> - 1-3: Low confidence, likely false positive or noise
|
|
266
|
+
> - 4-6: Medium confidence, needs investigation
|
|
267
|
+
> - 7-10: High confidence, likely true vulnerability
|
|
268
|
+
|
|
269
|
+
START ANALYSIS:
|
|
270
|
+
|
|
271
|
+
Begin your analysis now. Do this in 3 steps:
|
|
272
|
+
|
|
273
|
+
1. Use a sub-task to identify vulnerabilities. Use the repository exploration tools to understand the codebase context, then analyze the PR changes for security implications. In the prompt for this sub-task, include all of the above.
|
|
274
|
+
2. Then for each vulnerability identified by the above sub-task, create a new sub-task to filter out false-positives. Launch these sub-tasks as parallel sub-tasks. In the prompt for these sub-tasks, include everything in the "FALSE POSITIVE FILTERING" instructions.
|
|
275
|
+
3. Filter out any vulnerabilities where the sub-task reported a confidence less than 8.
|
|
276
|
+
|
|
277
|
+
Your final reply must contain the markdown report and nothing else.`;
|
|
278
|
+
export const BUNDLED_SKILLS = {
|
|
279
|
+
init: {
|
|
280
|
+
name: "init",
|
|
281
|
+
description: "Initialize a new CLAUDE.md file with codebase documentation so future Claude sessions know how to build, test, and navigate the repo.",
|
|
282
|
+
body: INIT_BODY,
|
|
283
|
+
},
|
|
284
|
+
review: {
|
|
285
|
+
name: "review",
|
|
286
|
+
description: "Review a pull request — inspect the diff, PR metadata, and provide a structured code review covering correctness, conventions, performance, tests, and security.",
|
|
287
|
+
body: REVIEW_BODY,
|
|
288
|
+
},
|
|
289
|
+
simplify: {
|
|
290
|
+
name: "simplify",
|
|
291
|
+
description: "Review changed code for reuse, quality, and efficiency, then fix any issues found. Launches three parallel sub-agents (Reuse, Quality, Efficiency) and aggregates their findings.",
|
|
292
|
+
body: SIMPLIFY_BODY,
|
|
293
|
+
},
|
|
294
|
+
"security-review": {
|
|
295
|
+
name: "security-review",
|
|
296
|
+
description: "Complete a security review of the pending changes on the current branch. High-confidence vulnerabilities only; filters false positives through a two-phase sub-agent pass.",
|
|
297
|
+
body: SECURITY_REVIEW_BODY,
|
|
298
|
+
},
|
|
299
|
+
};
|
|
300
|
+
/**
|
|
301
|
+
* Render a BundledSkill to the `.cursor/rules/<name>.mdc` on-disk format.
|
|
302
|
+
* `alwaysApply: false` — cursor-agent selects the rule based on the
|
|
303
|
+
* description when the user (or caller) invokes `/<skill-name>`.
|
|
304
|
+
*/
|
|
305
|
+
export function renderSkillAsMdc(skill) {
|
|
306
|
+
return `---
|
|
307
|
+
description: ${skill.description.replace(/\r?\n/g, " ").trim()}
|
|
308
|
+
alwaysApply: false
|
|
309
|
+
---
|
|
310
|
+
|
|
311
|
+
${skill.body.trim()}
|
|
312
|
+
`;
|
|
313
|
+
}
|
|
314
|
+
//# sourceMappingURL=bundled-skills.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundled-skills.js","sourceRoot":"","sources":["../../src/lib/bundled-skills.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAWH,MAAM,SAAS,GAAG;;;;;;;;;;;;;;;;;;;;aAoBL,CAAC;AAEd,MAAM,WAAW,GAAG;;;;;;;;;;;;;;;;;;0DAkBsC,CAAC;AAE3D,MAAM,aAAa,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qFAgD+D,CAAC;AAEtF,MAAM,oBAAoB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oEAuKuC,CAAC;AAErE,MAAM,CAAC,MAAM,cAAc,GAAiC;IAC1D,IAAI,EAAE;QACJ,IAAI,EAAE,MAAM;QACZ,WAAW,EACT,uIAAuI;QACzI,IAAI,EAAE,SAAS;KAChB;IACD,MAAM,EAAE;QACN,IAAI,EAAE,QAAQ;QACd,WAAW,EACT,kKAAkK;QACpK,IAAI,EAAE,WAAW;KAClB;IACD,QAAQ,EAAE;QACR,IAAI,EAAE,UAAU;QAChB,WAAW,EACT,mLAAmL;QACrL,IAAI,EAAE,aAAa;KACpB;IACD,iBAAiB,EAAE;QACjB,IAAI,EAAE,iBAAiB;QACvB,WAAW,EACT,4KAA4K;QAC9K,IAAI,EAAE,oBAAoB;KAC3B;CACF,CAAC;AAEF;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAmB;IAClD,OAAO;eACM,KAAK,CAAC,WAAW,CAAC,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE;;;;EAI5D,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE;CAClB,CAAC;AACF,CAAC"}
|
|
@@ -6,8 +6,19 @@ import type { AgentStreamEvent } from "./agent-stream-events.js";
|
|
|
6
6
|
* - `{ type: "assistant", message: { content: [{type:"text", text}, {type:"thinking", thinking}, {type:"tool_use", id, name, input}] } }`
|
|
7
7
|
* The `message.content` array is cumulative — each line contains the full message so far.
|
|
8
8
|
* We diff against what we've already emitted so consumers see clean deltas.
|
|
9
|
+
* - `{ type: "tool_call", subtype: "started"|"completed", call_id, tool_call: { <kind>ToolCall: { args, result? } } }`
|
|
10
|
+
* cursor-agent's native tool events. We translate them to Anthropic `tool_use`
|
|
11
|
+
* blocks so SDK consumers (claude-overnight progress UI, budget tracking,
|
|
12
|
+
* nudge-on-silence) see tool activity the same way as a direct Anthropic run.
|
|
9
13
|
* - `{ type: "result", subtype: "success" }` — terminates the stream.
|
|
10
14
|
*
|
|
11
15
|
* Unknown types are ignored (non-JSON lines too) so future cursor CLI updates don't crash.
|
|
12
16
|
*/
|
|
13
17
|
export declare function createStreamParser(onEvent: (event: AgentStreamEvent) => void, onDone: () => void): (line: string) => void;
|
|
18
|
+
/**
|
|
19
|
+
* Map cursor-agent's camelCase tool kind (e.g. `readToolCall`) to its
|
|
20
|
+
* Anthropic-standard name (`Read`). Unknown kinds fall back to stripping the
|
|
21
|
+
* `ToolCall` suffix and capitalising, which keeps future cursor tools
|
|
22
|
+
* surfacing with a reasonable name rather than being dropped on the floor.
|
|
23
|
+
*/
|
|
24
|
+
export declare function mapCursorToolName(rawKind: string): string;
|
|
@@ -5,6 +5,10 @@
|
|
|
5
5
|
* - `{ type: "assistant", message: { content: [{type:"text", text}, {type:"thinking", thinking}, {type:"tool_use", id, name, input}] } }`
|
|
6
6
|
* The `message.content` array is cumulative — each line contains the full message so far.
|
|
7
7
|
* We diff against what we've already emitted so consumers see clean deltas.
|
|
8
|
+
* - `{ type: "tool_call", subtype: "started"|"completed", call_id, tool_call: { <kind>ToolCall: { args, result? } } }`
|
|
9
|
+
* cursor-agent's native tool events. We translate them to Anthropic `tool_use`
|
|
10
|
+
* blocks so SDK consumers (claude-overnight progress UI, budget tracking,
|
|
11
|
+
* nudge-on-silence) see tool activity the same way as a direct Anthropic run.
|
|
8
12
|
* - `{ type: "result", subtype: "success" }` — terminates the stream.
|
|
9
13
|
*
|
|
10
14
|
* Unknown types are ignored (non-JSON lines too) so future cursor CLI updates don't crash.
|
|
@@ -14,6 +18,12 @@ export function createStreamParser(onEvent, onDone) {
|
|
|
14
18
|
let thinkingAcc = "";
|
|
15
19
|
const seenToolIds = new Set();
|
|
16
20
|
let done = false;
|
|
21
|
+
const emitToolUse = (id, name, input) => {
|
|
22
|
+
if (seenToolIds.has(id))
|
|
23
|
+
return;
|
|
24
|
+
seenToolIds.add(id);
|
|
25
|
+
onEvent({ kind: "tool_use", id, name, input });
|
|
26
|
+
};
|
|
17
27
|
return (line) => {
|
|
18
28
|
if (done)
|
|
19
29
|
return;
|
|
@@ -39,18 +49,24 @@ export function createStreamParser(onEvent, onDone) {
|
|
|
39
49
|
}
|
|
40
50
|
}
|
|
41
51
|
else if (part.type === "tool_use" && part.id && part.name) {
|
|
42
|
-
|
|
43
|
-
seenToolIds.add(part.id);
|
|
44
|
-
onEvent({
|
|
45
|
-
kind: "tool_use",
|
|
46
|
-
id: part.id,
|
|
47
|
-
name: part.name,
|
|
48
|
-
input: part.input ?? {},
|
|
49
|
-
});
|
|
50
|
-
}
|
|
52
|
+
emitToolUse(part.id, part.name, part.input ?? {});
|
|
51
53
|
}
|
|
52
54
|
}
|
|
53
55
|
}
|
|
56
|
+
if (obj.type === "tool_call" &&
|
|
57
|
+
obj.subtype === "started" &&
|
|
58
|
+
obj.call_id &&
|
|
59
|
+
obj.tool_call) {
|
|
60
|
+
const entry = Object.entries(obj.tool_call)[0];
|
|
61
|
+
if (entry) {
|
|
62
|
+
const [rawKind, body] = entry;
|
|
63
|
+
const name = mapCursorToolName(rawKind);
|
|
64
|
+
const input = body && typeof body === "object" && "args" in body
|
|
65
|
+
? (body.args ?? {})
|
|
66
|
+
: {};
|
|
67
|
+
emitToolUse(obj.call_id, name, input);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
54
70
|
if (obj.type === "result" && obj.subtype === "success") {
|
|
55
71
|
done = true;
|
|
56
72
|
onDone();
|
|
@@ -61,6 +77,38 @@ export function createStreamParser(onEvent, onDone) {
|
|
|
61
77
|
}
|
|
62
78
|
};
|
|
63
79
|
}
|
|
80
|
+
/**
|
|
81
|
+
* Map cursor-agent's camelCase tool kind (e.g. `readToolCall`) to its
|
|
82
|
+
* Anthropic-standard name (`Read`). Unknown kinds fall back to stripping the
|
|
83
|
+
* `ToolCall` suffix and capitalising, which keeps future cursor tools
|
|
84
|
+
* surfacing with a reasonable name rather than being dropped on the floor.
|
|
85
|
+
*/
|
|
86
|
+
export function mapCursorToolName(rawKind) {
|
|
87
|
+
const table = {
|
|
88
|
+
readToolCall: "Read",
|
|
89
|
+
editToolCall: "Edit",
|
|
90
|
+
writeToolCall: "Write",
|
|
91
|
+
multiEditToolCall: "MultiEdit",
|
|
92
|
+
globToolCall: "Glob",
|
|
93
|
+
grepToolCall: "Grep",
|
|
94
|
+
shellToolCall: "Bash",
|
|
95
|
+
runTerminalToolCall: "Bash",
|
|
96
|
+
terminalToolCall: "Bash",
|
|
97
|
+
taskToolCall: "Task",
|
|
98
|
+
webFetchToolCall: "WebFetch",
|
|
99
|
+
webSearchToolCall: "WebSearch",
|
|
100
|
+
readLintsToolCall: "ReadLints",
|
|
101
|
+
lsToolCall: "LS",
|
|
102
|
+
todoWriteToolCall: "TodoWrite",
|
|
103
|
+
notebookEditToolCall: "NotebookEdit",
|
|
104
|
+
};
|
|
105
|
+
if (rawKind in table)
|
|
106
|
+
return table[rawKind];
|
|
107
|
+
const stripped = rawKind.replace(/ToolCall$/, "");
|
|
108
|
+
if (!stripped)
|
|
109
|
+
return rawKind;
|
|
110
|
+
return stripped.charAt(0).toUpperCase() + stripped.slice(1);
|
|
111
|
+
}
|
|
64
112
|
/**
|
|
65
113
|
* If `full` extends `prev`, return the delta (possibly empty).
|
|
66
114
|
* If `full === prev`, return empty string (no-op).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-stream-parser.js","sourceRoot":"","sources":["../../src/lib/cli-stream-parser.ts"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"cli-stream-parser.js","sourceRoot":"","sources":["../../src/lib/cli-stream-parser.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,kBAAkB,CAChC,OAA0C,EAC1C,MAAkB;IAElB,IAAI,OAAO,GAAG,EAAE,CAAC;IACjB,IAAI,WAAW,GAAG,EAAE,CAAC;IACrB,MAAM,WAAW,GAAG,IAAI,GAAG,EAAU,CAAC;IACtC,IAAI,IAAI,GAAG,KAAK,CAAC;IAEjB,MAAM,WAAW,GAAG,CAAC,EAAU,EAAE,IAAY,EAAE,KAAc,EAAE,EAAE;QAC/D,IAAI,WAAW,CAAC,GAAG,CAAC,EAAE,CAAC;YAAE,OAAO;QAChC,WAAW,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACpB,OAAO,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,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,EAAE,WAAW;QAC9B,YAAY,EAAE,MAAM;QACpB,YAAY,EAAE,MAAM;QACpB,aAAa,EAAE,MAAM;QACrB,mBAAmB,EAAE,MAAM;QAC3B,gBAAgB,EAAE,MAAM;QACxB,YAAY,EAAE,MAAM;QACpB,gBAAgB,EAAE,UAAU;QAC5B,iBAAiB,EAAE,WAAW;QAC9B,iBAAiB,EAAE,WAAW;QAC9B,UAAU,EAAE,IAAI;QAChB,iBAAiB,EAAE,WAAW;QAC9B,oBAAoB,EAAE,cAAc;KACrC,CAAC;IACF,IAAI,OAAO,IAAI,KAAK;QAAE,OAAO,KAAK,CAAC,OAAO,CAAC,CAAC;IAC5C,MAAM,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;IAClD,IAAI,CAAC,QAAQ;QAAE,OAAO,OAAO,CAAC;IAC9B,OAAO,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAC9D,CAAC;AAED;;;;;;GAMG;AACH,SAAS,UAAU,CAAC,IAAY,EAAE,IAAY;IAC5C,IAAI,IAAI,KAAK,IAAI;QAAE,OAAO,EAAE,CAAC;IAC7B,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACnC,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC1D,IAAI,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM;QAAE,OAAO,IAAI,CAAC;IAC3C,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -10,6 +10,7 @@ import { logAgentError, logAccountAssigned, logAccountStats, logTrafficRequest,
|
|
|
10
10
|
import { resolveModel } from "../resolve-model.js";
|
|
11
11
|
import { resolveWorkspace } from "../workspace.js";
|
|
12
12
|
import { sanitizeMessages, sanitizeSystem } from "../sanitize.js";
|
|
13
|
+
import { extractAdvertisedSkillNames, materializeBundledSkills, } from "../skill-materializer.js";
|
|
13
14
|
import { getNextAccountConfigDir, reportRequestStart, reportRequestEnd, reportRateLimit, reportRequestSuccess, reportRequestError, getAccountStats, } from "../account-pool.js";
|
|
14
15
|
import { fitPromptToWinCmdline, warnPromptTruncated, } from "../win-cmdline-limit.js";
|
|
15
16
|
function analyzeStderr(stderr) {
|
|
@@ -91,6 +92,15 @@ export async function handleAnthropicMessages(req, res, ctx, rawBody, method, pa
|
|
|
91
92
|
});
|
|
92
93
|
return;
|
|
93
94
|
}
|
|
95
|
+
// Path D (PROXIED_FAST_MODEL_RESEARCH.md): cursor-agent can't invoke the
|
|
96
|
+
// SDK-provided Skill tool, so materialise bundled Anthropic skills as
|
|
97
|
+
// `.cursor/rules/<name>.mdc` in the workspace. cursor-agent auto-discovers
|
|
98
|
+
// them and applies them verbatim for `/<name>` invocations.
|
|
99
|
+
const advertised = extractAdvertisedSkillNames(body.tools);
|
|
100
|
+
const materialized = materializeBundledSkills(workspaceDir, advertised);
|
|
101
|
+
if (materialized.length > 0 && config.verbose) {
|
|
102
|
+
console.log(`[${new Date().toISOString()}] Materialised ${materialized.length} skill(s) as .cursor/rules: ${materialized.join(", ")}`);
|
|
103
|
+
}
|
|
94
104
|
const fixedArgs = buildAgentFixedArgs(config, workspaceDir, cursorModel, !!body.stream);
|
|
95
105
|
const fit = fitPromptToWinCmdline(config.agentBin, fixedArgs, prompt, {
|
|
96
106
|
maxCmdline: config.winCmdlineMax,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"anthropic-messages.js","sourceRoot":"","sources":["../../../src/lib/handlers/anthropic-messages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAIzC,OAAO,EAAE,gCAAgC,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,EAAE,mBAAmB,EA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R,GAAG,CAAC,MAAM,CACX,CAAC;QACF,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE;YACb,KAAK,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,kBAAkB,EAAE;SACxE,CAAC,CAAC;QACH,OAAO;IACT,CAAC;IAED,oBAAoB,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;IAC7C,MAAM,OAAO,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;IAClC,kBAAkB,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK,IAAI,WAAW,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;IACzE,eAAe,CAAC,MAAM,CAAC,OAAO,EAAE,eAAe,EAAE,CAAC,CAAC;IACnD,MAAM,KAAK,GAAG,cAAc,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC5C,MAAM,MAAM,GAAG,cAAc,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAC9C,IAAI,CACF,GAAG,EACH,GAAG,EACH;QACE,EAAE,EAAE,KAAK;QACT,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,WAAW;QACjB,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;QAC1C,KAAK,EAAE,YAAY,IAAI,WAAW;QAClC,WAAW,EAAE,UAAU;QACvB,KAAK,EAAE;YACL,YAAY,EAAE,KAAK;YACnB,aAAa,EAAE,MAAM;SACtB;KACF,EACD,gBAAgB,CACjB,CAAC;AACJ,CAAC"}
|
|
1
|
+
{"version":3,"file":"anthropic-messages.js","sourceRoot":"","sources":["../../../src/lib/handlers/anthropic-messages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAIzC,OAAO,EAAE,gCAAgC,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBA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AW;QACjB,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;QAC1C,KAAK,EAAE,YAAY,IAAI,WAAW;QAClC,WAAW,EAAE,UAAU;QACvB,KAAK,EAAE;YACL,YAAY,EAAE,KAAK;YACnB,aAAa,EAAE,MAAM;SACtB;KACF,EACD,gBAAgB,CACjB,CAAC;AACJ,CAAC"}
|
package/dist/lib/openai.d.ts
CHANGED
|
@@ -10,8 +10,9 @@ export type OpenAiChatCompletionRequest = {
|
|
|
10
10
|
export declare function normalizeModelId(raw: string | undefined): string | undefined;
|
|
11
11
|
/**
|
|
12
12
|
* Serialise tool/function schemas into a text block for the system prompt.
|
|
13
|
-
*
|
|
14
|
-
*
|
|
13
|
+
* Drops SDK-provided tools that cursor-agent can't honour (Skill/Task/etc.) —
|
|
14
|
+
* those either get translated elsewhere (Skill → `.cursor/rules/`) or are
|
|
15
|
+
* already served by cursor-agent's native tool loop.
|
|
15
16
|
*/
|
|
16
17
|
export declare function toolsToSystemText(tools?: any[], functions?: any[]): string | undefined;
|
|
17
18
|
export declare function buildPromptFromMessages(messages: any[]): string;
|
package/dist/lib/openai.js
CHANGED
|
@@ -46,22 +46,60 @@ function messageContentToText(content) {
|
|
|
46
46
|
}
|
|
47
47
|
return "";
|
|
48
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* Tools exposed by the Anthropic Agent SDK that cursor-agent cannot execute
|
|
51
|
+
* directly — they'd sit in the system prompt as confusing dead weight.
|
|
52
|
+
*
|
|
53
|
+
* - `Skill` is materialised as `.cursor/rules/*.mdc` (Path D from
|
|
54
|
+
* docs/PROXIED_FAST_MODEL_RESEARCH.md) so cursor-agent follows skill bodies
|
|
55
|
+
* natively rather than emitting a Skill tool_use the host would never see.
|
|
56
|
+
* - `Task` / `Agent` / `ExitPlanMode` / `EnterPlanMode` are handled by
|
|
57
|
+
* cursor-agent's own internal tool loop (`taskToolCall` etc.). Advertising
|
|
58
|
+
* the SDK schema to the model on top of that is pure noise.
|
|
59
|
+
* - `TaskCreate` / `TaskUpdate` / `TaskList` / `TodoWrite` are harness-level
|
|
60
|
+
* bookkeeping tools without a cursor equivalent.
|
|
61
|
+
*/
|
|
62
|
+
const NON_EXECUTABLE_SDK_TOOLS = new Set([
|
|
63
|
+
"Skill",
|
|
64
|
+
"Task",
|
|
65
|
+
"Agent",
|
|
66
|
+
"EnterPlanMode",
|
|
67
|
+
"ExitPlanMode",
|
|
68
|
+
"TaskCreate",
|
|
69
|
+
"TaskUpdate",
|
|
70
|
+
"TaskList",
|
|
71
|
+
"TaskGet",
|
|
72
|
+
"TaskOutput",
|
|
73
|
+
"TaskStop",
|
|
74
|
+
"TodoWrite",
|
|
75
|
+
"ScheduleWakeup",
|
|
76
|
+
]);
|
|
49
77
|
/**
|
|
50
78
|
* Serialise tool/function schemas into a text block for the system prompt.
|
|
51
|
-
*
|
|
52
|
-
*
|
|
79
|
+
* Drops SDK-provided tools that cursor-agent can't honour (Skill/Task/etc.) —
|
|
80
|
+
* those either get translated elsewhere (Skill → `.cursor/rules/`) or are
|
|
81
|
+
* already served by cursor-agent's native tool loop.
|
|
53
82
|
*/
|
|
54
83
|
export function toolsToSystemText(tools, functions) {
|
|
55
84
|
const defs = [];
|
|
56
85
|
if (tools && tools.length > 0) {
|
|
57
86
|
for (const t of tools) {
|
|
58
87
|
const fn = t?.type === "function" ? t.function : t;
|
|
59
|
-
if (fn)
|
|
60
|
-
|
|
88
|
+
if (!fn?.name)
|
|
89
|
+
continue;
|
|
90
|
+
if (NON_EXECUTABLE_SDK_TOOLS.has(fn.name))
|
|
91
|
+
continue;
|
|
92
|
+
defs.push(fn);
|
|
61
93
|
}
|
|
62
94
|
}
|
|
63
95
|
if (functions && functions.length > 0) {
|
|
64
|
-
|
|
96
|
+
for (const fn of functions) {
|
|
97
|
+
if (!fn?.name)
|
|
98
|
+
continue;
|
|
99
|
+
if (NON_EXECUTABLE_SDK_TOOLS.has(fn.name))
|
|
100
|
+
continue;
|
|
101
|
+
defs.push(fn);
|
|
102
|
+
}
|
|
65
103
|
}
|
|
66
104
|
if (defs.length === 0)
|
|
67
105
|
return undefined;
|
package/dist/lib/openai.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openai.js","sourceRoot":"","sources":["../../src/lib/openai.ts"],"names":[],"mappings":"AAUA,MAAM,UAAU,gBAAgB,CAAC,GAAuB;IACtD,IAAI,CAAC,GAAG;QAAE,OAAO,SAAS,CAAC;IAC3B,MAAM,OAAO,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC;IAC3B,IAAI,CAAC,OAAO;QAAE,OAAO,SAAS,CAAC;IAC/B,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACjC,OAAO,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,SAAS,CAAC;AAC9C,CAAC;AAED,SAAS,cAAc,CAAC,QAAa;IACnC,IAAI,CAAC,QAAQ;QAAE,OAAO,SAAS,CAAC;IAChC,MAAM,GAAG,GACP,OAAO,QAAQ,KAAK,QAAQ;QAC1B,CAAC,CAAC,QAAQ;QACV,CAAC,CAAC,OAAO,QAAQ,EAAE,GAAG,KAAK,QAAQ;YACjC,CAAC,CAAC,QAAQ,CAAC,GAAG;YACd,CAAC,CAAC,EAAE,CAAC;IACX,IAAI,CAAC,GAAG;QAAE,OAAO,SAAS,CAAC;IAC3B,IAAI,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;QAC5B,MAAM,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,OAAO,CAAC;QACvD,OAAO,kBAAkB,IAAI,GAAG,CAAC;IACnC,CAAC;IACD,OAAO,WAAW,GAAG,GAAG,CAAC;AAC3B,CAAC;AAED,SAAS,oBAAoB,CAAC,OAAY;IACxC,IAAI,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AI,KAAK,WAAW,EAAE,CAAC;YACzB,KAAK,CAAC,IAAI,CAAC,cAAc,IAAI,EAAE,CAAC,CAAC;YACjC,SAAS;QACX,CAAC;QACD,IAAI,IAAI,KAAK,MAAM,IAAI,IAAI,KAAK,UAAU,EAAE,CAAC;YAC3C,KAAK,CAAC,IAAI,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC;YAC5B,SAAS;QACX,CAAC;IACH,CAAC;IAED,MAAM,MAAM,GAAG,WAAW,CAAC,MAAM;QAC/B,CAAC,CAAC,YAAY,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM;QAC5C,CAAC,CAAC,EAAE,CAAC;IACP,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACtC,OAAO,MAAM,GAAG,UAAU,GAAG,gBAAgB,CAAC;AAChD,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extract the enum of skill names from an Anthropic Agent SDK tools array.
|
|
3
|
+
*
|
|
4
|
+
* The SDK registers a single tool named "Skill" with a schema like:
|
|
5
|
+
*
|
|
6
|
+
* { name: "Skill",
|
|
7
|
+
* input_schema: {
|
|
8
|
+
* type: "object",
|
|
9
|
+
* properties: {
|
|
10
|
+
* skill: { type: "string", enum: ["simplify", "review", ...] },
|
|
11
|
+
* args: { type: "string", description: "..." },
|
|
12
|
+
* }, required: ["skill"] } }
|
|
13
|
+
*
|
|
14
|
+
* Returns `undefined` if no Skill tool is present, the empty array if it's
|
|
15
|
+
* present without an enum (meaning: no skills advertised), or the list of
|
|
16
|
+
* advertised names otherwise.
|
|
17
|
+
*/
|
|
18
|
+
export declare function extractAdvertisedSkillNames(tools: unknown): string[] | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* Materialize the subset of bundled Anthropic skills that the SDK is
|
|
21
|
+
* advertising as `.cursor/rules/<name>.mdc` inside the resolved workspace, so
|
|
22
|
+
* cursor-agent discovers them and follows them for `/<name>` invocations.
|
|
23
|
+
*
|
|
24
|
+
* - If `advertised` is `undefined`, no Skill tool was present — fall back to
|
|
25
|
+
* materialising every bundled skill so calls like `/simplify` still work
|
|
26
|
+
* when consumers don't wire up the Skill tool explicitly.
|
|
27
|
+
* - If `advertised` is the empty array, the caller opted out of skills — write
|
|
28
|
+
* nothing.
|
|
29
|
+
*
|
|
30
|
+
* Existing `.mdc` files are not overwritten; callers managing their own rules
|
|
31
|
+
* take precedence.
|
|
32
|
+
*/
|
|
33
|
+
export declare function materializeBundledSkills(workspaceDir: string, advertised: string[] | undefined): string[];
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import * as fs from "node:fs";
|
|
2
|
+
import * as path from "node:path";
|
|
3
|
+
import { BUNDLED_SKILLS, renderSkillAsMdc } from "./bundled-skills.js";
|
|
4
|
+
/**
|
|
5
|
+
* Extract the enum of skill names from an Anthropic Agent SDK tools array.
|
|
6
|
+
*
|
|
7
|
+
* The SDK registers a single tool named "Skill" with a schema like:
|
|
8
|
+
*
|
|
9
|
+
* { name: "Skill",
|
|
10
|
+
* input_schema: {
|
|
11
|
+
* type: "object",
|
|
12
|
+
* properties: {
|
|
13
|
+
* skill: { type: "string", enum: ["simplify", "review", ...] },
|
|
14
|
+
* args: { type: "string", description: "..." },
|
|
15
|
+
* }, required: ["skill"] } }
|
|
16
|
+
*
|
|
17
|
+
* Returns `undefined` if no Skill tool is present, the empty array if it's
|
|
18
|
+
* present without an enum (meaning: no skills advertised), or the list of
|
|
19
|
+
* advertised names otherwise.
|
|
20
|
+
*/
|
|
21
|
+
export function extractAdvertisedSkillNames(tools) {
|
|
22
|
+
if (!Array.isArray(tools))
|
|
23
|
+
return undefined;
|
|
24
|
+
for (const t of tools) {
|
|
25
|
+
if (!t || typeof t !== "object")
|
|
26
|
+
continue;
|
|
27
|
+
const tt = t;
|
|
28
|
+
const name = tt.name ?? (tt.type === "function" && tt.function?.name);
|
|
29
|
+
if (name !== "Skill")
|
|
30
|
+
continue;
|
|
31
|
+
const schema = tt.input_schema ??
|
|
32
|
+
tt.parameters ??
|
|
33
|
+
tt.function?.parameters;
|
|
34
|
+
const skillProp = schema?.properties?.skill;
|
|
35
|
+
const enumVals = skillProp?.enum;
|
|
36
|
+
if (Array.isArray(enumVals)) {
|
|
37
|
+
return enumVals.filter((v) => typeof v === "string");
|
|
38
|
+
}
|
|
39
|
+
return [];
|
|
40
|
+
}
|
|
41
|
+
return undefined;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Materialize the subset of bundled Anthropic skills that the SDK is
|
|
45
|
+
* advertising as `.cursor/rules/<name>.mdc` inside the resolved workspace, so
|
|
46
|
+
* cursor-agent discovers them and follows them for `/<name>` invocations.
|
|
47
|
+
*
|
|
48
|
+
* - If `advertised` is `undefined`, no Skill tool was present — fall back to
|
|
49
|
+
* materialising every bundled skill so calls like `/simplify` still work
|
|
50
|
+
* when consumers don't wire up the Skill tool explicitly.
|
|
51
|
+
* - If `advertised` is the empty array, the caller opted out of skills — write
|
|
52
|
+
* nothing.
|
|
53
|
+
*
|
|
54
|
+
* Existing `.mdc` files are not overwritten; callers managing their own rules
|
|
55
|
+
* take precedence.
|
|
56
|
+
*/
|
|
57
|
+
export function materializeBundledSkills(workspaceDir, advertised) {
|
|
58
|
+
const names = advertised === undefined
|
|
59
|
+
? Object.keys(BUNDLED_SKILLS)
|
|
60
|
+
: advertised.filter((n) => n in BUNDLED_SKILLS);
|
|
61
|
+
if (names.length === 0)
|
|
62
|
+
return [];
|
|
63
|
+
const rulesDir = path.join(workspaceDir, ".cursor", "rules");
|
|
64
|
+
try {
|
|
65
|
+
fs.mkdirSync(rulesDir, { recursive: true });
|
|
66
|
+
}
|
|
67
|
+
catch {
|
|
68
|
+
return [];
|
|
69
|
+
}
|
|
70
|
+
const written = [];
|
|
71
|
+
for (const name of names) {
|
|
72
|
+
const skill = BUNDLED_SKILLS[name];
|
|
73
|
+
const dest = path.join(rulesDir, `${skill.name}.mdc`);
|
|
74
|
+
if (fs.existsSync(dest))
|
|
75
|
+
continue;
|
|
76
|
+
try {
|
|
77
|
+
fs.writeFileSync(dest, renderSkillAsMdc(skill), "utf8");
|
|
78
|
+
written.push(skill.name);
|
|
79
|
+
}
|
|
80
|
+
catch {
|
|
81
|
+
/* ignore — materialisation is best-effort */
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return written;
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=skill-materializer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skill-materializer.js","sourceRoot":"","sources":["../../src/lib/skill-materializer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAqB,MAAM,qBAAqB,CAAC;AAE1F;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,2BAA2B,CACzC,KAAc;IAEd,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC;IAC5C,KAAK,MAAM,CAAC,IAAI,KAAK,EAAE,CAAC;QACtB,IAAI,CAAC,CAAC,IAAI,OAAO,CAAC,KAAK,QAAQ;YAAE,SAAS;QAC1C,MAAM,EAAE,GAAG,CAA4B,CAAC;QACxC,MAAM,IAAI,GAAG,EAAE,CAAC,IAAI,IAAI,CAAC,EAAE,CAAC,IAAI,KAAK,UAAU,IAAK,EAAE,CAAC,QAAgB,EAAE,IAAI,CAAC,CAAC;QAC/E,IAAI,IAAI,KAAK,OAAO;YAAE,SAAS;QAC/B,MAAM,MAAM,GACT,EAAE,CAAC,YAAoB;YACvB,EAAE,CAAC,UAAkB;YACpB,EAAE,CAAC,QAAgB,EAAE,UAAkB,CAAC;QAC5C,MAAM,SAAS,GAAG,MAAM,EAAE,UAAU,EAAE,KAAK,CAAC;QAC5C,MAAM,QAAQ,GAAG,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