refactor: depend on SecretStore instead of the VaultStore class (P1.2)
Connectors, the connector SDK and registry, setup-connectors, provider-env, the LiteLLM runtime config and the sidecar's `vault` decoration only read and write secrets, so they now take the SecretStore interface. VaultStore is still constructed in the sidecar and the service startup, and its file format is unchanged. AGENTS.md now points at the interface.
This commit is contained in:
@@ -272,9 +272,9 @@ interface AgentPersona {
|
|||||||
|
|
||||||
## 8. Security Constraints (Non-Negotiable)
|
## 8. Security Constraints (Non-Negotiable)
|
||||||
|
|
||||||
1. **Secrets** belong in the secret store (`packages/core/src/vault.ts` until P1.2 replaces
|
1. **Secrets** belong in the secret store (the `SecretStore` interface in
|
||||||
it with a `SecretStore` interface) or an untracked local `.env`. Never in git. `.env.example`
|
`packages/core/src/secret-store.ts`, implemented by `VaultStore` in `vault.ts`) or an
|
||||||
holds placeholders only.
|
untracked local `.env`. Never in git. `.env.example` holds placeholders only.
|
||||||
2. **Injection defense.** Call `scanForInjection()` from `injection-scanner.ts` on all
|
2. **Injection defense.** Call `scanForInjection()` from `injection-scanner.ts` on all
|
||||||
connector and external input.
|
connector and external input.
|
||||||
3. **No eval and no dynamic require.**
|
3. **No eval and no dynamic require.**
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
import type { WaggleConnector, ConnectorResult } from './connector-sdk.js';
|
import type { WaggleConnector, ConnectorResult } from './connector-sdk.js';
|
||||||
import { getConnectorCredential } from './connectors/connector-credentials.js';
|
import { getConnectorCredential } from './connectors/connector-credentials.js';
|
||||||
import type { ToolDefinition } from './tools.js';
|
import type { ToolDefinition } from './tools.js';
|
||||||
import type { VaultStore } from '@waggle/core';
|
import type { SecretStore } from '@waggle/core';
|
||||||
import type { ConnectorDefinition, ConnectorHealth } from '@waggle/shared';
|
import type { ConnectorDefinition, ConnectorHealth } from '@waggle/shared';
|
||||||
|
|
||||||
export interface AuditLogger {
|
export interface AuditLogger {
|
||||||
@@ -25,10 +25,10 @@ interface ConnectorHydration {
|
|||||||
export class ConnectorRegistry {
|
export class ConnectorRegistry {
|
||||||
private connectors = new Map<string, WaggleConnector>();
|
private connectors = new Map<string, WaggleConnector>();
|
||||||
private hydration = new WeakMap<WaggleConnector, ConnectorHydration>();
|
private hydration = new WeakMap<WaggleConnector, ConnectorHydration>();
|
||||||
private vault: VaultStore;
|
private vault: SecretStore;
|
||||||
private auditLogger?: AuditLogger;
|
private auditLogger?: AuditLogger;
|
||||||
|
|
||||||
constructor(vault: VaultStore, auditLogger?: AuditLogger) {
|
constructor(vault: SecretStore, auditLogger?: AuditLogger) {
|
||||||
this.vault = vault;
|
this.vault = vault;
|
||||||
this.auditLogger = auditLogger;
|
this.auditLogger = auditLogger;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import type { ConnectorDefinition, ConnectorHealth, ConnectorStatus, ConnectorActionMeta } from '@waggle/shared';
|
import type { ConnectorDefinition, ConnectorHealth, ConnectorStatus, ConnectorActionMeta } from '@waggle/shared';
|
||||||
import type { VaultStore } from '@waggle/core';
|
import type { SecretStore } from '@waggle/core';
|
||||||
|
|
||||||
/** Full action definition with input/output schemas (runtime-only) */
|
/** Full action definition with input/output schemas (runtime-only) */
|
||||||
export interface ConnectorAction {
|
export interface ConnectorAction {
|
||||||
@@ -58,7 +58,7 @@ export interface WaggleConnector {
|
|||||||
readonly setupGuide?: string;
|
readonly setupGuide?: string;
|
||||||
|
|
||||||
/** Initialize connector with vault credentials */
|
/** Initialize connector with vault credentials */
|
||||||
connect(vault: VaultStore): Promise<void>;
|
connect(vault: SecretStore): Promise<void>;
|
||||||
/** Check if connection is healthy */
|
/** Check if connection is healthy */
|
||||||
healthCheck(): Promise<ConnectorHealth>;
|
healthCheck(): Promise<ConnectorHealth>;
|
||||||
/** Execute an action by name */
|
/** Execute an action by name */
|
||||||
@@ -83,7 +83,7 @@ export abstract class BaseConnector implements WaggleConnector {
|
|||||||
readonly category?: 'productivity' | 'development' | 'crm' | 'data' | 'communication' | 'storage' | 'integration';
|
readonly category?: 'productivity' | 'development' | 'crm' | 'data' | 'communication' | 'storage' | 'integration';
|
||||||
readonly setupGuide?: string;
|
readonly setupGuide?: string;
|
||||||
|
|
||||||
abstract connect(vault: VaultStore): Promise<void>;
|
abstract connect(vault: SecretStore): Promise<void>;
|
||||||
abstract healthCheck(): Promise<ConnectorHealth>;
|
abstract healthCheck(): Promise<ConnectorHealth>;
|
||||||
abstract execute(action: string, params: Record<string, unknown>): Promise<ConnectorResult>;
|
abstract execute(action: string, params: Record<string, unknown>): Promise<ConnectorResult>;
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
import { BaseConnector, type ConnectorAction, type ConnectorResult } from '../connector-sdk.js';
|
import { BaseConnector, type ConnectorAction, type ConnectorResult } from '../connector-sdk.js';
|
||||||
import { getConnectorCredential } from './connector-credentials.js';
|
import { getConnectorCredential } from './connector-credentials.js';
|
||||||
import type { VaultStore } from '@waggle/core';
|
import type { SecretStore } from '@waggle/core';
|
||||||
import type { ConnectorHealth } from '@waggle/shared';
|
import type { ConnectorHealth } from '@waggle/shared';
|
||||||
|
|
||||||
const API_BASE = 'https://api.airtable.com/v0';
|
const API_BASE = 'https://api.airtable.com/v0';
|
||||||
@@ -107,7 +107,7 @@ export class AirtableConnector extends BaseConnector {
|
|||||||
|
|
||||||
private token: string | null = null;
|
private token: string | null = null;
|
||||||
|
|
||||||
async connect(vault: VaultStore): Promise<void> {
|
async connect(vault: SecretStore): Promise<void> {
|
||||||
const cred = getConnectorCredential(vault, this.id);
|
const cred = getConnectorCredential(vault, this.id);
|
||||||
this.token = cred?.value ?? null;
|
this.token = cred?.value ?? null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
import { BaseConnector, type ConnectorAction, type ConnectorResult } from '../connector-sdk.js';
|
import { BaseConnector, type ConnectorAction, type ConnectorResult } from '../connector-sdk.js';
|
||||||
import { getConnectorCredential } from './connector-credentials.js';
|
import { getConnectorCredential } from './connector-credentials.js';
|
||||||
import type { VaultStore } from '@waggle/core';
|
import type { SecretStore } from '@waggle/core';
|
||||||
import type { ConnectorHealth } from '@waggle/shared';
|
import type { ConnectorHealth } from '@waggle/shared';
|
||||||
|
|
||||||
const API_BASE = 'https://app.asana.com/api/1.0';
|
const API_BASE = 'https://app.asana.com/api/1.0';
|
||||||
@@ -101,7 +101,7 @@ export class AsanaConnector extends BaseConnector {
|
|||||||
|
|
||||||
private token: string | null = null;
|
private token: string | null = null;
|
||||||
|
|
||||||
async connect(vault: VaultStore): Promise<void> {
|
async connect(vault: SecretStore): Promise<void> {
|
||||||
const cred = getConnectorCredential(vault, this.id);
|
const cred = getConnectorCredential(vault, this.id);
|
||||||
this.token = cred?.value ?? null;
|
this.token = cred?.value ?? null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
import { BaseConnector, type ConnectorAction, type ConnectorResult } from '../connector-sdk.js';
|
import { BaseConnector, type ConnectorAction, type ConnectorResult } from '../connector-sdk.js';
|
||||||
import { getConnectorCredential } from './connector-credentials.js';
|
import { getConnectorCredential } from './connector-credentials.js';
|
||||||
import type { VaultStore } from '@waggle/core';
|
import type { SecretStore } from '@waggle/core';
|
||||||
import type { ConnectorHealth } from '@waggle/shared';
|
import type { ConnectorHealth } from '@waggle/shared';
|
||||||
|
|
||||||
const API_BASE = 'https://api.bitbucket.org/2.0';
|
const API_BASE = 'https://api.bitbucket.org/2.0';
|
||||||
@@ -96,7 +96,7 @@ export class BitbucketConnector extends BaseConnector {
|
|||||||
|
|
||||||
private token: string | null = null;
|
private token: string | null = null;
|
||||||
|
|
||||||
async connect(vault: VaultStore): Promise<void> {
|
async connect(vault: SecretStore): Promise<void> {
|
||||||
const cred = getConnectorCredential(vault, this.id);
|
const cred = getConnectorCredential(vault, this.id);
|
||||||
this.token = cred?.value ?? null;
|
this.token = cred?.value ?? null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
import { BaseConnector, type ConnectorAction, type ConnectorResult } from '../connector-sdk.js';
|
import { BaseConnector, type ConnectorAction, type ConnectorResult } from '../connector-sdk.js';
|
||||||
import { getConnectorCredential } from './connector-credentials.js';
|
import { getConnectorCredential } from './connector-credentials.js';
|
||||||
import type { VaultStore } from '@waggle/core';
|
import type { SecretStore } from '@waggle/core';
|
||||||
import type { ConnectorHealth } from '@waggle/shared';
|
import type { ConnectorHealth } from '@waggle/shared';
|
||||||
|
|
||||||
const API_BASE = 'https://backend.composio.dev/api/v1';
|
const API_BASE = 'https://backend.composio.dev/api/v1';
|
||||||
@@ -91,7 +91,7 @@ export class ComposioConnector extends BaseConnector {
|
|||||||
|
|
||||||
private apiKey: string | null = null;
|
private apiKey: string | null = null;
|
||||||
|
|
||||||
async connect(vault: VaultStore): Promise<void> {
|
async connect(vault: SecretStore): Promise<void> {
|
||||||
const cred = getConnectorCredential(vault, this.id);
|
const cred = getConnectorCredential(vault, this.id);
|
||||||
this.apiKey = cred?.value ?? null;
|
this.apiKey = cred?.value ?? null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
import { BaseConnector, type ConnectorAction, type ConnectorResult } from '../connector-sdk.js';
|
import { BaseConnector, type ConnectorAction, type ConnectorResult } from '../connector-sdk.js';
|
||||||
import { getConnectorCredential } from './connector-credentials.js';
|
import { getConnectorCredential } from './connector-credentials.js';
|
||||||
import type { VaultStore } from '@waggle/core';
|
import type { SecretStore } from '@waggle/core';
|
||||||
import type { ConnectorHealth } from '@waggle/shared';
|
import type { ConnectorHealth } from '@waggle/shared';
|
||||||
|
|
||||||
export class ConfluenceConnector extends BaseConnector {
|
export class ConfluenceConnector extends BaseConnector {
|
||||||
@@ -90,7 +90,7 @@ export class ConfluenceConnector extends BaseConnector {
|
|||||||
private authHeader: string | null = null;
|
private authHeader: string | null = null;
|
||||||
private baseUrl: string | null = null;
|
private baseUrl: string | null = null;
|
||||||
|
|
||||||
async connect(vault: VaultStore): Promise<void> {
|
async connect(vault: SecretStore): Promise<void> {
|
||||||
const cred = getConnectorCredential(vault, this.id);
|
const cred = getConnectorCredential(vault, this.id);
|
||||||
if (!cred) {
|
if (!cred) {
|
||||||
this.authHeader = null;
|
this.authHeader = null;
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
import { BaseConnector, type ConnectorAction, type ConnectorResult } from '../connector-sdk.js';
|
import { BaseConnector, type ConnectorAction, type ConnectorResult } from '../connector-sdk.js';
|
||||||
import { getConnectorCredential } from './connector-credentials.js';
|
import { getConnectorCredential } from './connector-credentials.js';
|
||||||
import type { VaultStore } from '@waggle/core';
|
import type { SecretStore } from '@waggle/core';
|
||||||
import type { ConnectorHealth } from '@waggle/shared';
|
import type { ConnectorHealth } from '@waggle/shared';
|
||||||
|
|
||||||
const API_BASE = 'https://discord.com/api/v10';
|
const API_BASE = 'https://discord.com/api/v10';
|
||||||
@@ -94,7 +94,7 @@ export class DiscordConnector extends BaseConnector {
|
|||||||
|
|
||||||
private token: string | null = null;
|
private token: string | null = null;
|
||||||
|
|
||||||
async connect(vault: VaultStore): Promise<void> {
|
async connect(vault: SecretStore): Promise<void> {
|
||||||
const cred = getConnectorCredential(vault, this.id);
|
const cred = getConnectorCredential(vault, this.id);
|
||||||
this.token = cred?.value ?? null;
|
this.token = cred?.value ?? null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
import { BaseConnector, type ConnectorAction, type ConnectorResult } from '../connector-sdk.js';
|
import { BaseConnector, type ConnectorAction, type ConnectorResult } from '../connector-sdk.js';
|
||||||
import { getConnectorCredential } from './connector-credentials.js';
|
import { getConnectorCredential } from './connector-credentials.js';
|
||||||
import type { VaultStore } from '@waggle/core';
|
import type { SecretStore } from '@waggle/core';
|
||||||
import type { ConnectorHealth } from '@waggle/shared';
|
import type { ConnectorHealth } from '@waggle/shared';
|
||||||
|
|
||||||
const RPC_BASE = 'https://api.dropboxapi.com/2';
|
const RPC_BASE = 'https://api.dropboxapi.com/2';
|
||||||
@@ -89,7 +89,7 @@ export class DropboxConnector extends BaseConnector {
|
|||||||
|
|
||||||
private token: string | null = null;
|
private token: string | null = null;
|
||||||
|
|
||||||
async connect(vault: VaultStore): Promise<void> {
|
async connect(vault: SecretStore): Promise<void> {
|
||||||
const cred = getConnectorCredential(vault, this.id);
|
const cred = getConnectorCredential(vault, this.id);
|
||||||
this.token = cred?.value ?? null;
|
this.token = cred?.value ?? null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
import { BaseConnector, type ConnectorAction, type ConnectorResult } from '../connector-sdk.js';
|
import { BaseConnector, type ConnectorAction, type ConnectorResult } from '../connector-sdk.js';
|
||||||
import { getConnectorCredential } from './connector-credentials.js';
|
import { getConnectorCredential } from './connector-credentials.js';
|
||||||
import type { VaultStore } from '@waggle/core';
|
import type { SecretStore } from '@waggle/core';
|
||||||
import type { ConnectorHealth } from '@waggle/shared';
|
import type { ConnectorHealth } from '@waggle/shared';
|
||||||
|
|
||||||
const API_BASE = 'https://api.sendgrid.com/v3';
|
const API_BASE = 'https://api.sendgrid.com/v3';
|
||||||
@@ -72,7 +72,7 @@ export class EmailConnector extends BaseConnector {
|
|||||||
private dailyResetDate = new Date().toISOString().slice(0, 10);
|
private dailyResetDate = new Date().toISOString().slice(0, 10);
|
||||||
private maxDailyEmails = 100;
|
private maxDailyEmails = 100;
|
||||||
|
|
||||||
async connect(vault: VaultStore): Promise<void> {
|
async connect(vault: SecretStore): Promise<void> {
|
||||||
const cred = getConnectorCredential(vault, this.id);
|
const cred = getConnectorCredential(vault, this.id);
|
||||||
this.apiKey = cred?.value ?? null;
|
this.apiKey = cred?.value ?? null;
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
import { BaseConnector, type ConnectorAction, type ConnectorResult } from '../connector-sdk.js';
|
import { BaseConnector, type ConnectorAction, type ConnectorResult } from '../connector-sdk.js';
|
||||||
import { getConnectorCredential, setConnectorCredential } from './connector-credentials.js';
|
import { getConnectorCredential, setConnectorCredential } from './connector-credentials.js';
|
||||||
import type { VaultStore } from '@waggle/core';
|
import type { SecretStore } from '@waggle/core';
|
||||||
import type { ConnectorHealth } from '@waggle/shared';
|
import type { ConnectorHealth } from '@waggle/shared';
|
||||||
|
|
||||||
const CALENDAR_API = 'https://www.googleapis.com/calendar/v3';
|
const CALENDAR_API = 'https://www.googleapis.com/calendar/v3';
|
||||||
@@ -92,10 +92,10 @@ export class GoogleCalendarConnector extends BaseConnector {
|
|||||||
private expiresAt: string | null = null;
|
private expiresAt: string | null = null;
|
||||||
private clientId: string | null = null;
|
private clientId: string | null = null;
|
||||||
private clientSecret: string | null = null;
|
private clientSecret: string | null = null;
|
||||||
private vault: VaultStore | null = null;
|
private vault: SecretStore | null = null;
|
||||||
private credentialGeneration = 0;
|
private credentialGeneration = 0;
|
||||||
|
|
||||||
async connect(vault: VaultStore): Promise<void> {
|
async connect(vault: SecretStore): Promise<void> {
|
||||||
this.credentialGeneration += 1;
|
this.credentialGeneration += 1;
|
||||||
this.vault = vault;
|
this.vault = vault;
|
||||||
const cred = getConnectorCredential(vault, this.id);
|
const cred = getConnectorCredential(vault, this.id);
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
import { BaseConnector, type ConnectorAction, type ConnectorResult } from '../connector-sdk.js';
|
import { BaseConnector, type ConnectorAction, type ConnectorResult } from '../connector-sdk.js';
|
||||||
import { getConnectorCredential } from './connector-credentials.js';
|
import { getConnectorCredential } from './connector-credentials.js';
|
||||||
import type { VaultStore } from '@waggle/core';
|
import type { SecretStore } from '@waggle/core';
|
||||||
import type { ConnectorHealth } from '@waggle/shared';
|
import type { ConnectorHealth } from '@waggle/shared';
|
||||||
|
|
||||||
const DOCS_API = 'https://docs.googleapis.com/v1';
|
const DOCS_API = 'https://docs.googleapis.com/v1';
|
||||||
@@ -74,7 +74,7 @@ export class GoogleDocsConnector extends BaseConnector {
|
|||||||
|
|
||||||
private token: string | null = null;
|
private token: string | null = null;
|
||||||
|
|
||||||
async connect(vault: VaultStore): Promise<void> {
|
async connect(vault: SecretStore): Promise<void> {
|
||||||
const cred = getConnectorCredential(vault, this.id);
|
const cred = getConnectorCredential(vault, this.id);
|
||||||
this.token = cred?.value ?? null;
|
this.token = cred?.value ?? null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
import { BaseConnector, type ConnectorAction, type ConnectorResult } from '../connector-sdk.js';
|
import { BaseConnector, type ConnectorAction, type ConnectorResult } from '../connector-sdk.js';
|
||||||
import { getConnectorCredential } from './connector-credentials.js';
|
import { getConnectorCredential } from './connector-credentials.js';
|
||||||
import type { VaultStore } from '@waggle/core';
|
import type { SecretStore } from '@waggle/core';
|
||||||
import type { ConnectorHealth } from '@waggle/shared';
|
import type { ConnectorHealth } from '@waggle/shared';
|
||||||
|
|
||||||
const API_BASE = 'https://www.googleapis.com/drive/v3';
|
const API_BASE = 'https://www.googleapis.com/drive/v3';
|
||||||
@@ -102,7 +102,7 @@ export class GoogleDriveConnector extends BaseConnector {
|
|||||||
|
|
||||||
private token: string | null = null;
|
private token: string | null = null;
|
||||||
|
|
||||||
async connect(vault: VaultStore): Promise<void> {
|
async connect(vault: SecretStore): Promise<void> {
|
||||||
const cred = getConnectorCredential(vault, this.id);
|
const cred = getConnectorCredential(vault, this.id);
|
||||||
this.token = cred?.value ?? null;
|
this.token = cred?.value ?? null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
import { BaseConnector, type ConnectorAction, type ConnectorResult } from '../connector-sdk.js';
|
import { BaseConnector, type ConnectorAction, type ConnectorResult } from '../connector-sdk.js';
|
||||||
import { getConnectorCredential } from './connector-credentials.js';
|
import { getConnectorCredential } from './connector-credentials.js';
|
||||||
import type { VaultStore } from '@waggle/core';
|
import type { SecretStore } from '@waggle/core';
|
||||||
import type { ConnectorHealth } from '@waggle/shared';
|
import type { ConnectorHealth } from '@waggle/shared';
|
||||||
|
|
||||||
const API_BASE = 'https://api.github.com';
|
const API_BASE = 'https://api.github.com';
|
||||||
@@ -126,7 +126,7 @@ export class GitHubConnector extends BaseConnector {
|
|||||||
private token: string | null = null;
|
private token: string | null = null;
|
||||||
private baseUrl = API_BASE;
|
private baseUrl = API_BASE;
|
||||||
|
|
||||||
async connect(vault: VaultStore): Promise<void> {
|
async connect(vault: SecretStore): Promise<void> {
|
||||||
const cred = getConnectorCredential(vault, this.id);
|
const cred = getConnectorCredential(vault, this.id);
|
||||||
this.token = cred?.value ?? null;
|
this.token = cred?.value ?? null;
|
||||||
// Support GitHub Enterprise via connector config
|
// Support GitHub Enterprise via connector config
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
import { BaseConnector, type ConnectorAction, type ConnectorResult } from '../connector-sdk.js';
|
import { BaseConnector, type ConnectorAction, type ConnectorResult } from '../connector-sdk.js';
|
||||||
import { getConnectorCredential } from './connector-credentials.js';
|
import { getConnectorCredential } from './connector-credentials.js';
|
||||||
import type { VaultStore } from '@waggle/core';
|
import type { SecretStore } from '@waggle/core';
|
||||||
import type { ConnectorHealth } from '@waggle/shared';
|
import type { ConnectorHealth } from '@waggle/shared';
|
||||||
|
|
||||||
const DEFAULT_API_BASE = 'https://gitlab.com/api/v4';
|
const DEFAULT_API_BASE = 'https://gitlab.com/api/v4';
|
||||||
@@ -108,7 +108,7 @@ export class GitLabConnector extends BaseConnector {
|
|||||||
private token: string | null = null;
|
private token: string | null = null;
|
||||||
private baseUrl = DEFAULT_API_BASE;
|
private baseUrl = DEFAULT_API_BASE;
|
||||||
|
|
||||||
async connect(vault: VaultStore): Promise<void> {
|
async connect(vault: SecretStore): Promise<void> {
|
||||||
const cred = getConnectorCredential(vault, this.id);
|
const cred = getConnectorCredential(vault, this.id);
|
||||||
this.token = cred?.value ?? null;
|
this.token = cred?.value ?? null;
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
import { BaseConnector, type ConnectorAction, type ConnectorResult } from '../connector-sdk.js';
|
import { BaseConnector, type ConnectorAction, type ConnectorResult } from '../connector-sdk.js';
|
||||||
import { getConnectorCredential } from './connector-credentials.js';
|
import { getConnectorCredential } from './connector-credentials.js';
|
||||||
import type { VaultStore } from '@waggle/core';
|
import type { SecretStore } from '@waggle/core';
|
||||||
import type { ConnectorHealth } from '@waggle/shared';
|
import type { ConnectorHealth } from '@waggle/shared';
|
||||||
|
|
||||||
const API_BASE = 'https://gmail.googleapis.com/gmail/v1';
|
const API_BASE = 'https://gmail.googleapis.com/gmail/v1';
|
||||||
@@ -85,7 +85,7 @@ export class GmailConnector extends BaseConnector {
|
|||||||
|
|
||||||
private token: string | null = null;
|
private token: string | null = null;
|
||||||
|
|
||||||
async connect(vault: VaultStore): Promise<void> {
|
async connect(vault: SecretStore): Promise<void> {
|
||||||
const cred = getConnectorCredential(vault, this.id);
|
const cred = getConnectorCredential(vault, this.id);
|
||||||
this.token = cred?.value ?? null;
|
this.token = cred?.value ?? null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
import { BaseConnector, type ConnectorAction, type ConnectorResult } from '../connector-sdk.js';
|
import { BaseConnector, type ConnectorAction, type ConnectorResult } from '../connector-sdk.js';
|
||||||
import { getConnectorCredential } from './connector-credentials.js';
|
import { getConnectorCredential } from './connector-credentials.js';
|
||||||
import type { VaultStore } from '@waggle/core';
|
import type { SecretStore } from '@waggle/core';
|
||||||
import type { ConnectorHealth } from '@waggle/shared';
|
import type { ConnectorHealth } from '@waggle/shared';
|
||||||
|
|
||||||
const API_BASE = 'https://sheets.googleapis.com/v4';
|
const API_BASE = 'https://sheets.googleapis.com/v4';
|
||||||
@@ -90,7 +90,7 @@ export class GoogleSheetsConnector extends BaseConnector {
|
|||||||
|
|
||||||
private token: string | null = null;
|
private token: string | null = null;
|
||||||
|
|
||||||
async connect(vault: VaultStore): Promise<void> {
|
async connect(vault: SecretStore): Promise<void> {
|
||||||
const cred = getConnectorCredential(vault, this.id);
|
const cred = getConnectorCredential(vault, this.id);
|
||||||
this.token = cred?.value ?? null;
|
this.token = cred?.value ?? null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
import { BaseConnector, type ConnectorAction, type ConnectorResult } from '../connector-sdk.js';
|
import { BaseConnector, type ConnectorAction, type ConnectorResult } from '../connector-sdk.js';
|
||||||
import { getConnectorCredential } from './connector-credentials.js';
|
import { getConnectorCredential } from './connector-credentials.js';
|
||||||
import type { VaultStore } from '@waggle/core';
|
import type { SecretStore } from '@waggle/core';
|
||||||
import type { ConnectorHealth } from '@waggle/shared';
|
import type { ConnectorHealth } from '@waggle/shared';
|
||||||
|
|
||||||
const API_BASE = 'https://api.hubapi.com';
|
const API_BASE = 'https://api.hubapi.com';
|
||||||
@@ -116,7 +116,7 @@ export class HubSpotConnector extends BaseConnector {
|
|||||||
|
|
||||||
private token: string | null = null;
|
private token: string | null = null;
|
||||||
|
|
||||||
async connect(vault: VaultStore): Promise<void> {
|
async connect(vault: SecretStore): Promise<void> {
|
||||||
const cred = getConnectorCredential(vault, this.id);
|
const cred = getConnectorCredential(vault, this.id);
|
||||||
this.token = cred?.value ?? null;
|
this.token = cred?.value ?? null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
import { BaseConnector, type ConnectorAction, type ConnectorResult } from '../connector-sdk.js';
|
import { BaseConnector, type ConnectorAction, type ConnectorResult } from '../connector-sdk.js';
|
||||||
import { getConnectorCredential } from './connector-credentials.js';
|
import { getConnectorCredential } from './connector-credentials.js';
|
||||||
import type { VaultStore } from '@waggle/core';
|
import type { SecretStore } from '@waggle/core';
|
||||||
import type { ConnectorDefinition, ConnectorHealth, ConnectorStatus } from '@waggle/shared';
|
import type { ConnectorDefinition, ConnectorHealth, ConnectorStatus } from '@waggle/shared';
|
||||||
|
|
||||||
export class JiraConnector extends BaseConnector {
|
export class JiraConnector extends BaseConnector {
|
||||||
@@ -131,7 +131,7 @@ export class JiraConnector extends BaseConnector {
|
|||||||
return super.toDefinition(effectiveStatus);
|
return super.toDefinition(effectiveStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
async connect(vault: VaultStore): Promise<void> {
|
async connect(vault: SecretStore): Promise<void> {
|
||||||
const cred = getConnectorCredential(vault, this.id);
|
const cred = getConnectorCredential(vault, this.id);
|
||||||
if (!cred) {
|
if (!cred) {
|
||||||
this.authHeader = null;
|
this.authHeader = null;
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
import { BaseConnector, type ConnectorAction, type ConnectorResult } from '../connector-sdk.js';
|
import { BaseConnector, type ConnectorAction, type ConnectorResult } from '../connector-sdk.js';
|
||||||
import { getConnectorCredential } from './connector-credentials.js';
|
import { getConnectorCredential } from './connector-credentials.js';
|
||||||
import type { VaultStore } from '@waggle/core';
|
import type { SecretStore } from '@waggle/core';
|
||||||
import type { ConnectorHealth } from '@waggle/shared';
|
import type { ConnectorHealth } from '@waggle/shared';
|
||||||
|
|
||||||
const API_URL = 'https://api.linear.app/graphql';
|
const API_URL = 'https://api.linear.app/graphql';
|
||||||
@@ -102,7 +102,7 @@ export class LinearConnector extends BaseConnector {
|
|||||||
|
|
||||||
private token: string | null = null;
|
private token: string | null = null;
|
||||||
|
|
||||||
async connect(vault: VaultStore): Promise<void> {
|
async connect(vault: SecretStore): Promise<void> {
|
||||||
const cred = getConnectorCredential(vault, this.id);
|
const cred = getConnectorCredential(vault, this.id);
|
||||||
this.token = cred?.value ?? null;
|
this.token = cred?.value ?? null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
import { BaseConnector, type ConnectorAction, type ConnectorResult } from '../connector-sdk.js';
|
import { BaseConnector, type ConnectorAction, type ConnectorResult } from '../connector-sdk.js';
|
||||||
import { getConnectorCredential } from './connector-credentials.js';
|
import { getConnectorCredential } from './connector-credentials.js';
|
||||||
import type { VaultStore } from '@waggle/core';
|
import type { SecretStore } from '@waggle/core';
|
||||||
import type { ConnectorHealth } from '@waggle/shared';
|
import type { ConnectorHealth } from '@waggle/shared';
|
||||||
|
|
||||||
const API_URL = 'https://api.monday.com/v2';
|
const API_URL = 'https://api.monday.com/v2';
|
||||||
@@ -91,7 +91,7 @@ export class MondayConnector extends BaseConnector {
|
|||||||
|
|
||||||
private token: string | null = null;
|
private token: string | null = null;
|
||||||
|
|
||||||
async connect(vault: VaultStore): Promise<void> {
|
async connect(vault: SecretStore): Promise<void> {
|
||||||
const cred = getConnectorCredential(vault, this.id);
|
const cred = getConnectorCredential(vault, this.id);
|
||||||
this.token = cred?.value ?? null;
|
this.token = cred?.value ?? null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
import { BaseConnector, type ConnectorAction, type ConnectorResult } from '../connector-sdk.js';
|
import { BaseConnector, type ConnectorAction, type ConnectorResult } from '../connector-sdk.js';
|
||||||
import { getConnectorCredential } from './connector-credentials.js';
|
import { getConnectorCredential } from './connector-credentials.js';
|
||||||
import type { VaultStore } from '@waggle/core';
|
import type { SecretStore } from '@waggle/core';
|
||||||
import type { ConnectorHealth } from '@waggle/shared';
|
import type { ConnectorHealth } from '@waggle/shared';
|
||||||
|
|
||||||
const API_BASE = 'https://graph.microsoft.com/v1.0';
|
const API_BASE = 'https://graph.microsoft.com/v1.0';
|
||||||
@@ -95,7 +95,7 @@ export class MSTeamsConnector extends BaseConnector {
|
|||||||
|
|
||||||
private token: string | null = null;
|
private token: string | null = null;
|
||||||
|
|
||||||
async connect(vault: VaultStore): Promise<void> {
|
async connect(vault: SecretStore): Promise<void> {
|
||||||
const cred = getConnectorCredential(vault, this.id);
|
const cred = getConnectorCredential(vault, this.id);
|
||||||
this.token = cred?.value ?? null;
|
this.token = cred?.value ?? null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
import { BaseConnector, type ConnectorAction, type ConnectorResult } from '../connector-sdk.js';
|
import { BaseConnector, type ConnectorAction, type ConnectorResult } from '../connector-sdk.js';
|
||||||
import { getConnectorCredential } from './connector-credentials.js';
|
import { getConnectorCredential } from './connector-credentials.js';
|
||||||
import type { VaultStore } from '@waggle/core';
|
import type { SecretStore } from '@waggle/core';
|
||||||
import type { ConnectorHealth } from '@waggle/shared';
|
import type { ConnectorHealth } from '@waggle/shared';
|
||||||
|
|
||||||
const API_BASE = 'https://api.notion.com/v1';
|
const API_BASE = 'https://api.notion.com/v1';
|
||||||
@@ -114,7 +114,7 @@ export class NotionConnector extends BaseConnector {
|
|||||||
|
|
||||||
private token: string | null = null;
|
private token: string | null = null;
|
||||||
|
|
||||||
async connect(vault: VaultStore): Promise<void> {
|
async connect(vault: SecretStore): Promise<void> {
|
||||||
const cred = getConnectorCredential(vault, this.id);
|
const cred = getConnectorCredential(vault, this.id);
|
||||||
this.token = cred?.value ?? null;
|
this.token = cred?.value ?? null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import fs from 'node:fs';
|
|||||||
import path from 'node:path';
|
import path from 'node:path';
|
||||||
import { BaseConnector, type ConnectorAction, type ConnectorResult } from '../connector-sdk.js';
|
import { BaseConnector, type ConnectorAction, type ConnectorResult } from '../connector-sdk.js';
|
||||||
import { getConnectorCredential } from './connector-credentials.js';
|
import { getConnectorCredential } from './connector-credentials.js';
|
||||||
import type { VaultStore } from '@waggle/core';
|
import type { SecretStore } from '@waggle/core';
|
||||||
import type { ConnectorHealth } from '@waggle/shared';
|
import type { ConnectorHealth } from '@waggle/shared';
|
||||||
|
|
||||||
function isContained(root: string, candidate: string): boolean {
|
function isContained(root: string, candidate: string): boolean {
|
||||||
@@ -105,7 +105,7 @@ export class ObsidianConnector extends BaseConnector {
|
|||||||
|
|
||||||
private vaultPath: string | null = null;
|
private vaultPath: string | null = null;
|
||||||
|
|
||||||
async connect(vault: VaultStore): Promise<void> {
|
async connect(vault: SecretStore): Promise<void> {
|
||||||
const cred = getConnectorCredential(vault, this.id);
|
const cred = getConnectorCredential(vault, this.id);
|
||||||
this.vaultPath = cred?.value ?? null;
|
this.vaultPath = cred?.value ?? null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
import { BaseConnector, type ConnectorAction, type ConnectorResult } from '../connector-sdk.js';
|
import { BaseConnector, type ConnectorAction, type ConnectorResult } from '../connector-sdk.js';
|
||||||
import { getConnectorCredential } from './connector-credentials.js';
|
import { getConnectorCredential } from './connector-credentials.js';
|
||||||
import type { VaultStore } from '@waggle/core';
|
import type { SecretStore } from '@waggle/core';
|
||||||
import type { ConnectorHealth } from '@waggle/shared';
|
import type { ConnectorHealth } from '@waggle/shared';
|
||||||
|
|
||||||
const API_BASE = 'https://graph.microsoft.com/v1.0';
|
const API_BASE = 'https://graph.microsoft.com/v1.0';
|
||||||
@@ -83,7 +83,7 @@ export class OneDriveConnector extends BaseConnector {
|
|||||||
|
|
||||||
private token: string | null = null;
|
private token: string | null = null;
|
||||||
|
|
||||||
async connect(vault: VaultStore): Promise<void> {
|
async connect(vault: SecretStore): Promise<void> {
|
||||||
const cred = getConnectorCredential(vault, this.id);
|
const cred = getConnectorCredential(vault, this.id);
|
||||||
this.token = cred?.value ?? null;
|
this.token = cred?.value ?? null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
import { BaseConnector, type ConnectorAction, type ConnectorResult } from '../connector-sdk.js';
|
import { BaseConnector, type ConnectorAction, type ConnectorResult } from '../connector-sdk.js';
|
||||||
import { getConnectorCredential } from './connector-credentials.js';
|
import { getConnectorCredential } from './connector-credentials.js';
|
||||||
import type { VaultStore } from '@waggle/core';
|
import type { SecretStore } from '@waggle/core';
|
||||||
import type { ConnectorHealth } from '@waggle/shared';
|
import type { ConnectorHealth } from '@waggle/shared';
|
||||||
|
|
||||||
const API_BASE = 'https://graph.microsoft.com/v1.0';
|
const API_BASE = 'https://graph.microsoft.com/v1.0';
|
||||||
@@ -125,7 +125,7 @@ export class OneNoteConnector extends BaseConnector {
|
|||||||
|
|
||||||
private token: string | null = null;
|
private token: string | null = null;
|
||||||
|
|
||||||
async connect(vault: VaultStore): Promise<void> {
|
async connect(vault: SecretStore): Promise<void> {
|
||||||
const cred = getConnectorCredential(vault, this.id);
|
const cred = getConnectorCredential(vault, this.id);
|
||||||
this.token = cred?.value ?? null;
|
this.token = cred?.value ?? null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
import { BaseConnector, type ConnectorAction, type ConnectorResult } from '../connector-sdk.js';
|
import { BaseConnector, type ConnectorAction, type ConnectorResult } from '../connector-sdk.js';
|
||||||
import { getConnectorCredential } from './connector-credentials.js';
|
import { getConnectorCredential } from './connector-credentials.js';
|
||||||
import type { VaultStore } from '@waggle/core';
|
import type { SecretStore } from '@waggle/core';
|
||||||
import type { ConnectorHealth } from '@waggle/shared';
|
import type { ConnectorHealth } from '@waggle/shared';
|
||||||
|
|
||||||
const API_BASE = 'https://graph.microsoft.com/v1.0';
|
const API_BASE = 'https://graph.microsoft.com/v1.0';
|
||||||
@@ -117,7 +117,7 @@ export class OutlookConnector extends BaseConnector {
|
|||||||
|
|
||||||
private token: string | null = null;
|
private token: string | null = null;
|
||||||
|
|
||||||
async connect(vault: VaultStore): Promise<void> {
|
async connect(vault: SecretStore): Promise<void> {
|
||||||
const cred = getConnectorCredential(vault, this.id);
|
const cred = getConnectorCredential(vault, this.id);
|
||||||
this.token = cred?.value ?? null;
|
this.token = cred?.value ?? null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
import { BaseConnector, type ConnectorAction, type ConnectorResult } from '../connector-sdk.js';
|
import { BaseConnector, type ConnectorAction, type ConnectorResult } from '../connector-sdk.js';
|
||||||
import { getConnectorCredential } from './connector-credentials.js';
|
import { getConnectorCredential } from './connector-credentials.js';
|
||||||
import type { VaultStore } from '@waggle/core';
|
import type { SecretStore } from '@waggle/core';
|
||||||
import type { ConnectorHealth } from '@waggle/shared';
|
import type { ConnectorHealth } from '@waggle/shared';
|
||||||
|
|
||||||
const API_BASE = 'https://api.pipedrive.com/v1';
|
const API_BASE = 'https://api.pipedrive.com/v1';
|
||||||
@@ -118,7 +118,7 @@ export class PipedriveConnector extends BaseConnector {
|
|||||||
|
|
||||||
private apiToken: string | null = null;
|
private apiToken: string | null = null;
|
||||||
|
|
||||||
async connect(vault: VaultStore): Promise<void> {
|
async connect(vault: SecretStore): Promise<void> {
|
||||||
const cred = getConnectorCredential(vault, this.id);
|
const cred = getConnectorCredential(vault, this.id);
|
||||||
this.apiToken = cred?.value ?? null;
|
this.apiToken = cred?.value ?? null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
import { BaseConnector, type ConnectorAction, type ConnectorResult } from '../connector-sdk.js';
|
import { BaseConnector, type ConnectorAction, type ConnectorResult } from '../connector-sdk.js';
|
||||||
import { getConnectorCredential } from './connector-credentials.js';
|
import { getConnectorCredential } from './connector-credentials.js';
|
||||||
import type { VaultStore } from '@waggle/core';
|
import type { SecretStore } from '@waggle/core';
|
||||||
import type { ConnectorHealth } from '@waggle/shared';
|
import type { ConnectorHealth } from '@waggle/shared';
|
||||||
|
|
||||||
// ── Minimal shape of the optional `pg` module (only what we use) ──
|
// ── Minimal shape of the optional `pg` module (only what we use) ──
|
||||||
@@ -90,7 +90,7 @@ export class PostgresConnector extends BaseConnector {
|
|||||||
private pgModule: PgModule | null = null;
|
private pgModule: PgModule | null = null;
|
||||||
private client: PgClient | null = null;
|
private client: PgClient | null = null;
|
||||||
|
|
||||||
async connect(vault: VaultStore): Promise<void> {
|
async connect(vault: SecretStore): Promise<void> {
|
||||||
const cred = getConnectorCredential(vault, this.id);
|
const cred = getConnectorCredential(vault, this.id);
|
||||||
this.connectionString = cred?.value ?? null;
|
this.connectionString = cred?.value ?? null;
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
import { BaseConnector, type ConnectorAction, type ConnectorResult } from '../connector-sdk.js';
|
import { BaseConnector, type ConnectorAction, type ConnectorResult } from '../connector-sdk.js';
|
||||||
import { getConnectorCredential } from './connector-credentials.js';
|
import { getConnectorCredential } from './connector-credentials.js';
|
||||||
import { safeFetch } from '../url-egress-guard.js';
|
import { safeFetch } from '../url-egress-guard.js';
|
||||||
import type { VaultStore } from '@waggle/core';
|
import type { SecretStore } from '@waggle/core';
|
||||||
import type { ConnectorDefinition, ConnectorHealth, ConnectorStatus } from '@waggle/shared';
|
import type { ConnectorDefinition, ConnectorHealth, ConnectorStatus } from '@waggle/shared';
|
||||||
|
|
||||||
const API_VERSION = 'v59.0';
|
const API_VERSION = 'v59.0';
|
||||||
@@ -214,7 +214,7 @@ export class SalesforceConnector extends BaseConnector {
|
|||||||
return super.toDefinition(effectiveStatus);
|
return super.toDefinition(effectiveStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
async connect(vault: VaultStore): Promise<void> {
|
async connect(vault: SecretStore): Promise<void> {
|
||||||
const cred = getConnectorCredential(vault, this.id);
|
const cred = getConnectorCredential(vault, this.id);
|
||||||
this.token = cred?.value ?? null;
|
this.token = cred?.value ?? null;
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
import { BaseConnector, type ConnectorAction, type ConnectorResult } from '../connector-sdk.js';
|
import { BaseConnector, type ConnectorAction, type ConnectorResult } from '../connector-sdk.js';
|
||||||
import { getConnectorCredential } from './connector-credentials.js';
|
import { getConnectorCredential } from './connector-credentials.js';
|
||||||
import type { VaultStore } from '@waggle/core';
|
import type { SecretStore } from '@waggle/core';
|
||||||
import type { ConnectorHealth } from '@waggle/shared';
|
import type { ConnectorHealth } from '@waggle/shared';
|
||||||
|
|
||||||
const API_BASE = 'https://slack.com/api';
|
const API_BASE = 'https://slack.com/api';
|
||||||
@@ -73,7 +73,7 @@ export class SlackConnector extends BaseConnector {
|
|||||||
|
|
||||||
private token: string | null = null;
|
private token: string | null = null;
|
||||||
|
|
||||||
async connect(vault: VaultStore): Promise<void> {
|
async connect(vault: SecretStore): Promise<void> {
|
||||||
const cred = getConnectorCredential(vault, this.id);
|
const cred = getConnectorCredential(vault, this.id);
|
||||||
this.token = cred?.value ?? null;
|
this.token = cred?.value ?? null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
import { BaseConnector, type ConnectorAction, type ConnectorResult } from '../connector-sdk.js';
|
import { BaseConnector, type ConnectorAction, type ConnectorResult } from '../connector-sdk.js';
|
||||||
import { getConnectorCredential } from './connector-credentials.js';
|
import { getConnectorCredential } from './connector-credentials.js';
|
||||||
import type { VaultStore } from '@waggle/core';
|
import type { SecretStore } from '@waggle/core';
|
||||||
import type { ConnectorHealth } from '@waggle/shared';
|
import type { ConnectorHealth } from '@waggle/shared';
|
||||||
|
|
||||||
const API_BASE = 'https://api.trello.com/1';
|
const API_BASE = 'https://api.trello.com/1';
|
||||||
@@ -109,7 +109,7 @@ export class TrelloConnector extends BaseConnector {
|
|||||||
private apiKey: string | null = null;
|
private apiKey: string | null = null;
|
||||||
private apiToken: string | null = null;
|
private apiToken: string | null = null;
|
||||||
|
|
||||||
async connect(vault: VaultStore): Promise<void> {
|
async connect(vault: SecretStore): Promise<void> {
|
||||||
const cred = getConnectorCredential(vault, this.id);
|
const cred = getConnectorCredential(vault, this.id);
|
||||||
this.apiToken = cred?.value ?? null;
|
this.apiToken = cred?.value ?? null;
|
||||||
// API key stored as a separate vault entry
|
// API key stored as a separate vault entry
|
||||||
|
|||||||
@@ -243,7 +243,7 @@ export class CredentialPool {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Minimal vault interface — just enough to load keys.
|
* Minimal vault interface — just enough to load keys.
|
||||||
* Matches @waggle/core VaultStore.get() and VaultStore.has().
|
* Matches SecretStore.get() and SecretStore.has() from @waggle/core.
|
||||||
*/
|
*/
|
||||||
export interface VaultLike {
|
export interface VaultLike {
|
||||||
get(name: string): { value: string } | null;
|
get(name: string): { value: string } | null;
|
||||||
|
|||||||
@@ -372,7 +372,7 @@ declare module 'fastify' {
|
|||||||
traceStore: import('@waggle/core').ExecutionTraceStore;
|
traceStore: import('@waggle/core').ExecutionTraceStore;
|
||||||
/** Active behavioral spec — the compiled `BEHAVIORAL_SPEC` baseline. */
|
/** Active behavioral spec — the compiled `BEHAVIORAL_SPEC` baseline. */
|
||||||
activeBehavioralSpec: ReturnType<typeof import('@waggle/agent').buildActiveBehavioralSpec>;
|
activeBehavioralSpec: ReturnType<typeof import('@waggle/agent').buildActiveBehavioralSpec>;
|
||||||
vault: import('@waggle/core').VaultStore;
|
vault: import('@waggle/core').SecretStore;
|
||||||
embeddingProvider: import('@waggle/core').EmbeddingProviderInstance;
|
embeddingProvider: import('@waggle/core').EmbeddingProviderInstance;
|
||||||
skillHashStore: import('@waggle/core').SkillHashStore;
|
skillHashStore: import('@waggle/core').SkillHashStore;
|
||||||
scheduler: import('./cron.js').LocalScheduler;
|
scheduler: import('./cron.js').LocalScheduler;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import fs from 'node:fs';
|
import fs from 'node:fs';
|
||||||
import path from 'node:path';
|
import path from 'node:path';
|
||||||
import type { VaultStore } from '@waggle/core';
|
import type { SecretStore } from '@waggle/core';
|
||||||
import type { FastifyInstance } from 'fastify';
|
import type { FastifyInstance } from 'fastify';
|
||||||
import {
|
import {
|
||||||
discoverProviderModels,
|
discoverProviderModels,
|
||||||
@@ -108,7 +108,7 @@ export function buildLiteLLMRuntimeConfig(
|
|||||||
/** Build the executable router catalog from the same live APIs used by the UI. */
|
/** Build the executable router catalog from the same live APIs used by the UI. */
|
||||||
export async function prepareLiteLLMRuntimeConfig(
|
export async function prepareLiteLLMRuntimeConfig(
|
||||||
dataDir: string,
|
dataDir: string,
|
||||||
vault: VaultStore,
|
vault: SecretStore,
|
||||||
discoveryOptions: DiscoveryOptions = {},
|
discoveryOptions: DiscoveryOptions = {},
|
||||||
): Promise<LiteLLMRuntimeConfigResult> {
|
): Promise<LiteLLMRuntimeConfigResult> {
|
||||||
const catalogs = new Map<string, DiscoveredProviderModel[]>();
|
const catalogs = new Map<string, DiscoveredProviderModel[]>();
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { WaggleConfig, type ProviderEntry, type VaultStore } from '@waggle/core';
|
import { WaggleConfig, type ProviderEntry, type SecretStore } from '@waggle/core';
|
||||||
|
|
||||||
/** Provider credentials consumed by LiteLLM and provider SDKs. */
|
/** Provider credentials consumed by LiteLLM and provider SDKs. */
|
||||||
export const PROVIDER_ENV_NAMES: Record<string, readonly string[]> = {
|
export const PROVIDER_ENV_NAMES: Record<string, readonly string[]> = {
|
||||||
@@ -34,7 +34,7 @@ export function applyProviderKeyToEnv(
|
|||||||
|
|
||||||
export function getProviderApiKeys(
|
export function getProviderApiKeys(
|
||||||
providerId: string,
|
providerId: string,
|
||||||
vault: VaultStore | null | undefined,
|
vault: SecretStore | null | undefined,
|
||||||
): string[] {
|
): string[] {
|
||||||
const candidates: string[] = [];
|
const candidates: string[] = [];
|
||||||
try {
|
try {
|
||||||
@@ -52,13 +52,13 @@ export function getProviderApiKeys(
|
|||||||
|
|
||||||
export function getProviderApiKey(
|
export function getProviderApiKey(
|
||||||
providerId: string,
|
providerId: string,
|
||||||
vault: VaultStore | null | undefined,
|
vault: SecretStore | null | undefined,
|
||||||
): string | undefined {
|
): string | undefined {
|
||||||
return getProviderApiKeys(providerId, vault)[0];
|
return getProviderApiKeys(providerId, vault)[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Hydrate provider SDK/LiteLLM env before a child process snapshots it. */
|
/** Hydrate provider SDK/LiteLLM env before a child process snapshots it. */
|
||||||
export function hydrateProviderEnvFromVault(vault: VaultStore, overwrite = false): number {
|
export function hydrateProviderEnvFromVault(vault: SecretStore, overwrite = false): number {
|
||||||
let updated = 0;
|
let updated = 0;
|
||||||
for (const providerId of Object.keys(PROVIDER_ENV_NAMES)) {
|
for (const providerId of Object.keys(PROVIDER_ENV_NAMES)) {
|
||||||
const entry = vault.get(providerId);
|
const entry = vault.get(providerId);
|
||||||
@@ -73,7 +73,7 @@ export function hydrateProviderEnvFromVault(vault: VaultStore, overwrite = false
|
|||||||
* the vault already holds. Returns the number of keys copied.
|
* the vault already holds. Returns the number of keys copied.
|
||||||
*/
|
*/
|
||||||
export function copyProviderKeysToVault(
|
export function copyProviderKeysToVault(
|
||||||
vault: VaultStore,
|
vault: SecretStore,
|
||||||
providers: Readonly<Record<string, ProviderEntry>>,
|
providers: Readonly<Record<string, ProviderEntry>>,
|
||||||
): number {
|
): number {
|
||||||
let copied = 0;
|
let copied = 0;
|
||||||
@@ -90,7 +90,7 @@ export function copyProviderKeysToVault(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Move legacy config.json secrets before LiteLLM starts, then scrub plaintext. */
|
/** Move legacy config.json secrets before LiteLLM starts, then scrub plaintext. */
|
||||||
export function migrateLegacyProviderKeysToVault(dataDir: string, vault: VaultStore): number {
|
export function migrateLegacyProviderKeysToVault(dataDir: string, vault: SecretStore): number {
|
||||||
const config = new WaggleConfig(dataDir);
|
const config = new WaggleConfig(dataDir);
|
||||||
const providers = config.getProviders();
|
const providers = config.getProviders();
|
||||||
const migrated = copyProviderKeysToVault(vault, providers);
|
const migrated = copyProviderKeysToVault(vault, providers);
|
||||||
|
|||||||
@@ -16,9 +16,9 @@ import {
|
|||||||
MSTeamsConnector, OutlookConnector, OneDriveConnector, OneNoteConnector,
|
MSTeamsConnector, OutlookConnector, OneDriveConnector, OneNoteConnector,
|
||||||
ComposioConnector,
|
ComposioConnector,
|
||||||
} from '@waggle/agent';
|
} from '@waggle/agent';
|
||||||
import type { VaultStore } from '@waggle/core';
|
import type { SecretStore } from '@waggle/core';
|
||||||
|
|
||||||
export function registerConnectors(vault: VaultStore): ConnectorRegistry {
|
export function registerConnectors(vault: SecretStore): ConnectorRegistry {
|
||||||
const registry = new ConnectorRegistry(vault);
|
const registry = new ConnectorRegistry(vault);
|
||||||
registry.register(new GitHubConnector());
|
registry.register(new GitHubConnector());
|
||||||
registry.register(new SlackConnector());
|
registry.register(new SlackConnector());
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import Fastify from 'fastify';
|
|||||||
import * as fs from 'node:fs';
|
import * as fs from 'node:fs';
|
||||||
import * as path from 'node:path';
|
import * as path from 'node:path';
|
||||||
import * as os from 'node:os';
|
import * as os from 'node:os';
|
||||||
import { MindDB, InstallAuditStore, VaultStore } from '@waggle/core';
|
import { MindDB, InstallAuditStore, VaultStore, type SecretStore } from '@waggle/core';
|
||||||
import {
|
import {
|
||||||
ConnectorRegistry,
|
ConnectorRegistry,
|
||||||
BaseConnector,
|
BaseConnector,
|
||||||
@@ -46,7 +46,7 @@ class TestConnector extends BaseConnector {
|
|||||||
credentialValue: string | null = null;
|
credentialValue: string | null = null;
|
||||||
connectGate: Promise<void> | null = null;
|
connectGate: Promise<void> | null = null;
|
||||||
connectError: Error | null = null;
|
connectError: Error | null = null;
|
||||||
async connect(vault: VaultStore): Promise<void> {
|
async connect(vault: SecretStore): Promise<void> {
|
||||||
this.connectCalls += 1;
|
this.connectCalls += 1;
|
||||||
if (this.connectGate) await this.connectGate;
|
if (this.connectGate) await this.connectGate;
|
||||||
if (this.connectError) throw this.connectError;
|
if (this.connectError) throw this.connectError;
|
||||||
|
|||||||
Reference in New Issue
Block a user