@letta-ai/letta-code 0.34.30 → 0.34.32
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/cursor-worker.js +49 -16
- package/dist/mcp-client.js +2 -2
- package/dist/mcp-client.js.map +1 -1
- package/dist/mcp-oauth.js +2 -2
- package/dist/mcp-oauth.js.map +1 -1
- package/dist/types/agent/message.d.ts.map +1 -1
- package/dist/types/agent/subagents/subagent-process.d.ts +2 -0
- package/dist/types/agent/subagents/subagent-process.d.ts.map +1 -1
- package/dist/types/backend/dev/pi-request-headers.d.ts +3 -1
- package/dist/types/backend/dev/pi-request-headers.d.ts.map +1 -1
- package/dist/types/backend/dev/pi-stream-adapter.d.ts.map +1 -1
- package/dist/types/backend/local/compaction.d.ts.map +1 -1
- package/dist/types/cli/subcommands/mcp-io.d.ts.map +1 -1
- package/dist/types/tools/impl/codex-app-server.d.ts.map +1 -1
- package/dist/types/tools/impl/cursor-start-retry.d.ts +3 -0
- package/dist/types/tools/impl/cursor-start-retry.d.ts.map +1 -0
- package/dist/types/tools/impl/cursor-worker.d.ts.map +1 -1
- package/dist/types/utils/package-manager-spawn.d.ts +12 -0
- package/dist/types/utils/package-manager-spawn.d.ts.map +1 -1
- package/dist/types/utils/stdin.d.ts +3 -0
- package/dist/types/utils/stdin.d.ts.map +1 -0
- package/letta.js +929 -851
- package/npm-shrinkwrap.json +90 -90
- package/package.json +2 -2
package/cursor-worker.js
CHANGED
|
@@ -45,6 +45,27 @@ import {
|
|
|
45
45
|
Cursor,
|
|
46
46
|
JsonlLocalAgentStore
|
|
47
47
|
} from "@cursor/sdk";
|
|
48
|
+
|
|
49
|
+
// src/tools/impl/cursor-start-retry.ts
|
|
50
|
+
import { setTimeout } from "node:timers/promises";
|
|
51
|
+
function isCursorModelRejection(error) {
|
|
52
|
+
return error instanceof Error && /^AI Model Not Found\s+Model name is not valid:/.test(error.message);
|
|
53
|
+
}
|
|
54
|
+
async function retryCursorStart(start, canRetry, sleep = setTimeout) {
|
|
55
|
+
for (let attempt = 0;; attempt++) {
|
|
56
|
+
try {
|
|
57
|
+
return await start();
|
|
58
|
+
} catch (error) {
|
|
59
|
+
if (attempt >= 2 || !isCursorModelRejection(error) || !canRetry())
|
|
60
|
+
throw error;
|
|
61
|
+
await sleep(500 * (attempt + 1));
|
|
62
|
+
if (!canRetry())
|
|
63
|
+
throw error;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// src/tools/impl/cursor-worker.ts
|
|
48
69
|
function emit(event) {
|
|
49
70
|
process.stdout.write(`letta-cursor:${JSON.stringify(event)}
|
|
50
71
|
`);
|
|
@@ -94,25 +115,37 @@ async function start(command) {
|
|
|
94
115
|
const agent = __using(__stack, command.resume ? await Agent.resume(`agent-${command.sessionId}`, options) : await Agent.create({ ...options, agentId: `agent-${command.sessionId}` }), 1);
|
|
95
116
|
if (cancelled)
|
|
96
117
|
throw new Error("Cursor startup cancelled");
|
|
97
|
-
|
|
118
|
+
const seen = new Set;
|
|
119
|
+
let notified = false;
|
|
120
|
+
const result = await retryCursorStart(async () => {
|
|
121
|
+
run = await agent.send([config.reminder, command.prompt].filter(Boolean).join(`
|
|
98
122
|
|
|
99
123
|
`));
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
if (event.type === "tool_call" && !seen.has(event.call_id)) {
|
|
106
|
-
seen.add(event.call_id);
|
|
107
|
-
emit({
|
|
108
|
-
type: "tool",
|
|
109
|
-
id: event.call_id,
|
|
110
|
-
name: event.name,
|
|
111
|
-
args: event.args
|
|
112
|
-
});
|
|
124
|
+
if (cancelled)
|
|
125
|
+
await run.cancel();
|
|
126
|
+
if (!notified) {
|
|
127
|
+
emit({ type: "started", sessionId: command.sessionId });
|
|
128
|
+
notified = true;
|
|
113
129
|
}
|
|
114
|
-
|
|
115
|
-
|
|
130
|
+
for await (const event of run.stream()) {
|
|
131
|
+
if (event.type === "tool_call" && !seen.has(event.call_id)) {
|
|
132
|
+
seen.add(event.call_id);
|
|
133
|
+
emit({
|
|
134
|
+
type: "tool",
|
|
135
|
+
id: event.call_id,
|
|
136
|
+
name: event.name,
|
|
137
|
+
args: event.args
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
const result2 = await run.wait();
|
|
142
|
+
if (result2.status !== "finished" && result2.error) {
|
|
143
|
+
const error = new Error(result2.error.message);
|
|
144
|
+
if (isCursorModelRejection(error))
|
|
145
|
+
throw error;
|
|
146
|
+
}
|
|
147
|
+
return result2;
|
|
148
|
+
}, () => !cancelled && seen.size === 0 && steering.size === 0);
|
|
116
149
|
await Promise.all(steering);
|
|
117
150
|
emit({ type: "result", result });
|
|
118
151
|
} catch (_catch) {
|
package/dist/mcp-client.js
CHANGED
|
@@ -17025,7 +17025,7 @@ class StreamableHTTPClientTransport {
|
|
|
17025
17025
|
// src/mcp-client.ts
|
|
17026
17026
|
var DEFAULT_CLIENT_INFO = {
|
|
17027
17027
|
name: "letta-code",
|
|
17028
|
-
version: "0.34.
|
|
17028
|
+
version: "0.34.32"
|
|
17029
17029
|
};
|
|
17030
17030
|
async function connectMcpServer(config2, options = {}) {
|
|
17031
17031
|
let client = new Client(options.clientInfo ?? DEFAULT_CLIENT_INFO);
|
|
@@ -17192,4 +17192,4 @@ export {
|
|
|
17192
17192
|
connectMcpServer
|
|
17193
17193
|
};
|
|
17194
17194
|
|
|
17195
|
-
//# debugId=
|
|
17195
|
+
//# debugId=A4DBF39FE403B90F64756E2164756E21
|