@hermespilot/link 0.3.5 → 0.3.7
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/README.md +1 -1
- package/dist/{chunk-ZQO7TU7G.js → chunk-TZVQZFWU.js} +1376 -823
- package/dist/cli/index.js +1 -1
- package/dist/http/app.d.ts +97 -78
- package/dist/http/app.js +1 -1
- package/package.json +6 -4
- package/scripts/check-node-version.mjs +7 -7
package/dist/cli/index.js
CHANGED
package/dist/http/app.d.ts
CHANGED
|
@@ -1,82 +1,5 @@
|
|
|
1
1
|
import Koa from 'koa';
|
|
2
2
|
|
|
3
|
-
interface RuntimePaths {
|
|
4
|
-
homeDir: string;
|
|
5
|
-
identityFile: string;
|
|
6
|
-
configFile: string;
|
|
7
|
-
stateFile: string;
|
|
8
|
-
credentialsFile: string;
|
|
9
|
-
databaseFile: string;
|
|
10
|
-
conversationsDir: string;
|
|
11
|
-
blobsDir: string;
|
|
12
|
-
indexesDir: string;
|
|
13
|
-
logsDir: string;
|
|
14
|
-
runDir: string;
|
|
15
|
-
pairingDir: string;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
interface LinkStatistics {
|
|
19
|
-
conversations: {
|
|
20
|
-
total: number;
|
|
21
|
-
active: number;
|
|
22
|
-
deleted: number;
|
|
23
|
-
};
|
|
24
|
-
tokens: {
|
|
25
|
-
input_tokens: number;
|
|
26
|
-
output_tokens: number;
|
|
27
|
-
total_tokens: number;
|
|
28
|
-
};
|
|
29
|
-
messages: {
|
|
30
|
-
total: number;
|
|
31
|
-
};
|
|
32
|
-
runs: {
|
|
33
|
-
total: number;
|
|
34
|
-
};
|
|
35
|
-
models: {
|
|
36
|
-
total: number;
|
|
37
|
-
};
|
|
38
|
-
profiles: {
|
|
39
|
-
total: number;
|
|
40
|
-
};
|
|
41
|
-
skills: {
|
|
42
|
-
total: number;
|
|
43
|
-
};
|
|
44
|
-
tools: {
|
|
45
|
-
total: number;
|
|
46
|
-
};
|
|
47
|
-
updated_at?: string;
|
|
48
|
-
}
|
|
49
|
-
interface LinkStatisticsFilter {
|
|
50
|
-
profileUid?: string | null;
|
|
51
|
-
profileName?: string | null;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
type LogLevel = 'debug' | 'info' | 'warn' | 'error';
|
|
55
|
-
interface FileLoggerOptions {
|
|
56
|
-
paths?: RuntimePaths;
|
|
57
|
-
fileName?: string;
|
|
58
|
-
maxFileBytes?: number;
|
|
59
|
-
maxFiles?: number;
|
|
60
|
-
now?: () => Date;
|
|
61
|
-
}
|
|
62
|
-
declare class FileLogger {
|
|
63
|
-
readonly filePath: string;
|
|
64
|
-
private readonly paths;
|
|
65
|
-
private readonly maxFileBytes;
|
|
66
|
-
private readonly maxFiles;
|
|
67
|
-
private readonly now;
|
|
68
|
-
private queue;
|
|
69
|
-
constructor(options?: FileLoggerOptions);
|
|
70
|
-
debug(message: string, fields?: Record<string, unknown>): Promise<void>;
|
|
71
|
-
info(message: string, fields?: Record<string, unknown>): Promise<void>;
|
|
72
|
-
warn(message: string, fields?: Record<string, unknown>): Promise<void>;
|
|
73
|
-
error(message: string, fields?: Record<string, unknown>): Promise<void>;
|
|
74
|
-
write(level: LogLevel, message: string, fields?: Record<string, unknown>): Promise<void>;
|
|
75
|
-
flush(): Promise<void>;
|
|
76
|
-
private appendEntry;
|
|
77
|
-
private rotateIfNeeded;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
3
|
interface ConversationProfileSummary {
|
|
81
4
|
uid?: string;
|
|
82
5
|
name: string;
|
|
@@ -102,6 +25,15 @@ interface ConversationSummary {
|
|
|
102
25
|
content_preview: string;
|
|
103
26
|
} | null;
|
|
104
27
|
}
|
|
28
|
+
interface ConversationListPageInfo {
|
|
29
|
+
limit: number;
|
|
30
|
+
has_more: boolean;
|
|
31
|
+
next_cursor: string | null;
|
|
32
|
+
}
|
|
33
|
+
interface ConversationListPage {
|
|
34
|
+
conversations: ConversationSummary[];
|
|
35
|
+
page: ConversationListPageInfo;
|
|
36
|
+
}
|
|
105
37
|
interface ConversationRuntimeMetadata {
|
|
106
38
|
profile: ConversationProfileSummary;
|
|
107
39
|
model: {
|
|
@@ -118,7 +50,7 @@ interface ConversationRuntimeMetadata {
|
|
|
118
50
|
used_tokens?: number;
|
|
119
51
|
window_tokens?: number;
|
|
120
52
|
usage_percent?: number;
|
|
121
|
-
source: 'explicit' | 'unknown';
|
|
53
|
+
source: 'explicit' | 'estimated' | 'unknown';
|
|
122
54
|
updated_at?: string;
|
|
123
55
|
};
|
|
124
56
|
}
|
|
@@ -279,6 +211,7 @@ interface LinkRun {
|
|
|
279
211
|
context_tokens?: number;
|
|
280
212
|
context_window?: number;
|
|
281
213
|
usage_percent?: number;
|
|
214
|
+
context_source?: 'explicit' | 'estimated';
|
|
282
215
|
};
|
|
283
216
|
}
|
|
284
217
|
interface SendMessageInput {
|
|
@@ -321,6 +254,83 @@ interface CancelRunResult {
|
|
|
321
254
|
}
|
|
322
255
|
type ConversationEventListener = (event: ConversationEvent) => void;
|
|
323
256
|
|
|
257
|
+
interface RuntimePaths {
|
|
258
|
+
homeDir: string;
|
|
259
|
+
identityFile: string;
|
|
260
|
+
configFile: string;
|
|
261
|
+
stateFile: string;
|
|
262
|
+
credentialsFile: string;
|
|
263
|
+
databaseFile: string;
|
|
264
|
+
conversationsDir: string;
|
|
265
|
+
blobsDir: string;
|
|
266
|
+
indexesDir: string;
|
|
267
|
+
logsDir: string;
|
|
268
|
+
runDir: string;
|
|
269
|
+
pairingDir: string;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
interface LinkStatistics {
|
|
273
|
+
conversations: {
|
|
274
|
+
total: number;
|
|
275
|
+
active: number;
|
|
276
|
+
deleted: number;
|
|
277
|
+
};
|
|
278
|
+
tokens: {
|
|
279
|
+
input_tokens: number;
|
|
280
|
+
output_tokens: number;
|
|
281
|
+
total_tokens: number;
|
|
282
|
+
};
|
|
283
|
+
messages: {
|
|
284
|
+
total: number;
|
|
285
|
+
};
|
|
286
|
+
runs: {
|
|
287
|
+
total: number;
|
|
288
|
+
};
|
|
289
|
+
models: {
|
|
290
|
+
total: number;
|
|
291
|
+
};
|
|
292
|
+
profiles: {
|
|
293
|
+
total: number;
|
|
294
|
+
};
|
|
295
|
+
skills: {
|
|
296
|
+
total: number;
|
|
297
|
+
};
|
|
298
|
+
tools: {
|
|
299
|
+
total: number;
|
|
300
|
+
};
|
|
301
|
+
updated_at?: string;
|
|
302
|
+
}
|
|
303
|
+
interface LinkStatisticsFilter {
|
|
304
|
+
profileUid?: string | null;
|
|
305
|
+
profileName?: string | null;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
type LogLevel = 'debug' | 'info' | 'warn' | 'error';
|
|
309
|
+
interface FileLoggerOptions {
|
|
310
|
+
paths?: RuntimePaths;
|
|
311
|
+
fileName?: string;
|
|
312
|
+
maxFileBytes?: number;
|
|
313
|
+
maxFiles?: number;
|
|
314
|
+
now?: () => Date;
|
|
315
|
+
}
|
|
316
|
+
declare class FileLogger {
|
|
317
|
+
readonly filePath: string;
|
|
318
|
+
private readonly paths;
|
|
319
|
+
private readonly maxFileBytes;
|
|
320
|
+
private readonly maxFiles;
|
|
321
|
+
private readonly now;
|
|
322
|
+
private queue;
|
|
323
|
+
constructor(options?: FileLoggerOptions);
|
|
324
|
+
debug(message: string, fields?: Record<string, unknown>): Promise<void>;
|
|
325
|
+
info(message: string, fields?: Record<string, unknown>): Promise<void>;
|
|
326
|
+
warn(message: string, fields?: Record<string, unknown>): Promise<void>;
|
|
327
|
+
error(message: string, fields?: Record<string, unknown>): Promise<void>;
|
|
328
|
+
write(level: LogLevel, message: string, fields?: Record<string, unknown>): Promise<void>;
|
|
329
|
+
flush(): Promise<void>;
|
|
330
|
+
private appendEntry;
|
|
331
|
+
private rotateIfNeeded;
|
|
332
|
+
}
|
|
333
|
+
|
|
324
334
|
interface HermesSessionSyncResult {
|
|
325
335
|
scanned_profiles: number;
|
|
326
336
|
scanned_sessions: number;
|
|
@@ -366,6 +376,15 @@ declare class ConversationService {
|
|
|
366
376
|
constructor(paths: RuntimePaths, logger: FileLogger);
|
|
367
377
|
private withConversationLock;
|
|
368
378
|
listConversations(): Promise<ConversationSummary[]>;
|
|
379
|
+
listConversationPage(input?: {
|
|
380
|
+
limit?: number;
|
|
381
|
+
cursor?: string;
|
|
382
|
+
}): Promise<ConversationListPage>;
|
|
383
|
+
searchConversationPage(input?: {
|
|
384
|
+
limit?: number;
|
|
385
|
+
cursor?: string;
|
|
386
|
+
query?: string;
|
|
387
|
+
}): Promise<ConversationListPage>;
|
|
369
388
|
getStatistics(filter?: LinkStatisticsFilter): Promise<LinkStatistics>;
|
|
370
389
|
rebuildStatisticsIndex(): Promise<void>;
|
|
371
390
|
createConversation(input?: {
|
package/dist/http/app.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hermespilot/link",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.7",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Hermes Link companion service and CLI for connecting hermes-agent through HermesPilot",
|
|
6
6
|
"license": "MIT",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"access": "public"
|
|
28
28
|
},
|
|
29
29
|
"scripts": {
|
|
30
|
-
"build": "tsup src/cli/index.ts src/http/app.ts --format esm --target
|
|
30
|
+
"build": "tsup src/cli/index.ts src/http/app.ts --format esm --target node20 --dts --clean",
|
|
31
31
|
"check": "tsc --noEmit",
|
|
32
32
|
"dev": "tsx src/cli/index.ts",
|
|
33
33
|
"preinstall": "node ./scripts/check-node-version.mjs",
|
|
@@ -41,6 +41,7 @@
|
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@koa/router": "^15.4.0",
|
|
44
|
+
"better-sqlite3": "^12.9.0",
|
|
44
45
|
"commander": "^12.1.0",
|
|
45
46
|
"koa": "^2.15.3",
|
|
46
47
|
"qrcode": "^1.5.4",
|
|
@@ -50,8 +51,9 @@
|
|
|
50
51
|
"zod": "^3.24.1"
|
|
51
52
|
},
|
|
52
53
|
"devDependencies": {
|
|
54
|
+
"@types/better-sqlite3": "^7.6.13",
|
|
53
55
|
"@types/koa": "^2.15.0",
|
|
54
|
-
"@types/node": "^
|
|
56
|
+
"@types/node": "^20.19.39",
|
|
55
57
|
"@types/qrcode": "^1.5.6",
|
|
56
58
|
"@types/qrcode-terminal": "^0.12.2",
|
|
57
59
|
"@types/ws": "^8.5.13",
|
|
@@ -61,6 +63,6 @@
|
|
|
61
63
|
"vitest": "^2.1.8"
|
|
62
64
|
},
|
|
63
65
|
"engines": {
|
|
64
|
-
"node": ">=
|
|
66
|
+
"node": ">=20.0.0"
|
|
65
67
|
}
|
|
66
68
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import process from "node:process";
|
|
2
2
|
|
|
3
|
-
const MINIMUM_NODE_VERSION = "
|
|
3
|
+
const MINIMUM_NODE_VERSION = "20.0.0";
|
|
4
4
|
|
|
5
5
|
function parseVersion(input) {
|
|
6
6
|
const normalized = String(input ?? "")
|
|
@@ -55,21 +55,21 @@ if (compareVersions(current, minimum) < 0) {
|
|
|
55
55
|
const language = detectLanguage();
|
|
56
56
|
console.error("");
|
|
57
57
|
if (language === "zh-CN") {
|
|
58
|
-
console.error("Hermes Link 需要 Node.js
|
|
58
|
+
console.error("Hermes Link 需要 Node.js 20.0.0 或更新版本。");
|
|
59
59
|
console.error(`当前使用的是 Node.js ${process.versions.node}。`);
|
|
60
60
|
console.error("");
|
|
61
61
|
console.error("为什么需要这样做:");
|
|
62
|
-
console.error("- Hermes Link
|
|
63
|
-
console.error("- 如果继续在旧版 Node.js
|
|
62
|
+
console.error("- Hermes Link 与 hermes-agent 的 Node.js 20+ 要求保持一致。");
|
|
63
|
+
console.error("- 如果继续在旧版 Node.js 上安装,后续配对、后台服务或本地数据库可能会失败。");
|
|
64
64
|
console.error("");
|
|
65
65
|
console.error("请先升级 Node.js,然后重新运行安装命令。");
|
|
66
66
|
} else {
|
|
67
|
-
console.error("Hermes Link needs Node.js
|
|
67
|
+
console.error("Hermes Link needs Node.js 20.0.0 or newer.");
|
|
68
68
|
console.error(`You are using Node.js ${process.versions.node}.`);
|
|
69
69
|
console.error("");
|
|
70
70
|
console.error("Why this is required:");
|
|
71
|
-
console.error("- Hermes Link
|
|
72
|
-
console.error("- If installation continued on an older Node.js version, pairing
|
|
71
|
+
console.error("- Hermes Link now matches hermes-agent's Node.js 20+ requirement.");
|
|
72
|
+
console.error("- If installation continued on an older Node.js version, pairing, the background service, or the local database could fail later.");
|
|
73
73
|
console.error("");
|
|
74
74
|
console.error("Please update Node.js first, then run the install command again.");
|
|
75
75
|
}
|