@hermespilot/link 0.7.8 → 0.7.9

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
@@ -55,7 +55,7 @@ import {
55
55
  stopDaemonProcess,
56
56
  summarizeUsageProbeEnsure,
57
57
  translate
58
- } from "../chunk-7JPQICDK.js";
58
+ } from "../chunk-LUGNDJU3.js";
59
59
 
60
60
  // src/cli/index.ts
61
61
  import { Command } from "commander";
@@ -24,6 +24,7 @@ interface ConversationSummary {
24
24
  updated_at?: string;
25
25
  };
26
26
  profile: ConversationProfileSummary;
27
+ goal?: ConversationGoalState;
27
28
  last_message: {
28
29
  id: string;
29
30
  role: string;
@@ -44,8 +45,12 @@ interface ConversationRuntimeMetadata {
44
45
  model: {
45
46
  id: string;
46
47
  provider?: string;
48
+ provider_key?: string;
49
+ base_url?: string;
50
+ api_mode?: string;
47
51
  context_window?: number;
48
52
  reasoning_effort?: string;
53
+ reasoning_support_policy?: string;
49
54
  };
50
55
  context: {
51
56
  input_tokens: number;
@@ -55,11 +60,11 @@ interface ConversationRuntimeMetadata {
55
60
  used_tokens?: number;
56
61
  window_tokens?: number;
57
62
  usage_percent?: number;
58
- source: 'explicit' | 'probe' | 'estimated' | 'unknown';
63
+ source: "explicit" | "probe" | "estimated" | "unknown";
59
64
  updated_at?: string;
60
65
  };
61
66
  }
62
- type ConversationTitleSource = 'default' | 'temporary_user_message' | 'temporary_fallback' | 'manual' | 'generated' | 'hermes';
67
+ type ConversationTitleSource = "default" | "temporary_user_message" | "temporary_fallback" | "manual" | "generated" | "hermes";
63
68
  interface ConversationMessagesPageInfo {
64
69
  limit: number;
65
70
  has_more_before: boolean;
@@ -67,10 +72,10 @@ interface ConversationMessagesPageInfo {
67
72
  oldest_message_id: string | null;
68
73
  newest_message_id: string | null;
69
74
  }
70
- type ConversationEventStreamReason = 'terminal' | 'active_run' | 'queued_run' | 'recovering' | 'requires_user_action' | 'unknown';
75
+ type ConversationEventStreamReason = "terminal" | "active_run" | "queued_run" | "context_compression" | "recovering" | "requires_user_action" | "unknown";
71
76
  interface ConversationEventStreamRunSummary {
72
77
  id: string;
73
- status: LinkRun['status'];
78
+ status: LinkRun["status"];
74
79
  assistant_message_id: string;
75
80
  requires_user_action: boolean;
76
81
  updated_at: string;
@@ -84,7 +89,7 @@ interface ConversationEventStreamState {
84
89
  latest_runs: ConversationEventStreamRunSummary[];
85
90
  }
86
91
  interface LinkMessagePart {
87
- type: 'text' | 'image' | 'file' | 'audio' | 'video' | 'unsupported';
92
+ type: "text" | "image" | "file" | "audio" | "video" | "unsupported";
88
93
  text?: string;
89
94
  blob?: string;
90
95
  mime?: string;
@@ -92,21 +97,21 @@ interface LinkMessagePart {
92
97
  filename?: string;
93
98
  url?: string;
94
99
  local_path?: string;
95
- kind?: 'voice';
100
+ kind?: "voice";
96
101
  is_voice_note?: boolean;
97
102
  duration_ms?: number;
98
103
  waveform?: number[];
99
104
  }
100
105
  interface LinkMessageAgentEvent {
101
106
  id: string;
102
- kind?: 'tool' | 'thinking_delta';
107
+ kind?: "tool" | "thinking_delta";
103
108
  title: string;
104
- status: 'running' | 'completed' | 'failed' | 'info';
109
+ status: "running" | "completed" | "failed" | "info";
105
110
  created_at: string;
106
111
  subtitle?: string;
107
112
  detail?: string;
108
113
  text?: string;
109
- phase?: 'thinking' | 'final';
114
+ phase?: "thinking" | "final";
110
115
  completed_at?: string;
111
116
  raw?: {
112
117
  format: string;
@@ -115,24 +120,24 @@ interface LinkMessageAgentEvent {
115
120
  }
116
121
  type LinkMessageBlock = {
117
122
  id: string;
118
- type: 'text';
123
+ type: "text";
119
124
  text: string;
120
125
  created_at: string;
121
126
  updated_at?: string;
122
127
  } | {
123
128
  id: string;
124
- type: 'agent_events';
129
+ type: "agent_events";
125
130
  events: LinkMessageAgentEvent[];
126
131
  created_at: string;
127
132
  updated_at?: string;
128
133
  };
129
- type LinkApprovalDecisionScope = 'once' | 'session' | 'always';
130
- type LinkApprovalDecision = LinkApprovalDecisionScope | 'deny';
131
- type LinkApprovalStatus = 'pending' | 'approved' | 'denied' | 'expired';
134
+ type LinkApprovalDecisionScope = "once" | "session" | "always";
135
+ type LinkApprovalDecision = LinkApprovalDecisionScope | "deny";
136
+ type LinkApprovalStatus = "pending" | "approved" | "denied" | "expired";
132
137
  interface LinkApprovalRequest {
133
138
  id: string;
134
139
  status: LinkApprovalStatus;
135
- kind: 'terminal_command';
140
+ kind: "terminal_command";
136
141
  command: string;
137
142
  description?: string;
138
143
  pattern_key?: string;
@@ -147,19 +152,42 @@ interface LinkApprovalRequest {
147
152
  resolution_hint_en?: string;
148
153
  config_path?: string;
149
154
  }
155
+ type LinkInputRequestKind = "clarify" | "sudo" | "secret";
156
+ type LinkInputRequestStatus = "pending" | "answered" | "cancelled" | "expired";
157
+ interface LinkInputRequest {
158
+ id: string;
159
+ kind: LinkInputRequestKind;
160
+ status: LinkInputRequestStatus;
161
+ conversation_id: string;
162
+ run_id: string;
163
+ message_id?: string;
164
+ hermes_request_id: string;
165
+ hermes_rpc_session_id?: string;
166
+ question?: string;
167
+ choices?: string[];
168
+ allow_free_text?: boolean;
169
+ prompt?: string;
170
+ env_var?: string;
171
+ created_at: string;
172
+ resolved_at?: string;
173
+ raw?: {
174
+ format: string;
175
+ payload: unknown;
176
+ };
177
+ }
150
178
  interface LinkMessage {
151
179
  id: string;
152
180
  schema_version: 1;
153
181
  conversation_id: string;
154
- role: 'user' | 'assistant' | 'tool' | 'system';
155
- status: 'queued' | 'completed' | 'streaming' | 'failed' | 'cancelled';
182
+ role: "user" | "assistant" | "tool" | "system";
183
+ status: "queued" | "completed" | "streaming" | "failed" | "cancelled";
156
184
  run_id?: string;
157
185
  client_message_id?: string;
158
186
  created_at: string;
159
187
  updated_at: string;
160
188
  sender: {
161
189
  id: string;
162
- type: 'human' | 'agent' | 'system' | 'tool';
190
+ type: "human" | "agent" | "system" | "tool";
163
191
  display_name: string;
164
192
  profile_uid?: string;
165
193
  profile?: string;
@@ -169,6 +197,7 @@ interface LinkMessage {
169
197
  blocks?: LinkMessageBlock[];
170
198
  agent_events?: LinkMessageAgentEvent[];
171
199
  approvals?: LinkApprovalRequest[];
200
+ input_requests?: LinkInputRequest[];
172
201
  hermes?: Record<string, unknown>;
173
202
  raw?: {
174
203
  format: string;
@@ -204,7 +233,7 @@ interface UnarchiveConversationResult {
204
233
  }
205
234
  interface BulkDeleteConversationResult {
206
235
  conversation_id: string;
207
- status: 'deleted' | 'failed';
236
+ status: "deleted" | "failed";
208
237
  hermes_deleted?: boolean;
209
238
  hermes_session_ids?: string[];
210
239
  deleted_at?: string;
@@ -215,15 +244,15 @@ interface BulkDeleteConversationResult {
215
244
  }
216
245
  interface BulkArchiveConversationResult {
217
246
  conversation_id: string;
218
- status: 'archived' | 'failed';
247
+ status: "archived" | "failed";
219
248
  archived_at?: string;
220
249
  error?: {
221
250
  code: string;
222
251
  message: string;
223
252
  };
224
253
  }
225
- type ConversationClearPlanStatus = 'prepared' | 'executing' | 'completed' | 'failed';
226
- type ConversationClearPlanTargetStatus = 'active' | 'archived';
254
+ type ConversationClearPlanStatus = "prepared" | "executing" | "completed" | "failed";
255
+ type ConversationClearPlanTargetStatus = "active" | "archived";
227
256
  interface ConversationClearPlan {
228
257
  id: string;
229
258
  status: ConversationClearPlanStatus;
@@ -250,13 +279,32 @@ interface ConversationArchivePlan {
250
279
  conversations: BulkArchiveConversationResult[];
251
280
  completed_at?: string;
252
281
  }
282
+ interface ConversationGoalState {
283
+ title: string;
284
+ content: string;
285
+ status: "active" | "paused" | "done" | "cleared";
286
+ updated_at: string;
287
+ turns_used?: number;
288
+ max_turns?: number;
289
+ last_reason?: string;
290
+ usage?: {
291
+ input_tokens: number;
292
+ output_tokens: number;
293
+ total_tokens: number;
294
+ context_tokens?: number;
295
+ context_window?: number;
296
+ usage_percent?: number;
297
+ run_ids?: string[];
298
+ };
299
+ }
253
300
  interface LinkRun {
254
301
  id: string;
255
- kind?: 'agent' | 'command';
256
- queue_mode?: 'guided_interrupt';
302
+ kind?: "agent" | "command" | "compression";
303
+ mode?: "message" | "goal";
304
+ queue_mode?: "guided_interrupt";
257
305
  queue_promoted_at?: string;
258
306
  guided_after_run_id?: string;
259
- hermes_backend?: 'tui_gateway' | 'responses' | 'runs';
307
+ hermes_backend?: "tui_gateway" | "responses" | "runs";
260
308
  hermes_run_id?: string;
261
309
  hermes_response_id?: string;
262
310
  hermes_rpc_session_id?: string;
@@ -265,7 +313,7 @@ interface LinkRun {
265
313
  trigger_message_id: string;
266
314
  assistant_message_id: string;
267
315
  hermes_session_id: string;
268
- status: 'queued' | 'running' | 'completed' | 'failed' | 'cancelled' | 'unknown';
316
+ status: "queued" | "running" | "completed" | "failed" | "cancelled" | "unknown";
269
317
  started_at: string;
270
318
  completed_at?: string;
271
319
  error_message?: string;
@@ -278,7 +326,13 @@ interface LinkRun {
278
326
  language?: string;
279
327
  model?: string;
280
328
  provider?: string;
329
+ model_override?: boolean;
330
+ base_url?: string;
331
+ api_mode?: string;
281
332
  context_window?: number;
333
+ reasoning_effort?: string;
334
+ reasoning_override?: boolean;
335
+ reasoning_support_policy?: string;
282
336
  usage?: {
283
337
  input_tokens: number;
284
338
  output_tokens: number;
@@ -286,12 +340,61 @@ interface LinkRun {
286
340
  context_tokens?: number;
287
341
  context_window?: number;
288
342
  usage_percent?: number;
289
- context_source?: 'explicit' | 'probe' | 'estimated';
343
+ context_source?: "explicit" | "probe" | "estimated" | "native";
290
344
  };
345
+ context_compression?: ContextCompressionMetadata;
346
+ }
347
+ interface ContextCompressionMetadata {
348
+ operation_id: string;
349
+ generation: number;
350
+ status: "compressing" | "completed" | "failed" | "timed_out" | "cancelled";
351
+ started_at: string;
352
+ completed_at?: string;
353
+ source?: "manual" | "auto";
354
+ focus_provided?: boolean;
355
+ previous_session_id?: string;
356
+ next_session_id?: string;
357
+ usage_before?: ContextCompressionUsage;
358
+ usage_after?: ContextCompressionUsage;
359
+ error_code?: string;
360
+ error_message?: string;
361
+ }
362
+ interface ContextCompressionUsage {
363
+ context_tokens?: number;
364
+ context_window?: number;
365
+ usage_percent?: number;
366
+ source?: "native";
367
+ }
368
+ interface ContextCompressionResult {
369
+ conversation_id: string;
370
+ operation: {
371
+ id: string;
372
+ status: ContextCompressionMetadata["status"];
373
+ marker_message_id: string;
374
+ run_id: string;
375
+ started_at: string;
376
+ };
377
+ user_message?: Pick<LinkMessage, "id" | "status">;
378
+ assistant_message: Pick<LinkMessage, "id" | "status">;
379
+ run: Pick<LinkRun, "id" | "status">;
380
+ last_event_seq: number;
381
+ conversation?: ConversationSummary;
382
+ event_stream?: ConversationEventStreamState;
383
+ }
384
+ interface StartContextCompressionInput {
385
+ conversationId: string;
386
+ focus?: string;
387
+ clientOperationId?: string;
388
+ rawContent?: string;
389
+ createUserMessage?: boolean;
390
+ accountId?: string;
391
+ appInstanceId?: string;
392
+ language?: string;
291
393
  }
292
394
  interface SendMessageInput {
293
395
  conversationId: string;
294
396
  content: string;
397
+ mode?: "message" | "goal";
295
398
  attachments?: MessageAttachmentInput[];
296
399
  clientMessageId?: string;
297
400
  idempotencyKey?: string;
@@ -319,21 +422,29 @@ interface ConversationMessagesPageOptions {
319
422
  }
320
423
  interface SendMessageResult {
321
424
  conversation_id: string;
322
- user_message: Pick<LinkMessage, 'id' | 'status'>;
323
- assistant_message: Pick<LinkMessage, 'id' | 'status'>;
324
- run: Pick<LinkRun, 'id' | 'status'>;
425
+ user_message: Pick<LinkMessage, "id" | "status">;
426
+ assistant_message: Pick<LinkMessage, "id" | "status">;
427
+ run: Pick<LinkRun, "id" | "status">;
325
428
  last_event_seq: number;
326
429
  conversation?: ConversationSummary;
327
430
  runtime?: ConversationRuntimeMetadata;
431
+ goal?: ConversationGoalState;
432
+ }
433
+ interface ConversationGoalControlResult {
434
+ conversation_id: string;
435
+ goal: ConversationGoalState;
436
+ last_event_seq: number;
437
+ cancel_run?: Pick<LinkRun, "id" | "status">;
438
+ run?: Pick<LinkRun, "id" | "status">;
328
439
  }
329
440
  interface CancelRunResult {
330
441
  conversation_id: string;
331
- run: Pick<LinkRun, 'id' | 'status'>;
442
+ run: Pick<LinkRun, "id" | "status">;
332
443
  last_event_seq: number;
333
444
  }
334
445
  interface QueuedRunActionResult {
335
446
  conversation_id: string;
336
- queued_run: Pick<LinkRun, 'id' | 'status'>;
447
+ queued_run: Pick<LinkRun, "id" | "status">;
337
448
  last_event_seq: number;
338
449
  }
339
450
  type ConversationEventListener = (event: ConversationEvent) => void;
@@ -383,6 +494,10 @@ interface LinkStatisticsFilter {
383
494
  profileName?: string | null;
384
495
  }
385
496
 
497
+ type SupportedLanguage = 'zh-CN' | 'en';
498
+
499
+ type HermesReasoningEffort = 'none' | 'minimal' | 'low' | 'medium' | 'high' | 'xhigh';
500
+
386
501
  type LogLevel = 'debug' | 'info' | 'warn' | 'error';
387
502
  interface FileLoggerOptions {
388
503
  paths?: RuntimePaths;
@@ -411,8 +526,6 @@ declare class FileLogger {
411
526
  private rotateIfNeeded;
412
527
  }
413
528
 
414
- type SupportedLanguage = 'zh-CN' | 'en';
415
-
416
529
  interface ConversationWorkspace {
417
530
  id: string;
418
531
  name: string;
@@ -462,6 +575,7 @@ declare class ConversationService {
462
575
  private readonly maintenance;
463
576
  private readonly orchestration;
464
577
  private readonly queries;
578
+ private readonly contextCompression;
465
579
  private readonly runLifecycle;
466
580
  private hermesSessionSyncPromise;
467
581
  private cronDeliverySyncPromise;
@@ -496,6 +610,11 @@ declare class ConversationService {
496
610
  accountId?: string;
497
611
  appInstanceId?: string;
498
612
  workspaceId?: string | null;
613
+ modelId?: string;
614
+ modelProvider?: string;
615
+ modelBaseUrl?: string;
616
+ modelApiMode?: string;
617
+ reasoningEffort?: HermesReasoningEffort;
499
618
  }): Promise<ConversationSummary>;
500
619
  ensureCronInboxConversation(input?: {
501
620
  profileName?: string;
@@ -542,9 +661,19 @@ declare class ConversationService {
542
661
  page: ConversationMessagesPageInfo;
543
662
  event_stream: ConversationEventStreamState;
544
663
  }>;
545
- setConversationModel(conversationId: string, modelId: string): Promise<{
664
+ setConversationModel(conversationId: string, input: string | {
665
+ modelId?: string;
666
+ modelProvider?: string;
667
+ modelBaseUrl?: string;
668
+ modelApiMode?: string;
669
+ reasoningEffort?: HermesReasoningEffort;
670
+ }): Promise<{
546
671
  conversation_id: string;
547
672
  default_model: string;
673
+ conversation_model?: string;
674
+ default_reasoning_effort?: string;
675
+ conversation_reasoning_effort?: string;
676
+ scope: 'conversation';
548
677
  runtime: ConversationRuntimeMetadata;
549
678
  last_event_seq: number;
550
679
  }>;
@@ -573,6 +702,9 @@ declare class ConversationService {
573
702
  subscribeAll(listener: ConversationEventListener): () => void;
574
703
  shouldPublishNotificationEvent(event: Pick<ConversationEvent, 'type' | 'conversation_id' | 'payload'>): Promise<boolean>;
575
704
  sendMessage(input: SendMessageInput): Promise<SendMessageResult>;
705
+ setGoalPaused(conversationId: string, paused: boolean, language?: SupportedLanguage): Promise<ConversationGoalControlResult>;
706
+ clearGoal(conversationId: string, language?: SupportedLanguage): Promise<ConversationGoalControlResult>;
707
+ startContextCompression(input: StartContextCompressionInput): Promise<ContextCompressionResult>;
576
708
  cancelRun(conversationId: string, runId: string): Promise<CancelRunResult>;
577
709
  cancelRunById(runId: string): Promise<CancelRunResult>;
578
710
  guideQueuedRun(conversationId: string, runId: string): Promise<QueuedRunActionResult>;
@@ -595,6 +727,32 @@ declare class ConversationService {
595
727
  resume_available: boolean;
596
728
  last_event_seq: number;
597
729
  }>;
730
+ listInputRequests(conversationId: string): Promise<{
731
+ conversation_id: string;
732
+ input_requests: LinkInputRequest[];
733
+ }>;
734
+ respondInputRequest(input: {
735
+ conversationId: string;
736
+ requestId: string;
737
+ kind: LinkInputRequestKind;
738
+ answer?: string;
739
+ password?: string;
740
+ value?: string;
741
+ }): Promise<{
742
+ conversation_id: string;
743
+ message_id?: string;
744
+ input_request: LinkInputRequest;
745
+ last_event_seq: number;
746
+ }>;
747
+ cancelInputRequest(input: {
748
+ conversationId: string;
749
+ requestId: string;
750
+ }): Promise<{
751
+ conversation_id: string;
752
+ message_id?: string;
753
+ input_request: LinkInputRequest;
754
+ last_event_seq: number;
755
+ }>;
598
756
  deleteConversation(conversationId: string): Promise<DeleteConversationResult>;
599
757
  archiveConversation(conversationId: string): Promise<ArchiveConversationResult>;
600
758
  unarchiveConversation(conversationId: string): Promise<UnarchiveConversationResult>;
package/dist/http/app.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createApp
3
- } from "../chunk-7JPQICDK.js";
3
+ } from "../chunk-LUGNDJU3.js";
4
4
  export {
5
5
  createApp
6
6
  };