Skip to main content

set_snapshot_root

Method
This is a method of the Agent class in the agent module.
Root filesystem change-tracking at project_path. Bots/gateway resolve file tools against a per-chat Workspace and attach it after construction, but the FileSnapshot backing :meth:undo/:meth:redo/:meth:diff was created at __init__ time rooted at os.getcwd(). Without this, /undo tracks the wrong directory (never where the tools actually wrote). Call this once after the workspace is known so change tracking follows the tools. Rooting at a new directory clears the undo/redo stacks (they belong to the previous root). A no-op when the root is unchanged. Returns True when a snapshot manager is rooted at project_path.

Signature

Parameters

str
required
No description available.

Returns

bool
The result of the operation.

Uses

  • abspath
  • FileSnapshot
  • logger.debug

Source

View on GitHub

praisonaiagents/agent/agent.py at line 3407