Bring in desk from news
The plugin contract, the model task and the tools roledesk imports, copied rather than reached through an editable install of news, which also exposes a package named pipeline. news stays the source of truth for desk. Refreshed from news/desk at a275c38a1aa0fe80a7ec7dd5781ecccf683f71c6 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
9d666d0937
commit
248ea1636d
36 files changed
+8393
No files matched your search
@@ -0,0 +1,32 @@
|
||||
"""Local credential settings. Read per call so running workers see replacements."""
|
||||
|
||||
import os
|
||||
import sqlite3
|
||||
from contextlib import closing
|
||||
|
||||
from desk.config import AgentConfig
|
||||
|
||||
|
||||
def saved_token(settings: AgentConfig) -> str:
|
||||
if not settings.credentials_database:
|
||||
return ""
|
||||
with closing(sqlite3.connect(settings.credentials_database)) as conn:
|
||||
if not conn.execute(
|
||||
"SELECT 1 FROM sqlite_master WHERE type='table' AND name='credentials'"
|
||||
).fetchone():
|
||||
return ""
|
||||
row = conn.execute("SELECT value FROM credentials WHERE name='claude_oauth'").fetchone()
|
||||
return row[0] if row else ""
|
||||
|
||||
|
||||
def token(settings: AgentConfig) -> str:
|
||||
return saved_token(settings) or os.environ.get("CLAUDE_CODE_OAUTH_TOKEN", "")
|
||||
|
||||
|
||||
def save_token(settings: AgentConfig, value: str) -> None:
|
||||
with closing(sqlite3.connect(settings.credentials_database)) as conn, conn:
|
||||
conn.execute("CREATE TABLE IF NOT EXISTS credentials (name TEXT PRIMARY KEY, value TEXT NOT NULL)")
|
||||
if value:
|
||||
conn.execute("INSERT OR REPLACE INTO credentials VALUES ('claude_oauth', ?)", (value,))
|
||||
else:
|
||||
conn.execute("DELETE FROM credentials WHERE name='claude_oauth'")
|
||||
Reference in new issue
Block a user