@tickernelz/paperclip-pro-adapter-cursor-local 2026.925.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/LICENSE +22 -0
- package/dist/cli/format-event.d.ts +2 -0
- package/dist/cli/format-event.d.ts.map +1 -0
- package/dist/cli/format-event.js +296 -0
- package/dist/cli/format-event.js.map +1 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +2 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +102 -0
- package/dist/index.js.map +1 -0
- package/dist/server/execute.d.ts +15 -0
- package/dist/server/execute.d.ts.map +1 -0
- package/dist/server/execute.js +640 -0
- package/dist/server/execute.js.map +1 -0
- package/dist/server/execute.remote.test.d.ts +2 -0
- package/dist/server/execute.remote.test.d.ts.map +1 -0
- package/dist/server/execute.remote.test.js +284 -0
- package/dist/server/execute.remote.test.js.map +1 -0
- package/dist/server/execute.test.d.ts +2 -0
- package/dist/server/execute.test.d.ts.map +1 -0
- package/dist/server/execute.test.js +294 -0
- package/dist/server/execute.test.js.map +1 -0
- package/dist/server/index.d.ts +7 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/index.js +62 -0
- package/dist/server/index.js.map +1 -0
- package/dist/server/parse.d.ts +13 -0
- package/dist/server/parse.d.ts.map +1 -0
- package/dist/server/parse.js +139 -0
- package/dist/server/parse.js.map +1 -0
- package/dist/server/remote-command.d.ts +20 -0
- package/dist/server/remote-command.d.ts.map +1 -0
- package/dist/server/remote-command.js +172 -0
- package/dist/server/remote-command.js.map +1 -0
- package/dist/server/remote-command.test.d.ts +2 -0
- package/dist/server/remote-command.test.d.ts.map +1 -0
- package/dist/server/remote-command.test.js +123 -0
- package/dist/server/remote-command.test.js.map +1 -0
- package/dist/server/skills.d.ts +8 -0
- package/dist/server/skills.d.ts.map +1 -0
- package/dist/server/skills.js +69 -0
- package/dist/server/skills.js.map +1 -0
- package/dist/server/test.d.ts +10 -0
- package/dist/server/test.d.ts.map +1 -0
- package/dist/server/test.js +334 -0
- package/dist/server/test.js.map +1 -0
- package/dist/server/test.test.d.ts +2 -0
- package/dist/server/test.test.d.ts.map +1 -0
- package/dist/server/test.test.js +116 -0
- package/dist/server/test.test.js.map +1 -0
- package/dist/shared/stream.d.ts +5 -0
- package/dist/shared/stream.d.ts.map +1 -0
- package/dist/shared/stream.js +13 -0
- package/dist/shared/stream.js.map +1 -0
- package/dist/shared/trust.d.ts +2 -0
- package/dist/shared/trust.d.ts.map +1 -0
- package/dist/shared/trust.js +7 -0
- package/dist/shared/trust.js.map +1 -0
- package/dist/ui/build-config.d.ts +3 -0
- package/dist/ui/build-config.d.ts.map +1 -0
- package/dist/ui/build-config.js +36 -0
- package/dist/ui/build-config.js.map +1 -0
- package/dist/ui/index.d.ts +3 -0
- package/dist/ui/index.d.ts.map +1 -0
- package/dist/ui/index.js +3 -0
- package/dist/ui/index.js.map +1 -0
- package/dist/ui/parse-stdout.d.ts +3 -0
- package/dist/ui/parse-stdout.d.ts.map +1 -0
- package/dist/ui/parse-stdout.js +378 -0
- package/dist/ui/parse-stdout.js.map +1 -0
- package/package.json +58 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Paperclip AI
|
|
4
|
+
Copyright (c) 2026 Zhafron Adani Kautsar (paperclip-pro fork modifications)
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format-event.d.ts","sourceRoot":"","sources":["../../src/cli/format-event.ts"],"names":[],"mappings":"AAqMA,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,IAAI,CAuHzE"}
|
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
import pc from "picocolors";
|
|
2
|
+
import { normalizeCursorStreamLine } from "../shared/stream.js";
|
|
3
|
+
function asRecord(value) {
|
|
4
|
+
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
5
|
+
return null;
|
|
6
|
+
return value;
|
|
7
|
+
}
|
|
8
|
+
function asString(value, fallback = "") {
|
|
9
|
+
return typeof value === "string" ? value : fallback;
|
|
10
|
+
}
|
|
11
|
+
function asNumber(value, fallback = 0) {
|
|
12
|
+
return typeof value === "number" && Number.isFinite(value) ? value : fallback;
|
|
13
|
+
}
|
|
14
|
+
function stringifyUnknown(value) {
|
|
15
|
+
if (typeof value === "string")
|
|
16
|
+
return value;
|
|
17
|
+
if (value === null || value === undefined)
|
|
18
|
+
return "";
|
|
19
|
+
try {
|
|
20
|
+
return JSON.stringify(value, null, 2);
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
return String(value);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
function printUserMessage(messageRaw) {
|
|
27
|
+
if (typeof messageRaw === "string") {
|
|
28
|
+
const text = messageRaw.trim();
|
|
29
|
+
if (text)
|
|
30
|
+
console.log(pc.gray(`user: ${text}`));
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
const message = asRecord(messageRaw);
|
|
34
|
+
if (!message)
|
|
35
|
+
return;
|
|
36
|
+
const directText = asString(message.text).trim();
|
|
37
|
+
if (directText)
|
|
38
|
+
console.log(pc.gray(`user: ${directText}`));
|
|
39
|
+
const content = Array.isArray(message.content) ? message.content : [];
|
|
40
|
+
for (const partRaw of content) {
|
|
41
|
+
const part = asRecord(partRaw);
|
|
42
|
+
if (!part)
|
|
43
|
+
continue;
|
|
44
|
+
const type = asString(part.type).trim();
|
|
45
|
+
if (type !== "output_text" && type !== "text")
|
|
46
|
+
continue;
|
|
47
|
+
const text = asString(part.text).trim();
|
|
48
|
+
if (text)
|
|
49
|
+
console.log(pc.gray(`user: ${text}`));
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
function printAssistantMessage(messageRaw) {
|
|
53
|
+
if (typeof messageRaw === "string") {
|
|
54
|
+
const text = messageRaw.trim();
|
|
55
|
+
if (text)
|
|
56
|
+
console.log(pc.green(`assistant: ${text}`));
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
const message = asRecord(messageRaw);
|
|
60
|
+
if (!message)
|
|
61
|
+
return;
|
|
62
|
+
const directText = asString(message.text).trim();
|
|
63
|
+
if (directText)
|
|
64
|
+
console.log(pc.green(`assistant: ${directText}`));
|
|
65
|
+
const content = Array.isArray(message.content) ? message.content : [];
|
|
66
|
+
for (const partRaw of content) {
|
|
67
|
+
const part = asRecord(partRaw);
|
|
68
|
+
if (!part)
|
|
69
|
+
continue;
|
|
70
|
+
const type = asString(part.type).trim();
|
|
71
|
+
if (type === "output_text" || type === "text") {
|
|
72
|
+
const text = asString(part.text).trim();
|
|
73
|
+
if (text)
|
|
74
|
+
console.log(pc.green(`assistant: ${text}`));
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
77
|
+
if (type === "thinking") {
|
|
78
|
+
const text = asString(part.text).trim();
|
|
79
|
+
if (text)
|
|
80
|
+
console.log(pc.gray(`thinking: ${text}`));
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
if (type === "tool_call") {
|
|
84
|
+
const name = asString(part.name, asString(part.tool, "tool"));
|
|
85
|
+
console.log(pc.yellow(`tool_call: ${name}`));
|
|
86
|
+
const input = part.input ?? part.arguments ?? part.args;
|
|
87
|
+
if (input !== undefined) {
|
|
88
|
+
try {
|
|
89
|
+
console.log(pc.gray(JSON.stringify(input, null, 2)));
|
|
90
|
+
}
|
|
91
|
+
catch {
|
|
92
|
+
console.log(pc.gray(String(input)));
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
97
|
+
if (type === "tool_result") {
|
|
98
|
+
const isError = part.is_error === true || asString(part.status).toLowerCase() === "error";
|
|
99
|
+
const contentText = asString(part.output) ||
|
|
100
|
+
asString(part.text) ||
|
|
101
|
+
asString(part.result) ||
|
|
102
|
+
stringifyUnknown(part.output ?? part.result ?? part.text ?? part);
|
|
103
|
+
console.log((isError ? pc.red : pc.cyan)(`tool_result${isError ? " (error)" : ""}`));
|
|
104
|
+
if (contentText)
|
|
105
|
+
console.log((isError ? pc.red : pc.gray)(contentText));
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
function printToolCallEventTopLevel(parsed) {
|
|
110
|
+
const subtype = asString(parsed.subtype).trim().toLowerCase();
|
|
111
|
+
const callId = asString(parsed.call_id, asString(parsed.callId, asString(parsed.id, "")));
|
|
112
|
+
const toolCall = asRecord(parsed.tool_call ?? parsed.toolCall);
|
|
113
|
+
if (!toolCall) {
|
|
114
|
+
console.log(pc.yellow(`tool_call${subtype ? `: ${subtype}` : ""}`));
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
const [toolName] = Object.keys(toolCall);
|
|
118
|
+
if (!toolName) {
|
|
119
|
+
console.log(pc.yellow(`tool_call${subtype ? `: ${subtype}` : ""}`));
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
const payload = asRecord(toolCall[toolName]) ?? {};
|
|
123
|
+
const args = payload.args ?? asRecord(payload.function)?.arguments;
|
|
124
|
+
const result = payload.result ??
|
|
125
|
+
payload.output ??
|
|
126
|
+
payload.error ??
|
|
127
|
+
asRecord(payload.function)?.result ??
|
|
128
|
+
asRecord(payload.function)?.output;
|
|
129
|
+
const isError = parsed.is_error === true ||
|
|
130
|
+
payload.is_error === true ||
|
|
131
|
+
subtype === "failed" ||
|
|
132
|
+
subtype === "error" ||
|
|
133
|
+
subtype === "cancelled" ||
|
|
134
|
+
payload.error !== undefined;
|
|
135
|
+
if (subtype === "started" || subtype === "start") {
|
|
136
|
+
console.log(pc.yellow(`tool_call: ${toolName}${callId ? ` (${callId})` : ""}`));
|
|
137
|
+
if (args !== undefined) {
|
|
138
|
+
console.log(pc.gray(stringifyUnknown(args)));
|
|
139
|
+
}
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
if (subtype === "completed" || subtype === "complete" || subtype === "finished") {
|
|
143
|
+
const header = `tool_result${isError ? " (error)" : ""}${callId ? ` (${callId})` : ""}`;
|
|
144
|
+
console.log((isError ? pc.red : pc.cyan)(header));
|
|
145
|
+
if (result !== undefined) {
|
|
146
|
+
console.log((isError ? pc.red : pc.gray)(stringifyUnknown(result)));
|
|
147
|
+
}
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
console.log(pc.yellow(`tool_call: ${toolName}${subtype ? ` (${subtype})` : ""}`));
|
|
151
|
+
}
|
|
152
|
+
function printLegacyToolEvent(part) {
|
|
153
|
+
const tool = asString(part.tool, "tool");
|
|
154
|
+
const callId = asString(part.callID, asString(part.id, ""));
|
|
155
|
+
const state = asRecord(part.state);
|
|
156
|
+
const status = asString(state?.status);
|
|
157
|
+
const input = state?.input;
|
|
158
|
+
const output = asString(state?.output).replace(/\s+$/, "");
|
|
159
|
+
const metadata = asRecord(state?.metadata);
|
|
160
|
+
const exit = asNumber(metadata?.exit, NaN);
|
|
161
|
+
const isError = status === "failed" ||
|
|
162
|
+
status === "error" ||
|
|
163
|
+
status === "cancelled" ||
|
|
164
|
+
(Number.isFinite(exit) && exit !== 0);
|
|
165
|
+
console.log(pc.yellow(`tool_call: ${tool}${callId ? ` (${callId})` : ""}`));
|
|
166
|
+
if (input !== undefined) {
|
|
167
|
+
try {
|
|
168
|
+
console.log(pc.gray(JSON.stringify(input, null, 2)));
|
|
169
|
+
}
|
|
170
|
+
catch {
|
|
171
|
+
console.log(pc.gray(String(input)));
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
if (status || output) {
|
|
175
|
+
const summary = [
|
|
176
|
+
"tool_result",
|
|
177
|
+
status ? `status=${status}` : "",
|
|
178
|
+
Number.isFinite(exit) ? `exit=${exit}` : "",
|
|
179
|
+
]
|
|
180
|
+
.filter(Boolean)
|
|
181
|
+
.join(" ");
|
|
182
|
+
console.log((isError ? pc.red : pc.cyan)(summary));
|
|
183
|
+
if (output) {
|
|
184
|
+
console.log((isError ? pc.red : pc.gray)(output));
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
export function printCursorStreamEvent(raw, _debug) {
|
|
189
|
+
const line = normalizeCursorStreamLine(raw).line;
|
|
190
|
+
if (!line)
|
|
191
|
+
return;
|
|
192
|
+
let parsed = null;
|
|
193
|
+
try {
|
|
194
|
+
parsed = JSON.parse(line);
|
|
195
|
+
}
|
|
196
|
+
catch {
|
|
197
|
+
console.log(line);
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
const type = asString(parsed.type);
|
|
201
|
+
if (type === "system") {
|
|
202
|
+
const subtype = asString(parsed.subtype);
|
|
203
|
+
if (subtype === "init") {
|
|
204
|
+
const sessionId = asString(parsed.session_id) ||
|
|
205
|
+
asString(parsed.sessionId) ||
|
|
206
|
+
asString(parsed.sessionID);
|
|
207
|
+
const model = asString(parsed.model);
|
|
208
|
+
const details = [sessionId ? `session: ${sessionId}` : "", model ? `model: ${model}` : ""]
|
|
209
|
+
.filter(Boolean)
|
|
210
|
+
.join(", ");
|
|
211
|
+
console.log(pc.blue(`Cursor init${details ? ` (${details})` : ""}`));
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
console.log(pc.blue(`system: ${subtype || "event"}`));
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
if (type === "assistant") {
|
|
218
|
+
printAssistantMessage(parsed.message);
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
221
|
+
if (type === "user") {
|
|
222
|
+
printUserMessage(parsed.message);
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
if (type === "thinking") {
|
|
226
|
+
const text = asString(parsed.text).trim() || asString(asRecord(parsed.delta)?.text).trim();
|
|
227
|
+
if (text)
|
|
228
|
+
console.log(pc.gray(`thinking: ${text}`));
|
|
229
|
+
return;
|
|
230
|
+
}
|
|
231
|
+
if (type === "tool_call") {
|
|
232
|
+
printToolCallEventTopLevel(parsed);
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
235
|
+
if (type === "result") {
|
|
236
|
+
const usage = asRecord(parsed.usage);
|
|
237
|
+
const input = asNumber(usage?.input_tokens, asNumber(usage?.inputTokens));
|
|
238
|
+
const output = asNumber(usage?.output_tokens, asNumber(usage?.outputTokens));
|
|
239
|
+
const cached = asNumber(usage?.cached_input_tokens, asNumber(usage?.cachedInputTokens, asNumber(usage?.cache_read_input_tokens)));
|
|
240
|
+
const cost = asNumber(parsed.total_cost_usd, asNumber(parsed.cost_usd, asNumber(parsed.cost)));
|
|
241
|
+
const subtype = asString(parsed.subtype, "result");
|
|
242
|
+
const isError = parsed.is_error === true || subtype === "error" || subtype === "failed";
|
|
243
|
+
console.log(pc.blue(`result: subtype=${subtype}`));
|
|
244
|
+
console.log(pc.blue(`tokens: in=${input} out=${output} cached=${cached} cost=$${cost.toFixed(6)}`));
|
|
245
|
+
const resultText = asString(parsed.result).trim();
|
|
246
|
+
if (resultText)
|
|
247
|
+
console.log((isError ? pc.red : pc.green)(`assistant: ${resultText}`));
|
|
248
|
+
const errors = Array.isArray(parsed.errors) ? parsed.errors.map((value) => stringifyUnknown(value)).filter(Boolean) : [];
|
|
249
|
+
if (errors.length > 0)
|
|
250
|
+
console.log(pc.red(`errors: ${errors.join(" | ")}`));
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
253
|
+
if (type === "error") {
|
|
254
|
+
const message = asString(parsed.message) || stringifyUnknown(parsed.error ?? parsed.detail) || line;
|
|
255
|
+
console.log(pc.red(`error: ${message}`));
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
258
|
+
// Compatibility with older stream-json event shapes.
|
|
259
|
+
if (type === "step_start") {
|
|
260
|
+
const sessionId = asString(parsed.sessionID);
|
|
261
|
+
console.log(pc.blue(`step started${sessionId ? ` (session: ${sessionId})` : ""}`));
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
264
|
+
if (type === "text") {
|
|
265
|
+
const part = asRecord(parsed.part);
|
|
266
|
+
const text = asString(part?.text);
|
|
267
|
+
if (text)
|
|
268
|
+
console.log(pc.green(`assistant: ${text}`));
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
271
|
+
if (type === "tool_use") {
|
|
272
|
+
const part = asRecord(parsed.part);
|
|
273
|
+
if (part) {
|
|
274
|
+
printLegacyToolEvent(part);
|
|
275
|
+
}
|
|
276
|
+
else {
|
|
277
|
+
console.log(pc.yellow("tool_use"));
|
|
278
|
+
}
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
281
|
+
if (type === "step_finish") {
|
|
282
|
+
const part = asRecord(parsed.part);
|
|
283
|
+
const tokens = asRecord(part?.tokens);
|
|
284
|
+
const cache = asRecord(tokens?.cache);
|
|
285
|
+
const reason = asString(part?.reason, "step_finish");
|
|
286
|
+
const input = asNumber(tokens?.input);
|
|
287
|
+
const output = asNumber(tokens?.output);
|
|
288
|
+
const cached = asNumber(cache?.read);
|
|
289
|
+
const cost = asNumber(part?.cost);
|
|
290
|
+
console.log(pc.blue(`step finished: reason=${reason}`));
|
|
291
|
+
console.log(pc.blue(`tokens: in=${input} out=${output} cached=${cached} cost=$${cost.toFixed(6)}`));
|
|
292
|
+
return;
|
|
293
|
+
}
|
|
294
|
+
console.log(line);
|
|
295
|
+
}
|
|
296
|
+
//# sourceMappingURL=format-event.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format-event.js","sourceRoot":"","sources":["../../src/cli/format-event.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAEhE,SAAS,QAAQ,CAAC,KAAc;IAC9B,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACrF,OAAO,KAAgC,CAAC;AAC1C,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc,EAAE,QAAQ,GAAG,EAAE;IAC7C,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC;AACtD,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc,EAAE,QAAQ,GAAG,CAAC;IAC5C,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC;AAChF,CAAC;AAED,SAAS,gBAAgB,CAAC,KAAc;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C,CAAC;QACtC,MAAM,MAAM,GAAG,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACxC,MAAM,MAAM,GAAG,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;QACrC,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAClC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,yBAAyB,MAAM,EAAE,CAAC,CAAC,CAAC;QACxD,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,cAAc,KAAK,QAAQ,MAAM,WAAW,MAAM,UAAU,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QACpG,OAAO;IACT,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AACpB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const type = "cursor";
|
|
2
|
+
export declare const label = "Cursor";
|
|
3
|
+
export declare const SANDBOX_INSTALL_COMMAND = "curl https://cursor.com/install -fsS | bash";
|
|
4
|
+
export declare const DEFAULT_CURSOR_LOCAL_MODEL = "auto";
|
|
5
|
+
export declare const models: {
|
|
6
|
+
id: string;
|
|
7
|
+
label: string;
|
|
8
|
+
}[];
|
|
9
|
+
export declare const agentConfigurationDoc = "# cursor agent configuration\n\nAdapter: cursor\n\nUse when:\n- You want Paperclip to run Cursor Agent CLI locally as the agent runtime\n- You want Cursor chat session resume across heartbeats via --resume\n- You want structured stream output in run logs via --output-format stream-json\n\nDon't use when:\n- You need webhook-style external invocation (use openclaw_gateway or http)\n- You only need one-shot shell commands (use process)\n- Cursor Agent CLI is not installed on the machine\n\nCore fields:\n- cwd (string, optional): default absolute working directory fallback for the agent process (created if missing when possible)\n- instructionsFilePath (string, optional): absolute path to a markdown instructions file prepended to the run prompt\n- promptTemplate (string, optional): run prompt template\n- model (string, optional): Cursor model id (for example auto or gpt-5.3-codex)\n- mode (string, optional): Cursor execution mode passed as --mode (plan|ask). Leave unset for normal autonomous runs.\n- command (string, optional): defaults to \"agent\"\n- extraArgs (string[], optional): additional CLI args\n- env (object, optional): KEY=VALUE environment variables\n\nOperational fields:\n- timeoutSec (number, optional): run timeout in seconds\n- graceSec (number, optional): SIGTERM grace period in seconds\n\nNotes:\n- Runs are executed with: agent -p --output-format stream-json ...\n- Prompts are piped to Cursor via stdin.\n- Sessions are resumed with --resume when stored session cwd matches current cwd.\n- Paperclip auto-injects local skills into \"~/.cursor/skills\" when missing, so Cursor can discover \"$paperclip\" and related skills on local runs.\n- Paperclip auto-adds --yolo unless one of --trust/--yolo/-f is already present in extraArgs.\n- Remote sandbox runs prepend \"~/.cursor/bin\" and \"~/.local/bin\" to PATH and prefer the installed absolute entrypoint from one of those directories when the default Cursor command is requested, so installer-managed sandbox leases do not need hardcoded command paths.\n";
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,IAAI,WAAW,CAAC;AAC7B,eAAO,MAAM,KAAK,WAAW,CAAC;AAS9B,eAAO,MAAM,uBAAuB,gDAAgD,CAAC;AAErF,eAAO,MAAM,0BAA0B,SAAS,CAAC;AAwDjD,eAAO,MAAM,MAAM;;;GAA6D,CAAC;AAEjF,eAAO,MAAM,qBAAqB,ggEAmCjC,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
export const type = "cursor";
|
|
2
|
+
export const label = "Cursor";
|
|
3
|
+
// Cursor CLI is not distributed as an npm package — the official install
|
|
4
|
+
// path is the upstream installer script at cursor.com/install. Other adapters
|
|
5
|
+
// in this repo prefer `npm install -g <pkg>` which is content-addressed by the
|
|
6
|
+
// registry; cursor must use `curl | bash` until upstream publishes a registry
|
|
7
|
+
// artifact. Pinning a commit/version here would require shipping our own
|
|
8
|
+
// mirror of the installer; revisit if Cursor adds an npm/release-asset
|
|
9
|
+
// equivalent.
|
|
10
|
+
export const SANDBOX_INSTALL_COMMAND = "curl https://cursor.com/install -fsS | bash";
|
|
11
|
+
export const DEFAULT_CURSOR_LOCAL_MODEL = "auto";
|
|
12
|
+
const CURSOR_FALLBACK_MODEL_IDS = [
|
|
13
|
+
"auto",
|
|
14
|
+
"composer-2.5",
|
|
15
|
+
"claude-opus-5-5",
|
|
16
|
+
"claude-fable-5-1",
|
|
17
|
+
"claude-sonnet-5",
|
|
18
|
+
"gpt-5.6-sol",
|
|
19
|
+
"gpt-5.6-terra",
|
|
20
|
+
"gpt-5.6-luna",
|
|
21
|
+
"gemini-3.8-flash",
|
|
22
|
+
"muse-spark-1.3",
|
|
23
|
+
"grok-4.7",
|
|
24
|
+
"grok-4.6",
|
|
25
|
+
"grok-4.5",
|
|
26
|
+
"composer-1.5",
|
|
27
|
+
"composer-1",
|
|
28
|
+
"gpt-5.3-codex-low",
|
|
29
|
+
"gpt-5.3-codex-low-fast",
|
|
30
|
+
"gpt-5.3-codex",
|
|
31
|
+
"gpt-5.3-codex-fast",
|
|
32
|
+
"gpt-5.3-codex-high",
|
|
33
|
+
"gpt-5.3-codex-high-fast",
|
|
34
|
+
"gpt-5.3-codex-xhigh",
|
|
35
|
+
"gpt-5.3-codex-xhigh-fast",
|
|
36
|
+
"gpt-5.3-codex-spark-preview",
|
|
37
|
+
"gpt-5.2",
|
|
38
|
+
"gpt-5.2-codex-low",
|
|
39
|
+
"gpt-5.2-codex-low-fast",
|
|
40
|
+
"gpt-5.2-codex",
|
|
41
|
+
"gpt-5.2-codex-fast",
|
|
42
|
+
"gpt-5.2-codex-high",
|
|
43
|
+
"gpt-5.2-codex-high-fast",
|
|
44
|
+
"gpt-5.2-codex-xhigh",
|
|
45
|
+
"gpt-5.2-codex-xhigh-fast",
|
|
46
|
+
"gpt-5.1-codex-max",
|
|
47
|
+
"gpt-5.1-codex-max-high",
|
|
48
|
+
"gpt-5.2-high",
|
|
49
|
+
"gpt-5.1-high",
|
|
50
|
+
"gpt-5.1-codex-mini",
|
|
51
|
+
"opus-4.6-thinking",
|
|
52
|
+
"opus-4.6",
|
|
53
|
+
"opus-4.5",
|
|
54
|
+
"opus-4.5-thinking",
|
|
55
|
+
"sonnet-4.6",
|
|
56
|
+
"sonnet-4.6-thinking",
|
|
57
|
+
"sonnet-4.5",
|
|
58
|
+
"sonnet-4.5-thinking",
|
|
59
|
+
"gemini-3.1-pro",
|
|
60
|
+
"gemini-3-pro",
|
|
61
|
+
"gemini-3-flash",
|
|
62
|
+
"grok",
|
|
63
|
+
"kimi-k2.5",
|
|
64
|
+
];
|
|
65
|
+
export const models = CURSOR_FALLBACK_MODEL_IDS.map((id) => ({ id, label: id }));
|
|
66
|
+
export const agentConfigurationDoc = `# cursor agent configuration
|
|
67
|
+
|
|
68
|
+
Adapter: cursor
|
|
69
|
+
|
|
70
|
+
Use when:
|
|
71
|
+
- You want Paperclip to run Cursor Agent CLI locally as the agent runtime
|
|
72
|
+
- You want Cursor chat session resume across heartbeats via --resume
|
|
73
|
+
- You want structured stream output in run logs via --output-format stream-json
|
|
74
|
+
|
|
75
|
+
Don't use when:
|
|
76
|
+
- You need webhook-style external invocation (use openclaw_gateway or http)
|
|
77
|
+
- You only need one-shot shell commands (use process)
|
|
78
|
+
- Cursor Agent CLI is not installed on the machine
|
|
79
|
+
|
|
80
|
+
Core fields:
|
|
81
|
+
- cwd (string, optional): default absolute working directory fallback for the agent process (created if missing when possible)
|
|
82
|
+
- instructionsFilePath (string, optional): absolute path to a markdown instructions file prepended to the run prompt
|
|
83
|
+
- promptTemplate (string, optional): run prompt template
|
|
84
|
+
- model (string, optional): Cursor model id (for example auto or gpt-5.3-codex)
|
|
85
|
+
- mode (string, optional): Cursor execution mode passed as --mode (plan|ask). Leave unset for normal autonomous runs.
|
|
86
|
+
- command (string, optional): defaults to "agent"
|
|
87
|
+
- extraArgs (string[], optional): additional CLI args
|
|
88
|
+
- env (object, optional): KEY=VALUE environment variables
|
|
89
|
+
|
|
90
|
+
Operational fields:
|
|
91
|
+
- timeoutSec (number, optional): run timeout in seconds
|
|
92
|
+
- graceSec (number, optional): SIGTERM grace period in seconds
|
|
93
|
+
|
|
94
|
+
Notes:
|
|
95
|
+
- Runs are executed with: agent -p --output-format stream-json ...
|
|
96
|
+
- Prompts are piped to Cursor via stdin.
|
|
97
|
+
- Sessions are resumed with --resume when stored session cwd matches current cwd.
|
|
98
|
+
- Paperclip auto-injects local skills into "~/.cursor/skills" when missing, so Cursor can discover "$paperclip" and related skills on local runs.
|
|
99
|
+
- Paperclip auto-adds --yolo unless one of --trust/--yolo/-f is already present in extraArgs.
|
|
100
|
+
- Remote sandbox runs prepend "~/.cursor/bin" and "~/.local/bin" to PATH and prefer the installed absolute entrypoint from one of those directories when the default Cursor command is requested, so installer-managed sandbox leases do not need hardcoded command paths.
|
|
101
|
+
`;
|
|
102
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,IAAI,GAAG,QAAQ,CAAC;AAC7B,MAAM,CAAC,MAAM,KAAK,GAAG,QAAQ,CAAC;AAE9B,yEAAyE;AACzE,8EAA8E;AAC9E,+EAA+E;AAC/E,8EAA8E;AAC9E,yEAAyE;AACzE,uEAAuE;AACvE,cAAc;AACd,MAAM,CAAC,MAAM,uBAAuB,GAAG,6CAA6C,CAAC;AAErF,MAAM,CAAC,MAAM,0BAA0B,GAAG,MAAM,CAAC;AAEjD,MAAM,yBAAyB,GAAG;IAChC,MAAM;IACN,cAAc;IACd,iBAAiB;IACjB,kBAAkB;IAClB,iBAAiB;IACjB,aAAa;IACb,eAAe;IACf,cAAc;IACd,kBAAkB;IAClB,gBAAgB;IAChB,UAAU;IACV,UAAU;IACV,UAAU;IACV,cAAc;IACd,YAAY;IACZ,mBAAmB;IACnB,wBAAwB;IACxB,eAAe;IACf,oBAAoB;IACpB,oBAAoB;IACpB,yBAAyB;IACzB,qBAAqB;IACrB,0BAA0B;IAC1B,6BAA6B;IAC7B,SAAS;IACT,mBAAmB;IACnB,wBAAwB;IACxB,eAAe;IACf,oBAAoB;IACpB,oBAAoB;IACpB,yBAAyB;IACzB,qBAAqB;IACrB,0BAA0B;IAC1B,mBAAmB;IACnB,wBAAwB;IACxB,cAAc;IACd,cAAc;IACd,oBAAoB;IACpB,mBAAmB;IACnB,UAAU;IACV,UAAU;IACV,mBAAmB;IACnB,YAAY;IACZ,qBAAqB;IACrB,YAAY;IACZ,qBAAqB;IACrB,gBAAgB;IAChB,cAAc;IACd,gBAAgB;IAChB,MAAM;IACN,WAAW;CACZ,CAAC;AAEF,MAAM,CAAC,MAAM,MAAM,GAAG,yBAAyB,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;AAEjF,MAAM,CAAC,MAAM,qBAAqB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmCpC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type AdapterExecutionContext, type AdapterExecutionResult } from "@tickernelz/paperclip-pro-adapter-utils";
|
|
2
|
+
type EnsureCursorSkillsInjectedOptions = {
|
|
3
|
+
skillsDir?: string | null;
|
|
4
|
+
skillsEntries?: Array<{
|
|
5
|
+
key: string;
|
|
6
|
+
runtimeName: string;
|
|
7
|
+
source: string;
|
|
8
|
+
}>;
|
|
9
|
+
skillsHome?: string;
|
|
10
|
+
linkSkill?: (source: string, target: string) => Promise<void>;
|
|
11
|
+
};
|
|
12
|
+
export declare function ensureCursorSkillsInjected(onLog: AdapterExecutionContext["onLog"], options?: EnsureCursorSkillsInjectedOptions): Promise<void>;
|
|
13
|
+
export declare function execute(ctx: AdapterExecutionContext): Promise<AdapterExecutionResult>;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=execute.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../src/server/execute.ts"],"names":[],"mappings":"AAIA,OAAO,EAA+B,KAAK,uBAAuB,EAAE,KAAK,sBAAsB,EAAE,MAAM,yCAAyC,CAAC;AAqIjJ,KAAK,iCAAiC,GAAG;IACvC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,aAAa,CAAC,EAAE,KAAK,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC5E,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC/D,CAAC;AAEF,wBAAsB,0BAA0B,CAC9C,KAAK,EAAE,uBAAuB,CAAC,OAAO,CAAC,EACvC,OAAO,GAAE,iCAAsC,iBAoDhD;AAED,wBAAsB,OAAO,CAAC,GAAG,EAAE,uBAAuB,GAAG,OAAO,CAAC,sBAAsB,CAAC,CA+kB3F"}
|