@letta-ai/letta-code 0.25.3 → 0.25.4

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.
Files changed (2) hide show
  1. package/letta.js +33 -8
  2. package/package.json +1 -1
package/letta.js CHANGED
@@ -3143,7 +3143,7 @@ var package_default;
3143
3143
  var init_package = __esm(() => {
3144
3144
  package_default = {
3145
3145
  name: "@letta-ai/letta-code",
3146
- version: "0.25.3",
3146
+ version: "0.25.4",
3147
3147
  description: "Letta Code is a CLI tool for interacting with stateful Letta agents from the terminal.",
3148
3148
  type: "module",
3149
3149
  bin: {
@@ -64368,6 +64368,8 @@ function createChatGPTFetch(options) {
64368
64368
  const auth = await getFreshAuth(options.storageDir);
64369
64369
  next.headers.delete("authorization");
64370
64370
  next.headers.set("authorization", `Bearer ${auth.access}`);
64371
+ next.headers.set("OpenAI-Beta", "responses=v1");
64372
+ next.headers.set("OpenAI-Originator", "codex");
64371
64373
  if (auth.accountId) {
64372
64374
  next.headers.set("ChatGPT-Account-Id", auth.accountId);
64373
64375
  }
@@ -69891,6 +69893,9 @@ function anthropicThinking(value, modelHandle) {
69891
69893
  function aiSDKProviderKind(modelHandle, modelSettings) {
69892
69894
  return aiSDKProviderKindFromModel(modelHandle, modelSettings);
69893
69895
  }
69896
+ function isChatGPTOAuthModel(modelHandle, modelSettings) {
69897
+ return modelHandle.startsWith("chatgpt-plus-pro/") || stringValue(modelSettings.provider_type) === "chatgpt_oauth";
69898
+ }
69894
69899
  function partProviderMetadata(part) {
69895
69900
  if (!isRecord2(part))
69896
69901
  return;
@@ -69924,14 +69929,20 @@ function sanitizeUIMessagesForProvider(messages, provider) {
69924
69929
  return parts.length === message.parts.length ? message : { ...message, parts };
69925
69930
  }).filter((message) => message.role !== "assistant" || message.parts.length > 0);
69926
69931
  }
69927
- function buildAISDKProviderOptions(modelHandle, modelSettings) {
69932
+ function buildAISDKProviderOptions(modelHandle, modelSettings, options = {}) {
69928
69933
  const provider = aiSDKProviderKind(modelHandle, modelSettings);
69929
69934
  if (provider === "openai") {
69935
+ const chatgptOAuth = isChatGPTOAuthModel(modelHandle, modelSettings);
69930
69936
  const reasoning = isRecord2(modelSettings.reasoning) ? modelSettings.reasoning : undefined;
69931
69937
  const reasoningEffort = openAIReasoningEffort(reasoning?.reasoning_effort ?? modelSettings.reasoning_effort);
69932
69938
  const textVerbosity = openAITextVerbosity(modelSettings.verbosity);
69933
69939
  const parallelToolCalls = boolValue(modelSettings.parallel_tool_calls);
69934
69940
  const openai2 = {
69941
+ ...chatgptOAuth ? {
69942
+ instructions: options.systemPrompt,
69943
+ store: false,
69944
+ systemMessageMode: "remove"
69945
+ } : {},
69935
69946
  ...reasoningEffort !== undefined ? { reasoningEffort } : {},
69936
69947
  ...textVerbosity !== undefined ? { textVerbosity } : {},
69937
69948
  ...parallelToolCalls !== undefined ? { parallelToolCalls } : {}
@@ -70016,10 +70027,10 @@ class AISDKStreamAdapter {
70016
70027
  });
70017
70028
  const result = this.runStreamText({
70018
70029
  model: this.createModel?.() ?? createAISDKModelFactoryFromAgent(input.agent.model, input.agent.model_settings, { localProviderAuthStorageDir: this.localProviderAuthStorageDir })(),
70019
- system: input.systemPrompt ?? input.agent.system,
70030
+ system: provider === "openai" && isChatGPTOAuthModel(input.agent.model, input.agent.model_settings) ? undefined : input.systemPrompt ?? input.agent.system,
70020
70031
  messages: await convertToModelMessages(uiMessages, { tools }),
70021
70032
  tools,
70022
- providerOptions: buildAISDKProviderOptions(input.agent.model, input.agent.model_settings),
70033
+ providerOptions: buildAISDKProviderOptions(input.agent.model, input.agent.model_settings, { systemPrompt: input.systemPrompt ?? input.agent.system }),
70023
70034
  maxRetries: 0,
70024
70035
  abortSignal: this.abortSignal
70025
70036
  });
@@ -145758,6 +145769,8 @@ function toTildePath(absolutePath) {
145758
145769
  return absolutePath;
145759
145770
  }
145760
145771
  function getInitialAuthMethod() {
145772
+ if (isLocalBackendEnabled())
145773
+ return "local";
145761
145774
  if (process.env.LETTA_BASE_URL)
145762
145775
  return "url";
145763
145776
  if (process.env.LETTA_API_KEY)
@@ -145765,6 +145778,8 @@ function getInitialAuthMethod() {
145765
145778
  return null;
145766
145779
  }
145767
145780
  async function getAuthMethod() {
145781
+ if (isLocalBackendEnabled())
145782
+ return "local";
145768
145783
  if (process.env.LETTA_BASE_URL) {
145769
145784
  return "url";
145770
145785
  }
@@ -145800,7 +145815,7 @@ function WelcomeScreen({
145800
145815
  getAuthMethod().then(setAuthMethod);
145801
145816
  }
145802
145817
  }, [initialAuth]);
145803
- const authDisplay = authMethod === "url" ? process.env.LETTA_BASE_URL || "Custom URL" : authMethod === "api-key" ? "API key auth" : "OAuth";
145818
+ const authDisplay = authMethod === "local" ? "Local" : authMethod === "url" ? process.env.LETTA_BASE_URL || "Custom URL" : authMethod === "api-key" ? "API key auth" : "OAuth";
145804
145819
  const memfsEnabled = agentState?.id ? settingsManager.isMemfsEnabled(agentState.id) : true;
145805
145820
  return /* @__PURE__ */ jsx_dev_runtime6.jsxDEV(Box_default, {
145806
145821
  flexDirection: "row",
@@ -145870,6 +145885,7 @@ function getLoadingMessage(loadingState, continueSession) {
145870
145885
  var import_react25, jsx_dev_runtime6;
145871
145886
  var init_WelcomeScreen = __esm(async () => {
145872
145887
  init_model();
145888
+ init_backend2();
145873
145889
  init_settings_manager();
145874
145890
  init_version();
145875
145891
  init_useTerminalWidth();
@@ -152028,6 +152044,15 @@ function shouldRetryRunMetadataError(errorType, detail) {
152028
152044
  return true;
152029
152045
  return retryable429Detail || retryableDetail;
152030
152046
  }
152047
+ function normalizeStreamErrorTypeToStopReason(errorType) {
152048
+ if (errorType === "llm_error" || errorType === "llm_api_error") {
152049
+ return "llm_api_error";
152050
+ }
152051
+ if (errorType === "internal_error" || errorType === "stream_incomplete") {
152052
+ return "error";
152053
+ }
152054
+ return "error";
152055
+ }
152031
152056
  function isEmptyResponseRetryable(errorType, detail, emptyResponseRetries, maxEmptyResponseRetries) {
152032
152057
  if (emptyResponseRetries >= maxEmptyResponseRetries)
152033
152058
  return false;
@@ -158201,7 +158226,7 @@ async function drainRecoveryStreamWithEmission(recoveryStream, socket, runtime,
158201
158226
  if (errorInfo) {
158202
158227
  emitLoopErrorNotice(socket, runtime, {
158203
158228
  message: errorInfo.message || "Stream error",
158204
- stopReason: errorInfo.error_type || "error",
158229
+ stopReason: normalizeStreamErrorTypeToStopReason(errorInfo.error_type),
158205
158230
  isTerminal: false,
158206
158231
  runId: runtime.activeRunId || errorInfo.run_id,
158207
158232
  agentId: params.agentId ?? undefined,
@@ -161943,7 +161968,7 @@ async function handleIncomingMessage(msg, socket, runtime, onStatusChange, conne
161943
161968
  if (!recoverableApprovalErrorText) {
161944
161969
  emitLoopErrorNotice(socket, runtime, {
161945
161970
  message: errorInfo.message || "Stream error",
161946
- stopReason: errorInfo.error_type || "error",
161971
+ stopReason: normalizeStreamErrorTypeToStopReason(errorInfo.error_type),
161947
161972
  isTerminal: false,
161948
161973
  runId: runId || errorInfo.run_id,
161949
161974
  agentId,
@@ -239121,4 +239146,4 @@ Error during initialization: ${message}`);
239121
239146
  }
239122
239147
  main();
239123
239148
 
239124
- //# debugId=6C6C45F6A1ED024464756E2164756E21
239149
+ //# debugId=A8E6490E4F5F858164756E2164756E21
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@letta-ai/letta-code",
3
- "version": "0.25.3",
3
+ "version": "0.25.4",
4
4
  "description": "Letta Code is a CLI tool for interacting with stateful Letta agents from the terminal.",
5
5
  "type": "module",
6
6
  "bin": {