@ai-sdk/harness-cursor 0.0.0 → 1.0.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 +16 -0
- package/LICENSE +13 -0
- package/README.md +44 -2
- package/dist/index.d.ts +26113 -0
- package/dist/index.js +380 -0
- package/dist/index.js.map +1 -0
- package/package.json +66 -10
- package/src/cursor-harness.ts +441 -0
- package/src/index.ts +10 -0
- package/src/version.ts +5 -0
- package/index.js +0 -1
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# @ai-sdk/harness-cursor
|
|
2
|
+
|
|
3
|
+
## 1.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- ac1384b: feat(harness-cursor): implement Cursor harness adapter
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [79186d1]
|
|
12
|
+
- Updated dependencies [b6396ff]
|
|
13
|
+
- Updated dependencies [8a15038]
|
|
14
|
+
- @ai-sdk/harness-acp@1.0.25
|
|
15
|
+
- @ai-sdk/harness@1.0.87
|
|
16
|
+
- @ai-sdk/provider-utils@5.0.30
|
package/LICENSE
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Copyright 2023 Vercel, Inc.
|
|
2
|
+
|
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License.
|
|
5
|
+
You may obtain a copy of the License at
|
|
6
|
+
|
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
|
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
See the License for the specific language governing permissions and
|
|
13
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,3 +1,45 @@
|
|
|
1
|
-
#
|
|
1
|
+
# AI SDK - Cursor Harness
|
|
2
2
|
|
|
3
|
-
AI SDK harness
|
|
3
|
+
The **[@ai-sdk/harness-cursor](https://www.npmjs.com/package/@ai-sdk/harness-cursor)** package adapts [Cursor CLI](https://cursor.com/cli) to the AI SDK harness abstraction through the Agent Client Protocol (ACP).
|
|
4
|
+
|
|
5
|
+
## Setup
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @ai-sdk/harness @ai-sdk/harness-cursor @ai-sdk/sandbox-vercel
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Create a Cursor user API key and set `CURSOR_API_KEY`. The key authenticates Cursor CLI in the sandbox regardless of how Cursor is configured to authenticate to the model provider.
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import { HarnessAgent } from '@ai-sdk/harness/agent';
|
|
17
|
+
import { cursor } from '@ai-sdk/harness-cursor';
|
|
18
|
+
import { createVercelSandbox } from '@ai-sdk/sandbox-vercel';
|
|
19
|
+
|
|
20
|
+
const agent = new HarnessAgent({
|
|
21
|
+
harness: cursor,
|
|
22
|
+
sandbox: createVercelSandbox({
|
|
23
|
+
runtime: 'node24',
|
|
24
|
+
ports: [4000],
|
|
25
|
+
}),
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
const session = await agent.createSession();
|
|
29
|
+
|
|
30
|
+
try {
|
|
31
|
+
const result = await agent.generate({
|
|
32
|
+
session,
|
|
33
|
+
prompt: 'Inspect this project and summarize its purpose.',
|
|
34
|
+
});
|
|
35
|
+
console.log(result.text);
|
|
36
|
+
} finally {
|
|
37
|
+
await session.destroy();
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
The adapter installs Cursor CLI inside the sandbox with Cursor's official installer. The sandbox must provide network access and at least one exposed TCP port.
|
|
42
|
+
|
|
43
|
+
Cursor controls model-provider authentication in its own settings. For AI Gateway, configure Cursor's OpenAI API key with an AI Gateway key and set **Override OpenAI Base URL** to `https://ai-gateway.vercel.sh/cursor/v1`. The `auth` setting accepts the shared ACP modes `auto`, `direct`, and `ai-gateway`; explicit `direct` and `ai-gateway` values emit a configuration reminder, while `auto` does not. The setting cannot change Cursor's account configuration.
|
|
44
|
+
|
|
45
|
+
See the [Cursor harness documentation](https://ai-sdk.dev/providers/ai-sdk-harnesses/cursor) for settings, tools, and limitations.
|