@holon-run/agentinbox 1.0.1 → 1.0.2
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/src/service.js +7 -7
- package/dist/src/terminal.js +8 -1
- package/package.json +1 -1
package/dist/src/service.js
CHANGED
|
@@ -2260,7 +2260,7 @@ class AgentInboxService {
|
|
|
2260
2260
|
}
|
|
2261
2261
|
const state = this.store.getActivationDispatchState(input.agentId, input.targetId);
|
|
2262
2262
|
const inbox = this.ensureInboxForAgent(input.agentId);
|
|
2263
|
-
const summary = summarizeActivation(
|
|
2263
|
+
const summary = summarizeActivation(input.agentId, input.newItemCount, input.summary);
|
|
2264
2264
|
const totalUnackedCount = input.totalUnackedCount ?? this.store.listInboxEntries(inbox.inboxId, { includeAcked: false }).length;
|
|
2265
2265
|
const notificationPolicy = notificationPolicyForTarget(target);
|
|
2266
2266
|
if (!meetsNotificationThreshold(notificationPolicy, totalUnackedCount)) {
|
|
@@ -2317,7 +2317,7 @@ class AgentInboxService {
|
|
|
2317
2317
|
this.reconcileAgentStatus(target.agentId);
|
|
2318
2318
|
return "offline";
|
|
2319
2319
|
}
|
|
2320
|
-
const reminder = await this.buildTerminalReminder(target,
|
|
2320
|
+
const reminder = await this.buildTerminalReminder(target, totalUnackedCount, input.summary, input.entries);
|
|
2321
2321
|
if (!this.activationTargetExists(input.agentId, input.targetId)) {
|
|
2322
2322
|
return "offline";
|
|
2323
2323
|
}
|
|
@@ -2536,7 +2536,7 @@ class AgentInboxService {
|
|
|
2536
2536
|
updatedAt: (0, util_1.nowIso)(),
|
|
2537
2537
|
});
|
|
2538
2538
|
}
|
|
2539
|
-
async buildTerminalReminder(target,
|
|
2539
|
+
async buildTerminalReminder(target, totalUnackedCount, summary, entries) {
|
|
2540
2540
|
let preview = null;
|
|
2541
2541
|
if (totalUnackedCount === 1 && entries.length === 1 && entries[0]?.kind === "item") {
|
|
2542
2542
|
const singleItem = entries[0].item;
|
|
@@ -2553,7 +2553,7 @@ class AgentInboxService {
|
|
|
2553
2553
|
preview ??= (0, terminal_1.deriveInlineItemPreview)(singleItem, summary);
|
|
2554
2554
|
}
|
|
2555
2555
|
const prompt = (0, terminal_1.renderAgentPrompt)({
|
|
2556
|
-
|
|
2556
|
+
agentId: target.agentId,
|
|
2557
2557
|
totalUnackedCount,
|
|
2558
2558
|
summary,
|
|
2559
2559
|
preview,
|
|
@@ -3501,12 +3501,12 @@ function uniqueSortedNullable(values) {
|
|
|
3501
3501
|
function notificationBufferKey(agentId, targetId) {
|
|
3502
3502
|
return `${agentId}::${targetId}`;
|
|
3503
3503
|
}
|
|
3504
|
-
function summarizeActivation(
|
|
3504
|
+
function summarizeActivation(agentId, newItemCount, firstSummary) {
|
|
3505
3505
|
const itemWord = newItemCount === 1 ? "item" : "items";
|
|
3506
3506
|
if (firstSummary) {
|
|
3507
|
-
return `${newItemCount} new ${itemWord}
|
|
3507
|
+
return `${newItemCount} new ${itemWord} for agent ${agentId} from ${firstSummary}`;
|
|
3508
3508
|
}
|
|
3509
|
-
return `${newItemCount} new ${itemWord}
|
|
3509
|
+
return `${newItemCount} new ${itemWord} for agent ${agentId}`;
|
|
3510
3510
|
}
|
|
3511
3511
|
function latestEntryIdForNotification(entries) {
|
|
3512
3512
|
return entries.length > 0 ? entries[entries.length - 1]?.entryId ?? null : null;
|
package/dist/src/terminal.js
CHANGED
|
@@ -72,7 +72,14 @@ function detectTerminalContext(env = process.env) {
|
|
|
72
72
|
function renderAgentPrompt(input) {
|
|
73
73
|
const totalUnackedCount = input.totalUnackedCount;
|
|
74
74
|
const itemWord = totalUnackedCount === 1 ? "item" : "items";
|
|
75
|
-
const
|
|
75
|
+
const agentId = normalizeOptionalString(input.agentId ?? null);
|
|
76
|
+
const inboxId = normalizeOptionalString(input.inboxId ?? null);
|
|
77
|
+
const targetLabel = agentId
|
|
78
|
+
? `for agent ${agentId}`
|
|
79
|
+
: inboxId
|
|
80
|
+
? `in inbox ${inboxId}`
|
|
81
|
+
: "in inbox";
|
|
82
|
+
const base = `AgentInbox: ${totalUnackedCount} unacked ${itemWord} ${targetLabel}.`;
|
|
76
83
|
const latestEntryIdSuffix = input.latestEntryId ? ` Latest entryId: ${input.latestEntryId}.` : "";
|
|
77
84
|
if (totalUnackedCount === 1 && input.preview) {
|
|
78
85
|
const suffix = /(?:[.!?…]|\.{3})$/.test(input.preview) ? "" : ".";
|