@hermespilot/link 0.6.5 → 0.6.6
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.
|
@@ -5418,7 +5418,7 @@ import os2 from "os";
|
|
|
5418
5418
|
import path5 from "path";
|
|
5419
5419
|
|
|
5420
5420
|
// src/constants.ts
|
|
5421
|
-
var LINK_VERSION = "0.6.
|
|
5421
|
+
var LINK_VERSION = "0.6.6";
|
|
5422
5422
|
var LINK_COMMAND = "hermeslink";
|
|
5423
5423
|
var LINK_DEFAULT_PORT = 52379;
|
|
5424
5424
|
var LINK_RUNTIME_DIR_NAME = ".hermeslink";
|
|
@@ -8273,6 +8273,37 @@ function hasRunningRuns(snapshot) {
|
|
|
8273
8273
|
function hasQueuedRuns(snapshot) {
|
|
8274
8274
|
return snapshot.runs.some((run) => run.status === "queued");
|
|
8275
8275
|
}
|
|
8276
|
+
function buildConversationEventStreamState(snapshot) {
|
|
8277
|
+
const pendingApprovalRunIds = /* @__PURE__ */ new Set();
|
|
8278
|
+
let hasPendingApproval = false;
|
|
8279
|
+
for (const message of snapshot.messages) {
|
|
8280
|
+
if (!message.approvals?.some((approval) => approval.status === "pending")) {
|
|
8281
|
+
continue;
|
|
8282
|
+
}
|
|
8283
|
+
hasPendingApproval = true;
|
|
8284
|
+
if (message.run_id) {
|
|
8285
|
+
pendingApprovalRunIds.add(message.run_id);
|
|
8286
|
+
}
|
|
8287
|
+
}
|
|
8288
|
+
const summaries = snapshot.runs.map(
|
|
8289
|
+
(run) => toEventStreamRunSummary(run, pendingApprovalRunIds.has(run.id))
|
|
8290
|
+
);
|
|
8291
|
+
const activeRuns = summaries.filter((run) => isRealtimeRunStatus(run.status));
|
|
8292
|
+
const unknownRuns = summaries.filter((run) => run.status === "unknown");
|
|
8293
|
+
const requiresUserAction = hasPendingApproval || summaries.some((run) => run.requires_user_action);
|
|
8294
|
+
const hasQueuedRun = activeRuns.some((run) => run.status === "queued");
|
|
8295
|
+
const hasRunningRun = activeRuns.some((run) => run.status === "running");
|
|
8296
|
+
const hasUnknownRun = unknownRuns.length > 0;
|
|
8297
|
+
const reason = requiresUserAction ? "requires_user_action" : hasQueuedRun ? "queued_run" : hasRunningRun ? "active_run" : hasUnknownRun ? "unknown" : "terminal";
|
|
8298
|
+
return {
|
|
8299
|
+
should_subscribe: !requiresUserAction && activeRuns.length > 0,
|
|
8300
|
+
reason,
|
|
8301
|
+
has_active_runs: activeRuns.length > 0 || hasUnknownRun,
|
|
8302
|
+
requires_user_action: requiresUserAction,
|
|
8303
|
+
active_runs: activeRuns,
|
|
8304
|
+
latest_runs: summaries.slice().sort((left, right) => right.updated_at.localeCompare(left.updated_at)).slice(0, 5)
|
|
8305
|
+
};
|
|
8306
|
+
}
|
|
8276
8307
|
function isRetryableUserMessage(message) {
|
|
8277
8308
|
return message.role === "user" && message.raw?.format !== "hermes-link-slash-command" && (messageText(message).length > 0 || message.parts.some((part) => Boolean(part.blob)));
|
|
8278
8309
|
}
|
|
@@ -8325,6 +8356,18 @@ function previewText(message) {
|
|
|
8325
8356
|
function messageText(message) {
|
|
8326
8357
|
return message.parts.filter((part) => part.type === "text" && part.text).map((part) => part.text).join("").trim();
|
|
8327
8358
|
}
|
|
8359
|
+
function toEventStreamRunSummary(run, requiresUserAction) {
|
|
8360
|
+
return {
|
|
8361
|
+
id: run.id,
|
|
8362
|
+
status: run.status,
|
|
8363
|
+
assistant_message_id: run.assistant_message_id,
|
|
8364
|
+
requires_user_action: requiresUserAction,
|
|
8365
|
+
updated_at: run.completed_at ?? run.started_at
|
|
8366
|
+
};
|
|
8367
|
+
}
|
|
8368
|
+
function isRealtimeRunStatus(status) {
|
|
8369
|
+
return status === "queued" || status === "running";
|
|
8370
|
+
}
|
|
8328
8371
|
|
|
8329
8372
|
// src/conversations/slash-commands.ts
|
|
8330
8373
|
import { randomUUID as randomUUID4 } from "crypto";
|
|
@@ -11538,7 +11581,8 @@ var ConversationQueryCoordinator = class {
|
|
|
11538
11581
|
has_more_after: endIndex < total,
|
|
11539
11582
|
oldest_message_id: messages2[0]?.id ?? null,
|
|
11540
11583
|
newest_message_id: messages2.at(-1)?.id ?? null
|
|
11541
|
-
}
|
|
11584
|
+
},
|
|
11585
|
+
event_stream: buildConversationEventStreamState(snapshot)
|
|
11542
11586
|
};
|
|
11543
11587
|
}
|
|
11544
11588
|
async listEvents(conversationId, after = 0) {
|
package/dist/cli/index.js
CHANGED
package/dist/http/app.d.ts
CHANGED
|
@@ -62,6 +62,22 @@ interface ConversationMessagesPageInfo {
|
|
|
62
62
|
oldest_message_id: string | null;
|
|
63
63
|
newest_message_id: string | null;
|
|
64
64
|
}
|
|
65
|
+
type ConversationEventStreamReason = 'terminal' | 'active_run' | 'queued_run' | 'recovering' | 'requires_user_action' | 'unknown';
|
|
66
|
+
interface ConversationEventStreamRunSummary {
|
|
67
|
+
id: string;
|
|
68
|
+
status: LinkRun['status'];
|
|
69
|
+
assistant_message_id: string;
|
|
70
|
+
requires_user_action: boolean;
|
|
71
|
+
updated_at: string;
|
|
72
|
+
}
|
|
73
|
+
interface ConversationEventStreamState {
|
|
74
|
+
should_subscribe: boolean;
|
|
75
|
+
reason: ConversationEventStreamReason;
|
|
76
|
+
has_active_runs: boolean;
|
|
77
|
+
requires_user_action: boolean;
|
|
78
|
+
active_runs: ConversationEventStreamRunSummary[];
|
|
79
|
+
latest_runs: ConversationEventStreamRunSummary[];
|
|
80
|
+
}
|
|
65
81
|
interface LinkMessagePart {
|
|
66
82
|
type: 'text' | 'image' | 'file' | 'audio' | 'video' | 'unsupported';
|
|
67
83
|
text?: string;
|
|
@@ -455,6 +471,7 @@ declare class ConversationService {
|
|
|
455
471
|
last_event_seq: number;
|
|
456
472
|
runtime: ConversationRuntimeMetadata;
|
|
457
473
|
page: ConversationMessagesPageInfo;
|
|
474
|
+
event_stream: ConversationEventStreamState;
|
|
458
475
|
}>;
|
|
459
476
|
setConversationModel(conversationId: string, modelId: string): Promise<{
|
|
460
477
|
conversation_id: string;
|
package/dist/http/app.js
CHANGED