@awebai/claude-channel 1.5.0 → 1.5.1
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/.claude-plugin/plugin.json +1 -1
- package/dist/index.js +37 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -26739,6 +26739,9 @@ var MAX_DELIVERED_IDS = 5e3;
|
|
|
26739
26739
|
var DELIVERED_IDS_TTL_MS = 24 * 60 * 60 * 1e3;
|
|
26740
26740
|
var MAIL_FETCH_LIMIT = 200;
|
|
26741
26741
|
var CHAT_FETCH_LIMIT = 2e3;
|
|
26742
|
+
var APP_EVENT_SUMMARY_SEPARATOR = " \u2014 ";
|
|
26743
|
+
var MAX_APP_EVENT_VALUE_LENGTH = 160;
|
|
26744
|
+
var MAX_APP_EVENT_PAYLOAD_LENGTH = 500;
|
|
26742
26745
|
async function loadPinStore(path = DEFAULT_PIN_STORE_PATH) {
|
|
26743
26746
|
try {
|
|
26744
26747
|
const content = await readFile4(path, "utf-8");
|
|
@@ -26922,7 +26925,7 @@ async function dispatchAppEvent(options, dispatched, event) {
|
|
|
26922
26925
|
meta3.payload = summarizePayload(payload);
|
|
26923
26926
|
await options.onAwakening({
|
|
26924
26927
|
kind: "app",
|
|
26925
|
-
content:
|
|
26928
|
+
content: formatAppEventSummary(event, payload),
|
|
26926
26929
|
deliveryIntent: event.delivery_intent || "ambient",
|
|
26927
26930
|
meta: meta3
|
|
26928
26931
|
});
|
|
@@ -27129,7 +27132,39 @@ function summarizePayload(payload) {
|
|
|
27129
27132
|
const json3 = JSON.stringify(payload);
|
|
27130
27133
|
if (!json3)
|
|
27131
27134
|
return "";
|
|
27132
|
-
return json3
|
|
27135
|
+
return truncateText(json3, MAX_APP_EVENT_PAYLOAD_LENGTH);
|
|
27136
|
+
}
|
|
27137
|
+
function formatAppEventSummary(event, payload) {
|
|
27138
|
+
const parts = [sanitizeSummaryComponent(event.app_event_type || "app_event") || "app_event"];
|
|
27139
|
+
const resourceRef = sanitizeSummaryComponent(event.resource_ref || "");
|
|
27140
|
+
if (resourceRef)
|
|
27141
|
+
parts.push(resourceRef);
|
|
27142
|
+
const payloadSummary = payload ? summarizePayloadFields(payload) : "";
|
|
27143
|
+
if (payloadSummary)
|
|
27144
|
+
parts.push(payloadSummary);
|
|
27145
|
+
return parts.join(APP_EVENT_SUMMARY_SEPARATOR);
|
|
27146
|
+
}
|
|
27147
|
+
function summarizePayloadFields(payload) {
|
|
27148
|
+
return Object.entries(payload).map(([key, value]) => `${sanitizeSummaryComponent(key)}=${formatPayloadSummaryValue(value)}`).filter((part) => part.trim() !== "").join(", ");
|
|
27149
|
+
}
|
|
27150
|
+
function formatPayloadSummaryValue(value) {
|
|
27151
|
+
if (typeof value === "string")
|
|
27152
|
+
return truncateText(sanitizeSummaryComponent(value), MAX_APP_EVENT_VALUE_LENGTH);
|
|
27153
|
+
if (typeof value === "number" || typeof value === "boolean" || value === null) {
|
|
27154
|
+
return String(value);
|
|
27155
|
+
}
|
|
27156
|
+
const json3 = JSON.stringify(value);
|
|
27157
|
+
return truncateText(sanitizeSummaryComponent(json3 || String(value)), MAX_APP_EVENT_VALUE_LENGTH);
|
|
27158
|
+
}
|
|
27159
|
+
function sanitizeSummaryComponent(value) {
|
|
27160
|
+
return value.replace(/[\u0000-\u001F\u007F]+/g, " ").trim();
|
|
27161
|
+
}
|
|
27162
|
+
function truncateText(value, maxLength) {
|
|
27163
|
+
if (value.length <= maxLength)
|
|
27164
|
+
return value;
|
|
27165
|
+
if (maxLength <= 3)
|
|
27166
|
+
return value.slice(0, maxLength);
|
|
27167
|
+
return `${value.slice(0, maxLength - 3)}...`;
|
|
27133
27168
|
}
|
|
27134
27169
|
function senderDisplayAddress(alias, address) {
|
|
27135
27170
|
const qualified = (address || "").trim();
|