@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/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-7OVDWXR7.js";
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({ paths });
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
- console.log(t("pair.scan"));
854
- qrcode.generate(qrValue, { small: true });
855
- await openSystemBrowser(pairingPageUrl);
856
- console.log(t("pair.openPairingPage", { url: pairingPageUrl }));
857
- console.log(t("pair.manualCode"));
858
- console.log(prepared.code);
859
- console.log(t("pair.expires"));
860
- const result = await waitForPairingOrShutdown(prepared.sessionId, paths);
861
- if (service) {
862
- await service.close();
863
- }
864
- if (result === "claimed") {
865
- await clearPairingClaim(prepared.sessionId, paths);
866
- console.log(t(reusedRunningService ? "pair.claimedRunning" : "pair.claimed"));
867
- printPostPairingNetworkNotice(prepared.routes.environment, config, t);
868
- try {
869
- if (hadActiveDevices) {
870
- console.log(t("pair.autostartUnchanged"));
871
- } else {
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 autostart2 = await enableAutostart();
882
- if (autostart2.supported && autostart2.enabled) {
883
- console.log(t("autostart.enabled", { method: autostart2.method, path: autostart2.filePath ?? "" }));
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"));
@@ -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
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createApp
3
- } from "../chunk-7OVDWXR7.js";
3
+ } from "../chunk-FWPHQZP6.js";
4
4
  export {
5
5
  createApp
6
6
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hermespilot/link",
3
- "version": "0.3.9",
3
+ "version": "0.4.0",
4
4
  "private": false,
5
5
  "description": "Hermes Link companion service and CLI for connecting hermes-agent through HermesPilot",
6
6
  "license": "MIT",