summaryrefslogtreecommitdiffhomepage
path: root/packages/core/src/credentials/store.ts
diff options
context:
space:
mode:
authorAdam Malczewski <[email protected]>2026-05-22 15:24:13 +0900
committerAdam Malczewski <[email protected]>2026-05-22 15:24:13 +0900
commit9ecaabd87c0e51b8a7408dabb0133a9344586859 (patch)
tree4b5809ab23948a5e3f558f3aa34c52d5038f4e19 /packages/core/src/credentials/store.ts
parent8f1dd855f0c4c877bff8d3a4ba193432b268b1c2 (diff)
downloaddispatch-9ecaabd87c0e51b8a7408dabb0133a9344586859.tar.gz
dispatch-9ecaabd87c0e51b8a7408dabb0133a9344586859.zip
feat: agent builder, CWD support, auto-save, UI polish, unavailable tool handling
- Agent Builder: full CRUD with card grid, drag-and-drop model reorder, edit/delete - Auto-save on edit with 600ms debounce, AbortController for concurrency, fieldset disabled until name entered - Agent definitions stored as TOML with cwd field, loaded from global/project dirs - Working directory: per-tab CWD override in Chat Settings, agent default CWD, auto-create on first message - CWD validation: check-dir endpoint with ~ expansion, real-time validity indicator - Subagent CWD validated against parent's effective CWD using path.relative - Unavailable tool calls: caught gracefully, shown as tool call with error badge, model retries - UI: tab bar border radius, sidebar border removed, chat input ghost style, scroll-to-bottom rectangle - Skills dir collapse uses CSS rotation, Model Choice renamed to Chat Settings, System Prompt view removed - Reusable SkillsBrowser/ToolPermissions with external mode for Agent Builder - ModelSelector: Agent/Manual toggle, agent list, Agent Settings link - Page router, skills recursive scanning, bin/up gopass removed, docker volume mounts
Diffstat (limited to 'packages/core/src/credentials/store.ts')
-rw-r--r--packages/core/src/credentials/store.ts26
1 files changed, 17 insertions, 9 deletions
diff --git a/packages/core/src/credentials/store.ts b/packages/core/src/credentials/store.ts
index 6c814f9..662b322 100644
--- a/packages/core/src/credentials/store.ts
+++ b/packages/core/src/credentials/store.ts
@@ -1,6 +1,6 @@
+import { existsSync, readFileSync } from "node:fs";
import { getDatabase } from "../db/index.js";
import type { ClaudeCredentials } from "./claude.js";
-import { existsSync, readFileSync } from "node:fs";
export interface StoredCredential {
keyId: string;
@@ -41,7 +41,8 @@ function parseCredentialsFile(raw: string): ClaudeCredentials | null {
accessToken: creds.accessToken as string,
refreshToken: creds.refreshToken as string,
expiresAt: creds.expiresAt as number,
- subscriptionType: typeof creds.subscriptionType === "string" ? creds.subscriptionType : undefined,
+ subscriptionType:
+ typeof creds.subscriptionType === "string" ? creds.subscriptionType : undefined,
};
}
@@ -62,7 +63,10 @@ export function importCredentialsFromFile(
try {
raw = readFileSync(filePath, "utf-8").trim();
} catch (e) {
- return { success: false, error: `Failed to read file: ${e instanceof Error ? e.message : String(e)}` };
+ return {
+ success: false,
+ error: `Failed to read file: ${e instanceof Error ? e.message : String(e)}`,
+ };
}
if (!raw) {
@@ -106,9 +110,11 @@ export function importCredentialsFromFile(
*/
export function getStoredCredentials(keyId: string): StoredCredential | null {
const db = getDatabase();
- const row = db.query(
- "SELECT key_id, provider, access_token, refresh_token, expires_at, subscription_type, source_file, imported_at, updated_at FROM credentials WHERE key_id = $keyId",
- ).get({ $keyId: keyId }) as Record<string, unknown> | null;
+ const row = db
+ .query(
+ "SELECT key_id, provider, access_token, refresh_token, expires_at, subscription_type, source_file, imported_at, updated_at FROM credentials WHERE key_id = $keyId",
+ )
+ .get({ $keyId: keyId }) as Record<string, unknown> | null;
if (!row) return null;
@@ -159,9 +165,11 @@ export function deleteStoredCredentials(keyId: string): void {
*/
export function listStoredCredentials(): StoredCredential[] {
const db = getDatabase();
- const rows = db.query(
- "SELECT key_id, provider, access_token, refresh_token, expires_at, subscription_type, source_file, imported_at, updated_at FROM credentials ORDER BY key_id",
- ).all() as Array<Record<string, unknown>>;
+ const rows = db
+ .query(
+ "SELECT key_id, provider, access_token, refresh_token, expires_at, subscription_type, source_file, imported_at, updated_at FROM credentials ORDER BY key_id",
+ )
+ .all() as Array<Record<string, unknown>>;
return rows.map((row) => ({
keyId: row.key_id as string,