@letta-ai/letta-code 0.26.7 → 0.26.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 CHANGED
@@ -4997,7 +4997,7 @@ var package_default;
4997
4997
  var init_package = __esm(() => {
4998
4998
  package_default = {
4999
4999
  name: "@letta-ai/letta-code",
5000
- version: "0.26.7",
5000
+ version: "0.26.8",
5001
5001
  description: "Letta Code is a CLI tool for interacting with stateful Letta agents from the terminal.",
5002
5002
  type: "module",
5003
5003
  packageManager: "bun@1.3.0",
@@ -145040,6 +145040,17 @@ var init_models7 = __esm(() => {
145040
145040
  parallel_tool_calls: true
145041
145041
  }
145042
145042
  },
145043
+ {
145044
+ id: "gemini-3.1-flash-lite",
145045
+ handle: "google_ai/gemini-3.1-flash-lite",
145046
+ label: "Gemini 3.1 Flash-Lite",
145047
+ description: "Google's lightweight Gemini 3.1 Flash-Lite model",
145048
+ updateArgs: {
145049
+ context_window: 1048576,
145050
+ temperature: 1,
145051
+ parallel_tool_calls: true
145052
+ }
145053
+ },
145043
145054
  {
145044
145055
  id: "gpt-4.1",
145045
145056
  handle: "openai/gpt-4.1",
@@ -243689,7 +243700,30 @@ function getLockDirPath() {
243689
243700
  return join30(getLettaDir(), LOCK_DIR_NAME);
243690
243701
  }
243691
243702
  function emptyFile() {
243692
- return { version: 1, scheduler_owner: null, tasks: [] };
243703
+ return {
243704
+ version: 1,
243705
+ scheduler_owner: null,
243706
+ tasks: []
243707
+ };
243708
+ }
243709
+ function normalizeTask(task2) {
243710
+ return {
243711
+ ...task2,
243712
+ last_run_at: task2.last_run_at ?? null,
243713
+ last_run_outcome: task2.last_run_outcome ?? null,
243714
+ last_run_reason: task2.last_run_reason ?? null,
243715
+ last_run_error: task2.last_run_error ?? null,
243716
+ last_missed_at: task2.last_missed_at ?? null,
243717
+ missed_count: task2.missed_count ?? 0,
243718
+ failed_count: task2.failed_count ?? 0
243719
+ };
243720
+ }
243721
+ function normalizeCronFileData(data) {
243722
+ return {
243723
+ version: 1,
243724
+ scheduler_owner: data.scheduler_owner ?? null,
243725
+ tasks: Array.isArray(data.tasks) ? data.tasks.map(normalizeTask) : []
243726
+ };
243693
243727
  }
243694
243728
  function readCronFile() {
243695
243729
  const path27 = getCronFilePath();
@@ -243700,7 +243734,7 @@ function readCronFile() {
243700
243734
  const data = JSON.parse(raw2);
243701
243735
  if (data.version !== 1)
243702
243736
  return emptyFile();
243703
- return data;
243737
+ return normalizeCronFileData(data);
243704
243738
  } catch {
243705
243739
  return emptyFile();
243706
243740
  }
@@ -243907,6 +243941,13 @@ function addTask(input) {
243907
243941
  fire_count: 0,
243908
243942
  cancel_reason: null,
243909
243943
  jitter_offset_ms: computeJitter(taskId, input.cron, input.recurring, input.scheduled_for ?? null, now),
243944
+ last_run_at: null,
243945
+ last_run_outcome: null,
243946
+ last_run_reason: null,
243947
+ last_run_error: null,
243948
+ last_missed_at: null,
243949
+ missed_count: 0,
243950
+ failed_count: 0,
243910
243951
  scheduled_for: input.scheduled_for?.toISOString() ?? null,
243911
243952
  fired_at: null,
243912
243953
  missed_at: null
@@ -244149,6 +244190,8 @@ function parseAllRunLogEntries(raw2, jobId) {
244149
244190
  jobId: obj.jobId,
244150
244191
  action: "finished",
244151
244192
  status: obj.status,
244193
+ outcome: obj.outcome,
244194
+ reason: obj.reason,
244152
244195
  error: obj.error,
244153
244196
  summary: obj.summary,
244154
244197
  agentId: obj.agentId,
@@ -244157,7 +244200,10 @@ function parseAllRunLogEntries(raw2, jobId) {
244157
244200
  runAtMs: obj.runAtMs,
244158
244201
  queueItemId: obj.queueItemId,
244159
244202
  scheduledFor: obj.scheduledFor,
244160
- firedAt: obj.firedAt
244203
+ firedAt: obj.firedAt,
244204
+ missedCount: obj.missedCount,
244205
+ windowStart: obj.windowStart,
244206
+ windowEnd: obj.windowEnd
244161
244207
  });
244162
244208
  } catch {}
244163
244209
  }
@@ -245003,6 +245049,23 @@ function refreshTaskCache(state) {
245003
245049
  state.lastMtime = mtime;
245004
245050
  }
245005
245051
  }
245052
+ function setLastRunOutcome(taskId, input) {
245053
+ const runAtIso = input.runAt.toISOString();
245054
+ updateTask(taskId, (t2) => {
245055
+ t2.last_run_at = runAtIso;
245056
+ t2.last_run_outcome = input.outcome;
245057
+ t2.last_run_reason = input.reason;
245058
+ t2.last_run_error = input.error ?? null;
245059
+ if (input.outcome === "missed") {
245060
+ const missedCount = Math.max(1, input.missedCount ?? 1);
245061
+ t2.last_missed_at = input.missedAt?.toISOString() ?? runAtIso;
245062
+ t2.missed_count = (t2.missed_count ?? 0) + missedCount;
245063
+ }
245064
+ if (input.outcome === "failed") {
245065
+ t2.failed_count = (t2.failed_count ?? 0) + 1;
245066
+ }
245067
+ });
245068
+ }
245006
245069
  function shouldFireTask(task2, now) {
245007
245070
  if (!task2.recurring && task2.scheduled_for) {
245008
245071
  const scheduledMs = new Date(task2.scheduled_for).getTime() + task2.jitter_offset_ms;
@@ -245012,11 +245075,41 @@ function shouldFireTask(task2, now) {
245012
245075
  }
245013
245076
  function fireCronTask(task2, now, socket, opts, processQueuedTurn) {
245014
245077
  const listener = getActiveRuntime();
245015
- if (!listener)
245078
+ if (!listener) {
245079
+ setLastRunOutcome(task2.id, {
245080
+ outcome: "failed",
245081
+ reason: "runtime_unavailable",
245082
+ runAt: now,
245083
+ error: "No active runtime"
245084
+ });
245085
+ safeAppendCronRunLogForTask(task2, {
245086
+ status: "error",
245087
+ outcome: "failed",
245088
+ reason: "runtime_unavailable",
245089
+ error: "No active runtime",
245090
+ runAtMs: now.getTime(),
245091
+ scheduledFor: task2.scheduled_for
245092
+ });
245016
245093
  return;
245094
+ }
245017
245095
  const rawRuntime = getOrCreateConversationRuntime(listener, task2.agent_id, task2.conversation_id === "default" ? undefined : task2.conversation_id);
245018
- if (!rawRuntime)
245096
+ if (!rawRuntime) {
245097
+ setLastRunOutcome(task2.id, {
245098
+ outcome: "failed",
245099
+ reason: "runtime_unavailable",
245100
+ runAt: now,
245101
+ error: "Conversation runtime unavailable"
245102
+ });
245103
+ safeAppendCronRunLogForTask(task2, {
245104
+ status: "error",
245105
+ outcome: "failed",
245106
+ reason: "runtime_unavailable",
245107
+ error: "Conversation runtime unavailable",
245108
+ runAtMs: now.getTime(),
245109
+ scheduledFor: task2.scheduled_for
245110
+ });
245019
245111
  return;
245112
+ }
245020
245113
  const conversationRuntime = ensureConversationQueueRuntime(listener, rawRuntime);
245021
245114
  const text2 = wrapCronPrompt(task2);
245022
245115
  const queuedItem = conversationRuntime.queueRuntime.enqueue({
@@ -245028,8 +245121,16 @@ function fireCronTask(task2, now, socket, opts, processQueuedTurn) {
245028
245121
  conversationId: task2.conversation_id
245029
245122
  });
245030
245123
  if (!queuedItem) {
245124
+ setLastRunOutcome(task2.id, {
245125
+ outcome: "failed",
245126
+ reason: "queue_full",
245127
+ runAt: now,
245128
+ error: "queue buffer limit"
245129
+ });
245031
245130
  safeAppendCronRunLogForTask(task2, {
245032
245131
  status: "error",
245132
+ outcome: "failed",
245133
+ reason: "queue_full",
245033
245134
  error: "queue buffer limit",
245034
245135
  runAtMs: now.getTime(),
245035
245136
  scheduledFor: task2.scheduled_for
@@ -245042,6 +245143,10 @@ function fireCronTask(task2, now, socket, opts, processQueuedTurn) {
245042
245143
  updateTask(task2.id, (t2) => {
245043
245144
  t2.last_fired_at = nowIso;
245044
245145
  t2.fire_count += 1;
245146
+ t2.last_run_at = nowIso;
245147
+ t2.last_run_outcome = "queued";
245148
+ t2.last_run_reason = "scheduled_time_matched";
245149
+ t2.last_run_error = null;
245045
245150
  });
245046
245151
  } else {
245047
245152
  updateTask(task2.id, (t2) => {
@@ -245049,10 +245154,16 @@ function fireCronTask(task2, now, socket, opts, processQueuedTurn) {
245049
245154
  t2.fired_at = nowIso;
245050
245155
  t2.last_fired_at = nowIso;
245051
245156
  t2.fire_count = 1;
245157
+ t2.last_run_at = nowIso;
245158
+ t2.last_run_outcome = "queued";
245159
+ t2.last_run_reason = "one_off_due";
245160
+ t2.last_run_error = null;
245052
245161
  });
245053
245162
  }
245054
245163
  safeAppendCronRunLogForTask(task2, {
245055
245164
  status: "ok",
245165
+ outcome: "queued",
245166
+ reason: task2.recurring ? "scheduled_time_matched" : "one_off_due",
245056
245167
  runAtMs: now.getTime(),
245057
245168
  queueItemId: queuedItem.id,
245058
245169
  scheduledFor: task2.scheduled_for,
@@ -245065,15 +245176,27 @@ function handleMissedOneShot(task2, now) {
245065
245176
  const scheduledMs = new Date(task2.scheduled_for).getTime();
245066
245177
  const missThreshold = 5 * 60000;
245067
245178
  if (now.getTime() > scheduledMs + missThreshold && task2.status === "active") {
245179
+ const reason = task2.last_run_outcome === "failed" ? task2.last_run_reason ?? "scheduler_error" : "scheduler_inactive";
245180
+ const error54 = task2.last_run_outcome === "failed" ? task2.last_run_error : null;
245068
245181
  updateTask(task2.id, (t2) => {
245069
245182
  t2.status = "missed";
245070
245183
  t2.missed_at = now.toISOString();
245184
+ t2.last_run_at = now.toISOString();
245185
+ t2.last_run_outcome = "missed";
245186
+ t2.last_run_reason = reason;
245187
+ t2.last_run_error = error54 ?? null;
245188
+ t2.last_missed_at = task2.scheduled_for;
245189
+ t2.missed_count = (t2.missed_count ?? 0) + 1;
245071
245190
  });
245072
245191
  safeAppendCronRunLogForTask(task2, {
245073
245192
  status: "skipped",
245193
+ outcome: "missed",
245194
+ reason,
245074
245195
  summary: "missed",
245196
+ error: error54 ?? undefined,
245075
245197
  runAtMs: now.getTime(),
245076
- scheduledFor: task2.scheduled_for
245198
+ scheduledFor: task2.scheduled_for,
245199
+ missedCount: 1
245077
245200
  });
245078
245201
  return true;
245079
245202
  }
@@ -245113,8 +245236,16 @@ function tick2(state, socket, opts, processQueuedTurn) {
245113
245236
  fireCronTask(freshTask, now, socket, opts, processQueuedTurn);
245114
245237
  } catch (err) {
245115
245238
  console.error(`[Cron] Error firing task ${taskId}:`, err);
245239
+ setLastRunOutcome(freshTask.id, {
245240
+ outcome: "failed",
245241
+ reason: "scheduler_error",
245242
+ runAt: now,
245243
+ error: err instanceof Error ? err.message : String(err)
245244
+ });
245116
245245
  safeAppendCronRunLogForTask(freshTask, {
245117
245246
  status: "error",
245247
+ outcome: "failed",
245248
+ reason: "scheduler_error",
245118
245249
  error: err instanceof Error ? err.message : String(err),
245119
245250
  runAtMs: now.getTime(),
245120
245251
  scheduledFor: freshTask.scheduled_for
@@ -247677,6 +247808,12 @@ function isCronGetCommand(value) {
247677
247808
  const c = value;
247678
247809
  return c.type === "cron_get" && typeof c.request_id === "string" && typeof c.task_id === "string";
247679
247810
  }
247811
+ function isCronRunsCommand(value) {
247812
+ if (!value || typeof value !== "object")
247813
+ return false;
247814
+ const c = value;
247815
+ return c.type === "cron_runs" && typeof c.request_id === "string" && typeof c.task_id === "string" && (c.limit === undefined || typeof c.limit === "number") && (c.offset === undefined || typeof c.offset === "number") && (c.run_id === undefined || typeof c.run_id === "string");
247816
+ }
247680
247817
  function isCronDeleteCommand(value) {
247681
247818
  if (!value || typeof value !== "object")
247682
247819
  return false;
@@ -247956,7 +248093,7 @@ function parseServerMessage(data) {
247956
248093
  try {
247957
248094
  const raw2 = typeof data === "string" ? data : data.toString();
247958
248095
  const parsed = JSON.parse(raw2);
247959
- if (isInputCommand(parsed) || isChangeDeviceStateCommand(parsed) || isAbortMessageCommand(parsed) || isSyncCommand(parsed) || isTerminalSpawnCommand(parsed) || isTerminalInputCommand(parsed) || isTerminalResizeCommand(parsed) || isTerminalKillCommand(parsed) || isSearchFilesCommand(parsed) || isGrepInFilesCommand(parsed) || isListInDirectoryCommand(parsed) || isGetTreeCommand(parsed) || isReadFileCommand(parsed) || isWriteFileCommand(parsed) || isWatchFileCommand(parsed) || isUnwatchFileCommand(parsed) || isEditFileCommand(parsed) || isFileOpsCommand(parsed) || isListMemoryCommand(parsed) || isMemoryHistoryCommand(parsed) || isMemoryFileAtRefCommand(parsed) || isMemoryCommitDiffCommand(parsed) || isReadMemoryFileCommand(parsed) || isWriteMemoryFileCommand(parsed) || isDeleteMemoryFileCommand(parsed) || isEnableMemfsCommand(parsed) || isListModelsCommand(parsed) || isUpdateModelCommand(parsed) || isUpdateToolsetCommand(parsed) || isCronListCommand(parsed) || isCronAddCommand(parsed) || isCronGetCommand(parsed) || isCronDeleteCommand(parsed) || isCronDeleteAllCommand(parsed) || isSkillEnableCommand(parsed) || isSkillDisableCommand(parsed) || isCreateAgentCommand(parsed) || isGetCwdMapCommand(parsed) || isGetExperimentsCommand(parsed) || isSetExperimentCommand(parsed) || isGetReflectionSettingsCommand(parsed) || isSetReflectionSettingsCommand(parsed) || isChannelsListCommand(parsed) || isChannelAccountsListCommand(parsed) || isChannelAccountCreateCommand(parsed) || isChannelAccountUpdateCommand(parsed) || isChannelAccountBindCommand(parsed) || isChannelAccountUnbindCommand(parsed) || isChannelAccountDeleteCommand(parsed) || isChannelAccountStartCommand(parsed) || isChannelAccountStopCommand(parsed) || isChannelGetConfigCommand(parsed) || isChannelSetConfigCommand(parsed) || isChannelStartCommand(parsed) || isChannelStopCommand(parsed) || isChannelPairingsListCommand(parsed) || isChannelPairingBindCommand(parsed) || isChannelRoutesListCommand(parsed) || isChannelTargetsListCommand(parsed) || isChannelTargetBindCommand(parsed) || isChannelRouteUpdateCommand(parsed) || isChannelRouteRemoveCommand(parsed) || isExecuteCommandCommand(parsed) || isRemoveQueueItemCommand(parsed) || isSearchBranchesCommand(parsed) || isCheckoutBranchCommand(parsed) || isSecretListCommand(parsed) || isSecretApplyCommand(parsed)) {
248096
+ if (isInputCommand(parsed) || isChangeDeviceStateCommand(parsed) || isAbortMessageCommand(parsed) || isSyncCommand(parsed) || isTerminalSpawnCommand(parsed) || isTerminalInputCommand(parsed) || isTerminalResizeCommand(parsed) || isTerminalKillCommand(parsed) || isSearchFilesCommand(parsed) || isGrepInFilesCommand(parsed) || isListInDirectoryCommand(parsed) || isGetTreeCommand(parsed) || isReadFileCommand(parsed) || isWriteFileCommand(parsed) || isWatchFileCommand(parsed) || isUnwatchFileCommand(parsed) || isEditFileCommand(parsed) || isFileOpsCommand(parsed) || isListMemoryCommand(parsed) || isMemoryHistoryCommand(parsed) || isMemoryFileAtRefCommand(parsed) || isMemoryCommitDiffCommand(parsed) || isReadMemoryFileCommand(parsed) || isWriteMemoryFileCommand(parsed) || isDeleteMemoryFileCommand(parsed) || isEnableMemfsCommand(parsed) || isListModelsCommand(parsed) || isUpdateModelCommand(parsed) || isUpdateToolsetCommand(parsed) || isCronListCommand(parsed) || isCronAddCommand(parsed) || isCronGetCommand(parsed) || isCronRunsCommand(parsed) || isCronDeleteCommand(parsed) || isCronDeleteAllCommand(parsed) || isSkillEnableCommand(parsed) || isSkillDisableCommand(parsed) || isCreateAgentCommand(parsed) || isGetCwdMapCommand(parsed) || isGetExperimentsCommand(parsed) || isSetExperimentCommand(parsed) || isGetReflectionSettingsCommand(parsed) || isSetReflectionSettingsCommand(parsed) || isChannelsListCommand(parsed) || isChannelAccountsListCommand(parsed) || isChannelAccountCreateCommand(parsed) || isChannelAccountUpdateCommand(parsed) || isChannelAccountBindCommand(parsed) || isChannelAccountUnbindCommand(parsed) || isChannelAccountDeleteCommand(parsed) || isChannelAccountStartCommand(parsed) || isChannelAccountStopCommand(parsed) || isChannelGetConfigCommand(parsed) || isChannelSetConfigCommand(parsed) || isChannelStartCommand(parsed) || isChannelStopCommand(parsed) || isChannelPairingsListCommand(parsed) || isChannelPairingBindCommand(parsed) || isChannelRoutesListCommand(parsed) || isChannelTargetsListCommand(parsed) || isChannelTargetBindCommand(parsed) || isChannelRouteUpdateCommand(parsed) || isChannelRouteRemoveCommand(parsed) || isExecuteCommandCommand(parsed) || isRemoveQueueItemCommand(parsed) || isSearchBranchesCommand(parsed) || isCheckoutBranchCommand(parsed) || isSecretListCommand(parsed) || isSecretApplyCommand(parsed)) {
247960
248097
  return parsed;
247961
248098
  }
247962
248099
  const invalidInput = getInvalidInputReason(parsed);
@@ -248910,6 +249047,30 @@ async function handleCronCommand(parsed, socket, safeSocketSend) {
248910
249047
  }
248911
249048
  return true;
248912
249049
  }
249050
+ if (parsed.type === "cron_runs") {
249051
+ try {
249052
+ const page = readCronRunLogEntriesPage(getCronRunLogPath(parsed.task_id), {
249053
+ jobId: parsed.task_id,
249054
+ limit: parsed.limit,
249055
+ offset: parsed.offset,
249056
+ runId: parsed.run_id
249057
+ });
249058
+ safeSocketSend(socket, {
249059
+ type: "cron_runs_response",
249060
+ request_id: parsed.request_id,
249061
+ success: true,
249062
+ page
249063
+ }, "listener_cron_send_failed", "listener_cron_command");
249064
+ } catch (err) {
249065
+ safeSocketSend(socket, {
249066
+ type: "cron_runs_response",
249067
+ request_id: parsed.request_id,
249068
+ success: false,
249069
+ error: err instanceof Error ? err.message : "Failed to list cron run history"
249070
+ }, "listener_cron_send_failed", "listener_cron_command");
249071
+ }
249072
+ return true;
249073
+ }
248913
249074
  if (parsed.type === "cron_delete") {
248914
249075
  try {
248915
249076
  const existingTask = getTask(parsed.task_id);
@@ -248965,7 +249126,7 @@ async function handleCronCommand(parsed, socket, safeSocketSend) {
248965
249126
  }
248966
249127
  function handleCronProtocolCommand(parsed, context3) {
248967
249128
  const { socket, safeSocketSend, runDetachedListenerTask } = context3;
248968
- if (isCronListCommand(parsed) || isCronAddCommand(parsed) || isCronGetCommand(parsed) || isCronDeleteCommand(parsed) || isCronDeleteAllCommand(parsed)) {
249129
+ if (isCronListCommand(parsed) || isCronAddCommand(parsed) || isCronGetCommand(parsed) || isCronRunsCommand(parsed) || isCronDeleteCommand(parsed) || isCronDeleteAllCommand(parsed)) {
248969
249130
  runDetachedListenerTask("cron_command", async () => {
248970
249131
  await handleCronCommand(parsed, socket, safeSocketSend);
248971
249132
  });
@@ -437701,7 +437862,7 @@ function createExtensionConversationHandle(options3) {
437701
437862
  };
437702
437863
  }
437703
437864
 
437704
- // src/extensions/extension-host.ts
437865
+ // src/extensions/extension-engine.ts
437705
437866
  import { createHash as createHash3 } from "node:crypto";
437706
437867
  import {
437707
437868
  existsSync as existsSync45,
@@ -438542,7 +438703,7 @@ function disposeLocalExtensions(registry2) {
438542
438703
  registry2.ui.statuslineRenderer = null;
438543
438704
  delete registry2.ui.statuslineRendererOwner;
438544
438705
  }
438545
- function createExtensionHost(options3) {
438706
+ function createExtensionEngine(options3) {
438546
438707
  let generation = 0;
438547
438708
  let disposed = false;
438548
438709
  const capabilities = resolveExtensionCapabilities(options3.capabilities);
@@ -438638,7 +438799,7 @@ function createExtensionHost(options3) {
438638
438799
  };
438639
438800
  }
438640
438801
  var ts, GLOBAL_EXTENSIONS_DIRECTORY, EXTENSION_CACHE_DIRECTORY, EXTENSION_FILE_EXTENSIONS, TYPESCRIPT_EXTENSION_FILE_EXTENSIONS, requireFromRuntime, SUPPORTED_EXTENSION_EVENT_NAMES;
438641
- var init_extension_host = __esm(() => {
438802
+ var init_extension_engine = __esm(() => {
438642
438803
  init_available_models();
438643
438804
  init_pi_provider_extension_registry();
438644
438805
  init_capabilities();
@@ -438657,7 +438818,7 @@ var init_extension_host = __esm(() => {
438657
438818
  ]);
438658
438819
  });
438659
438820
 
438660
- // src/extensions/extension-runtime.ts
438821
+ // src/extensions/extension-adapter.ts
438661
438822
  function createDisabledExtensionRegistry() {
438662
438823
  return {
438663
438824
  capabilities: cloneExtensionCapabilities(DISABLED_EXTENSION_CAPABILITIES),
@@ -438680,7 +438841,7 @@ function createDisabledExtensionRegistry() {
438680
438841
  }
438681
438842
  };
438682
438843
  }
438683
- function createDisabledExtensionHost(registry2) {
438844
+ function createDisabledExtensionEngine(registry2) {
438684
438845
  return {
438685
438846
  dispose() {},
438686
438847
  emitEvent(name) {
@@ -438699,12 +438860,12 @@ function createDisabledExtensionHost(registry2) {
438699
438860
  }
438700
438861
  };
438701
438862
  }
438702
- function createDisabledExtensionRuntime(options3) {
438863
+ function createDisabledExtensionAdapter(options3) {
438703
438864
  clearExtensionTools();
438704
438865
  clearRegisteredPiProviders();
438705
438866
  let context3 = options3.initialContext;
438706
438867
  const registry2 = createDisabledExtensionRegistry();
438707
- const host = createDisabledExtensionHost(registry2);
438868
+ const engine4 = createDisabledExtensionEngine(registry2);
438708
438869
  const snapshot = {
438709
438870
  hadStatuslineRenderer: false,
438710
438871
  hasExtensionSources: false,
@@ -438734,7 +438895,7 @@ function createDisabledExtensionRuntime(options3) {
438734
438895
  getSnapshot() {
438735
438896
  return snapshot;
438736
438897
  },
438737
- host,
438898
+ engine: engine4,
438738
438899
  reload() {
438739
438900
  return Promise.resolve();
438740
438901
  },
@@ -438751,7 +438912,7 @@ function createDisabledExtensionRuntime(options3) {
438751
438912
  function hasExtensionSources(options3) {
438752
438913
  return resolveLocalExtensionSources(options3).some((source2) => source2.files.length > 0);
438753
438914
  }
438754
- function createLazyRuntimeBackendApi(getBackendApi) {
438915
+ function createLazyAdapterBackendApi(getBackendApi) {
438755
438916
  const requireBackend = () => {
438756
438917
  const backend4 = getBackendApi();
438757
438918
  if (!backend4) {
@@ -438771,21 +438932,21 @@ function createLazyRuntimeBackendApi(getBackendApi) {
438771
438932
  }
438772
438933
  };
438773
438934
  }
438774
- function createExtensionRuntime(options3) {
438935
+ function createExtensionAdapter(options3) {
438775
438936
  if (options3.disabled) {
438776
438937
  disableExtensionsForProcess();
438777
438938
  }
438778
438939
  if (options3.disabled || areExtensionsDisabled()) {
438779
- return createDisabledExtensionRuntime(options3);
438940
+ return createDisabledExtensionAdapter(options3);
438780
438941
  }
438781
438942
  const {
438782
438943
  getBackendApi: resolveBackendApi,
438783
438944
  initialContext,
438784
- ...hostOptions
438945
+ ...engineOptions
438785
438946
  } = options3;
438786
438947
  let context3 = initialContext;
438787
438948
  let disposed = false;
438788
- const initialHasExtensionSources = hasExtensionSources(hostOptions);
438949
+ const initialHasExtensionSources = hasExtensionSources(engineOptions);
438789
438950
  let loadState = {
438790
438951
  hadStatuslineRenderer: false,
438791
438952
  hasExtensionSources: initialHasExtensionSources,
@@ -438794,22 +438955,22 @@ function createExtensionRuntime(options3) {
438794
438955
  const listeners3 = new Set;
438795
438956
  const getBackendApi = () => resolveBackendApi?.();
438796
438957
  const getContext3 = () => context3;
438797
- const backend4 = resolveBackendApi ? createLazyRuntimeBackendApi(getBackendApi) : undefined;
438798
- const host = createExtensionHost({
438799
- ...hostOptions,
438958
+ const backend4 = resolveBackendApi ? createLazyAdapterBackendApi(getBackendApi) : undefined;
438959
+ const engine4 = createExtensionEngine({
438960
+ ...engineOptions,
438800
438961
  ...backend4 ? { backend: backend4 } : {},
438801
438962
  getContext: getContext3
438802
438963
  });
438803
438964
  const eventEmitter = {
438804
438965
  emitEvent(name, event2) {
438805
- return host.emitEvent(name, event2, getBackendApi());
438966
+ return engine4.emitEvent(name, event2, getBackendApi());
438806
438967
  },
438807
438968
  getSnapshot() {
438808
438969
  return loadState;
438809
438970
  }
438810
438971
  };
438811
438972
  const buildSnapshot = () => ({
438812
- registry: host.getSnapshot(),
438973
+ registry: engine4.getSnapshot(),
438813
438974
  ...loadState
438814
438975
  });
438815
438976
  let snapshot = buildSnapshot();
@@ -438819,23 +438980,23 @@ function createExtensionRuntime(options3) {
438819
438980
  listener();
438820
438981
  }
438821
438982
  };
438822
- const unsubscribeHost = host.subscribe(publish);
438983
+ const unsubscribeEngine = engine4.subscribe(publish);
438823
438984
  const getSnapshot3 = () => snapshot;
438824
438985
  const reload = async () => {
438825
438986
  if (disposed)
438826
438987
  return;
438827
- const previousSnapshot = host.getSnapshot();
438988
+ const previousSnapshot = engine4.getSnapshot();
438828
438989
  const previousHadStatuslineRenderer = Boolean(previousSnapshot.ui.statuslineRenderer) || loadState.hadStatuslineRenderer;
438829
438990
  loadState = {
438830
438991
  hadStatuslineRenderer: previousHadStatuslineRenderer,
438831
- hasExtensionSources: hasExtensionSources(hostOptions),
438992
+ hasExtensionSources: hasExtensionSources(engineOptions),
438832
438993
  isLoading: true
438833
438994
  };
438834
438995
  publish();
438835
- await host.reload();
438996
+ await engine4.reload();
438836
438997
  if (disposed)
438837
438998
  return;
438838
- const nextRegistry = host.getSnapshot();
438999
+ const nextRegistry = engine4.getSnapshot();
438839
439000
  debugLog("extensions", "loaded %s extension(s) from %s source(s); renderer=%s", nextRegistry.loadedPaths.length, nextRegistry.sources.length, nextRegistry.ui.statuslineRenderer?.id ?? "(none)");
438840
439001
  for (const loadError of nextRegistry.errors) {
438841
439002
  debugLog("extensions", "failed to load %s: %s", loadError.path, loadError.error.message);
@@ -438852,18 +439013,18 @@ function createExtensionRuntime(options3) {
438852
439013
  if (disposed)
438853
439014
  return;
438854
439015
  disposed = true;
438855
- host.dispose();
438856
- unsubscribeHost();
439016
+ engine4.dispose();
439017
+ unsubscribeEngine();
438857
439018
  listeners3.clear();
438858
439019
  },
438859
439020
  emitEvent(name, event2) {
438860
- return host.emitEvent(name, event2, getBackendApi());
439021
+ return engine4.emitEvent(name, event2, getBackendApi());
438861
439022
  },
438862
439023
  eventEmitter,
438863
439024
  getBackendApi,
438864
439025
  getContext: getContext3,
438865
439026
  getSnapshot: getSnapshot3,
438866
- host,
439027
+ engine: engine4,
438867
439028
  reload,
438868
439029
  subscribe(listener) {
438869
439030
  listeners3.add(listener);
@@ -438876,15 +439037,15 @@ function createExtensionRuntime(options3) {
438876
439037
  }
438877
439038
  };
438878
439039
  }
438879
- var init_extension_runtime = __esm(() => {
439040
+ var init_extension_adapter = __esm(() => {
438880
439041
  init_pi_provider_extension_registry();
438881
439042
  init_capabilities();
438882
- init_extension_host();
439043
+ init_extension_engine();
438883
439044
  init_tool_registry();
438884
439045
  init_debug();
438885
439046
  });
438886
439047
 
438887
- // src/headless-extension-runtime.ts
439048
+ // src/headless-extension-adapter.ts
438888
439049
  function createHeadlessExtensionBackendApi(backend4) {
438889
439050
  return {
438890
439051
  forkConversation(conversationId, options3) {
@@ -438968,8 +439129,8 @@ function createHeadlessExtensionContext(options3) {
438968
439129
  backgroundAgents: []
438969
439130
  };
438970
439131
  }
438971
- function createHeadlessExtensionRuntime(options3) {
438972
- return createExtensionRuntime({
439132
+ function createHeadlessExtensionAdapter(options3) {
439133
+ return createExtensionAdapter({
438973
439134
  ...options3.cacheDirectory ? { cacheDirectory: options3.cacheDirectory } : {},
438974
439135
  capabilities: HEADLESS_EXTENSION_CAPABILITIES,
438975
439136
  disabled: options3.disabled,
@@ -438980,9 +439141,9 @@ function createHeadlessExtensionRuntime(options3) {
438980
439141
  });
438981
439142
  }
438982
439143
  async function emitHeadlessConversationOpen(options3) {
438983
- if (!options3.runtime.getSnapshot().hasExtensionSources)
439144
+ if (!options3.adapter.getSnapshot().hasExtensionSources)
438984
439145
  return;
438985
- await options3.runtime.emitEvent("conversation_open", {
439146
+ await options3.adapter.emitEvent("conversation_open", {
438986
439147
  agentId: options3.agent.id,
438987
439148
  agentName: options3.agent.name ?? null,
438988
439149
  conversationId: options3.conversationId,
@@ -438990,9 +439151,9 @@ async function emitHeadlessConversationOpen(options3) {
438990
439151
  });
438991
439152
  }
438992
439153
  async function emitHeadlessConversationClose(options3) {
438993
- if (!options3.runtime.getSnapshot().hasExtensionSources)
439154
+ if (!options3.adapter.getSnapshot().hasExtensionSources)
438994
439155
  return;
438995
- await options3.runtime.emitEvent("conversation_close", {
439156
+ await options3.adapter.emitEvent("conversation_close", {
438996
439157
  agentId: options3.agent.id,
438997
439158
  conversationId: options3.conversationId,
438998
439159
  durationMs: options3.durationMs,
@@ -439002,11 +439163,11 @@ async function emitHeadlessConversationClose(options3) {
439002
439163
  });
439003
439164
  }
439004
439165
  var HEADLESS_EXTENSION_CAPABILITIES;
439005
- var init_headless_extension_runtime = __esm(async () => {
439166
+ var init_headless_extension_adapter = __esm(async () => {
439006
439167
  init_memory_filesystem2();
439007
439168
  init_model();
439008
439169
  init_client2();
439009
- init_extension_runtime();
439170
+ init_extension_adapter();
439010
439171
  init_runtime_context();
439011
439172
  init_settings_manager();
439012
439173
  init_telemetry();
@@ -439519,7 +439680,7 @@ function isTurnInputArray(value) {
439519
439680
  return Array.isArray(value) && value.every((item) => typeof item === "object" && item !== null);
439520
439681
  }
439521
439682
  async function emitHeadlessTurnStart(options3) {
439522
- if (!options3.runtime.getSnapshot().hasExtensionSources)
439683
+ if (!options3.adapter.getSnapshot().hasExtensionSources)
439523
439684
  return options3.input;
439524
439685
  try {
439525
439686
  const event2 = {
@@ -439527,7 +439688,7 @@ async function emitHeadlessTurnStart(options3) {
439527
439688
  conversationId: options3.conversationId,
439528
439689
  input: options3.input
439529
439690
  };
439530
- await options3.runtime.emitEvent("turn_start", event2);
439691
+ await options3.adapter.emitEvent("turn_start", event2);
439531
439692
  return isTurnInputArray(event2.input) ? event2.input : options3.input;
439532
439693
  } catch {
439533
439694
  return options3.input;
@@ -440249,7 +440410,7 @@ Current session AGENT_ID=${process.env.AGENT_ID}; --backend local switches to a
440249
440410
  }
440250
440411
  const sessionStats = new SessionStats;
440251
440412
  const headlessPermissionMode = yoloMode ? "unrestricted" : typeof permissionModeValue === "string" ? permissionModeValue : null;
440252
- const headlessExtensionRuntime = createHeadlessExtensionRuntime({
440413
+ const headlessExtensionAdapter = createHeadlessExtensionAdapter({
440253
440414
  agent: agent2,
440254
440415
  backend: backend4,
440255
440416
  conversationId,
@@ -440258,13 +440419,13 @@ Current session AGENT_ID=${process.env.AGENT_ID}; --backend local switches to a
440258
440419
  sessionStats,
440259
440420
  disabled: extensionsDisabled
440260
440421
  });
440261
- await headlessExtensionRuntime.reload();
440422
+ await headlessExtensionAdapter.reload();
440262
440423
  try {
440263
440424
  await emitHeadlessConversationOpen({
440264
440425
  agent: agent2,
440265
440426
  conversationId,
440266
440427
  reason: conversationOpenReason,
440267
- runtime: headlessExtensionRuntime
440428
+ adapter: headlessExtensionAdapter
440268
440429
  });
440269
440430
  } catch {}
440270
440431
  let availableTools = agent2.tools?.map((t2) => t2.name).filter((n) => !!n) || [];
@@ -440275,14 +440436,14 @@ Current session AGENT_ID=${process.env.AGENT_ID}; --backend local switches to a
440275
440436
  agentId: agent2.id,
440276
440437
  conversationId,
440277
440438
  cachedAgent: agent2,
440278
- extensionEventEmitter: headlessExtensionRuntime.eventEmitter
440439
+ extensionEventEmitter: headlessExtensionAdapter.eventEmitter
440279
440440
  });
440280
440441
  availableTools = initialToolContext.availableTools;
440281
440442
  cachedAgent = initialToolContext.preparedToolContext.agent;
440282
440443
  preparedEffectiveModel = initialToolContext.preparedToolContext.effectiveModel;
440283
440444
  }
440284
440445
  if (isBidirectionalMode) {
440285
- await runBidirectionalMode(agent2, conversationId, outputFormat, includePartialMessages, availableTools, resolvedSkillSources, systemInfoReminderEnabled, effectiveReflectionSettings, headlessExtensionRuntime);
440446
+ await runBidirectionalMode(agent2, conversationId, outputFormat, includePartialMessages, availableTools, resolvedSkillSources, systemInfoReminderEnabled, effectiveReflectionSettings, headlessExtensionAdapter);
440286
440447
  return;
440287
440448
  }
440288
440449
  const buffers = createBuffers(agent2.id);
@@ -440294,7 +440455,7 @@ Current session AGENT_ID=${process.env.AGENT_ID}; --backend local switches to a
440294
440455
  try {
440295
440456
  if (!headlessConversationClosed) {
440296
440457
  headlessConversationClosed = true;
440297
- headlessExtensionRuntime.updateContext(createHeadlessExtensionContext({
440458
+ headlessExtensionAdapter.updateContext(createHeadlessExtensionContext({
440298
440459
  agent: agent2,
440299
440460
  conversationId,
440300
440461
  lastRunId: lastKnownRunId,
@@ -440307,14 +440468,14 @@ Current session AGENT_ID=${process.env.AGENT_ID}; --backend local switches to a
440307
440468
  agent: agent2,
440308
440469
  conversationId,
440309
440470
  durationMs: sessionStats.getSnapshot().totalWallMs,
440310
- runtime: headlessExtensionRuntime
440471
+ adapter: headlessExtensionAdapter
440311
440472
  });
440312
440473
  } catch {}
440313
440474
  }
440314
440475
  telemetry.trackSessionEnd(sessionStats.getSnapshot(), exitReason);
440315
440476
  await telemetry.flush();
440316
440477
  } finally {
440317
- headlessExtensionRuntime.dispose();
440478
+ headlessExtensionAdapter.dispose();
440318
440479
  telemetry.setSessionStatsGetter(undefined);
440319
440480
  }
440320
440481
  return await flushAndExit(code2);
@@ -440392,7 +440553,7 @@ Current session AGENT_ID=${process.env.AGENT_ID}; --backend local switches to a
440392
440553
  agentId: agent2.id,
440393
440554
  conversationId,
440394
440555
  approvalMessages,
440395
- extensionEventEmitter: headlessExtensionRuntime.eventEmitter
440556
+ extensionEventEmitter: headlessExtensionAdapter.eventEmitter
440396
440557
  });
440397
440558
  const drainResult = await drainStreamWithResume(approvalStream, createBuffers(agent2.id), () => {}, undefined, undefined, undefined, reminderContextTracker);
440398
440559
  if (drainResult.stopReason === "error" || drainResult.stopReason === "cancelled") {
@@ -440509,7 +440670,7 @@ ${loadedContents.join(`
440509
440670
  ];
440510
440671
  queuedRecoveredApprovalResults = null;
440511
440672
  }
440512
- headlessExtensionRuntime.updateContext(createHeadlessExtensionContext({
440673
+ headlessExtensionAdapter.updateContext(createHeadlessExtensionContext({
440513
440674
  agent: agent2,
440514
440675
  conversationId,
440515
440676
  permissionMode: headlessPermissionMode,
@@ -440520,7 +440681,7 @@ ${loadedContents.join(`
440520
440681
  agent: agent2,
440521
440682
  conversationId,
440522
440683
  input: currentInput,
440523
- runtime: headlessExtensionRuntime
440684
+ adapter: headlessExtensionAdapter
440524
440685
  });
440525
440686
  let llmApiErrorRetries = 0;
440526
440687
  let emptyResponseRetries = 0;
@@ -440577,7 +440738,7 @@ ${loadedContents.join(`
440577
440738
  conversationId,
440578
440739
  overrideModel: overrideModelHandle ?? preparedEffectiveModel,
440579
440740
  cachedAgent,
440580
- extensionEventEmitter: headlessExtensionRuntime.eventEmitter
440741
+ extensionEventEmitter: headlessExtensionAdapter.eventEmitter
440581
440742
  });
440582
440743
  availableTools = turnToolContext.availableTools;
440583
440744
  stream5 = await sendMessageStream(conversationId, currentInput, {
@@ -441201,7 +441362,7 @@ ${loadedContents.join(`
441201
441362
  reportAllMilestones();
441202
441363
  await exitHeadless(0, "headless_complete");
441203
441364
  }
441204
- async function runBidirectionalMode(agent2, conversationId, _outputFormat, includePartialMessages, availableTools, skillSources, systemInfoReminderEnabled, reflectionSettings, headlessExtensionRuntime) {
441365
+ async function runBidirectionalMode(agent2, conversationId, _outputFormat, includePartialMessages, availableTools, skillSources, systemInfoReminderEnabled, reflectionSettings, headlessExtensionAdapter) {
441205
441366
  const sessionId = agent2.id;
441206
441367
  const backend4 = getBackend();
441207
441368
  const telemetryModelId = agent2.llm_config?.model ?? "unknown";
@@ -441218,14 +441379,14 @@ async function runBidirectionalMode(agent2, conversationId, _outputFormat, inclu
441218
441379
  agent: agent2,
441219
441380
  conversationId,
441220
441381
  durationMs: null,
441221
- runtime: headlessExtensionRuntime
441382
+ adapter: headlessExtensionAdapter
441222
441383
  });
441223
441384
  } catch {}
441224
441385
  }
441225
441386
  telemetry.trackSessionEnd(undefined, exitReason);
441226
441387
  await telemetry.flush();
441227
441388
  } finally {
441228
- headlessExtensionRuntime.dispose();
441389
+ headlessExtensionAdapter.dispose();
441229
441390
  }
441230
441391
  return await flushAndExit(code2);
441231
441392
  };
@@ -441310,7 +441471,7 @@ async function runBidirectionalMode(agent2, conversationId, _outputFormat, inclu
441310
441471
  agentId: agent2.id,
441311
441472
  conversationId,
441312
441473
  approvalMessages,
441313
- extensionEventEmitter: headlessExtensionRuntime.eventEmitter
441474
+ extensionEventEmitter: headlessExtensionAdapter.eventEmitter
441314
441475
  });
441315
441476
  const drainResult = await drainStreamWithResume(approvalStream, createBuffers(agent2.id), () => {}, undefined, undefined, undefined, reminderContextTracker);
441316
441477
  if (drainResult.stopReason === "error" || drainResult.stopReason === "cancelled") {
@@ -441565,7 +441726,7 @@ async function runBidirectionalMode(agent2, conversationId, _outputFormat, inclu
441565
441726
  agentId: agent2.id,
441566
441727
  conversationId: targetConversationId,
441567
441728
  approvalMessages: [approvalInput],
441568
- extensionEventEmitter: headlessExtensionRuntime.eventEmitter
441729
+ extensionEventEmitter: headlessExtensionAdapter.eventEmitter
441569
441730
  });
441570
441731
  const drainResult = await drainStreamWithResume(approvalStream, createBuffers(agent2.id), () => {}, undefined, undefined, undefined, reminderContextTracker);
441571
441732
  if (drainResult.stopReason === "error") {
@@ -441846,7 +442007,7 @@ async function runBidirectionalMode(agent2, conversationId, _outputFormat, inclu
441846
442007
  skillSources,
441847
442008
  maybeLaunchReflectionSubagent
441848
442009
  });
441849
- headlessExtensionRuntime.updateContext(createHeadlessExtensionContext({
442010
+ headlessExtensionAdapter.updateContext(createHeadlessExtensionContext({
441850
442011
  agent: agent2,
441851
442012
  conversationId,
441852
442013
  reflectionSettings
@@ -441861,7 +442022,7 @@ async function runBidirectionalMode(agent2, conversationId, _outputFormat, inclu
441861
442022
  agent: agent2,
441862
442023
  conversationId,
441863
442024
  input: currentInput,
441864
- runtime: headlessExtensionRuntime
442025
+ adapter: headlessExtensionAdapter
441865
442026
  });
441866
442027
  while (true) {
441867
442028
  numTurns++;
@@ -441890,7 +442051,7 @@ async function runBidirectionalMode(agent2, conversationId, _outputFormat, inclu
441890
442051
  const turnToolContext = await prepareHeadlessToolExecutionContext({
441891
442052
  agentId: agent2.id,
441892
442053
  conversationId,
441893
- extensionEventEmitter: headlessExtensionRuntime.eventEmitter
442054
+ extensionEventEmitter: headlessExtensionAdapter.eventEmitter
441894
442055
  });
441895
442056
  availableTools = turnToolContext.availableTools;
441896
442057
  stream5 = await sendMessageStream(conversationId, currentInput, {
@@ -442206,7 +442367,7 @@ var init_headless = __esm(async () => {
442206
442367
  init_accumulator(),
442207
442368
  init_approval_classification(),
442208
442369
  init_stream2(),
442209
- init_headless_extension_runtime(),
442370
+ init_headless_extension_adapter(),
442210
442371
  init_manager4(),
442211
442372
  init_toolset()
442212
442373
  ]);
@@ -444130,19 +444291,19 @@ function withDefaultReservations(options3) {
444130
444291
  ]
444131
444292
  };
444132
444293
  }
444133
- function createExtensionRuntime2(options3) {
444134
- return createExtensionRuntime(withDefaultReservations(options3));
444294
+ function createExtensionAdapter2(options3) {
444295
+ return createExtensionAdapter(withDefaultReservations(options3));
444135
444296
  }
444136
444297
  var init_local_extension_loader = __esm(async () => {
444137
444298
  init_registry2();
444138
- init_extension_host();
444139
- init_extension_runtime();
444299
+ init_extension_adapter();
444300
+ init_extension_engine();
444140
444301
  init_capabilities2();
444141
444302
  init_capabilities2();
444142
444303
  await init_manager4();
444143
444304
  });
444144
444305
 
444145
- // src/cli/extensions/use-local-extension-runtime.ts
444306
+ // src/cli/extensions/use-local-extension-adapter.ts
444146
444307
  function createExtensionBackendApi(backend4) {
444147
444308
  return {
444148
444309
  forkConversation(conversationId, options3) {
@@ -444159,39 +444320,39 @@ function createExtensionBackendApi(backend4) {
444159
444320
  }
444160
444321
  };
444161
444322
  }
444162
- function useLocalExtensionRuntime(initialContext, options3 = {}) {
444163
- const runtime = import_react40.useMemo(() => createExtensionRuntime2({
444323
+ function useLocalExtensionAdapter(initialContext, options3 = {}) {
444324
+ const adapter = import_react40.useMemo(() => createExtensionAdapter2({
444164
444325
  disabled: options3.disabled,
444165
444326
  getBackendApi: () => createExtensionBackendApi(getBackend()),
444166
444327
  getClient,
444167
444328
  initialContext
444168
444329
  }), []);
444169
- const snapshot = import_react40.useSyncExternalStore(runtime.subscribe, runtime.getSnapshot, runtime.getSnapshot);
444330
+ const snapshot = import_react40.useSyncExternalStore(adapter.subscribe, adapter.getSnapshot, adapter.getSnapshot);
444170
444331
  import_react40.useEffect(() => {
444171
- runtime.updateContext(initialContext);
444172
- }, [initialContext, runtime]);
444332
+ adapter.updateContext(initialContext);
444333
+ }, [initialContext, adapter]);
444173
444334
  import_react40.useEffect(() => {
444174
- runtime.reload();
444335
+ adapter.reload();
444175
444336
  return () => {
444176
- runtime.dispose();
444337
+ adapter.dispose();
444177
444338
  };
444178
- }, [runtime]);
444339
+ }, [adapter]);
444179
444340
  return import_react40.useMemo(() => ({
444180
- emitEvent: runtime.emitEvent,
444181
- eventEmitter: runtime.eventEmitter,
444182
- getBackendApi: runtime.getBackendApi,
444183
- getContext: runtime.getContext,
444341
+ emitEvent: adapter.emitEvent,
444342
+ eventEmitter: adapter.eventEmitter,
444343
+ getBackendApi: adapter.getBackendApi,
444344
+ getContext: adapter.getContext,
444184
444345
  hadStatuslineRenderer: snapshot.hadStatuslineRenderer,
444185
444346
  hasExtensionSources: snapshot.hasExtensionSources,
444186
- host: runtime.host,
444347
+ engine: adapter.engine,
444187
444348
  isLoading: snapshot.isLoading,
444188
444349
  registry: snapshot.registry,
444189
- reload: runtime.reload,
444190
- updateContext: runtime.updateContext
444191
- }), [runtime, snapshot]);
444350
+ reload: adapter.reload,
444351
+ updateContext: adapter.updateContext
444352
+ }), [adapter, snapshot]);
444192
444353
  }
444193
444354
  var import_react40;
444194
- var init_use_local_extension_runtime = __esm(async () => {
444355
+ var init_use_local_extension_adapter = __esm(async () => {
444195
444356
  init_backend2();
444196
444357
  init_client2();
444197
444358
  await __promiseAll([
@@ -455584,7 +455745,7 @@ function Input({
455584
455745
  terminalWidth,
455585
455746
  shouldAnimate = true,
455586
455747
  statusLinePayload,
455587
- extensionRuntime,
455748
+ extensionAdapter,
455588
455749
  statusLinePrompt,
455589
455750
  onCycleReasoningEffort,
455590
455751
  footerNotification,
@@ -456227,7 +456388,7 @@ function Input({
456227
456388
  flexDirection: "column",
456228
456389
  children: [
456229
456390
  !suppressDividers && /* @__PURE__ */ jsx_dev_runtime61.jsxDEV(ExtensionPanelRow, {
456230
- panels: extensionRuntime.registry?.ui.panels,
456391
+ panels: extensionAdapter.registry?.ui.panels,
456231
456392
  terminalWidth
456232
456393
  }, undefined, false, undefined, this),
456233
456394
  !suppressDividers && /* @__PURE__ */ jsx_dev_runtime61.jsxDEV(ProductStatusRow, {
@@ -456293,7 +456454,7 @@ function Input({
456293
456454
  serverUrl,
456294
456455
  workingDirectory: process.cwd(),
456295
456456
  conversationId,
456296
- extensionCommands: extensionRuntime.registry?.commands
456457
+ extensionCommands: extensionAdapter.registry?.commands
456297
456458
  }, undefined, false, undefined, this),
456298
456459
  !suppressDividers && /* @__PURE__ */ jsx_dev_runtime61.jsxDEV(StatuslineSlot, {
456299
456460
  ctrlCPressed,
@@ -456311,7 +456472,7 @@ function Input({
456311
456472
  hideFooter,
456312
456473
  rightColumnWidth: footerRightColumnWidth,
456313
456474
  statusLinePayload,
456314
- extensionRuntime,
456475
+ extensionAdapter,
456315
456476
  transientHint: statuslineTransientHint
456316
456477
  }, undefined, false, undefined, this)
456317
456478
  ]
@@ -456359,7 +456520,7 @@ function Input({
456359
456520
  reserveInputSpace,
456360
456521
  inputChromeHeight,
456361
456522
  statusLinePayload,
456362
- extensionRuntime,
456523
+ extensionAdapter,
456363
456524
  goalStatusText,
456364
456525
  promptChar,
456365
456526
  promptVisualWidth,
@@ -456473,7 +456634,7 @@ var init_InputRich = __esm(async () => {
456473
456634
  hideFooter,
456474
456635
  rightColumnWidth,
456475
456636
  statusLinePayload,
456476
- extensionRuntime,
456637
+ extensionAdapter,
456477
456638
  transientHint
456478
456639
  }) {
456479
456640
  const hideFooterContent = hideFooter;
@@ -456495,12 +456656,12 @@ var init_InputRich = __esm(async () => {
456495
456656
  });
456496
456657
  const statuslineContext = {
456497
456658
  ...baseStatuslineContext,
456498
- statuses: evaluateLocalExtensionStatuses(extensionRuntime.registry, baseStatuslineContext)
456659
+ statuses: evaluateLocalExtensionStatuses(extensionAdapter.registry, baseStatuslineContext)
456499
456660
  };
456500
- extensionRuntime.updateContext(statuslineContext);
456661
+ extensionAdapter.updateContext(statuslineContext);
456501
456662
  const builtInStatuslineRenderer = getBuiltinStatuslineRenderer(DEFAULT_STATUSLINE_RENDERER_ID);
456502
- const localStatuslineRenderer = extensionRuntime.registry?.ui.statuslineRenderer ?? null;
456503
- const extensionStatuslineLoading = extensionRuntime.isLoading && (extensionRuntime.hasExtensionSources || extensionRuntime.hadStatuslineRenderer);
456663
+ const localStatuslineRenderer = extensionAdapter.registry?.ui.statuslineRenderer ?? null;
456664
+ const extensionStatuslineLoading = extensionAdapter.isLoading && (extensionAdapter.hasExtensionSources || extensionAdapter.hadStatuslineRenderer);
456504
456665
  const customStatuslineActive = Boolean(localStatuslineRenderer || extensionStatuslineLoading);
456505
456666
  const idleSlotAvailable = !hideFooterContent && !preemption && !transientHint;
456506
456667
  if (idleSlotAvailable && localStatuslineRenderer) {
@@ -485238,7 +485399,7 @@ function AppView(props) {
485238
485399
  staticRenderEpoch,
485239
485400
  statusLinePayload,
485240
485401
  statusLinePrompt,
485241
- extensionRuntime,
485402
+ extensionAdapter,
485242
485403
  streaming: streaming3,
485243
485404
  stubDescriptions,
485244
485405
  thinkingMessage,
@@ -485423,7 +485584,7 @@ function AppView(props) {
485423
485584
  terminalWidth: chromeColumns,
485424
485585
  shouldAnimate,
485425
485586
  statusLinePayload,
485426
- extensionRuntime,
485587
+ extensionAdapter,
485427
485588
  statusLinePrompt,
485428
485589
  footerNotification: footerUpdateText,
485429
485590
  showInspirationalPromptHints
@@ -488269,7 +488430,7 @@ function useConversationLoop(ctx) {
488269
488430
  emptyResponseRetriesRef,
488270
488431
  executingToolCallIdsRef,
488271
488432
  generateConversationDescription,
488272
- extensionRuntime,
488433
+ extensionAdapter,
488273
488434
  generateConversationTitle,
488274
488435
  hasConversationModelOverrideRef,
488275
488436
  interruptQueuedRef,
@@ -488504,7 +488665,7 @@ function useConversationLoop(ctx) {
488504
488665
  return;
488505
488666
  }
488506
488667
  processingConversationRef.current += 1;
488507
- if (hasUserMessageInput(currentInput) && extensionRuntime.hasExtensionSources && !extensionRuntime.isLoading) {
488668
+ if (hasUserMessageInput(currentInput) && extensionAdapter.hasExtensionSources && !extensionAdapter.isLoading) {
488508
488669
  const originalInput = currentInput;
488509
488670
  try {
488510
488671
  const turnStartEvent = {
@@ -488512,7 +488673,7 @@ function useConversationLoop(ctx) {
488512
488673
  conversationId: conversationIdRef.current ?? null,
488513
488674
  input: currentInput
488514
488675
  };
488515
- await extensionRuntime.emitEvent("turn_start", turnStartEvent);
488676
+ await extensionAdapter.emitEvent("turn_start", turnStartEvent);
488516
488677
  currentInput = isTurnInputArray2(turnStartEvent.input) ? turnStartEvent.input : originalInput;
488517
488678
  } catch {
488518
488679
  currentInput = originalInput;
@@ -489800,7 +489961,7 @@ ${feedback}
489800
489961
  setUiPermissionMode,
489801
489962
  prepareScopedToolExecutionContext,
489802
489963
  maybeStreamSyntheticNoModelResponse,
489803
- extensionRuntime
489964
+ extensionAdapter
489804
489965
  ]);
489805
489966
  return processConversation;
489806
489967
  }
@@ -489868,7 +490029,7 @@ function useConversationSwitching(ctx) {
489868
490029
  currentModelHandle,
489869
490030
  currentModelId,
489870
490031
  emittedIdsRef,
489871
- extensionRuntime,
490032
+ extensionAdapter,
489872
490033
  hasBackfilledRef,
489873
490034
  isAgentBusy,
489874
490035
  maybeCarryOverActiveConversationModel,
@@ -490069,7 +490230,7 @@ function useConversationSwitching(ctx) {
490069
490230
  }
490070
490231
  }).catch(() => {});
490071
490232
  sessionHooksRanRef.current = true;
490072
- extensionRuntime.emitEvent("conversation_open", {
490233
+ extensionAdapter.emitEvent("conversation_open", {
490073
490234
  agentId,
490074
490235
  agentName: agentName ?? null,
490075
490236
  conversationId,
@@ -490099,7 +490260,7 @@ function useConversationSwitching(ctx) {
490099
490260
  setCommandRunning,
490100
490261
  setStreaming,
490101
490262
  recoverRestoredPendingApprovals,
490102
- extensionRuntime,
490263
+ extensionAdapter,
490103
490264
  resetDeferredToolCallCommits,
490104
490265
  resetTrajectoryBases,
490105
490266
  abortControllerRef,
@@ -493329,7 +493490,7 @@ function useSubmitHandler(ctx) {
493329
493490
  currentModelProvider,
493330
493491
  effectiveContextWindowSize,
493331
493492
  emittedIdsRef,
493332
- extensionRuntime,
493493
+ extensionAdapter,
493333
493494
  firstUserQueryRef,
493334
493495
  flushPendingReasoningEffort,
493335
493496
  generateConversationDescription,
@@ -493482,7 +493643,7 @@ ${SYSTEM_REMINDER_CLOSE}` : "";
493482
493643
  }
493483
493644
  const isSlashCommand = userTextForInput.startsWith("/");
493484
493645
  const parsedExtensionCommand = isSlashCommand ? parseExtensionSlashCommand(userTextForInput.trim()) : null;
493485
- const queueBypassExtensionCommand = parsedExtensionCommand ? extensionRuntime.registry?.commands[parsedExtensionCommand.command] : undefined;
493646
+ const queueBypassExtensionCommand = parsedExtensionCommand ? extensionAdapter.registry?.commands[parsedExtensionCommand.command] : undefined;
493486
493647
  const isExtensionCommandShadowedByCustom = isAgentBusy() && queueBypassExtensionCommand?.runWhenBusy === true ? await hasCustomCommand(parsedExtensionCommand?.command ?? "") : false;
493487
493648
  const shouldBypassQueue = isSlashCommand && (isInteractiveCommand(userTextForInput) || isNonStateCommand(userTextForInput) || queueBypassExtensionCommand?.runWhenBusy === true && !isExtensionCommandShadowedByCustom);
493488
493649
  if (isAgentBusy() && isSlashCommand && !shouldBypassQueue) {
@@ -493962,7 +494123,7 @@ Tip: Use /clear instead to clear the current message buffer.`;
493962
494123
  }
493963
494124
  }).catch(() => {});
493964
494125
  sessionHooksRanRef.current = true;
493965
- extensionRuntime.emitEvent("conversation_open", {
494126
+ extensionAdapter.emitEvent("conversation_open", {
493966
494127
  agentId,
493967
494128
  agentName: agentName ?? null,
493968
494129
  conversationId: conversation.id,
@@ -494019,7 +494180,7 @@ Tip: Use /clear instead to clear the current message buffer.`;
494019
494180
  }
494020
494181
  }).catch(() => {});
494021
494182
  sessionHooksRanRef.current = true;
494022
- extensionRuntime.emitEvent("conversation_open", {
494183
+ extensionAdapter.emitEvent("conversation_open", {
494023
494184
  agentId,
494024
494185
  agentName: agentName ?? null,
494025
494186
  conversationId: forked.id,
@@ -494083,7 +494244,7 @@ Tip: Use /clear instead to clear the current message buffer.`;
494083
494244
  }
494084
494245
  }).catch(() => {});
494085
494246
  sessionHooksRanRef.current = true;
494086
- extensionRuntime.emitEvent("conversation_open", {
494247
+ extensionAdapter.emitEvent("conversation_open", {
494087
494248
  agentId,
494088
494249
  agentName: agentName ?? null,
494089
494250
  conversationId: conversation.id,
@@ -494975,7 +495136,7 @@ ${SYSTEM_REMINDER_CLOSE}`),
494975
495136
  }
494976
495137
  return { submitted: true };
494977
495138
  }
494978
- const matchedExtensionCommand = parsedExtensionCommand ? extensionRuntime.registry?.commands[parsedExtensionCommand.command] : undefined;
495139
+ const matchedExtensionCommand = parsedExtensionCommand ? extensionAdapter.registry?.commands[parsedExtensionCommand.command] : undefined;
494979
495140
  if (parsedExtensionCommand && matchedExtensionCommand) {
494980
495141
  const showInTranscript = matchedExtensionCommand.showInTranscript;
494981
495142
  const shouldLockCommand = !matchedExtensionCommand.runWhenBusy;
@@ -494985,11 +495146,11 @@ ${SYSTEM_REMINDER_CLOSE}`),
494985
495146
  setCommandRunning(true);
494986
495147
  }
494987
495148
  try {
494988
- const extensionContext = extensionRuntime.getContext();
495149
+ const extensionContext = extensionAdapter.getContext();
494989
495150
  const cwd2 = getCurrentWorkingDirectory();
494990
495151
  const conversation = createExtensionConversationHandle({
494991
495152
  agentId,
494992
- backend: extensionRuntime.getBackendApi(),
495153
+ backend: extensionAdapter.getBackendApi(),
494993
495154
  conversationId: conversationIdRef.current,
494994
495155
  workingDirectory: cwd2
494995
495156
  });
@@ -495000,7 +495161,7 @@ ${SYSTEM_REMINDER_CLOSE}`),
495000
495161
  command: parsedExtensionCommand.command,
495001
495162
  conversation: { ...conversation, id: conversationIdRef.current },
495002
495163
  cwd: cwd2,
495003
- getContext: extensionRuntime.getContext,
495164
+ getContext: extensionAdapter.getContext,
495004
495165
  model: {
495005
495166
  id: currentModelId ?? llmConfigRef.current?.model ?? extensionContext.model.id,
495006
495167
  displayName: extensionContext.model.displayName
@@ -495305,7 +495466,7 @@ ${SYSTEM_REMINDER_CLOSE}
495305
495466
  conversationId,
495306
495467
  currentModelHandle,
495307
495468
  currentModelId,
495308
- extensionRuntime,
495469
+ extensionAdapter,
495309
495470
  effectiveContextWindowSize,
495310
495471
  commandRunner,
495311
495472
  handleExit,
@@ -495844,7 +496005,7 @@ function App2({
495844
496005
  const sessionStartTimeRef = import_react122.useRef(Date.now());
495845
496006
  const sessionHooksRanRef = import_react122.useRef(false);
495846
496007
  const sessionExtensionStartAttemptedRef = import_react122.useRef(false);
495847
- const extensionRuntimeRef = import_react122.useRef(null);
496008
+ const extensionAdapterRef = import_react122.useRef(null);
495848
496009
  import_react122.useEffect(() => {
495849
496010
  if (agentId && agentId !== "loading") {
495850
496011
  chunkLog.init(agentId, telemetry.getSessionId());
@@ -495917,10 +496078,10 @@ function App2({
495917
496078
  try {
495918
496079
  await runSessionEndHooks(durationMs, undefined, undefined, agentIdRef.current ?? undefined, conversationIdRef.current ?? undefined);
495919
496080
  } catch {}
495920
- const extensionRuntime2 = extensionRuntimeRef.current;
495921
- if (extensionRuntime2 && !extensionRuntime2.isLoading && extensionRuntime2.hasExtensionSources) {
496081
+ const extensionAdapter2 = extensionAdapterRef.current;
496082
+ if (extensionAdapter2 && !extensionAdapter2.isLoading && extensionAdapter2.hasExtensionSources) {
495922
496083
  try {
495923
- await extensionRuntime2.emitEvent("conversation_close", {
496084
+ await extensionAdapter2.emitEvent("conversation_close", {
495924
496085
  agentId: agentIdRef.current ?? null,
495925
496086
  conversationId: conversationIdRef.current ?? null,
495926
496087
  durationMs,
@@ -496214,14 +496375,14 @@ function App2({
496214
496375
  conversationId: conversationIdRef.current,
496215
496376
  overrideModel: desiredModel,
496216
496377
  workingDirectory,
496217
- extensionEventEmitter: extensionRuntimeRef.current?.eventEmitter
496378
+ extensionEventEmitter: extensionAdapterRef.current?.eventEmitter
496218
496379
  });
496219
496380
  }
496220
496381
  if (desiredModel) {
496221
496382
  return prepareToolExecutionContextForResolvedTarget({
496222
496383
  modelIdentifier: desiredModel,
496223
496384
  conversationId: conversationIdRef.current,
496224
- extensionEventEmitter: extensionRuntimeRef.current?.eventEmitter,
496385
+ extensionEventEmitter: extensionAdapterRef.current?.eventEmitter,
496225
496386
  toolsetPreference: currentToolsetPreference,
496226
496387
  workingDirectory
496227
496388
  });
@@ -496229,7 +496390,7 @@ function App2({
496229
496390
  return prepareToolExecutionContextForResolvedTarget({
496230
496391
  modelIdentifier: null,
496231
496392
  conversationId: conversationIdRef.current,
496232
- extensionEventEmitter: extensionRuntimeRef.current?.eventEmitter,
496393
+ extensionEventEmitter: extensionAdapterRef.current?.eventEmitter,
496233
496394
  toolsetPreference: currentToolsetPreference,
496234
496395
  workingDirectory
496235
496396
  });
@@ -496687,29 +496848,29 @@ function App2({
496687
496848
  isLocalBackend,
496688
496849
  statusLinePayload
496689
496850
  ]);
496690
- const extensionRuntime = useLocalExtensionRuntime(extensionContext, {
496851
+ const extensionAdapter = useLocalExtensionAdapter(extensionContext, {
496691
496852
  disabled: extensionsDisabled
496692
496853
  });
496693
496854
  import_react122.useEffect(() => {
496694
- extensionRuntimeRef.current = extensionRuntime;
496695
- }, [extensionRuntime]);
496855
+ extensionAdapterRef.current = extensionAdapter;
496856
+ }, [extensionAdapter]);
496696
496857
  import_react122.useEffect(() => {
496697
496858
  if (!agentId || agentId === "loading")
496698
496859
  return;
496699
496860
  if (sessionExtensionStartAttemptedRef.current)
496700
496861
  return;
496701
- if (extensionRuntime.isLoading)
496862
+ if (extensionAdapter.isLoading)
496702
496863
  return;
496703
- if (!extensionRuntime.hasExtensionSources)
496864
+ if (!extensionAdapter.hasExtensionSources)
496704
496865
  return;
496705
496866
  sessionExtensionStartAttemptedRef.current = true;
496706
- extensionRuntime.emitEvent("conversation_open", {
496867
+ extensionAdapter.emitEvent("conversation_open", {
496707
496868
  agentId,
496708
496869
  agentName: agentName ?? null,
496709
496870
  conversationId: conversationIdRef.current ?? null,
496710
496871
  reason: "startup"
496711
496872
  });
496712
- }, [agentId, agentName, extensionRuntime]);
496873
+ }, [agentId, agentName, extensionAdapter]);
496713
496874
  import_react122.useEffect(() => {
496714
496875
  buffersRef.current.agentId = agentState?.id;
496715
496876
  }, [agentState?.id]);
@@ -497205,7 +497366,7 @@ function App2({
497205
497366
  });
497206
497367
  });
497207
497368
  };
497208
- if (!extensionRuntime.isLoading) {
497369
+ if (!extensionAdapter.isLoading) {
497209
497370
  refreshAgentFromRegisteredProviderMetadata();
497210
497371
  }
497211
497372
  const unsubscribe = subscribePiProviderRegistry(refreshAgentFromRegisteredProviderMetadata);
@@ -497215,7 +497376,7 @@ function App2({
497215
497376
  };
497216
497377
  }, [
497217
497378
  agentId,
497218
- extensionRuntime.isLoading,
497379
+ extensionAdapter.isLoading,
497219
497380
  hasConversationModelOverrideRef,
497220
497381
  isLocalBackend,
497221
497382
  loadingState
@@ -497474,7 +497635,7 @@ Memory may be stale. Try running: git -C ${getScopedMemoryFilesystemRoot(agentId
497474
497635
  emptyResponseRetriesRef,
497475
497636
  executingToolCallIdsRef,
497476
497637
  generateConversationDescription,
497477
- extensionRuntime,
497638
+ extensionAdapter,
497478
497639
  generateConversationTitle,
497479
497640
  hasConversationModelOverrideRef,
497480
497641
  interruptQueuedRef,
@@ -497741,7 +497902,7 @@ Memory may be stale. Try running: git -C ${getScopedMemoryFilesystemRoot(agentId
497741
497902
  currentModelHandle,
497742
497903
  currentModelId,
497743
497904
  emittedIdsRef,
497744
- extensionRuntime,
497905
+ extensionAdapter,
497745
497906
  hasBackfilledRef,
497746
497907
  isAgentBusy,
497747
497908
  maybeCarryOverActiveConversationModel,
@@ -497827,7 +497988,7 @@ Memory may be stale. Try running: git -C ${getScopedMemoryFilesystemRoot(agentId
497827
497988
  currentModelProvider,
497828
497989
  effectiveContextWindowSize,
497829
497990
  emittedIdsRef,
497830
- extensionRuntime,
497991
+ extensionAdapter,
497831
497992
  firstUserQueryRef,
497832
497993
  flushPendingReasoningEffort: () => flushPendingReasoningEffort(),
497833
497994
  generateConversationDescription,
@@ -498474,7 +498635,7 @@ Memory may be stale. Try running: git -C ${getScopedMemoryFilesystemRoot(agentId
498474
498635
  staticRenderEpoch,
498475
498636
  statusLinePayload,
498476
498637
  statusLinePrompt: CLI_GLYPHS.prompt,
498477
- extensionRuntime,
498638
+ extensionAdapter,
498478
498639
  streaming: streaming3,
498479
498640
  stubDescriptions,
498480
498641
  thinkingMessage,
@@ -498538,7 +498699,7 @@ var init_AppCoordinator = __esm(async () => {
498538
498699
  init_use_reasoning_cycle();
498539
498700
  await __promiseAll([
498540
498701
  init_context2(),
498541
- init_use_local_extension_runtime(),
498702
+ init_use_local_extension_adapter(),
498542
498703
  init_accumulator(),
498543
498704
  init_format_args_display(),
498544
498705
  init_subagent_aggregation(),
@@ -511896,4 +512057,4 @@ Error during initialization: ${message}`);
511896
512057
  }
511897
512058
  main2();
511898
512059
 
511899
- //# debugId=8D2F67AC962C172564756E2164756E21
512060
+ //# debugId=68D5011FF656D31164756E2164756E21
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@letta-ai/letta-code",
3
- "version": "0.26.7",
3
+ "version": "0.26.8",
4
4
  "description": "Letta Code is a CLI tool for interacting with stateful Letta agents from the terminal.",
5
5
  "type": "module",
6
6
  "packageManager": "bun@1.3.0",
@@ -96,7 +96,7 @@ Keep state separate from source code. Do not store secrets in plain JSON; use ex
96
96
 
97
97
  ## Timers and subscriptions
98
98
 
99
- Timers are okay for active-session behavior, but they only run while the extension host is alive. Always clear them:
99
+ Timers are okay for active-session behavior, but they only run while the extension engine is alive. Always clear them:
100
100
 
101
101
  ```ts
102
102
  const timer = setInterval(update, 30_000);