clementine-agent 1.10.1 → 1.10.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config.d.ts +6 -0
- package/dist/config.js +1 -1
- package/dist/integrations/composio/client.js +17 -5
- package/package.json +1 -1
package/dist/config.d.ts
CHANGED
|
@@ -11,6 +11,12 @@ export declare const PKG_DIR: string;
|
|
|
11
11
|
/** Data home — user data, vault, .env, logs, sessions. */
|
|
12
12
|
export declare const BASE_DIR: string;
|
|
13
13
|
import { shellEscape as _shellEscape } from './config/env-parser.js';
|
|
14
|
+
/**
|
|
15
|
+
* Look up a config value: local .env first, then process.env fallback.
|
|
16
|
+
* Keychain refs in either source are resolved lazily; failed resolution
|
|
17
|
+
* falls through to the fallback rather than returning the literal stub.
|
|
18
|
+
*/
|
|
19
|
+
export declare function getEnv(key: string, fallback?: string): string;
|
|
14
20
|
/** Merged view of process.env overlaid with .env. Use for classifyIntegrations / summarizeIntegrationStatus. */
|
|
15
21
|
export declare function envSnapshot(): Record<string, string | undefined>;
|
|
16
22
|
/** Test-only: clear the keychain ref cache so re-resolution can be tested. */
|
package/dist/config.js
CHANGED
|
@@ -84,7 +84,7 @@ function maybeResolveRef(value) {
|
|
|
84
84
|
* Keychain refs in either source are resolved lazily; failed resolution
|
|
85
85
|
* falls through to the fallback rather than returning the literal stub.
|
|
86
86
|
*/
|
|
87
|
-
function getEnv(key, fallback = '') {
|
|
87
|
+
export function getEnv(key, fallback = '') {
|
|
88
88
|
const fromLocal = maybeResolveRef(env[key]);
|
|
89
89
|
if (fromLocal !== undefined && fromLocal !== '')
|
|
90
90
|
return fromLocal;
|
|
@@ -15,7 +15,18 @@
|
|
|
15
15
|
import { Composio } from '@composio/core';
|
|
16
16
|
import { ClaudeAgentSDKProvider } from '@composio/claude-agent-sdk';
|
|
17
17
|
import pino from 'pino';
|
|
18
|
+
import { getEnv } from '../../config.js';
|
|
18
19
|
const logger = pino({ name: 'clementine.composio' });
|
|
20
|
+
// `process.env` is intentionally NOT populated from .env (config.ts keeps
|
|
21
|
+
// secrets out of the SDK subprocess). Reading process.env.COMPOSIO_API_KEY
|
|
22
|
+
// directly works during the dashboard's hot-reload (PUT handler mutates
|
|
23
|
+
// process.env), but is empty after a fresh daemon restart even if the key
|
|
24
|
+
// is in .env. Use this helper everywhere we read Composio env vars: it
|
|
25
|
+
// prefers process.env (hot-reload from dashboard) and falls back to the
|
|
26
|
+
// .env file via getEnv (survives restarts).
|
|
27
|
+
function readComposioEnv(key) {
|
|
28
|
+
return process.env[key] || getEnv(key, '');
|
|
29
|
+
}
|
|
19
30
|
// Curated set surfaced in the dashboard. Composio exposes 1000+ — rendering
|
|
20
31
|
// them all is noisy. Users can still connect anything by editing this list.
|
|
21
32
|
export const CURATED_TOOLKITS = [
|
|
@@ -50,7 +61,7 @@ let singleton = null;
|
|
|
50
61
|
export function getComposio() {
|
|
51
62
|
if (singleton)
|
|
52
63
|
return singleton;
|
|
53
|
-
const apiKey =
|
|
64
|
+
const apiKey = readComposioEnv('COMPOSIO_API_KEY');
|
|
54
65
|
if (!apiKey)
|
|
55
66
|
return null;
|
|
56
67
|
singleton = new Composio({
|
|
@@ -60,7 +71,7 @@ export function getComposio() {
|
|
|
60
71
|
return singleton;
|
|
61
72
|
}
|
|
62
73
|
export function isComposioEnabled() {
|
|
63
|
-
return Boolean(
|
|
74
|
+
return Boolean(readComposioEnv('COMPOSIO_API_KEY'));
|
|
64
75
|
}
|
|
65
76
|
/**
|
|
66
77
|
* Discard the cached client + identity cache so the next call to getComposio()
|
|
@@ -89,13 +100,14 @@ export async function getPreferredUserId() {
|
|
|
89
100
|
// with the most existing connections, falling back to this constant.
|
|
90
101
|
const DEFAULT_NEW_CONNECTION_USER_ID = 'default';
|
|
91
102
|
export function clementineUserId() {
|
|
92
|
-
return
|
|
103
|
+
return readComposioEnv('COMPOSIO_USER_ID') || DEFAULT_NEW_CONNECTION_USER_ID;
|
|
93
104
|
}
|
|
94
105
|
// Cached after first detection — avoids extra API calls per authorize.
|
|
95
106
|
let detectedPreferredUserId = null;
|
|
96
107
|
async function detectPreferredUserId(composio) {
|
|
97
|
-
|
|
98
|
-
|
|
108
|
+
const explicit = readComposioEnv('COMPOSIO_USER_ID');
|
|
109
|
+
if (explicit)
|
|
110
|
+
return explicit;
|
|
99
111
|
if (detectedPreferredUserId)
|
|
100
112
|
return detectedPreferredUserId;
|
|
101
113
|
try {
|