- Restore native Copilot CLI prompts for authentic Plan Mode behavior - Add SQLite-backed session management for state persistence via system prompt - Implement Adaptive Autonomy (Agent chooses planning vs direct execution) - Fix OpenWebUI custom tool context injection for v0.8.x compatibility - Add compact Live TODO widget synchronized with session.db - Upgrade SDK to github-copilot-sdk==0.1.30 - Remove legacy mode switch RPC calls (moved to prompt-driven orchestration) - Fix intent status localization and widget whitespace optimization - Sync bilingual READMEs and all documentation mirrors to v0.10.0
61 lines
1.9 KiB
Python
61 lines
1.9 KiB
Python
import asyncio
|
|
import os
|
|
import logging
|
|
import json
|
|
from copilot import CopilotClient, PermissionHandler
|
|
|
|
# Configure logging
|
|
logging.basicConfig(level=logging.INFO)
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
async def main():
|
|
"""Verify session persistence in the configured directory."""
|
|
# Test path based on our persistent configuration
|
|
config_dir = os.path.expanduser(
|
|
"/app/backend/data/copilot"
|
|
if os.path.exists("/app/backend/data")
|
|
else "~/.copilot"
|
|
)
|
|
logger.info(f"Targeting config directory: {config_dir}")
|
|
|
|
# Ensure it exists
|
|
os.makedirs(config_dir, exist_ok=True)
|
|
|
|
client = CopilotClient({"config_dir": config_dir})
|
|
await client.start()
|
|
|
|
try:
|
|
# 1. Create a session
|
|
logger.info("Creating a persistent session...")
|
|
session = await client.create_session(
|
|
{"on_permission_request": PermissionHandler.approve_all, "model": "gpt-4o"}
|
|
)
|
|
chat_id = session.session_id
|
|
logger.info(f"Session ID: {chat_id}")
|
|
|
|
# 2. Verify file structure on host
|
|
session_state_dir = os.path.join(config_dir, "session-state", chat_id)
|
|
logger.info(f"Expected metadata path: {session_state_dir}")
|
|
|
|
# We need to wait a bit for some meta-files to appear or just check if the directory was created
|
|
if os.path.exists(session_state_dir):
|
|
logger.info(f"✅ SUCCESS: Session state directory created in {config_dir}")
|
|
else:
|
|
logger.error(f"❌ ERROR: Session state directory NOT found in {config_dir}")
|
|
|
|
# 3. Check for specific persistence files
|
|
# history.json / snapshot.json are usually created by the CLI
|
|
await asyncio.sleep(2)
|
|
files = (
|
|
os.listdir(session_state_dir) if os.path.exists(session_state_dir) else []
|
|
)
|
|
logger.info(f"Files found in metadata dir: {files}")
|
|
|
|
finally:
|
|
await client.stop()
|
|
|
|
|
|
if __name__ == "__main__":
|
|
asyncio.run(main())
|