类 AgentStateMemoryView

java.lang.Object
io.agentscope.core.memory.AgentStateMemoryView
所有已实现的接口:
Memory

@Deprecated(forRemoval=true, since="2.0.0") public final class AgentStateMemoryView extends Object implements Memory
已过时, 待删除: 此 API 元素将从以后的版本中删除。
since 2.0.0. New code should read context directly from AgentState.getContext().
Read-only Memory adapter that proxies getMessages() to a live AgentState.getContext() resolved at call time.

Exists solely so deprecated 1.x hooks and tools (notably StaticLongTermMemoryHook) keep working after the 2.0 builder dropped agent-owned Memory. All mutating operations throw UnsupportedOperationException; mutate context via AgentState.context instead.

The Supplier contract is "best-effort": a null return is interpreted as "agent not yet bound" and surfaces as an empty message list rather than an exception, so callers may instantiate the view before the owning ReActAgent is constructed.

  • 构造器概要

    构造器
    构造器
    说明
    已过时, 待删除: 此 API 元素将从以后的版本中删除。
     
  • 方法概要

    修饰符和类型
    方法
    说明
    void
    addMessage(Msg message)
    已过时, 待删除: 此 API 元素将从以后的版本中删除。
    Adds a message to the memory.
    void
    已过时, 待删除: 此 API 元素将从以后的版本中删除。
    Clears all messages from memory.
    void
    deleteMessage(int index)
    已过时, 待删除: 此 API 元素将从以后的版本中删除。
    Deletes a message at the specified index.
    已过时, 待删除: 此 API 元素将从以后的版本中删除。
    Retrieves all messages stored in memory.
    void
    loadFrom(AgentStateStore stateStore, String userId, String sessionId)
    已过时, 待删除: 此 API 元素将从以后的版本中删除。
    Load a previously saved message buffer (no-op when none exists).
    void
    saveTo(AgentStateStore stateStore, String userId, String sessionId)
    已过时, 待删除: 此 API 元素将从以后的版本中删除。
    Save the message buffer under the memory_messages session key.

    从类继承的方法 java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 构造器详细资料

    • AgentStateMemoryView

      public AgentStateMemoryView(Supplier<AgentState> stateSupplier)
      已过时, 待删除: 此 API 元素将从以后的版本中删除。
  • 方法详细资料

    • getMessages

      public List<Msg> getMessages()
      已过时, 待删除: 此 API 元素将从以后的版本中删除。
      从接口复制的说明: Memory
      Retrieves all messages stored in memory.
      指定者:
      getMessages 在接口中 Memory
      返回:
      A list of all messages (may be empty but never null)
    • addMessage

      public void addMessage(Msg message)
      已过时, 待删除: 此 API 元素将从以后的版本中删除。
      从接口复制的说明: Memory
      Adds a message to the memory.
      指定者:
      addMessage 在接口中 Memory
      参数:
      message - The message to store in memory
    • deleteMessage

      public void deleteMessage(int index)
      已过时, 待删除: 此 API 元素将从以后的版本中删除。
      从接口复制的说明: Memory
      Deletes a message at the specified index.

      If the index is out of bounds (negative or >= size), this operation should be a no-op rather than throwing an exception. This provides safe cleanup even with concurrent modifications.

      指定者:
      deleteMessage 在接口中 Memory
      参数:
      index - The index of the message to delete (0-based)
    • clear

      public void clear()
      已过时, 待删除: 此 API 元素将从以后的版本中删除。
      从接口复制的说明: Memory
      Clears all messages from memory.

      This operation removes all stored conversation history. Use with caution as this action is typically irreversible unless state has been persisted.

      指定者:
      clear 在接口中 Memory
    • saveTo

      public void saveTo(AgentStateStore stateStore, String userId, String sessionId)
      已过时, 待删除: 此 API 元素将从以后的版本中删除。
      从接口复制的说明: Memory
      Save the message buffer under the memory_messages session key.
      指定者:
      saveTo 在接口中 Memory
    • loadFrom

      public void loadFrom(AgentStateStore stateStore, String userId, String sessionId)
      已过时, 待删除: 此 API 元素将从以后的版本中删除。
      从接口复制的说明: Memory
      Load a previously saved message buffer (no-op when none exists).
      指定者:
      loadFrom 在接口中 Memory