@letta-ai/letta-code 0.16.7 → 0.16.8
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/letta.js +32 -17
- package/package.json +1 -1
package/letta.js
CHANGED
|
@@ -3122,7 +3122,7 @@ var package_default;
|
|
|
3122
3122
|
var init_package = __esm(() => {
|
|
3123
3123
|
package_default = {
|
|
3124
3124
|
name: "@letta-ai/letta-code",
|
|
3125
|
-
version: "0.16.
|
|
3125
|
+
version: "0.16.8",
|
|
3126
3126
|
description: "Letta Code is a CLI tool for interacting with stateful Letta agents from the terminal.",
|
|
3127
3127
|
type: "module",
|
|
3128
3128
|
bin: {
|
|
@@ -40018,20 +40018,20 @@ function areHooksDisabled(workingDirectory = process.cwd()) {
|
|
|
40018
40018
|
if (projectDisabled === true) {
|
|
40019
40019
|
return true;
|
|
40020
40020
|
}
|
|
40021
|
-
} catch
|
|
40022
|
-
debugLog("hooks", "areHooksDisabled: Project settings not loaded, skipping"
|
|
40021
|
+
} catch {
|
|
40022
|
+
debugLog("hooks", "areHooksDisabled: Project settings not loaded, skipping");
|
|
40023
40023
|
}
|
|
40024
40024
|
try {
|
|
40025
40025
|
const localDisabled = settingsManager.getLocalProjectSettings(workingDirectory)?.hooks?.disabled;
|
|
40026
40026
|
if (localDisabled === true) {
|
|
40027
40027
|
return true;
|
|
40028
40028
|
}
|
|
40029
|
-
} catch
|
|
40030
|
-
debugLog("hooks", "areHooksDisabled: Local project settings not loaded, skipping"
|
|
40029
|
+
} catch {
|
|
40030
|
+
debugLog("hooks", "areHooksDisabled: Local project settings not loaded, skipping");
|
|
40031
40031
|
}
|
|
40032
40032
|
return false;
|
|
40033
|
-
} catch
|
|
40034
|
-
debugLog("hooks", "areHooksDisabled: Failed to check hooks disabled status"
|
|
40033
|
+
} catch {
|
|
40034
|
+
debugLog("hooks", "areHooksDisabled: Failed to check hooks disabled status");
|
|
40035
40035
|
return false;
|
|
40036
40036
|
}
|
|
40037
40037
|
}
|
|
@@ -67113,8 +67113,9 @@ async function fetchConversationBackfillMessages2(client, conversationId) {
|
|
|
67113
67113
|
}
|
|
67114
67114
|
return sortChronological2(collected);
|
|
67115
67115
|
}
|
|
67116
|
-
async function getResumeData2(client, agent, conversationId) {
|
|
67116
|
+
async function getResumeData2(client, agent, conversationId, options = {}) {
|
|
67117
67117
|
try {
|
|
67118
|
+
const includeMessageHistory = options.includeMessageHistory ?? true;
|
|
67118
67119
|
let inContextMessageIds;
|
|
67119
67120
|
let messages = [];
|
|
67120
67121
|
const useConversationsApi = conversationId && conversationId !== "default";
|
|
@@ -67126,7 +67127,7 @@ async function getResumeData2(client, agent, conversationId) {
|
|
|
67126
67127
|
inContextMessageIds = conversation.in_context_message_ids;
|
|
67127
67128
|
if (!inContextMessageIds || inContextMessageIds.length === 0) {
|
|
67128
67129
|
debugWarn("check-approval", "No in-context messages - no pending approvals");
|
|
67129
|
-
if (isBackfillEnabled2()) {
|
|
67130
|
+
if (includeMessageHistory && isBackfillEnabled2()) {
|
|
67130
67131
|
try {
|
|
67131
67132
|
const backfill = await fetchConversationBackfillMessages2(client, conversationId);
|
|
67132
67133
|
return {
|
|
@@ -67151,7 +67152,7 @@ async function getResumeData2(client, agent, conversationId) {
|
|
|
67151
67152
|
throw new Error("Expected at least one in-context message");
|
|
67152
67153
|
}
|
|
67153
67154
|
const retrievedMessages = await client.messages.retrieve(lastInContextId);
|
|
67154
|
-
if (isBackfillEnabled2()) {
|
|
67155
|
+
if (includeMessageHistory && isBackfillEnabled2()) {
|
|
67155
67156
|
try {
|
|
67156
67157
|
messages = await fetchConversationBackfillMessages2(client, conversationId);
|
|
67157
67158
|
} catch (backfillError) {
|
|
@@ -67194,7 +67195,7 @@ async function getResumeData2(client, agent, conversationId) {
|
|
|
67194
67195
|
throw new Error("Expected at least one in-context message");
|
|
67195
67196
|
}
|
|
67196
67197
|
const retrievedMessages = await client.messages.retrieve(lastInContextId);
|
|
67197
|
-
if (isBackfillEnabled2()) {
|
|
67198
|
+
if (includeMessageHistory && isBackfillEnabled2()) {
|
|
67198
67199
|
try {
|
|
67199
67200
|
const messagesPage = await client.agents.messages.list(agent.id, {
|
|
67200
67201
|
limit: BACKFILL_PAGE_LIMIT2,
|
|
@@ -75383,6 +75384,19 @@ async function runBidirectionalMode(agent, conversationId, client, _outputFormat
|
|
|
75383
75384
|
console.log(JSON.stringify(registerResponse));
|
|
75384
75385
|
} else if (subtype === "bootstrap_session_state") {
|
|
75385
75386
|
const bootstrapReq = message.request;
|
|
75387
|
+
const { getResumeData: getResumeData3 } = await Promise.resolve().then(() => (init_check_approval(), exports_check_approval));
|
|
75388
|
+
let hasPendingApproval = false;
|
|
75389
|
+
try {
|
|
75390
|
+
const freshAgent = await client.agents.retrieve(agent.id);
|
|
75391
|
+
const resume = await getResumeData3(client, freshAgent, conversationId, {
|
|
75392
|
+
includeMessageHistory: false
|
|
75393
|
+
});
|
|
75394
|
+
hasPendingApproval = (resume.pendingApprovals?.length ?? 0) > 0;
|
|
75395
|
+
} catch (error) {
|
|
75396
|
+
if (!(error instanceof APIError2) || error.status !== 404 && error.status !== 422) {
|
|
75397
|
+
console.warn(`[bootstrap] pending-approval probe failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
75398
|
+
}
|
|
75399
|
+
}
|
|
75386
75400
|
const bootstrapResp = await handleBootstrapSessionState({
|
|
75387
75401
|
bootstrapReq,
|
|
75388
75402
|
sessionContext: {
|
|
@@ -75395,7 +75409,7 @@ async function runBidirectionalMode(agent, conversationId, client, _outputFormat
|
|
|
75395
75409
|
},
|
|
75396
75410
|
requestId: requestId ?? "",
|
|
75397
75411
|
client,
|
|
75398
|
-
hasPendingApproval
|
|
75412
|
+
hasPendingApproval
|
|
75399
75413
|
});
|
|
75400
75414
|
console.log(JSON.stringify(bootstrapResp));
|
|
75401
75415
|
} else if (subtype === "list_messages") {
|
|
@@ -113985,8 +113999,9 @@ async function fetchConversationBackfillMessages(client, conversationId) {
|
|
|
113985
113999
|
}
|
|
113986
114000
|
return sortChronological(collected);
|
|
113987
114001
|
}
|
|
113988
|
-
async function getResumeData(client, agent, conversationId) {
|
|
114002
|
+
async function getResumeData(client, agent, conversationId, options = {}) {
|
|
113989
114003
|
try {
|
|
114004
|
+
const includeMessageHistory = options.includeMessageHistory ?? true;
|
|
113990
114005
|
let inContextMessageIds;
|
|
113991
114006
|
let messages = [];
|
|
113992
114007
|
const useConversationsApi = conversationId && conversationId !== "default";
|
|
@@ -113998,7 +114013,7 @@ async function getResumeData(client, agent, conversationId) {
|
|
|
113998
114013
|
inContextMessageIds = conversation.in_context_message_ids;
|
|
113999
114014
|
if (!inContextMessageIds || inContextMessageIds.length === 0) {
|
|
114000
114015
|
debugWarn("check-approval", "No in-context messages - no pending approvals");
|
|
114001
|
-
if (isBackfillEnabled()) {
|
|
114016
|
+
if (includeMessageHistory && isBackfillEnabled()) {
|
|
114002
114017
|
try {
|
|
114003
114018
|
const backfill = await fetchConversationBackfillMessages(client, conversationId);
|
|
114004
114019
|
return {
|
|
@@ -114023,7 +114038,7 @@ async function getResumeData(client, agent, conversationId) {
|
|
|
114023
114038
|
throw new Error("Expected at least one in-context message");
|
|
114024
114039
|
}
|
|
114025
114040
|
const retrievedMessages = await client.messages.retrieve(lastInContextId);
|
|
114026
|
-
if (isBackfillEnabled()) {
|
|
114041
|
+
if (includeMessageHistory && isBackfillEnabled()) {
|
|
114027
114042
|
try {
|
|
114028
114043
|
messages = await fetchConversationBackfillMessages(client, conversationId);
|
|
114029
114044
|
} catch (backfillError) {
|
|
@@ -114066,7 +114081,7 @@ async function getResumeData(client, agent, conversationId) {
|
|
|
114066
114081
|
throw new Error("Expected at least one in-context message");
|
|
114067
114082
|
}
|
|
114068
114083
|
const retrievedMessages = await client.messages.retrieve(lastInContextId);
|
|
114069
|
-
if (isBackfillEnabled()) {
|
|
114084
|
+
if (includeMessageHistory && isBackfillEnabled()) {
|
|
114070
114085
|
try {
|
|
114071
114086
|
const messagesPage = await client.agents.messages.list(agent.id, {
|
|
114072
114087
|
limit: BACKFILL_PAGE_LIMIT,
|
|
@@ -119493,4 +119508,4 @@ Error during initialization: ${message}`);
|
|
|
119493
119508
|
}
|
|
119494
119509
|
main();
|
|
119495
119510
|
|
|
119496
|
-
//# debugId=
|
|
119511
|
+
//# debugId=2A5ECDC878B332C764756E2164756E21
|