@hermespilot/link 0.3.9 → 0.4.0
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/{chunk-7OVDWXR7.js → chunk-FWPHQZP6.js} +900 -206
- package/dist/cli/index.js +60 -43
- package/dist/http/app.d.ts +17 -0
- package/dist/http/app.js +1 -1
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
LINK_VERSION,
|
|
6
6
|
LinkHttpError,
|
|
7
7
|
clearPairingClaim,
|
|
8
|
+
connectRelayControl,
|
|
8
9
|
createFileLogger,
|
|
9
10
|
currentCliScriptPath,
|
|
10
11
|
daemonLogFile,
|
|
@@ -33,7 +34,7 @@ import {
|
|
|
33
34
|
startDaemonProcess,
|
|
34
35
|
startLinkService,
|
|
35
36
|
stopDaemonProcess
|
|
36
|
-
} from "../chunk-
|
|
37
|
+
} from "../chunk-FWPHQZP6.js";
|
|
37
38
|
|
|
38
39
|
// src/cli/index.ts
|
|
39
40
|
import { Command } from "commander";
|
|
@@ -847,55 +848,71 @@ program.command("pair").description(helpText("pair.description")).action(async (
|
|
|
847
848
|
}
|
|
848
849
|
const reusedRunningService = probe.reusable;
|
|
849
850
|
const restartReusedServiceAfterClaim = reusedRunningService && !probeBeforePair.linkId;
|
|
850
|
-
const service = reusedRunningService ? null : await startLinkService({
|
|
851
|
+
const service = reusedRunningService ? null : await startLinkService({
|
|
852
|
+
paths,
|
|
853
|
+
waitForRelayReady: true
|
|
854
|
+
});
|
|
855
|
+
let pairingRelayBridge = null;
|
|
856
|
+
if (restartReusedServiceAfterClaim) {
|
|
857
|
+
pairingRelayBridge = connectRelayControl({
|
|
858
|
+
relayBaseUrl: prepared.relayBaseUrl,
|
|
859
|
+
linkId: prepared.linkId,
|
|
860
|
+
localPort: config.port
|
|
861
|
+
});
|
|
862
|
+
pairingRelayBridge.publishNetworkRoutes(prepared.routes);
|
|
863
|
+
}
|
|
851
864
|
const qrValue = JSON.stringify(prepared.qrPayload);
|
|
852
865
|
const pairingPageUrl = `http://127.0.0.1:${config.port}/pair?session_id=${encodeURIComponent(prepared.sessionId)}`;
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
const currentAutostart = await getAutostartStatus();
|
|
873
|
-
if (currentAutostart.supported && currentAutostart.enabled) {
|
|
874
|
-
console.log(
|
|
875
|
-
t("autostart.alreadyEnabled", {
|
|
876
|
-
method: currentAutostart.method,
|
|
877
|
-
path: currentAutostart.filePath ?? ""
|
|
878
|
-
})
|
|
879
|
-
);
|
|
866
|
+
try {
|
|
867
|
+
console.log(t("pair.scan"));
|
|
868
|
+
qrcode.generate(qrValue, { small: true });
|
|
869
|
+
await openSystemBrowser(pairingPageUrl);
|
|
870
|
+
console.log(t("pair.openPairingPage", { url: pairingPageUrl }));
|
|
871
|
+
console.log(t("pair.manualCode"));
|
|
872
|
+
console.log(prepared.code);
|
|
873
|
+
console.log(t("pair.expires"));
|
|
874
|
+
const result = await waitForPairingOrShutdown(prepared.sessionId, paths);
|
|
875
|
+
if (service) {
|
|
876
|
+
await service.close();
|
|
877
|
+
}
|
|
878
|
+
if (result === "claimed") {
|
|
879
|
+
await clearPairingClaim(prepared.sessionId, paths);
|
|
880
|
+
console.log(t(reusedRunningService ? "pair.claimedRunning" : "pair.claimed"));
|
|
881
|
+
printPostPairingNetworkNotice(prepared.routes.environment, config, t);
|
|
882
|
+
try {
|
|
883
|
+
if (hadActiveDevices) {
|
|
884
|
+
console.log(t("pair.autostartUnchanged"));
|
|
880
885
|
} else {
|
|
881
|
-
const
|
|
882
|
-
if (
|
|
883
|
-
console.log(
|
|
886
|
+
const currentAutostart = await getAutostartStatus();
|
|
887
|
+
if (currentAutostart.supported && currentAutostart.enabled) {
|
|
888
|
+
console.log(
|
|
889
|
+
t("autostart.alreadyEnabled", {
|
|
890
|
+
method: currentAutostart.method,
|
|
891
|
+
path: currentAutostart.filePath ?? ""
|
|
892
|
+
})
|
|
893
|
+
);
|
|
894
|
+
} else {
|
|
895
|
+
const autostart2 = await enableAutostart();
|
|
896
|
+
if (autostart2.supported && autostart2.enabled) {
|
|
897
|
+
console.log(t("autostart.enabled", { method: autostart2.method, path: autostart2.filePath ?? "" }));
|
|
898
|
+
}
|
|
884
899
|
}
|
|
885
900
|
}
|
|
901
|
+
} catch (error) {
|
|
902
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
903
|
+
console.log(t("pair.autostartFailed", { message }));
|
|
904
|
+
}
|
|
905
|
+
if (restartReusedServiceAfterClaim) {
|
|
906
|
+
await stopDaemonProcess(paths);
|
|
907
|
+
const status = await startDaemonProcess(paths);
|
|
908
|
+
console.log(t("start.backgroundStarted", { pid: status.pid ?? "unknown" }));
|
|
909
|
+
} else if (!reusedRunningService) {
|
|
910
|
+
const status = await startDaemonProcess(paths);
|
|
911
|
+
console.log(t("start.backgroundStarted", { pid: status.pid ?? "unknown" }));
|
|
886
912
|
}
|
|
887
|
-
} catch (error) {
|
|
888
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
889
|
-
console.log(t("pair.autostartFailed", { message }));
|
|
890
|
-
}
|
|
891
|
-
if (restartReusedServiceAfterClaim) {
|
|
892
|
-
await stopDaemonProcess(paths);
|
|
893
|
-
const status = await startDaemonProcess(paths);
|
|
894
|
-
console.log(t("start.backgroundStarted", { pid: status.pid ?? "unknown" }));
|
|
895
|
-
} else if (!reusedRunningService) {
|
|
896
|
-
const status = await startDaemonProcess(paths);
|
|
897
|
-
console.log(t("start.backgroundStarted", { pid: status.pid ?? "unknown" }));
|
|
898
913
|
}
|
|
914
|
+
} finally {
|
|
915
|
+
pairingRelayBridge?.close();
|
|
899
916
|
}
|
|
900
917
|
});
|
|
901
918
|
var autostart = program.command("autostart").description(helpText("autostart.description"));
|
package/dist/http/app.d.ts
CHANGED
|
@@ -183,6 +183,19 @@ interface BulkDeleteConversationResult {
|
|
|
183
183
|
message: string;
|
|
184
184
|
};
|
|
185
185
|
}
|
|
186
|
+
type ConversationClearPlanStatus = 'prepared' | 'executing' | 'completed' | 'failed';
|
|
187
|
+
interface ConversationClearPlan {
|
|
188
|
+
id: string;
|
|
189
|
+
status: ConversationClearPlanStatus;
|
|
190
|
+
created_at: string;
|
|
191
|
+
updated_at: string;
|
|
192
|
+
total_count: number;
|
|
193
|
+
deleted_count: number;
|
|
194
|
+
failed_count: number;
|
|
195
|
+
conversation_ids: string[];
|
|
196
|
+
conversations: BulkDeleteConversationResult[];
|
|
197
|
+
completed_at?: string;
|
|
198
|
+
}
|
|
186
199
|
interface LinkRun {
|
|
187
200
|
id: string;
|
|
188
201
|
kind?: 'agent' | 'command';
|
|
@@ -462,6 +475,10 @@ declare class ConversationService {
|
|
|
462
475
|
last_event_seq: number;
|
|
463
476
|
}>;
|
|
464
477
|
deleteConversation(conversationId: string): Promise<DeleteConversationResult>;
|
|
478
|
+
prepareClearAllConversationPlan(): Promise<ConversationClearPlan>;
|
|
479
|
+
readClearAllConversationPlan(planId: string): Promise<ConversationClearPlan>;
|
|
480
|
+
executeClearAllConversationPlan(planId: string): Promise<ConversationClearPlan>;
|
|
481
|
+
startClearAllConversationPlan(planId: string): Promise<ConversationClearPlan>;
|
|
465
482
|
deleteConversations(conversationIds: string[]): Promise<{
|
|
466
483
|
deleted_count: number;
|
|
467
484
|
failed_count: number;
|
package/dist/http/app.js
CHANGED