@saleso.innovations/bridge 0.1.42 → 0.1.43
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/client.d.ts +2 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +5 -1
- package/dist/constants.d.ts +2 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +3 -0
- package/dist/cronList.d.ts +2 -0
- package/dist/cronList.d.ts.map +1 -1
- package/dist/cronList.js +11 -8
- package/dist/cronWatcher.d.ts +1 -1
- package/dist/cronWatcher.d.ts.map +1 -1
- package/dist/cronWatcher.js +70 -29
- package/dist/ensureHermesApi.d.ts +1 -1
- package/dist/ensureHermesApi.d.ts.map +1 -1
- package/dist/ensureHermesApi.js +14 -10
- package/dist/gatewayControl.d.ts +3 -3
- package/dist/gatewayControl.d.ts.map +1 -1
- package/dist/gatewayControl.js +58 -24
- package/dist/hermesCommands.d.ts +1 -1
- package/dist/hermesCommands.d.ts.map +1 -1
- package/dist/hermesCommands.js +48 -27
- package/dist/hermesFileCommands.d.ts +5 -5
- package/dist/hermesFileCommands.d.ts.map +1 -1
- package/dist/hermesFileCommands.js +10 -10
- package/dist/hermesFiles.d.ts +7 -6
- package/dist/hermesFiles.d.ts.map +1 -1
- package/dist/hermesFiles.js +11 -14
- package/dist/hermesForwarder.d.ts +2 -0
- package/dist/hermesForwarder.d.ts.map +1 -1
- package/dist/hermesForwarder.js +27 -20
- package/dist/hermesSessionDb.d.ts +10 -6
- package/dist/hermesSessionDb.d.ts.map +1 -1
- package/dist/hermesSessionDb.js +44 -24
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/mcpList.d.ts +3 -2
- package/dist/mcpList.d.ts.map +1 -1
- package/dist/mcpList.js +5 -5
- package/dist/profiles.d.ts +66 -0
- package/dist/profiles.d.ts.map +1 -0
- package/dist/profiles.js +409 -0
- package/dist/renameHermesSession.d.ts +1 -1
- package/dist/renameHermesSession.d.ts.map +1 -1
- package/dist/renameHermesSession.js +2 -2
- package/dist/skillLearnedDetector.d.ts +1 -1
- package/dist/skillLearnedDetector.d.ts.map +1 -1
- package/dist/skillLearnedDetector.js +2 -3
- package/dist/skillsList.d.ts +5 -2
- package/dist/skillsList.d.ts.map +1 -1
- package/dist/skillsList.js +14 -14
- package/dist/toolsList.d.ts +2 -2
- package/dist/toolsList.d.ts.map +1 -1
- package/dist/toolsList.js +4 -4
- package/package.json +1 -1
package/dist/hermesSessionDb.js
CHANGED
|
@@ -3,12 +3,15 @@ import { homedir } from "node:os";
|
|
|
3
3
|
import { join } from "node:path";
|
|
4
4
|
import Database from "better-sqlite3";
|
|
5
5
|
import { unwrapHermesStructuredContent } from "./hermesStructuredContent.js";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
return join(
|
|
6
|
+
/** Default state-db home (the default profile). Kept local to avoid a cycle with profiles.ts. */
|
|
7
|
+
function resolveStateHome(home) {
|
|
8
|
+
return home?.trim() || process.env.HERMES_HOME?.trim() || join(homedir(), ".hermes");
|
|
9
9
|
}
|
|
10
|
-
function
|
|
11
|
-
|
|
10
|
+
function hermesStateDbPath(home) {
|
|
11
|
+
return join(resolveStateHome(home), "state.db");
|
|
12
|
+
}
|
|
13
|
+
function openReadOnlyDb(home) {
|
|
14
|
+
const dbPath = hermesStateDbPath(home);
|
|
12
15
|
return new Database(dbPath, { readonly: true, fileMustExist: true });
|
|
13
16
|
}
|
|
14
17
|
function decodeMessageContent(raw) {
|
|
@@ -113,11 +116,11 @@ function sessionTitleFromFirstUserMessage(db, sessionId) {
|
|
|
113
116
|
function sessionTitleForLookupId(db, sessionId) {
|
|
114
117
|
return sessionTitleFromChain(db, sessionId) ?? sessionTitleFromFirstUserMessage(db, sessionId);
|
|
115
118
|
}
|
|
116
|
-
export function resolveSessionTitle(sessionId) {
|
|
117
|
-
if (!sessionId.trim() || !hermesStateDbExists()) {
|
|
119
|
+
export function resolveSessionTitle(sessionId, home) {
|
|
120
|
+
if (!sessionId.trim() || !hermesStateDbExists(home)) {
|
|
118
121
|
return null;
|
|
119
122
|
}
|
|
120
|
-
const db = openReadOnlyDb();
|
|
123
|
+
const db = openReadOnlyDb(home);
|
|
121
124
|
try {
|
|
122
125
|
return sessionTitleForLookupId(db, sessionId);
|
|
123
126
|
}
|
|
@@ -128,16 +131,16 @@ export function resolveSessionTitle(sessionId) {
|
|
|
128
131
|
db.close();
|
|
129
132
|
}
|
|
130
133
|
}
|
|
131
|
-
export function resolveSessionTitles(sessionIds) {
|
|
134
|
+
export function resolveSessionTitles(sessionIds, home) {
|
|
132
135
|
const uniqueIds = [...new Set(sessionIds.map((id) => id.trim()).filter(Boolean))];
|
|
133
136
|
const titles = {};
|
|
134
137
|
for (const sessionId of uniqueIds) {
|
|
135
138
|
titles[sessionId] = null;
|
|
136
139
|
}
|
|
137
|
-
if (uniqueIds.length === 0 || !hermesStateDbExists()) {
|
|
140
|
+
if (uniqueIds.length === 0 || !hermesStateDbExists(home)) {
|
|
138
141
|
return titles;
|
|
139
142
|
}
|
|
140
|
-
const db = openReadOnlyDb();
|
|
143
|
+
const db = openReadOnlyDb(home);
|
|
141
144
|
try {
|
|
142
145
|
for (const sessionId of uniqueIds) {
|
|
143
146
|
titles[sessionId] = sessionTitleForLookupId(db, sessionId);
|
|
@@ -152,7 +155,7 @@ export function resolveSessionTitles(sessionIds) {
|
|
|
152
155
|
return titles;
|
|
153
156
|
}
|
|
154
157
|
export function listSessionMessages(sessionId, options = {}) {
|
|
155
|
-
const db = openReadOnlyDb();
|
|
158
|
+
const db = openReadOnlyDb(options.home);
|
|
156
159
|
try {
|
|
157
160
|
const resolved = resolveResumeSessionId(db, sessionId);
|
|
158
161
|
const chain = sessionAncestorChain(db, resolved);
|
|
@@ -185,8 +188,8 @@ export function listSessionMessages(sessionId, options = {}) {
|
|
|
185
188
|
db.close();
|
|
186
189
|
}
|
|
187
190
|
}
|
|
188
|
-
export function getLatestTurnMessageIds(sessionId) {
|
|
189
|
-
const db = openReadOnlyDb();
|
|
191
|
+
export function getLatestTurnMessageIds(sessionId, home) {
|
|
192
|
+
const db = openReadOnlyDb(home);
|
|
190
193
|
try {
|
|
191
194
|
const resolved = resolveResumeSessionId(db, sessionId);
|
|
192
195
|
const chain = sessionAncestorChain(db, resolved);
|
|
@@ -249,12 +252,12 @@ function firstUserMessageContent(db, sessionId) {
|
|
|
249
252
|
return decodeMessageContent(row?.content ?? null);
|
|
250
253
|
}
|
|
251
254
|
export function listHermesSessions(options = {}) {
|
|
252
|
-
if (!hermesStateDbExists()) {
|
|
255
|
+
if (!hermesStateDbExists(options.home)) {
|
|
253
256
|
return [];
|
|
254
257
|
}
|
|
255
258
|
const limit = Math.min(Math.max(options.limit ?? 200, 1), 500);
|
|
256
259
|
const fetchLimit = Math.min(limit * 4, 500);
|
|
257
|
-
const db = openReadOnlyDb();
|
|
260
|
+
const db = openReadOnlyDb(options.home);
|
|
258
261
|
try {
|
|
259
262
|
const rows = db
|
|
260
263
|
.prepare(`SELECT
|
|
@@ -317,15 +320,15 @@ function emptySessionUsage(sessionId, resolvedSessionId) {
|
|
|
317
320
|
messageCount: 0,
|
|
318
321
|
};
|
|
319
322
|
}
|
|
320
|
-
export function getSessionUsage(sessionId) {
|
|
323
|
+
export function getSessionUsage(sessionId, home) {
|
|
321
324
|
const trimmed = sessionId.trim();
|
|
322
325
|
if (!trimmed) {
|
|
323
326
|
return emptySessionUsage(sessionId, sessionId);
|
|
324
327
|
}
|
|
325
|
-
if (!hermesStateDbExists()) {
|
|
328
|
+
if (!hermesStateDbExists(home)) {
|
|
326
329
|
return emptySessionUsage(trimmed, trimmed);
|
|
327
330
|
}
|
|
328
|
-
const db = openReadOnlyDb();
|
|
331
|
+
const db = openReadOnlyDb(home);
|
|
329
332
|
try {
|
|
330
333
|
const resolved = resolveResumeSessionId(db, trimmed);
|
|
331
334
|
const chain = sessionAncestorChain(db, resolved);
|
|
@@ -370,20 +373,20 @@ export function getSessionUsage(sessionId) {
|
|
|
370
373
|
db.close();
|
|
371
374
|
}
|
|
372
375
|
}
|
|
373
|
-
export function hermesStateDbExists() {
|
|
376
|
+
export function hermesStateDbExists(home) {
|
|
374
377
|
try {
|
|
375
|
-
readFileSync(hermesStateDbPath());
|
|
378
|
+
readFileSync(hermesStateDbPath(home));
|
|
376
379
|
return true;
|
|
377
380
|
}
|
|
378
381
|
catch {
|
|
379
382
|
return false;
|
|
380
383
|
}
|
|
381
384
|
}
|
|
382
|
-
export function countUserMessagesSent() {
|
|
383
|
-
if (!hermesStateDbExists()) {
|
|
385
|
+
export function countUserMessagesSent(home) {
|
|
386
|
+
if (!hermesStateDbExists(home)) {
|
|
384
387
|
return { count: 0 };
|
|
385
388
|
}
|
|
386
|
-
const db = openReadOnlyDb();
|
|
389
|
+
const db = openReadOnlyDb(home);
|
|
387
390
|
try {
|
|
388
391
|
const row = db
|
|
389
392
|
.prepare("SELECT COUNT(*) AS count FROM messages WHERE role = 'user'")
|
|
@@ -397,3 +400,20 @@ export function countUserMessagesSent() {
|
|
|
397
400
|
db.close();
|
|
398
401
|
}
|
|
399
402
|
}
|
|
403
|
+
/** Total number of sessions in a profile's state.db (best-effort). */
|
|
404
|
+
export function countSessions(home) {
|
|
405
|
+
if (!hermesStateDbExists(home)) {
|
|
406
|
+
return 0;
|
|
407
|
+
}
|
|
408
|
+
const db = openReadOnlyDb(home);
|
|
409
|
+
try {
|
|
410
|
+
const row = db.prepare("SELECT COUNT(*) AS count FROM sessions").get();
|
|
411
|
+
return row?.count ?? 0;
|
|
412
|
+
}
|
|
413
|
+
catch {
|
|
414
|
+
return 0;
|
|
415
|
+
}
|
|
416
|
+
finally {
|
|
417
|
+
db.close();
|
|
418
|
+
}
|
|
419
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -19,5 +19,7 @@ export { backfillCronDeliveries, describeCronDeliveryState } from "./cronBackfil
|
|
|
19
19
|
export { resolveActiveConversationId, rememberConversationId } from "./activeConversation.js";
|
|
20
20
|
export { runBridgeDaemon } from "./daemon.js";
|
|
21
21
|
export type { RunBridgeOptions } from "./daemon.js";
|
|
22
|
-
export { DEFAULT_BRIDGE_INSTALL_URL, DEFAULT_BRIDGE_UPDATE_URL, DEFAULT_CLEOS_CONVEX_SITE_URL, DEFAULT_HERMES_API_URL, DEFAULT_BRIDGE_CAPABILITIES, HERMES_COMMANDS_CAPABILITY, HERMES_SESSION_TITLES_CAPABILITY, HERMES_SESSIONS_LIST_CAPABILITY, bridgeInstallCommand, bridgeUpdateCommand, } from "./constants.js";
|
|
22
|
+
export { DEFAULT_BRIDGE_INSTALL_URL, DEFAULT_BRIDGE_UPDATE_URL, DEFAULT_CLEOS_CONVEX_SITE_URL, DEFAULT_HERMES_API_URL, DEFAULT_BRIDGE_CAPABILITIES, HERMES_COMMANDS_CAPABILITY, HERMES_SESSION_TITLES_CAPABILITY, HERMES_SESSIONS_LIST_CAPABILITY, HERMES_PROFILES_CAPABILITY, bridgeInstallCommand, bridgeUpdateCommand, } from "./constants.js";
|
|
23
|
+
export { DEFAULT_PROFILE, isValidProfileName, listHermesProfiles, normalizeProfileName, resolveProfileContext, resolveProfileHome, } from "./profiles.js";
|
|
24
|
+
export type { HermesProfileContext, HermesProfileEntry } from "./profiles.js";
|
|
23
25
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACvF,YAAY,EACV,oBAAoB,EACpB,kBAAkB,EAClB,UAAU,EACV,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,eAAe,GAChB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AAC/F,YAAY,EAAE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,EAAE,MAAM,qBAAqB,CAAC;AACrF,OAAO,EACL,yBAAyB,EACzB,2BAA2B,EAC3B,+BAA+B,GAChC,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC/F,OAAO,EAAE,sBAAsB,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AACtF,OAAO,EAAE,2BAA2B,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAC9F,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,YAAY,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EACL,0BAA0B,EAC1B,yBAAyB,EACzB,6BAA6B,EAC7B,sBAAsB,EACtB,2BAA2B,EAC3B,0BAA0B,EAC1B,gCAAgC,EAChC,+BAA+B,EAC/B,0BAA0B,EAC1B,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,kBAAkB,EAClB,oBAAoB,EACpB,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,eAAe,CAAC;AACvB,YAAY,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -10,4 +10,5 @@ export { startCronWatcher, listPendingCronFiles, clearDeliveredIndex } from "./c
|
|
|
10
10
|
export { backfillCronDeliveries, describeCronDeliveryState } from "./cronBackfill.js";
|
|
11
11
|
export { resolveActiveConversationId, rememberConversationId } from "./activeConversation.js";
|
|
12
12
|
export { runBridgeDaemon } from "./daemon.js";
|
|
13
|
-
export { DEFAULT_BRIDGE_INSTALL_URL, DEFAULT_BRIDGE_UPDATE_URL, DEFAULT_CLEOS_CONVEX_SITE_URL, DEFAULT_HERMES_API_URL, DEFAULT_BRIDGE_CAPABILITIES, HERMES_COMMANDS_CAPABILITY, HERMES_SESSION_TITLES_CAPABILITY, HERMES_SESSIONS_LIST_CAPABILITY, bridgeInstallCommand, bridgeUpdateCommand, } from "./constants.js";
|
|
13
|
+
export { DEFAULT_BRIDGE_INSTALL_URL, DEFAULT_BRIDGE_UPDATE_URL, DEFAULT_CLEOS_CONVEX_SITE_URL, DEFAULT_HERMES_API_URL, DEFAULT_BRIDGE_CAPABILITIES, HERMES_COMMANDS_CAPABILITY, HERMES_SESSION_TITLES_CAPABILITY, HERMES_SESSIONS_LIST_CAPABILITY, HERMES_PROFILES_CAPABILITY, bridgeInstallCommand, bridgeUpdateCommand, } from "./constants.js";
|
|
14
|
+
export { DEFAULT_PROFILE, isValidProfileName, listHermesProfiles, normalizeProfileName, resolveProfileContext, resolveProfileHome, } from "./profiles.js";
|
package/dist/mcpList.d.ts
CHANGED
|
@@ -6,17 +6,18 @@ export type HermesMcpServerEntry = {
|
|
|
6
6
|
enabled: boolean;
|
|
7
7
|
};
|
|
8
8
|
export declare function parseMcpListOutput(stdout: string): HermesMcpServerEntry[];
|
|
9
|
-
export declare function listHermesMcpServers(): Promise<{
|
|
9
|
+
export declare function listHermesMcpServers(env?: NodeJS.ProcessEnv): Promise<{
|
|
10
10
|
servers: HermesMcpServerEntry[];
|
|
11
11
|
}>;
|
|
12
12
|
export declare function addHermesMcpServer(input: {
|
|
13
13
|
name?: string;
|
|
14
14
|
json: string;
|
|
15
|
+
env?: NodeJS.ProcessEnv;
|
|
15
16
|
}): Promise<{
|
|
16
17
|
ok: true;
|
|
17
18
|
name: string;
|
|
18
19
|
}>;
|
|
19
|
-
export declare function removeHermesMcpServer(name: string): Promise<{
|
|
20
|
+
export declare function removeHermesMcpServer(name: string, env?: NodeJS.ProcessEnv): Promise<{
|
|
20
21
|
ok: true;
|
|
21
22
|
name: string;
|
|
22
23
|
}>;
|
package/dist/mcpList.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcpList.d.ts","sourceRoot":"","sources":["../src/mcpList.ts"],"names":[],"mappings":"AAUA,MAAM,MAAM,oBAAoB,GAAG;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAqBF,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,oBAAoB,EAAE,CAwEzE;AAED,wBAAsB,oBAAoB,
|
|
1
|
+
{"version":3,"file":"mcpList.d.ts","sourceRoot":"","sources":["../src/mcpList.ts"],"names":[],"mappings":"AAUA,MAAM,MAAM,oBAAoB,GAAG;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAqBF,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,oBAAoB,EAAE,CAwEzE;AAED,wBAAsB,oBAAoB,CACxC,GAAG,GAAE,MAAM,CAAC,UAAwB,GACnC,OAAO,CAAC;IAAE,OAAO,EAAE,oBAAoB,EAAE,CAAA;CAAE,CAAC,CAgB9C;AAuLD,wBAAsB,kBAAkB,CAAC,KAAK,EAAE;IAC9C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;CACzB,GAAG,OAAO,CAAC;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAYtC;AAED,wBAAsB,qBAAqB,CACzC,IAAI,EAAE,MAAM,EACZ,GAAG,GAAE,MAAM,CAAC,UAAwB,GACnC,OAAO,CAAC;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAOrC"}
|
package/dist/mcpList.js
CHANGED
|
@@ -85,12 +85,12 @@ export function parseMcpListOutput(stdout) {
|
|
|
85
85
|
}
|
|
86
86
|
return servers;
|
|
87
87
|
}
|
|
88
|
-
export async function listHermesMcpServers() {
|
|
88
|
+
export async function listHermesMcpServers(env = process.env) {
|
|
89
89
|
try {
|
|
90
90
|
const { stdout } = await execFileAsync("hermes", ["mcp", "list"], {
|
|
91
91
|
timeout: LIST_TIMEOUT_MS,
|
|
92
92
|
maxBuffer: MAX_OUTPUT_BYTES,
|
|
93
|
-
env
|
|
93
|
+
env,
|
|
94
94
|
});
|
|
95
95
|
return { servers: parseMcpListOutput(stdout) };
|
|
96
96
|
}
|
|
@@ -261,15 +261,15 @@ export async function addHermesMcpServer(input) {
|
|
|
261
261
|
await execFileAsync("hermes", argv, {
|
|
262
262
|
timeout: ADD_TIMEOUT_MS,
|
|
263
263
|
maxBuffer: MAX_OUTPUT_BYTES,
|
|
264
|
-
env: process.env,
|
|
264
|
+
env: input.env ?? process.env,
|
|
265
265
|
});
|
|
266
266
|
return { ok: true, name: normalized.name };
|
|
267
267
|
}
|
|
268
|
-
export async function removeHermesMcpServer(name) {
|
|
268
|
+
export async function removeHermesMcpServer(name, env = process.env) {
|
|
269
269
|
await execFileAsync("hermes", ["mcp", "remove", name], {
|
|
270
270
|
timeout: REMOVE_TIMEOUT_MS,
|
|
271
271
|
maxBuffer: MAX_OUTPUT_BYTES,
|
|
272
|
-
env
|
|
272
|
+
env,
|
|
273
273
|
});
|
|
274
274
|
return { ok: true, name };
|
|
275
275
|
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/** Hermes default profile is the base home (`~/.hermes`) itself. */
|
|
2
|
+
export declare const DEFAULT_PROFILE = "default";
|
|
3
|
+
export declare class HermesProfileError extends Error {
|
|
4
|
+
}
|
|
5
|
+
export declare function isValidProfileName(name: string): boolean;
|
|
6
|
+
export declare function normalizeProfileName(profile?: string | null): string;
|
|
7
|
+
export declare function isDefaultProfile(profile?: string | null): boolean;
|
|
8
|
+
/** Base Hermes home — the default profile's directory. */
|
|
9
|
+
export declare function resolveBaseHermesHome(): string;
|
|
10
|
+
export declare function profilesRootDir(): string;
|
|
11
|
+
/** Resolve the Hermes home directory for a given profile (default → base home). */
|
|
12
|
+
export declare function resolveProfileHome(profile?: string | null): string;
|
|
13
|
+
/** Build an env that scopes child `hermes` processes to the given profile. */
|
|
14
|
+
export declare function profileEnv(profile?: string | null): NodeJS.ProcessEnv;
|
|
15
|
+
/** Best-effort parse of `model.default` from a profile's config.yaml. */
|
|
16
|
+
export declare function readProfileModel(home: string): string | undefined;
|
|
17
|
+
export declare function resolveProfileGatewayPort(profile?: string | null): number | undefined;
|
|
18
|
+
export declare function resolveProfileGatewayUrl(profile?: string | null): string;
|
|
19
|
+
export type HermesProfileContext = {
|
|
20
|
+
profile: string;
|
|
21
|
+
home: string;
|
|
22
|
+
apiUrl: string;
|
|
23
|
+
apiKey: string | undefined;
|
|
24
|
+
env: NodeJS.ProcessEnv;
|
|
25
|
+
};
|
|
26
|
+
export declare function resolveProfileContext(profile?: string | null): HermesProfileContext;
|
|
27
|
+
export type HermesProfileEntry = {
|
|
28
|
+
name: string;
|
|
29
|
+
isDefault: boolean;
|
|
30
|
+
isActive: boolean;
|
|
31
|
+
model?: string;
|
|
32
|
+
gatewayRunning: boolean;
|
|
33
|
+
gatewayPort?: number;
|
|
34
|
+
skillsCount: number;
|
|
35
|
+
sessionsCount: number;
|
|
36
|
+
home: string;
|
|
37
|
+
};
|
|
38
|
+
/** Cheap, sync enumeration of profile homes (default + on-disk profiles). */
|
|
39
|
+
export declare function listProfileHomes(): {
|
|
40
|
+
profile: string;
|
|
41
|
+
home: string;
|
|
42
|
+
}[];
|
|
43
|
+
export declare function listHermesProfiles(): Promise<{
|
|
44
|
+
profiles: HermesProfileEntry[];
|
|
45
|
+
}>;
|
|
46
|
+
export declare function createHermesProfile(name: string, options?: {
|
|
47
|
+
clone?: boolean;
|
|
48
|
+
}): Promise<{
|
|
49
|
+
ok: true;
|
|
50
|
+
name: string;
|
|
51
|
+
}>;
|
|
52
|
+
export declare function renameHermesProfile(oldName: string, newName: string): Promise<{
|
|
53
|
+
ok: true;
|
|
54
|
+
oldName: string;
|
|
55
|
+
newName: string;
|
|
56
|
+
}>;
|
|
57
|
+
export declare function deleteHermesProfile(name: string): Promise<{
|
|
58
|
+
ok: true;
|
|
59
|
+
name: string;
|
|
60
|
+
}>;
|
|
61
|
+
export declare function setHermesProfileModel(profile: string | undefined, model: string): Promise<{
|
|
62
|
+
ok: true;
|
|
63
|
+
profile: string;
|
|
64
|
+
model: string;
|
|
65
|
+
}>;
|
|
66
|
+
//# sourceMappingURL=profiles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profiles.d.ts","sourceRoot":"","sources":["../src/profiles.ts"],"names":[],"mappings":"AAcA,oEAAoE;AACpE,eAAO,MAAM,eAAe,YAAY,CAAC;AAIzC,qBAAa,kBAAmB,SAAQ,KAAK;CAAG;AAEhD,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAGxD;AAED,wBAAgB,oBAAoB,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAIpE;AAED,wBAAgB,gBAAgB,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAEjE;AAED,0DAA0D;AAC1D,wBAAgB,qBAAqB,IAAI,MAAM,CAE9C;AAED,wBAAgB,eAAe,IAAI,MAAM,CAExC;AAED,mFAAmF;AACnF,wBAAgB,kBAAkB,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAIlE;AAED,8EAA8E;AAC9E,wBAAgB,UAAU,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,GA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